Skip to content

Commit 91d8c3f

Browse files
authored
Merge branch 'master' into master
2 parents 1bcd6cb + 413dff9 commit 91d8c3f

File tree

16 files changed

+114
-47
lines changed

16 files changed

+114
-47
lines changed

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,8 @@
66

77
[English introduction](https://github.com/JusterZhu/GeneralUpdate/blob/master/README_en.md)
88

9+
**更新无限,升级无界。**
10+
911
## 1.组件介绍 ##
1012

1113
GeneralUpdate是一款基于.NET Standard2.0开源自动升级组件。
@@ -88,6 +90,9 @@ MAUI GeneralUpdate.Maui
8890
| Linux | 支持 |
8991
| Android | 支持 |
9092
| 麒麟V10(飞腾S2500) | 支持 |
93+
| 麒麟V10(飞腾FT-2000) | 支持 |
9194
| 麒麟V10(x64) | 支持 |
9295
| Ubuntu | 支持 |
93-
| 龙芯(Loongnix) | 待验证 |
96+
| 龙芯(Loongnix LoongArch) | 支持 |
97+
| 华为欧拉(EulerOS-鲲鹏Kunpeng) | 支持 |
98+
| Apple Mac (M1) | 支持 |

README_en.md

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33

44
![](imgs/GeneralUpdate_h.png)
55

6+
Unlimited Updates, Boundless Upgrades.
7+
68
## 1. Component Introduction ##
79

810
GeneralUpdate is an open-source automatic update component based on .NET Standard 2.0.
@@ -72,12 +74,15 @@ Feature Introduction:
7274

7375
## 3. Operating Systems
7476

75-
| Operating System Name | Supported |
76-
| ------------------------- | -------------- |
77-
| Windows | Yes |
78-
| Linux | Yes |
79-
| Android | Yes |
80-
| Kylin V10 (Feiteng S2500) | Yes |
81-
| Kylin V10 (x64) | Yes |
82-
| Ubuntu | Yes |
83-
| Loongson (Loongnix) | To be verified |
77+
| Operating System Name | Supported |
78+
| ----------------------------- | --------- |
79+
| Windows | Yes |
80+
| Linux | Yes |
81+
| Android | Yes |
82+
| Kylin V10 (Feiteng S2500) | Yes |
83+
| Kylin V10 (Feiteng 2000) | Yes |
84+
| Kylin V10 (x64) | Yes |
85+
| Ubuntu | Yes |
86+
| Loongson (Loongnix LoongArch) | Yes |
87+
| HuaWeiEulerOS (Kunpeng) | Yes |
88+
| Apple Mac (M1) | Yes |

src/c#/GeneralUpdate.Client/Program.cs

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ internal class Program
1414
{
1515
static async Task Main(string[] args)
1616
{
17-
try
17+
/*try
1818
{
1919
Console.WriteLine($"主程序初始化,{DateTime.Now}!");
2020
Console.WriteLine("当前运行目录:" + Thread.GetDomain().BaseDirectory);
@@ -57,23 +57,25 @@ static async Task Main(string[] args)
5757
catch (Exception e)
5858
{
5959
Console.WriteLine(e.Message + "\n" + e.StackTrace);
60-
}
60+
}*/
6161

62-
/*var paramsOSS = new GlobalConfigInfoOSS();
63-
paramsOSS.Url = "http://192.168.50.203/versions.json";
64-
paramsOSS.CurrentVersion = "1.0.0.0";
65-
paramsOSS.VersionFileName = "versions.json";
66-
paramsOSS.AppName = "GeneralUpdate.Client.exe";
67-
paramsOSS.Encoding = Encoding.UTF8.WebName;
68-
GeneralClientOSS.Start(paramsOSS);*/
62+
var paramsOSS = new GlobalConfigInfoOSS
63+
{
64+
Url = @"http://localhost:5000/packages/versions.json",
65+
CurrentVersion = "1.0.0.0",
66+
VersionFileName = "versions.json",
67+
AppName = "GeneralUpdate.Client.exe",
68+
Encoding = Encoding.UTF8.WebName
69+
};
70+
await GeneralClientOSS.Start(paramsOSS, "GeneralUpdate.Upgrad.exe");
6971

70-
var hub = new UpgradeHubService("http://localhost:5000/UpgradeHub"
72+
/*var hub = new UpgradeHubService("http://localhost:5000/UpgradeHub"
7173
, null,"dfeb5833-975e-4afb-88f1-6278ee9aeff6");
7274
hub.AddListenerReceive((message) =>
7375
{
7476
Debug.WriteLine(message);
7577
});
76-
await hub.StartAsync();
78+
await hub.StartAsync();*/
7779

7880
/*Task.Run(async () =>
7981
{

src/c#/GeneralUpdate.ClientCore/GeneralClientBootstrap.cs

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,8 @@ public GeneralClientBootstrap SetConfig(Configinfo configInfo)
8080
UpgradeClientVersion = configInfo.UpgradeClientVersion,
8181
Bowl = configInfo.Bowl,
8282
SkipDirectorys = configInfo.SkipDirectorys
83+
Scheme = configInfo.Scheme,
84+
Token = configInfo.Token
8385
};
8486
return this;
8587
}
@@ -145,14 +147,18 @@ private async Task ExecuteWorkflowAsync()
145147
, AppType.ClientApp
146148
, _configInfo.AppSecretKey
147149
, GetPlatform()
148-
, _configInfo.ProductId);
150+
, _configInfo.ProductId
151+
, _configInfo.Scheme
152+
, _configInfo.Token);
149153

150154
var upgradeResp = await VersionService.Validate(_configInfo.UpdateUrl
151155
, _configInfo.UpgradeClientVersion
152156
, AppType.UpgradeApp
153157
, _configInfo.AppSecretKey
154158
, GetPlatform()
155-
, _configInfo.ProductId);
159+
, _configInfo.ProductId
160+
, _configInfo.Scheme
161+
, _configInfo.Token);
156162

157163
_configInfo.IsUpgradeUpdate = CheckUpgrade(upgradeResp);
158164
_configInfo.IsMainUpdate = CheckUpgrade(mainResp);
@@ -192,7 +198,9 @@ private async Task ExecuteWorkflowAsync()
192198
, mainResp.Body
193199
, _configInfo.ReportUrl
194200
, _configInfo.BackupDirectory
195-
, _configInfo.Bowl);
201+
, _configInfo.Bowl
202+
, _configInfo.Scheme
203+
, _configInfo.Token);
196204

197205
_configInfo.ProcessInfo =
198206
JsonSerializer.Serialize(processInfo, ProcessInfoJsonContext.Default.ProcessInfo);

src/c#/GeneralUpdate.ClientCore/Strategys/LinuxStrategy.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,12 @@ public override async Task ExecuteAsync()
6565
}
6666
finally
6767
{
68-
await VersionService.Report(_configinfo.ReportUrl, version.RecordId, status, version.AppType);
68+
await VersionService.Report(_configinfo.ReportUrl
69+
, version.RecordId
70+
, status
71+
, version.AppType
72+
, _configinfo.Scheme
73+
, _configinfo.Token);
6974
}
7075
}
7176

src/c#/GeneralUpdate.ClientCore/Strategys/WindowsStrategy.cs

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,12 @@ public override async Task ExecuteAsync()
6464
}
6565
finally
6666
{
67-
await VersionService.Report(_configinfo.ReportUrl, version.RecordId, status, version.AppType);
67+
await VersionService.Report(_configinfo.ReportUrl
68+
, version.RecordId
69+
, status
70+
, version.AppType
71+
, _configinfo.Scheme
72+
, _configinfo.Token);
6873
}
6974
}
7075

src/c#/GeneralUpdate.Common/Compress/ZipCompressionStrategy.cs

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,12 +118,6 @@ public void Decompress(string zipFilePath, string unZipDir, Encoding encoding)
118118
{
119119
try
120120
{
121-
if (Directory.Exists(unZipDir))
122-
{
123-
StorageManager.DeleteDirectory(unZipDir);
124-
}
125-
Directory.CreateDirectory(unZipDir);
126-
127121
var dirSeparatorChar = Path.DirectorySeparatorChar.ToString();
128122
unZipDir = unZipDir.EndsWith(dirSeparatorChar) ? unZipDir : unZipDir + dirSeparatorChar;
129123

@@ -158,6 +152,13 @@ public void Decompress(string zipFilePath, string unZipDir, Encoding encoding)
158152
{
159153
greatFolder.Create();
160154
}
155+
156+
if (File.Exists(filePath))
157+
{
158+
File.SetAttributes(filePath, FileAttributes.Normal);
159+
File.Delete(filePath);
160+
}
161+
161162
entries.ExtractToFile(filePath);
162163
}
163164
}

src/c#/GeneralUpdate.Common/Download/DownloadManager.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@ public async Task LaunchTasksAsync()
4343
{
4444
var downloadTasks = DownloadTasks.Select(task => task.LaunchAsync()).ToList();
4545
await Task.WhenAll(downloadTasks);
46-
MultiAllDownloadCompleted.Invoke(this, new MultiAllDownloadCompletedEventArgs(true, FailedVersions));
46+
MultiAllDownloadCompleted?.Invoke(this, new MultiAllDownloadCompletedEventArgs(true, FailedVersions));
4747
}
4848
catch (Exception ex)
4949
{
50-
MultiAllDownloadCompleted.Invoke(this, new MultiAllDownloadCompletedEventArgs(false, FailedVersions));
50+
MultiAllDownloadCompleted?.Invoke(this, new MultiAllDownloadCompletedEventArgs(false, FailedVersions));
5151
throw new Exception($"Download manager error: {ex.Message}", ex);
5252
}
5353
}

src/c#/GeneralUpdate.Common/Shared/Object/Configinfo.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,10 @@ public class Configinfo
7474
public string ProductId { get; set; }
7575

7676
public string Bowl { get; set; }
77+
78+
public string Scheme { get; set; }
79+
80+
public string Token { get; set; }
7781

7882
public void Validate()
7983
{

src/c#/GeneralUpdate.Common/Shared/Object/GlobalConfigInfo.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,4 +122,8 @@ public class GlobalConfigInfo
122122
public string BackupDirectory { get; set; }
123123

124124
public string Bowl { get; set; }
125+
126+
public string Scheme { get; set; }
127+
128+
public string Token { get; set; }
125129
}

0 commit comments

Comments
 (0)