diff --git a/src/ST.Client.Desktop/Services/Mvvm/ProxyService.cs b/src/ST.Client.Desktop/Services/Mvvm/ProxyService.cs index da688b770..b9ff5244c 100644 --- a/src/ST.Client.Desktop/Services/Mvvm/ProxyService.cs +++ b/src/ST.Client.Desktop/Services/Mvvm/ProxyService.cs @@ -241,67 +241,64 @@ namespace System.Application.Services } } - this.WhenAnyValue(v => v.ProxyScripts) - .Subscribe(script => script? - .Connect() - .AutoRefresh(x => x.Enable) - .WhenPropertyChanged(x => x.Enable, false) - .Subscribe(_ => - { - if (EnableProxyScripts != null) - { - ProxySettings.ScriptsStatus.Value = EnableProxyScripts.Where(w => w?.LocalId > 0).Select(k => k.LocalId).ToList(); - } - })); - #endregion - } - public async void BasicsInfo() - { - var basicsInfo = await ICloudServiceClient.Instance.Script.Basics(); - if (basicsInfo.Code == ApiResponseCode.OK && basicsInfo.Content != null) - { - var basicsItem = ProxyScripts.Items.FirstOrDefault(x => x.Id == Guid.Parse("00000000-0000-0000-0000-000000000001")); - if (basicsItem != null) - { - if (basicsItem.Version != basicsInfo.Content.Version && basicsInfo.Content.UpdateLink != null) - { - var index = ProxyScripts.Items.IndexOf(basicsItem); - basicsItem.IsUpdate = true; - basicsItem.UpdateLink = basicsInfo.Content.UpdateLink; - basicsItem.NewVersion = basicsInfo.Content.Version; - ProxyScripts.ReplaceAt(index, basicsItem); - } - } - else - { - if (basicsInfo.Content.UpdateLink != null) - { - var jspath = await DI.Get().DownloadScript(basicsInfo.Content.UpdateLink); - if (jspath.state) - { - var build = await DI.Get().AddScriptAsync(jspath.path, build: false, order: 1, deleteFile: true, pid: basicsInfo.Content.Id); - if (build.state) - { - if (build.model != null) - ProxyScripts.Insert(0, build.model); - } - } - } - } - } - } - public void StartTiming() - { - Task.Run(() => - { - Thread.CurrentThread.IsBackground = true; - while (ProxyStatus) - { - AccelerateTime = AccelerateTime.AddSeconds(1); - Thread.Sleep(1000); - } - }); - } + this.WhenAnyValue(v => v.ProxyScripts) + .Subscribe(script => script? + .Connect() + .AutoRefresh(x => x.Enable) + .WhenPropertyChanged(x => x.Enable, false) + .Subscribe(_ => + { + if (EnableProxyScripts != null) + { + ProxySettings.ScriptsStatus.Value = EnableProxyScripts.Where(w => w?.LocalId > 0).Select(k => k.LocalId).ToList(); + } + })); + #endregion + } + public async void BasicsInfo() + { + var basicsInfo = await ICloudServiceClient.Instance.Script.Basics(); + if (basicsInfo.Code == ApiResponseCode.OK && basicsInfo.Content != null) + { + var basicsItem = ProxyScripts.Items.FirstOrDefault(x => x.Id == Guid.Parse("00000000-0000-0000-0000-000000000001")); + if (basicsItem != null) + { + if (basicsItem.Version != basicsInfo.Content.Version) + { + var index = ProxyScripts.Items.IndexOf(basicsItem); + basicsItem.IsUpdate = true; + basicsItem.UpdateLink = basicsInfo.Content.UpdateLink; + basicsItem.NewVersion = basicsInfo.Content.Version; + ProxyScripts.ReplaceAt(index, basicsItem); + } + } + else + { + var jspath = await DI.Get().DownloadScript(basicsInfo.Content.UpdateLink); + if (jspath.state) + { + var build = await DI.Get().AddScriptAsync(jspath.path, build: false, order: 1, deleteFile: true, pid: basicsInfo.Content.Id); + if (build.state) + { + if (build.model != null) + ProxyScripts.Insert(0, build.model); + } + } + } + } + } + public void StartTiming() + { + Task.Run(() => + { + Thread.CurrentThread.IsBackground = true; + while (ProxyStatus) + { + AccelerateTime = AccelerateTime.AddSeconds(1); + Thread.Sleep(1000); + } + }); + } public void Dispose() { diff --git a/src/ST.Services.CloudService.Models/Models/ScriptResponse.cs b/src/ST.Services.CloudService.Models/Models/ScriptResponse.cs index f4a0c399d..d0949b7a9 100644 --- a/src/ST.Services.CloudService.Models/Models/ScriptResponse.cs +++ b/src/ST.Services.CloudService.Models/Models/ScriptResponse.cs @@ -18,7 +18,7 @@ namespace System.Application.Models [MPKey(1)] [N_JsonProperty("1")] [S_JsonProperty("1")] - public string? Version { get; set; } = string.Empty; + public string Version { get; set; } = string.Empty; /// /// 更新地址 @@ -26,7 +26,7 @@ namespace System.Application.Models [MPKey(2)] [N_JsonProperty("2")] [S_JsonProperty("2")] - public string? UpdateLink { get; set; } = string.Empty; + public string UpdateLink { get; set; } = string.Empty; /// @@ -35,7 +35,7 @@ namespace System.Application.Models [MPKey(3)] [N_JsonProperty("3")] [S_JsonProperty("3")] - public string? Description { get; set; } = string.Empty; + public string? Description { get; set; } /// /// 更新时间 ///