diff --git a/src/c#/GeneralUpdate.Client/MainPage.xaml.cs b/src/c#/GeneralUpdate.Client/MainPage.xaml.cs index d7f13ef183f13cc00704c16c506afd40f77e343f..fa47991299bdc40a876e08db5725cf405c0ae564 100644 --- a/src/c#/GeneralUpdate.Client/MainPage.xaml.cs +++ b/src/c#/GeneralUpdate.Client/MainPage.xaml.cs @@ -3,6 +3,9 @@ using GeneralUpdate.ClientCore.Hubs; using GeneralUpdate.Core.Bootstrap; using GeneralUpdate.Core.Domain.Entity; using GeneralUpdate.Core.Domain.Enum; +using GeneralUpdate.Core.Strategys.PlatformAndroid; +using GeneralUpdate.Core.Strategys.PlatformiOS; +using GeneralUpdate.Core.Strategys.PlatformMac; using GeneralUpdate.Core.Strategys.PlatformWindows; using System.Text; diff --git a/src/c#/GeneralUpdate.Differential/DifferentialCore.cs b/src/c#/GeneralUpdate.Differential/DifferentialCore.cs index 1aa90f4c18ba67b3720007f18ed0c672cde5a7d7..30076e708064b92595d106f384025d88b1fcbe8e 100644 --- a/src/c#/GeneralUpdate.Differential/DifferentialCore.cs +++ b/src/c#/GeneralUpdate.Differential/DifferentialCore.cs @@ -88,13 +88,13 @@ namespace GeneralUpdate.Differential if (string.IsNullOrEmpty(tempPath)) { tempDir = patchPath; - tempPath0 = Path.Combine(patchPath, $"{Path.GetFileNameWithoutExtension(file.Name)}{PATCH_FORMAT}"); + tempPath0 = Path.Combine(patchPath, $"{file.Name}{PATCH_FORMAT}"); } else { tempDir = Path.Combine(patchPath, tempPath); if (!Directory.Exists(tempDir)) Directory.CreateDirectory(tempDir); - tempPath0 = Path.Combine(tempDir, $"{Path.GetFileNameWithoutExtension(file.Name)}{PATCH_FORMAT}"); + tempPath0 = Path.Combine(tempDir, $"{file.Name}{PATCH_FORMAT}"); } var finOldFile = nodes.Item1.FirstOrDefault(i => i.Name.Equals(file.Name)); var oldfile = finOldFile == null ? "" : finOldFile.FullName; @@ -143,7 +143,11 @@ namespace GeneralUpdate.Differential foreach (var oldFile in oldFiles) { //Only the difference file (.patch) can be updated here. - var findFile = patchFiles.FirstOrDefault(f => Path.GetFileNameWithoutExtension(f.Name).Equals(Path.GetFileNameWithoutExtension(oldFile.Name))); + var findFile = patchFiles.FirstOrDefault(f => + { + var tempName = Path.GetFileNameWithoutExtension(f.Name).Replace(PATCH_FORMAT, ""); + return tempName.Equals(oldFile.Name); + }); if (findFile != null) { var extensionName = Path.GetExtension(findFile.FullName); diff --git a/src/c#/GeneralUpdate.Infrastructure/DataServices/Http/HttpService.cs b/src/c#/GeneralUpdate.Infrastructure/DataServices/Http/HttpService.cs index 09f5fbe7d3ac9c4deef5afb91fb0860d610b8b56..fdb656393dbaa5345cf8465d6b2f7d2846fe2ae6 100644 --- a/src/c#/GeneralUpdate.Infrastructure/DataServices/Http/HttpService.cs +++ b/src/c#/GeneralUpdate.Infrastructure/DataServices/Http/HttpService.cs @@ -24,7 +24,7 @@ namespace GeneralUpdate.Infrastructure.DataServices.Http } } - public async Task PostFileRequest(string url, Dictionary parameters, string filePath , Action reponseCallback, int timeOutInMillisecond = 1000 * 10) where T : class + public async Task PostFileRequest(string url, Dictionary parameters, string filePath , Action reponseCallback) where T : class { try { @@ -34,7 +34,6 @@ namespace GeneralUpdate.Infrastructure.DataServices.Http fileStream.Read(bytes, 0, bytes.Length); using (var client = new HttpClient()) { - client.Timeout = new TimeSpan(timeOutInMillisecond); var message = new HttpRequestMessage(HttpMethod.Post, url); message.Content = MultipartFormDataContentProvider.CreateContent(bytes,Path.GetFileName(filePath), parameters); var responseMessage = await client.SendAsync(message); diff --git a/src/c#/GeneralUpdate.PacketTool/Services/MainService.cs b/src/c#/GeneralUpdate.PacketTool/Services/MainService.cs index 16b9c18e338fdde59942903f9473086ff696ef9d..43cf19e3f5c696b954b15640c2efeb32693230dd 100644 --- a/src/c#/GeneralUpdate.PacketTool/Services/MainService.cs +++ b/src/c#/GeneralUpdate.PacketTool/Services/MainService.cs @@ -4,9 +4,9 @@ namespace GeneralUpdate.PacketTool.Services { public class MainService { - public async Task PostUpgradPakcet(string filePath, int clientType, string version, string clientAppKey,string md5,Action reponseCallback) where T : class + public async Task PostUpgradPakcet(string remoteUrl, string filePath, int clientType, string version, string clientAppKey,string md5,Action reponseCallback) where T : class { - var remoteUrl = "http://127.0.0.1:5001/upload"; + if(string.IsNullOrEmpty(remoteUrl)) remoteUrl = "http://127.0.0.1:5001/upload"; var parameters = new Dictionary(); parameters.Add("clientType", clientType.ToString()); parameters.Add("version", version); diff --git a/src/c#/GeneralUpdate.PacketTool/ViewModels/MainViewModel.cs b/src/c#/GeneralUpdate.PacketTool/ViewModels/MainViewModel.cs index a7f492c07579db6defb28feaddb6964a079e3031..5941ed2ca52a956d1b8f25ac3030df81db77dc70 100644 --- a/src/c#/GeneralUpdate.PacketTool/ViewModels/MainViewModel.cs +++ b/src/c#/GeneralUpdate.PacketTool/ViewModels/MainViewModel.cs @@ -80,8 +80,8 @@ namespace GeneralUpdate.PacketTool.ViewModels if (_formats == null) { _formats = new List(); - _formats.Add("ZIP"); - _formats.Add("7Z"); + _formats.Add(".zip"); + _formats.Add(".7z"); } return _formats; } @@ -178,12 +178,24 @@ namespace GeneralUpdate.PacketTool.ViewModels { await DifferentialCore.Instance.Clean(SourcePath, TargetPath, PatchPath, (sender, args) =>{}, String2OperationType(CurrentFormat),String2Encoding(CurrentEncoding), PacketName); + + await DifferentialCore.Instance.Drity(SourcePath,PatchPath); if (IsPublish) { - var packetPath = Path.Combine(TargetPath,PacketName); - if (!File.Exists(packetPath)) await Shell.Current.DisplayAlert("Build options", $"The package was not found in the following path {packetPath} !", "cancel"); - await _mainService.PostUpgradPakcet(packetPath, String2AppType(CurrnetAppType), CurrentVersion,CurrentClientAppKey,"", async (resp) => + var packetPath = Path.Combine(TargetPath,$"{PacketName}{CurrentFormat}"); + if (!File.Exists(packetPath)) + { + await Shell.Current.DisplayAlert("Build options", $"The package was not found in the following path {packetPath} !", "cancel"); + return; + } + await _mainService.PostUpgradPakcet(Url,packetPath, String2AppType(CurrnetAppType), CurrentVersion,CurrentClientAppKey,"", async (resp) => { + if (resp == null) + { + await Shell.Current.DisplayAlert("Build options", "Upload failed !", "cancel"); + return; + } + if (resp.Code == HttpStatus.OK) { await Shell.Current.DisplayAlert("Build options", resp.Message, "ok"); @@ -194,10 +206,14 @@ namespace GeneralUpdate.PacketTool.ViewModels } }); } + else + { + await Shell.Current.DisplayAlert("Build options", "Build complete.", "ok"); + } } catch (Exception ex) { - await Shell.Current.DisplayAlert("Build options", $"Operation failed : {TargetPath} , Error : {ex.Message} !", "ok"); + await Shell.Current.DisplayAlert("Build options", $"Operation failed : {TargetPath} , Error : {ex.Message} !", "cancel"); } } diff --git a/src/c#/GeneralUpdate.Zip/GeneralZipFactory.cs b/src/c#/GeneralUpdate.Zip/GeneralZipFactory.cs index 78ea828f9f4c0ffcbdadd25fd57c131c93f374d2..02b34f264197095c33025d094e89534b7b55d26f 100644 --- a/src/c#/GeneralUpdate.Zip/GeneralZipFactory.cs +++ b/src/c#/GeneralUpdate.Zip/GeneralZipFactory.cs @@ -27,10 +27,17 @@ namespace GeneralUpdate.Zip public event CompressProgressEventHandler CompressProgress; /// - /// Select archive format . + /// Configuring Compression. /// - /// + /// Enumeration selects the compressed package format to operate on.(OperationType.GZip , OperationType.G7z) + /// Compressed package Name. + /// Source file path. + /// The target path. + /// Whether to include the root directory when packing. + /// Compressed package encoding format. /// + /// + /// public IFactory CreatefOperate(OperationType type,string name, string sourcePath, string destinationPath, bool includeBaseDirectory = false, Encoding encoding = null) { if (string.IsNullOrWhiteSpace(sourcePath) || string.IsNullOrWhiteSpace(destinationPath))