From 992a706aaaba07c03e5f7fb3996015efb43b7266 Mon Sep 17 00:00:00 2001 From: DreamEnderKing Date: Sat, 18 Nov 2023 22:38:44 +0800 Subject: [PATCH 1/2] =?UTF-8?q?build:=20:arrow=5Fup:=20=E4=BF=AE=E6=94=B9i?= =?UTF-8?q?nstaller=EF=BC=8Cgrpc=E5=92=8Cplayback=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E8=87=B3.net=208.0=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 6 ++--- .github/workflows/format.yml | 2 +- dependency/proto/Protos.csproj | 4 ++-- dependency/proto/{Proto.sln => Protos.sln} | 2 +- installer/Model/Downloader.cs | 6 ++--- installer/Model/EEsast.cs | 13 +++++----- installer/Model/Local_Data.cs | 13 ++++++---- installer/Model/Tencent_Cos.cs | 24 ++++++++++--------- installer/Page/MainPage.xaml.cs | 7 ------ .../Platforms/MacCatalyst/Entitlements.plist | 14 +++++++++++ installer/ViewModel/Common.cs | 18 +++++++------- installer/ViewModel/LoginViewModel.cs | 4 ++-- installer/ViewModel/MainViewModel.cs | 4 ++-- installer/installer.csproj | 9 +++---- playback/Playback/Playback.csproj | 4 ++-- 15 files changed, 72 insertions(+), 58 deletions(-) rename dependency/proto/{Proto.sln => Protos.sln} (89%) create mode 100644 installer/Platforms/MacCatalyst/Entitlements.plist diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9260d1c1..6bc4085f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,10 +22,10 @@ jobs: - name: Setup .NET Core uses: actions/setup-dotnet@v3 with: - dotnet-version: 7.0.x + dotnet-version: 8.0.x - name: Build Installer - run: dotnet build "./installer/installer.sln" -c Release -f net7.0-windows10.0.19041.0 + run: dotnet build "./installer/installer.sln" -c Release -f net8.0-windows10.0.19041.0 dotnet-build-launcher: if: true @@ -48,7 +48,7 @@ jobs: - name: Setup .NET Core uses: actions/setup-dotnet@v3 with: - dotnet-version: 6.0.x + dotnet-version: 8.0.x - name: Build Playback run: dotnet build "./playback/playback.sln" -c Release diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 33f924e5..bc65a38e 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -62,7 +62,7 @@ jobs: - name: Setup .NET Core uses: actions/setup-dotnet@v3 with: - dotnet-version: 6.0.x + dotnet-version: 8.0.x - name: Check Playback run: | diff --git a/dependency/proto/Protos.csproj b/dependency/proto/Protos.csproj index 0ee29866..0722144e 100644 --- a/dependency/proto/Protos.csproj +++ b/dependency/proto/Protos.csproj @@ -1,7 +1,7 @@ - net6.0 + net8.0 enable enable @@ -15,7 +15,7 @@ - + diff --git a/dependency/proto/Proto.sln b/dependency/proto/Protos.sln similarity index 89% rename from dependency/proto/Proto.sln rename to dependency/proto/Protos.sln index 2cdbe95d..d34be8ef 100644 --- a/dependency/proto/Proto.sln +++ b/dependency/proto/Protos.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.1.32328.378 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Proto", "Proto.csproj", "{B9A3CDD7-7852-4220-A2AA-2B986E0C19E8}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Protos", "Protos.csproj", "{B9A3CDD7-7852-4220-A2AA-2B986E0C19E8}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/installer/Model/Downloader.cs b/installer/Model/Downloader.cs index b4e34d24..f1fd8db9 100644 --- a/installer/Model/Downloader.cs +++ b/installer/Model/Downloader.cs @@ -54,7 +54,7 @@ public void ResetDownloadFailedInfo() downloadFailed.Clear(); } - private int filenum = 0; // 总文件个数 + //private int filenum = 0; 总文件个数 public string Route { get; set; } public string Username { get; set; } = string.Empty; @@ -70,7 +70,7 @@ public enum UsingOS { Win, Linux, OSX }; public UsingOS usingOS { get; set; } public class Updater { - public string Message; + public string Message = string.Empty; public bool Working { get; set; } public bool CombatCompleted { get => false; } public bool UploadReady { get; set; } = false; @@ -88,7 +88,7 @@ public Downloader() Route = Data.InstallPath; Cloud = new Tencent_Cos("1314234950", "ap-beijing", "thuai6"); Web.Token_Changed += SaveToken; - string temp; + string? temp; if (Data.Config.TryGetValue("Remembered", out temp)) { if (Convert.ToBoolean(temp)) diff --git a/installer/Model/EEsast.cs b/installer/Model/EEsast.cs index 03cc0782..103a2fbe 100644 --- a/installer/Model/EEsast.cs +++ b/installer/Model/EEsast.cs @@ -20,20 +20,20 @@ record LoginResponse class EEsast { - public enum language { cpp, py }; + public enum LangUsed { cpp, py }; private string token = string.Empty; public string Token { get => token; protected set { if (token != value) - Token_Changed.Invoke(this, new EventArgs()); + Token_Changed?.Invoke(this, new EventArgs()); token = value; } } - public event EventHandler Token_Changed; - public string ID { get; protected set; } - public string Email { get; protected set; } + public event EventHandler? Token_Changed; + public string ID { get; protected set; } = string.Empty; + public string Email { get; protected set; } = string.Empty; public ConcurrentQueue Exceptions = new ConcurrentQueue(); public enum WebStatus @@ -41,10 +41,9 @@ public enum WebStatus disconnected, offline, logined } public WebStatus Status = WebStatus.disconnected; - public Tencent_Cos EEsast_Cos { get; protected set; } + public Tencent_Cos EEsast_Cos { get; protected set; } = new Tencent_Cos("1255334966", "ap-beijing", "eesast"); public async Task LoginToEEsast(HttpClient client, string useremail, string userpassword) { - EEsast_Cos = new Tencent_Cos("1255334966", "ap-beijing", "eesast"); try { using (var response = await client.PostAsync("https://api.eesast.com/users/login", JsonContent.Create(new diff --git a/installer/Model/Local_Data.cs b/installer/Model/Local_Data.cs index e987b841..28d2d06e 100644 --- a/installer/Model/Local_Data.cs +++ b/installer/Model/Local_Data.cs @@ -17,11 +17,11 @@ class Local_Data public Dictionary Config { get; protected set; - } + } = new Dictionary(); public Dictionary MD5Data { get; protected set; - }// 路径为尽可能相对路径 + } = new Dictionary(); // 路径为尽可能相对路径 public ConcurrentBag MD5Update { get; set; @@ -84,9 +84,14 @@ public Local_Data() public void ResetInstallPath(string newPath) { - if (!Directory.Exists(Path.GetDirectoryName(newPath))) + string? dirName = Path.GetDirectoryName(newPath); + if (dirName is null) + { + return; + } + if (!Directory.Exists(dirName)) { - Directory.CreateDirectory(Path.GetDirectoryName(newPath)); + Directory.CreateDirectory(dirName); } if (Installed) { diff --git a/installer/Model/Tencent_Cos.cs b/installer/Model/Tencent_Cos.cs index 359d5784..93486daf 100644 --- a/installer/Model/Tencent_Cos.cs +++ b/installer/Model/Tencent_Cos.cs @@ -2,14 +2,16 @@ using COSXML.Auth; using COSXML.CosException; using COSXML.Model.Object; -using ICSharpCode.SharpZipLib; -using ICSharpCode.SharpZipLib.Tar; -using ICSharpCode.SharpZipLib.GZip; using Newtonsoft.Json; using System.Collections.Concurrent; +using System.IO.Compression; +using System.Formats.Tar; using COSXML.Common; using COSXML.Transfer; +// 禁用对没有调用异步API的异步函数的警告 +#pragma warning disable CS1998 + namespace installer.Model { public class Tencent_Cos @@ -51,7 +53,7 @@ public void UpdateSecret(QCloudCredentialProvider credential) cosXml = new CosXmlServer(config, credential); } - public async Task DownloadFileAsync(string savePath, string remotePath = null) + public async Task DownloadFileAsync(string savePath, string? remotePath = null) { // download_dir标记根文件夹路径,key为相对根文件夹的路径(不带./) // 创建存储桶 @@ -88,8 +90,10 @@ public async Task DownloadQueueAsync(ConcurrentQueue queue, ConcurrentQu ThreadPool.SetMaxThreads(20, 20); for (int i = 0; i < queue.Count; i++) { - string item; + string? item; queue.TryDequeue(out item); + if (item == null) + continue; ThreadPool.QueueUserWorkItem(async _ => { try @@ -98,6 +102,7 @@ public async Task DownloadQueueAsync(ConcurrentQueue queue, ConcurrentQu } catch (Exception ex) { + Exceptions.Push(ex); downloadFailed.Enqueue(item); } }); @@ -108,16 +113,14 @@ public void ArchieveUnzip(string zipPath, string targetDir) { Stream? inStream = null; Stream? gzipStream = null; - TarArchive? tarArchive = null; try { using (inStream = File.OpenRead(zipPath)) { - using (gzipStream = new GZipInputStream(inStream)) + + using (gzipStream = new GZipStream(inStream, CompressionMode.Decompress)) { - tarArchive = TarArchive.CreateInputTarArchive(gzipStream); - tarArchive.ExtractContents(targetDir); - tarArchive.Close(); + TarFile.ExtractToDirectory(gzipStream, targetDir, true); } } } @@ -127,7 +130,6 @@ public void ArchieveUnzip(string zipPath, string targetDir) } finally { - if (tarArchive != null) tarArchive.Close(); if (gzipStream != null) gzipStream.Close(); if (inStream != null) inStream.Close(); } diff --git a/installer/Page/MainPage.xaml.cs b/installer/Page/MainPage.xaml.cs index 937e032b..f807072c 100644 --- a/installer/Page/MainPage.xaml.cs +++ b/installer/Page/MainPage.xaml.cs @@ -2,16 +2,9 @@ { public partial class MainPage : ContentPage { - int count = 0; - public MainPage() { InitializeComponent(); } - - private void OnSliderChanged(object sender, ValueChangedEventArgs e) - { - //Txt_Slider1.Text = e.NewValue.ToString(); - } } } \ No newline at end of file diff --git a/installer/Platforms/MacCatalyst/Entitlements.plist b/installer/Platforms/MacCatalyst/Entitlements.plist new file mode 100644 index 00000000..de4adc94 --- /dev/null +++ b/installer/Platforms/MacCatalyst/Entitlements.plist @@ -0,0 +1,14 @@ + + + + + + + com.apple.security.app-sandbox + + + com.apple.security.network.client + + + + diff --git a/installer/ViewModel/Common.cs b/installer/ViewModel/Common.cs index fd1d5f80..a64df7fd 100644 --- a/installer/ViewModel/Common.cs +++ b/installer/ViewModel/Common.cs @@ -15,18 +15,18 @@ namespace installer.ViewModel public abstract class NotificationObject : INotifyPropertyChanged { public event PropertyChangedEventHandler? PropertyChanged; - ///< summary> - /// announce notification - /// - ///< param name="propertyName">property name + /// + ///announce notification + /// + ///property name public void OnPropertyChanged([CallerMemberName] string propertyName = "") { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } } - ///< summary> - /// BaseCommand - /// + /// + ///BaseCommand + /// public class BaseCommand : ICommand { private Func? _canExecute; @@ -78,7 +78,7 @@ public void Execute(object? parameter) public class RadioConverter : IValueConverter { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture) { if (value == null || parameter == null) { @@ -105,10 +105,10 @@ public object Convert(object value, Type targetType, object parameter, CultureIn } } + /* /// /// Password 附加属性,来自https://blog.csdn.net/qq_43562262/article/details/121786337 /// - /* public class PasswordHelper { public static readonly DependencyProperty PasswordProperty = DependencyProperty.RegisterAttached("Password", typeof(string), typeof(PasswordHelper), diff --git a/installer/ViewModel/LoginViewModel.cs b/installer/ViewModel/LoginViewModel.cs index fe53563a..74333b0a 100644 --- a/installer/ViewModel/LoginViewModel.cs +++ b/installer/ViewModel/LoginViewModel.cs @@ -23,10 +23,10 @@ public string Txt1 public LoginViewModel() { - BtnClickedCommand = new AsyncRelayCommand(BtnClicked); + BtnClickedCommand = new RelayCommand(BtnClicked); } - private async Task BtnClicked() + private void BtnClicked() { enabled = !enabled; Txt1 = enabled.ToString(); diff --git a/installer/ViewModel/MainViewModel.cs b/installer/ViewModel/MainViewModel.cs index 340046bc..2c1e97a2 100644 --- a/installer/ViewModel/MainViewModel.cs +++ b/installer/ViewModel/MainViewModel.cs @@ -38,10 +38,10 @@ public string Slider_Txt public MainViewModel() { - CounterClickedCommand = new AsyncRelayCommand(CounterClicked); + CounterClickedCommand = new RelayCommand(CounterClicked); } - private async Task CounterClicked() + private void CounterClicked() { count++; diff --git a/installer/installer.csproj b/installer/installer.csproj index fa0a91cb..fb321083 100644 --- a/installer/installer.csproj +++ b/installer/installer.csproj @@ -1,8 +1,8 @@  - net7.0-android;net7.0-ios;net7.0-maccatalyst - $(TargetFrameworks);net7.0-windows10.0.19041.0 + net8.0-android;net8.0-ios;net8.0-maccatalyst + $(TargetFrameworks);net8.0-windows10.0.19041.0 Exe @@ -50,11 +50,12 @@ - - + + + diff --git a/playback/Playback/Playback.csproj b/playback/Playback/Playback.csproj index f450be5f..a1f4e26d 100644 --- a/playback/Playback/Playback.csproj +++ b/playback/Playback/Playback.csproj @@ -1,7 +1,7 @@  - net6.0 + net8.0 enable enable @@ -11,7 +11,7 @@ - + From 8eb6a5d25ff5a1af16d7d6d268c1957a0a67ae1f Mon Sep 17 00:00:00 2001 From: DreamEnderKing Date: Sat, 18 Nov 2023 22:38:44 +0800 Subject: [PATCH 2/2] =?UTF-8?q?build:=20:arrow=5Fup:=20=E4=BF=AE=E6=94=B9i?= =?UTF-8?q?nstaller=EF=BC=8Cgrpc=E5=92=8Cplayback=E7=89=88=E6=9C=AC?= =?UTF-8?q?=E8=87=B3.net=208.0=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/build.yml | 6 ++--- .github/workflows/format.yml | 2 +- dependency/proto/{Proto.sln => Protos.sln} | 2 +- installer/Model/Downloader.cs | 6 ++--- installer/Model/EEsast.cs | 13 +++++----- installer/Model/Local_Data.cs | 13 ++++++---- installer/Model/Tencent_Cos.cs | 24 ++++++++++--------- installer/Page/MainPage.xaml.cs | 7 ------ .../Platforms/MacCatalyst/Entitlements.plist | 14 +++++++++++ installer/ViewModel/Common.cs | 18 +++++++------- installer/ViewModel/LoginViewModel.cs | 4 ++-- installer/ViewModel/MainViewModel.cs | 4 ++-- installer/installer.csproj | 9 +++---- 13 files changed, 68 insertions(+), 54 deletions(-) rename dependency/proto/{Proto.sln => Protos.sln} (89%) create mode 100644 installer/Platforms/MacCatalyst/Entitlements.plist diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9260d1c1..6bc4085f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -22,10 +22,10 @@ jobs: - name: Setup .NET Core uses: actions/setup-dotnet@v3 with: - dotnet-version: 7.0.x + dotnet-version: 8.0.x - name: Build Installer - run: dotnet build "./installer/installer.sln" -c Release -f net7.0-windows10.0.19041.0 + run: dotnet build "./installer/installer.sln" -c Release -f net8.0-windows10.0.19041.0 dotnet-build-launcher: if: true @@ -48,7 +48,7 @@ jobs: - name: Setup .NET Core uses: actions/setup-dotnet@v3 with: - dotnet-version: 6.0.x + dotnet-version: 8.0.x - name: Build Playback run: dotnet build "./playback/playback.sln" -c Release diff --git a/.github/workflows/format.yml b/.github/workflows/format.yml index 33f924e5..bc65a38e 100644 --- a/.github/workflows/format.yml +++ b/.github/workflows/format.yml @@ -62,7 +62,7 @@ jobs: - name: Setup .NET Core uses: actions/setup-dotnet@v3 with: - dotnet-version: 6.0.x + dotnet-version: 8.0.x - name: Check Playback run: | diff --git a/dependency/proto/Proto.sln b/dependency/proto/Protos.sln similarity index 89% rename from dependency/proto/Proto.sln rename to dependency/proto/Protos.sln index 2cdbe95d..d34be8ef 100644 --- a/dependency/proto/Proto.sln +++ b/dependency/proto/Protos.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 17 VisualStudioVersion = 17.1.32328.378 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Proto", "Proto.csproj", "{B9A3CDD7-7852-4220-A2AA-2B986E0C19E8}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Protos", "Protos.csproj", "{B9A3CDD7-7852-4220-A2AA-2B986E0C19E8}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/installer/Model/Downloader.cs b/installer/Model/Downloader.cs index b4e34d24..f1fd8db9 100644 --- a/installer/Model/Downloader.cs +++ b/installer/Model/Downloader.cs @@ -54,7 +54,7 @@ public void ResetDownloadFailedInfo() downloadFailed.Clear(); } - private int filenum = 0; // 总文件个数 + //private int filenum = 0; 总文件个数 public string Route { get; set; } public string Username { get; set; } = string.Empty; @@ -70,7 +70,7 @@ public enum UsingOS { Win, Linux, OSX }; public UsingOS usingOS { get; set; } public class Updater { - public string Message; + public string Message = string.Empty; public bool Working { get; set; } public bool CombatCompleted { get => false; } public bool UploadReady { get; set; } = false; @@ -88,7 +88,7 @@ public Downloader() Route = Data.InstallPath; Cloud = new Tencent_Cos("1314234950", "ap-beijing", "thuai6"); Web.Token_Changed += SaveToken; - string temp; + string? temp; if (Data.Config.TryGetValue("Remembered", out temp)) { if (Convert.ToBoolean(temp)) diff --git a/installer/Model/EEsast.cs b/installer/Model/EEsast.cs index 03cc0782..103a2fbe 100644 --- a/installer/Model/EEsast.cs +++ b/installer/Model/EEsast.cs @@ -20,20 +20,20 @@ record LoginResponse class EEsast { - public enum language { cpp, py }; + public enum LangUsed { cpp, py }; private string token = string.Empty; public string Token { get => token; protected set { if (token != value) - Token_Changed.Invoke(this, new EventArgs()); + Token_Changed?.Invoke(this, new EventArgs()); token = value; } } - public event EventHandler Token_Changed; - public string ID { get; protected set; } - public string Email { get; protected set; } + public event EventHandler? Token_Changed; + public string ID { get; protected set; } = string.Empty; + public string Email { get; protected set; } = string.Empty; public ConcurrentQueue Exceptions = new ConcurrentQueue(); public enum WebStatus @@ -41,10 +41,9 @@ public enum WebStatus disconnected, offline, logined } public WebStatus Status = WebStatus.disconnected; - public Tencent_Cos EEsast_Cos { get; protected set; } + public Tencent_Cos EEsast_Cos { get; protected set; } = new Tencent_Cos("1255334966", "ap-beijing", "eesast"); public async Task LoginToEEsast(HttpClient client, string useremail, string userpassword) { - EEsast_Cos = new Tencent_Cos("1255334966", "ap-beijing", "eesast"); try { using (var response = await client.PostAsync("https://api.eesast.com/users/login", JsonContent.Create(new diff --git a/installer/Model/Local_Data.cs b/installer/Model/Local_Data.cs index e987b841..28d2d06e 100644 --- a/installer/Model/Local_Data.cs +++ b/installer/Model/Local_Data.cs @@ -17,11 +17,11 @@ class Local_Data public Dictionary Config { get; protected set; - } + } = new Dictionary(); public Dictionary MD5Data { get; protected set; - }// 路径为尽可能相对路径 + } = new Dictionary(); // 路径为尽可能相对路径 public ConcurrentBag MD5Update { get; set; @@ -84,9 +84,14 @@ public Local_Data() public void ResetInstallPath(string newPath) { - if (!Directory.Exists(Path.GetDirectoryName(newPath))) + string? dirName = Path.GetDirectoryName(newPath); + if (dirName is null) + { + return; + } + if (!Directory.Exists(dirName)) { - Directory.CreateDirectory(Path.GetDirectoryName(newPath)); + Directory.CreateDirectory(dirName); } if (Installed) { diff --git a/installer/Model/Tencent_Cos.cs b/installer/Model/Tencent_Cos.cs index 359d5784..93486daf 100644 --- a/installer/Model/Tencent_Cos.cs +++ b/installer/Model/Tencent_Cos.cs @@ -2,14 +2,16 @@ using COSXML.Auth; using COSXML.CosException; using COSXML.Model.Object; -using ICSharpCode.SharpZipLib; -using ICSharpCode.SharpZipLib.Tar; -using ICSharpCode.SharpZipLib.GZip; using Newtonsoft.Json; using System.Collections.Concurrent; +using System.IO.Compression; +using System.Formats.Tar; using COSXML.Common; using COSXML.Transfer; +// 禁用对没有调用异步API的异步函数的警告 +#pragma warning disable CS1998 + namespace installer.Model { public class Tencent_Cos @@ -51,7 +53,7 @@ public void UpdateSecret(QCloudCredentialProvider credential) cosXml = new CosXmlServer(config, credential); } - public async Task DownloadFileAsync(string savePath, string remotePath = null) + public async Task DownloadFileAsync(string savePath, string? remotePath = null) { // download_dir标记根文件夹路径,key为相对根文件夹的路径(不带./) // 创建存储桶 @@ -88,8 +90,10 @@ public async Task DownloadQueueAsync(ConcurrentQueue queue, ConcurrentQu ThreadPool.SetMaxThreads(20, 20); for (int i = 0; i < queue.Count; i++) { - string item; + string? item; queue.TryDequeue(out item); + if (item == null) + continue; ThreadPool.QueueUserWorkItem(async _ => { try @@ -98,6 +102,7 @@ public async Task DownloadQueueAsync(ConcurrentQueue queue, ConcurrentQu } catch (Exception ex) { + Exceptions.Push(ex); downloadFailed.Enqueue(item); } }); @@ -108,16 +113,14 @@ public void ArchieveUnzip(string zipPath, string targetDir) { Stream? inStream = null; Stream? gzipStream = null; - TarArchive? tarArchive = null; try { using (inStream = File.OpenRead(zipPath)) { - using (gzipStream = new GZipInputStream(inStream)) + + using (gzipStream = new GZipStream(inStream, CompressionMode.Decompress)) { - tarArchive = TarArchive.CreateInputTarArchive(gzipStream); - tarArchive.ExtractContents(targetDir); - tarArchive.Close(); + TarFile.ExtractToDirectory(gzipStream, targetDir, true); } } } @@ -127,7 +130,6 @@ public void ArchieveUnzip(string zipPath, string targetDir) } finally { - if (tarArchive != null) tarArchive.Close(); if (gzipStream != null) gzipStream.Close(); if (inStream != null) inStream.Close(); } diff --git a/installer/Page/MainPage.xaml.cs b/installer/Page/MainPage.xaml.cs index 937e032b..f807072c 100644 --- a/installer/Page/MainPage.xaml.cs +++ b/installer/Page/MainPage.xaml.cs @@ -2,16 +2,9 @@ { public partial class MainPage : ContentPage { - int count = 0; - public MainPage() { InitializeComponent(); } - - private void OnSliderChanged(object sender, ValueChangedEventArgs e) - { - //Txt_Slider1.Text = e.NewValue.ToString(); - } } } \ No newline at end of file diff --git a/installer/Platforms/MacCatalyst/Entitlements.plist b/installer/Platforms/MacCatalyst/Entitlements.plist new file mode 100644 index 00000000..de4adc94 --- /dev/null +++ b/installer/Platforms/MacCatalyst/Entitlements.plist @@ -0,0 +1,14 @@ + + + + + + + com.apple.security.app-sandbox + + + com.apple.security.network.client + + + + diff --git a/installer/ViewModel/Common.cs b/installer/ViewModel/Common.cs index fd1d5f80..a64df7fd 100644 --- a/installer/ViewModel/Common.cs +++ b/installer/ViewModel/Common.cs @@ -15,18 +15,18 @@ namespace installer.ViewModel public abstract class NotificationObject : INotifyPropertyChanged { public event PropertyChangedEventHandler? PropertyChanged; - ///< summary> - /// announce notification - /// - ///< param name="propertyName">property name + /// + ///announce notification + /// + ///property name public void OnPropertyChanged([CallerMemberName] string propertyName = "") { PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } } - ///< summary> - /// BaseCommand - /// + /// + ///BaseCommand + /// public class BaseCommand : ICommand { private Func? _canExecute; @@ -78,7 +78,7 @@ public void Execute(object? parameter) public class RadioConverter : IValueConverter { - public object Convert(object value, Type targetType, object parameter, CultureInfo culture) + public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture) { if (value == null || parameter == null) { @@ -105,10 +105,10 @@ public object Convert(object value, Type targetType, object parameter, CultureIn } } + /* /// /// Password 附加属性,来自https://blog.csdn.net/qq_43562262/article/details/121786337 /// - /* public class PasswordHelper { public static readonly DependencyProperty PasswordProperty = DependencyProperty.RegisterAttached("Password", typeof(string), typeof(PasswordHelper), diff --git a/installer/ViewModel/LoginViewModel.cs b/installer/ViewModel/LoginViewModel.cs index fe53563a..74333b0a 100644 --- a/installer/ViewModel/LoginViewModel.cs +++ b/installer/ViewModel/LoginViewModel.cs @@ -23,10 +23,10 @@ public string Txt1 public LoginViewModel() { - BtnClickedCommand = new AsyncRelayCommand(BtnClicked); + BtnClickedCommand = new RelayCommand(BtnClicked); } - private async Task BtnClicked() + private void BtnClicked() { enabled = !enabled; Txt1 = enabled.ToString(); diff --git a/installer/ViewModel/MainViewModel.cs b/installer/ViewModel/MainViewModel.cs index 340046bc..2c1e97a2 100644 --- a/installer/ViewModel/MainViewModel.cs +++ b/installer/ViewModel/MainViewModel.cs @@ -38,10 +38,10 @@ public string Slider_Txt public MainViewModel() { - CounterClickedCommand = new AsyncRelayCommand(CounterClicked); + CounterClickedCommand = new RelayCommand(CounterClicked); } - private async Task CounterClicked() + private void CounterClicked() { count++; diff --git a/installer/installer.csproj b/installer/installer.csproj index fa0a91cb..fb321083 100644 --- a/installer/installer.csproj +++ b/installer/installer.csproj @@ -1,8 +1,8 @@  - net7.0-android;net7.0-ios;net7.0-maccatalyst - $(TargetFrameworks);net7.0-windows10.0.19041.0 + net8.0-android;net8.0-ios;net8.0-maccatalyst + $(TargetFrameworks);net8.0-windows10.0.19041.0 Exe @@ -50,11 +50,12 @@ - - + + +