From ffb38129e2547b38f49a2cd20a085df65e2e20a7 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Wed, 23 Oct 2024 17:19:57 +0800 Subject: [PATCH] The first letter of the guiconfig attribute must be capitalized. --- v2rayN/ServiceLib/Handler/ClashApiHandler.cs | 8 +-- v2rayN/ServiceLib/Handler/ConfigHandler.cs | 10 +-- .../ServiceLib/Handler/StatisticsHandler.cs | 10 +-- .../ServiceLib/Models/ClashConnectionModel.cs | 22 +++---- v2rayN/ServiceLib/Models/ClashProxyModel.cs | 10 +-- v2rayN/ServiceLib/Models/RoutingTemplate.cs | 4 +- v2rayN/ServiceLib/Models/RulesItem.cs | 20 +++--- v2rayN/ServiceLib/Models/ServerSpeedItem.cs | 30 ++------- .../CoreConfig/CoreConfigSingboxService.cs | 34 +++++----- .../Statistics/StatisticsSingboxService.cs | 8 +-- .../Statistics/StatisticsV2rayService.cs | 8 +-- v2rayN/ServiceLib/Services/UpdateService.cs | 4 +- .../ViewModels/ClashConnectionsViewModel.cs | 38 +++++------ .../ViewModels/ClashProxiesViewModel.cs | 66 +++++++++---------- .../ViewModels/MainWindowViewModel.cs | 2 +- .../ViewModels/RoutingRuleDetailsViewModel.cs | 38 +++++------ .../ViewModels/RoutingRuleSettingViewModel.cs | 36 +++++----- .../ViewModels/RoutingSettingViewModel.cs | 24 +++---- .../ViewModels/StatusBarViewModel.cs | 4 +- .../Views/ClashConnectionsView.axaml | 14 ++-- .../Views/ClashProxiesView.axaml | 14 ++-- .../Views/RoutingRuleDetailsWindow.axaml.cs | 12 ++-- .../Views/RoutingRuleSettingWindow.axaml | 6 +- v2rayN/v2rayN/Views/ClashConnectionsView.xaml | 20 +++--- v2rayN/v2rayN/Views/ClashProxiesView.xaml | 22 +++---- .../Views/RoutingRuleDetailsWindow.xaml.cs | 12 ++-- .../Views/RoutingRuleSettingWindow.xaml | 6 +- 27 files changed, 232 insertions(+), 250 deletions(-) diff --git a/v2rayN/ServiceLib/Handler/ClashApiHandler.cs b/v2rayN/ServiceLib/Handler/ClashApiHandler.cs index 832f6549..da0f80c4 100644 --- a/v2rayN/ServiceLib/Handler/ClashApiHandler.cs +++ b/v2rayN/ServiceLib/Handler/ClashApiHandler.cs @@ -61,8 +61,8 @@ namespace ServiceLib.Handler } lstProxy.Add(new ClashProxyModel() { - name = kv.Value.name, - type = kv.Value.type.ToLower(), + Name = kv.Value.name, + Type = kv.Value.type.ToLower(), }); } } @@ -77,11 +77,11 @@ namespace ServiceLib.Handler List tasks = new List(); foreach (var it in lstProxy) { - if (Global.notAllowTestType.Contains(it.type.ToLower())) + if (Global.notAllowTestType.Contains(it.Type.ToLower())) { continue; } - var name = it.name; + var name = it.Name; var url = string.Format(urlBase, name); tasks.Add(Task.Run(async () => { diff --git a/v2rayN/ServiceLib/Handler/ConfigHandler.cs b/v2rayN/ServiceLib/Handler/ConfigHandler.cs index 52283f63..d17b7a7d 100644 --- a/v2rayN/ServiceLib/Handler/ConfigHandler.cs +++ b/v2rayN/ServiceLib/Handler/ConfigHandler.cs @@ -1501,7 +1501,7 @@ namespace ServiceLib.Handler foreach (var item in lstRules) { - item.id = Utils.GetGuid(false); + item.Id = Utils.GetGuid(false); } routingItem.RuleNum = lstRules.Count; routingItem.RuleSet = JsonUtils.Serialize(lstRules, false); @@ -1650,13 +1650,13 @@ namespace ServiceLib.Handler var items = await AppHandler.Instance.RoutingItems(); var maxSort = items.Count; - if (!blImportAdvancedRules && items.Where(t => t.Remarks.StartsWith(template.version)).ToList().Count > 0) + if (!blImportAdvancedRules && items.Where(t => t.Remarks.StartsWith(template.Version)).ToList().Count > 0) { return 0; } - for (var i = 0; i < template.routingItems.Length; i++) + for (var i = 0; i < template.RoutingItems.Length; i++) { - var item = template.routingItems[i]; + var item = template.RoutingItems[i]; if (string.IsNullOrEmpty(item.Url) && string.IsNullOrEmpty(item.RuleSet)) continue; @@ -1668,7 +1668,7 @@ namespace ServiceLib.Handler if (string.IsNullOrEmpty(ruleSetsString)) continue; - item.Remarks = $"{template.version}-{item.Remarks}"; + item.Remarks = $"{template.Version}-{item.Remarks}"; item.Enabled = true; item.Sort = ++maxSort; item.Url = string.Empty; diff --git a/v2rayN/ServiceLib/Handler/StatisticsHandler.cs b/v2rayN/ServiceLib/Handler/StatisticsHandler.cs index 6a631a7d..97d4f7b3 100644 --- a/v2rayN/ServiceLib/Handler/StatisticsHandler.cs +++ b/v2rayN/ServiceLib/Handler/StatisticsHandler.cs @@ -87,12 +87,12 @@ { return; } - if (server.proxyUp != 0 || server.proxyDown != 0) + if (server.ProxyUp != 0 || server.ProxyDown != 0) { - _serverStatItem.TodayUp += server.proxyUp; - _serverStatItem.TodayDown += server.proxyDown; - _serverStatItem.TotalUp += server.proxyUp; - _serverStatItem.TotalDown += server.proxyDown; + _serverStatItem.TodayUp += server.ProxyUp; + _serverStatItem.TodayDown += server.ProxyDown; + _serverStatItem.TotalUp += server.ProxyUp; + _serverStatItem.TotalDown += server.ProxyDown; } server.IndexId = _config.IndexId; diff --git a/v2rayN/ServiceLib/Models/ClashConnectionModel.cs b/v2rayN/ServiceLib/Models/ClashConnectionModel.cs index 4889500b..3a68feb2 100644 --- a/v2rayN/ServiceLib/Models/ClashConnectionModel.cs +++ b/v2rayN/ServiceLib/Models/ClashConnectionModel.cs @@ -2,16 +2,16 @@ { public class ClashConnectionModel { - public string? id { get; set; } - public string? network { get; set; } - public string? type { get; set; } - public string? host { get; set; } - public ulong upload { get; set; } - public ulong download { get; set; } - public string? uploadTraffic { get; set; } - public string? downloadTraffic { get; set; } - public double time { get; set; } - public string? elapsed { get; set; } - public string? chain { get; set; } + public string? Id { get; set; } + public string? Network { get; set; } + public string? Type { get; set; } + public string? Host { get; set; } + public ulong Upload { get; set; } + public ulong Download { get; set; } + public string? UploadTraffic { get; set; } + public string? DownloadTraffic { get; set; } + public double Time { get; set; } + public string? Elapsed { get; set; } + public string? Chain { get; set; } } } \ No newline at end of file diff --git a/v2rayN/ServiceLib/Models/ClashProxyModel.cs b/v2rayN/ServiceLib/Models/ClashProxyModel.cs index 8f5936da..a19de253 100644 --- a/v2rayN/ServiceLib/Models/ClashProxyModel.cs +++ b/v2rayN/ServiceLib/Models/ClashProxyModel.cs @@ -3,15 +3,15 @@ [Serializable] public class ClashProxyModel { - public string? name { get; set; } + public string? Name { get; set; } - public string? type { get; set; } + public string? Type { get; set; } - public string? now { get; set; } + public string? Now { get; set; } - public int delay { get; set; } + public int Delay { get; set; } - public string? delayName { get; set; } + public string? DelayName { get; set; } public bool IsActive { get; set; } } diff --git a/v2rayN/ServiceLib/Models/RoutingTemplate.cs b/v2rayN/ServiceLib/Models/RoutingTemplate.cs index 3c0a4e59..43ebd81c 100644 --- a/v2rayN/ServiceLib/Models/RoutingTemplate.cs +++ b/v2rayN/ServiceLib/Models/RoutingTemplate.cs @@ -3,7 +3,7 @@ [Serializable] public class RoutingTemplate { - public string version { get; set; } - public RoutingItem[] routingItems { get; set; } + public string Version { get; set; } + public RoutingItem[] RoutingItems { get; set; } } } \ No newline at end of file diff --git a/v2rayN/ServiceLib/Models/RulesItem.cs b/v2rayN/ServiceLib/Models/RulesItem.cs index f7414593..fde8d7db 100644 --- a/v2rayN/ServiceLib/Models/RulesItem.cs +++ b/v2rayN/ServiceLib/Models/RulesItem.cs @@ -3,16 +3,16 @@ [Serializable] public class RulesItem { - public string id { get; set; } - public string? type { get; set; } - public string? port { get; set; } - public string? network { get; set; } - public List? inboundTag { get; set; } - public string? outboundTag { get; set; } - public List? ip { get; set; } - public List? domain { get; set; } - public List? protocol { get; set; } - public List? process { get; set; } + public string Id { get; set; } + public string? Type { get; set; } + public string? Port { get; set; } + public string? Network { get; set; } + public List? InboundTag { get; set; } + public string? OutboundTag { get; set; } + public List? Ip { get; set; } + public List? Domain { get; set; } + public List? Protocol { get; set; } + public List? Process { get; set; } public bool Enabled { get; set; } = true; public string? Remarks { get; set; } } diff --git a/v2rayN/ServiceLib/Models/ServerSpeedItem.cs b/v2rayN/ServiceLib/Models/ServerSpeedItem.cs index 09c5e6ba..5781a6ea 100644 --- a/v2rayN/ServiceLib/Models/ServerSpeedItem.cs +++ b/v2rayN/ServiceLib/Models/ServerSpeedItem.cs @@ -3,38 +3,20 @@ [Serializable] public class ServerSpeedItem : ServerStatItem { - public long proxyUp - { - get; set; - } + public long ProxyUp { get; set; } - public long proxyDown - { - get; set; - } + public long ProxyDown { get; set; } - public long directUp - { - get; set; - } + public long DirectUp { get; set; } - public long directDown - { - get; set; - } + public long DirectDown { get; set; } } [Serializable] public class TrafficItem { - public ulong up - { - get; set; - } + public ulong Up { get; set; } - public ulong down - { - get; set; - } + public ulong Down { get; set; } } } \ No newline at end of file diff --git a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs index 49ba6282..b710ca25 100644 --- a/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs +++ b/v2rayN/ServiceLib/Services/CoreConfig/CoreConfigSingboxService.cs @@ -1030,41 +1030,41 @@ namespace ServiceLib.Services.CoreConfig var rule = new Rule4Sbox() { - outbound = item.outboundTag, + outbound = item.OutboundTag, }; - if (Utils.IsNotEmpty(item.port)) + if (Utils.IsNotEmpty(item.Port)) { - if (item.port.Contains("-")) + if (item.Port.Contains("-")) { - rule.port_range = new List { item.port.Replace("-", ":") }; + rule.port_range = new List { item.Port.Replace("-", ":") }; } else { - rule.port = new List { Utils.ToInt(item.port) }; + rule.port = new List { Utils.ToInt(item.Port) }; } } - if (Utils.IsNotEmpty(item.network)) + if (Utils.IsNotEmpty(item.Network)) { - rule.network = Utils.String2List(item.network); + rule.network = Utils.String2List(item.Network); } - if (item.protocol?.Count > 0) + if (item.Protocol?.Count > 0) { - rule.protocol = item.protocol; + rule.protocol = item.Protocol; } - if (item.inboundTag?.Count >= 0) + if (item.InboundTag?.Count >= 0) { - rule.inbound = item.inboundTag; + rule.inbound = item.InboundTag; } var rule1 = JsonUtils.DeepCopy(rule); var rule2 = JsonUtils.DeepCopy(rule); var rule3 = JsonUtils.DeepCopy(rule); var hasDomainIp = false; - if (item.domain?.Count > 0) + if (item.Domain?.Count > 0) { var countDomain = 0; - foreach (var it in item.domain) + foreach (var it in item.Domain) { if (ParseV2Domain(it, rule1)) countDomain++; } @@ -1075,10 +1075,10 @@ namespace ServiceLib.Services.CoreConfig } } - if (item.ip?.Count > 0) + if (item.Ip?.Count > 0) { var countIp = 0; - foreach (var it in item.ip) + foreach (var it in item.Ip) { if (ParseV2Address(it, rule2)) countIp++; } @@ -1089,9 +1089,9 @@ namespace ServiceLib.Services.CoreConfig } } - if (_config.TunModeItem.EnableTun && item.process?.Count > 0) + if (_config.TunModeItem.EnableTun && item.Process?.Count > 0) { - rule3.process_name = item.process; + rule3.process_name = item.Process; rules.Add(rule3); hasDomainIp = true; } diff --git a/v2rayN/ServiceLib/Services/Statistics/StatisticsSingboxService.cs b/v2rayN/ServiceLib/Services/Statistics/StatisticsSingboxService.cs index dc80d370..a051fc95 100644 --- a/v2rayN/ServiceLib/Services/Statistics/StatisticsSingboxService.cs +++ b/v2rayN/ServiceLib/Services/Statistics/StatisticsSingboxService.cs @@ -94,8 +94,8 @@ namespace ServiceLib.Services.Statistics _updateFunc?.Invoke(new ServerSpeedItem() { - proxyUp = (long)(up / 1000), - proxyDown = (long)(down / 1000) + ProxyUp = (long)(up / 1000), + ProxyDown = (long)(down / 1000) }); } res = await webSocket.ReceiveAsync(new ArraySegment(buffer), CancellationToken.None); @@ -116,8 +116,8 @@ namespace ServiceLib.Services.Statistics var trafficItem = JsonUtils.Deserialize(source); if (trafficItem != null) { - up = trafficItem.up; - down = trafficItem.down; + up = trafficItem.Up; + down = trafficItem.Down; } } catch diff --git a/v2rayN/ServiceLib/Services/Statistics/StatisticsV2rayService.cs b/v2rayN/ServiceLib/Services/Statistics/StatisticsV2rayService.cs index 440a6772..66419576 100644 --- a/v2rayN/ServiceLib/Services/Statistics/StatisticsV2rayService.cs +++ b/v2rayN/ServiceLib/Services/Statistics/StatisticsV2rayService.cs @@ -116,16 +116,16 @@ namespace ServiceLib.Services.Statistics { if (type == "uplink") { - server.directUp = value; + server.DirectUp = value; } else if (type == "downlink") { - server.directDown = value; + server.DirectDown = value; } } } - server.proxyUp = aggregateProxyUp; - server.proxyDown = aggregateProxyDown; + server.ProxyUp = aggregateProxyUp; + server.ProxyDown = aggregateProxyDown; } catch { diff --git a/v2rayN/ServiceLib/Services/UpdateService.cs b/v2rayN/ServiceLib/Services/UpdateService.cs index bc66b3af..f231b228 100644 --- a/v2rayN/ServiceLib/Services/UpdateService.cs +++ b/v2rayN/ServiceLib/Services/UpdateService.cs @@ -483,7 +483,7 @@ namespace ServiceLib.Services var rules = JsonUtils.Deserialize>(routing.RuleSet); foreach (var item in rules ?? []) { - foreach (var ip in item.ip ?? []) + foreach (var ip in item.Ip ?? []) { var prefix = "geoip:"; if (ip.StartsWith(prefix)) @@ -492,7 +492,7 @@ namespace ServiceLib.Services } } - foreach (var domain in item.domain ?? []) + foreach (var domain in item.Domain ?? []) { var prefix = "geosite:"; if (domain.StartsWith(prefix)) diff --git a/v2rayN/ServiceLib/ViewModels/ClashConnectionsViewModel.cs b/v2rayN/ServiceLib/ViewModels/ClashConnectionsViewModel.cs index 14025b43..e60ddbb9 100644 --- a/v2rayN/ServiceLib/ViewModels/ClashConnectionsViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/ClashConnectionsViewModel.cs @@ -36,7 +36,7 @@ namespace ServiceLib.ViewModels var canEditRemove = this.WhenAnyValue( x => x.SelectedSource, - selectedSource => selectedSource != null && Utils.IsNotEmpty(selectedSource.id)); + selectedSource => selectedSource != null && Utils.IsNotEmpty(selectedSource.Id)); this.WhenAnyValue( x => x.SortingSelected, @@ -125,18 +125,18 @@ namespace ServiceLib.ViewModels ClashConnectionModel model = new(); - model.id = item.id; - model.network = item.metadata.network; - model.type = item.metadata.type; - model.host = host; + model.Id = item.id; + model.Network = item.metadata.network; + model.Type = item.metadata.type; + model.Host = host; var sp = (dtNow - item.start); - model.time = sp.TotalSeconds < 0 ? 1 : sp.TotalSeconds; - model.upload = item.upload; - model.download = item.download; - model.uploadTraffic = $"{Utils.HumanFy((long)item.upload)}"; - model.downloadTraffic = $"{Utils.HumanFy((long)item.download)}"; - model.elapsed = sp.ToString(@"hh\:mm\:ss"); - model.chain = item.chains?.Count > 0 ? item.chains[0] : string.Empty; + model.Time = sp.TotalSeconds < 0 ? 1 : sp.TotalSeconds; + model.Upload = item.upload; + model.Download = item.download; + model.UploadTraffic = $"{Utils.HumanFy((long)item.upload)}"; + model.DownloadTraffic = $"{Utils.HumanFy((long)item.download)}"; + model.Elapsed = sp.ToString(@"hh\:mm\:ss"); + model.Chain = item.chains?.Count > 0 ? item.chains[0] : string.Empty; lstModel.Add(model); } @@ -146,27 +146,27 @@ namespace ServiceLib.ViewModels switch (SortingSelected) { case 0: - lstModel = lstModel.OrderBy(t => t.upload / t.time).ToList(); + lstModel = lstModel.OrderBy(t => t.Upload / t.Time).ToList(); break; case 1: - lstModel = lstModel.OrderBy(t => t.download / t.time).ToList(); + lstModel = lstModel.OrderBy(t => t.Download / t.Time).ToList(); break; case 2: - lstModel = lstModel.OrderBy(t => t.upload).ToList(); + lstModel = lstModel.OrderBy(t => t.Upload).ToList(); break; case 3: - lstModel = lstModel.OrderBy(t => t.download).ToList(); + lstModel = lstModel.OrderBy(t => t.Download).ToList(); break; case 4: - lstModel = lstModel.OrderBy(t => t.time).ToList(); + lstModel = lstModel.OrderBy(t => t.Time).ToList(); break; case 5: - lstModel = lstModel.OrderBy(t => t.host).ToList(); + lstModel = lstModel.OrderBy(t => t.Host).ToList(); break; } @@ -183,7 +183,7 @@ namespace ServiceLib.ViewModels { return; } - id = item.id; + id = item.Id; } else { diff --git a/v2rayN/ServiceLib/ViewModels/ClashProxiesViewModel.cs b/v2rayN/ServiceLib/ViewModels/ClashProxiesViewModel.cs index 7bfe7ffa..3827c38f 100644 --- a/v2rayN/ServiceLib/ViewModels/ClashProxiesViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/ClashProxiesViewModel.cs @@ -72,7 +72,7 @@ namespace ServiceLib.ViewModels this.WhenAnyValue( x => x.SelectedGroup, - y => y != null && Utils.IsNotEmpty(y.name)) + y => y != null && Utils.IsNotEmpty(y.Name)) .Subscribe(c => RefreshProxyDetails(c)); this.WhenAnyValue( @@ -185,7 +185,7 @@ namespace ServiceLib.ViewModels public void RefreshProxyGroups() { - var selectedName = SelectedGroup?.name; + var selectedName = SelectedGroup?.Name; _proxyGroups.Clear(); var proxyGroups = ClashApiHandler.Instance.GetClashProxyGroups(); @@ -204,9 +204,9 @@ namespace ServiceLib.ViewModels } _proxyGroups.Add(new ClashProxyModel() { - now = item.now, - name = item.name, - type = item.type + Now = item.now, + Name = item.name, + Type = item.type }); } } @@ -218,24 +218,24 @@ namespace ServiceLib.ViewModels { continue; } - var item = _proxyGroups.Where(t => t.name == kv.Key).FirstOrDefault(); - if (item != null && Utils.IsNotEmpty(item.name)) + var item = _proxyGroups.Where(t => t.Name == kv.Key).FirstOrDefault(); + if (item != null && Utils.IsNotEmpty(item.Name)) { continue; } _proxyGroups.Add(new ClashProxyModel() { - now = kv.Value.now, - name = kv.Key, - type = kv.Value.type + Now = kv.Value.now, + Name = kv.Key, + Type = kv.Value.type }); } if (_proxyGroups != null && _proxyGroups.Count > 0) { - if (selectedName != null && _proxyGroups.Any(t => t.name == selectedName)) + if (selectedName != null && _proxyGroups.Any(t => t.Name == selectedName)) { - SelectedGroup = _proxyGroups.FirstOrDefault(t => t.name == selectedName); + SelectedGroup = _proxyGroups.FirstOrDefault(t => t.Name == selectedName); } else { @@ -255,7 +255,7 @@ namespace ServiceLib.ViewModels { return; } - var name = SelectedGroup?.name; + var name = SelectedGroup?.Name; if (Utils.IsNullOrEmpty(name)) { return; @@ -289,21 +289,21 @@ namespace ServiceLib.ViewModels lstDetails.Add(new ClashProxyModel() { IsActive = IsActive, - name = item, - type = proxy2.type, - delay = delay <= 0 ? _delayTimeout : delay, - delayName = delay <= 0 ? string.Empty : $"{delay}ms", + Name = item, + Type = proxy2.type, + Delay = delay <= 0 ? _delayTimeout : delay, + DelayName = delay <= 0 ? string.Empty : $"{delay}ms", }); } //sort switch (SortingSelected) { case 0: - lstDetails = lstDetails.OrderBy(t => t.delay).ToList(); + lstDetails = lstDetails.OrderBy(t => t.Delay).ToList(); break; case 1: - lstDetails = lstDetails.OrderBy(t => t.name).ToList(); + lstDetails = lstDetails.OrderBy(t => t.Name).ToList(); break; default: @@ -341,20 +341,20 @@ namespace ServiceLib.ViewModels public async Task SetActiveProxy() { - if (SelectedGroup == null || Utils.IsNullOrEmpty(SelectedGroup.name)) + if (SelectedGroup == null || Utils.IsNullOrEmpty(SelectedGroup.Name)) { return; } - if (SelectedDetail == null || Utils.IsNullOrEmpty(SelectedDetail.name)) + if (SelectedDetail == null || Utils.IsNullOrEmpty(SelectedDetail.Name)) { return; } - var name = SelectedGroup.name; + var name = SelectedGroup.Name; if (Utils.IsNullOrEmpty(name)) { return; } - var nameNode = SelectedDetail.name; + var nameNode = SelectedDetail.Name; if (Utils.IsNullOrEmpty(nameNode)) { return; @@ -369,10 +369,10 @@ namespace ServiceLib.ViewModels await ClashApiHandler.Instance.ClashSetActiveProxy(name, nameNode); selectedProxy.now = nameNode; - var group = _proxyGroups.Where(it => it.name == SelectedGroup.name).FirstOrDefault(); + var group = _proxyGroups.Where(it => it.Name == SelectedGroup.Name).FirstOrDefault(); if (group != null) { - group.now = nameNode; + group.Now = nameNode; var group2 = JsonUtils.DeepCopy(group); _proxyGroups.Replace(group, group2); @@ -397,31 +397,31 @@ namespace ServiceLib.ViewModels return; } - _updateView?.Invoke(EViewAction.DispatcherProxiesDelayTest, new SpeedTestResult() { IndexId = item.name, Delay = result }); + _updateView?.Invoke(EViewAction.DispatcherProxiesDelayTest, new SpeedTestResult() { IndexId = item.Name, Delay = result }); }); } public void ProxiesDelayTestResult(SpeedTestResult result) { //UpdateHandler(false, $"{item.name}={result}"); - var detail = _proxyDetails.Where(it => it.name == result.IndexId).FirstOrDefault(); + var detail = _proxyDetails.Where(it => it.Name == result.IndexId).FirstOrDefault(); if (detail != null) { var dicResult = JsonUtils.Deserialize>(result.Delay); if (dicResult != null && dicResult.ContainsKey("delay")) { - detail.delay = Convert.ToInt32(dicResult["delay"].ToString()); - detail.delayName = $"{detail.delay}ms"; + detail.Delay = Convert.ToInt32(dicResult["delay"].ToString()); + detail.DelayName = $"{detail.Delay}ms"; } else if (dicResult != null && dicResult.ContainsKey("message")) { - detail.delay = _delayTimeout; - detail.delayName = $"{dicResult["message"]}"; + detail.Delay = _delayTimeout; + detail.DelayName = $"{dicResult["message"]}"; } else { - detail.delay = _delayTimeout; - detail.delayName = string.Empty; + detail.Delay = _delayTimeout; + detail.DelayName = string.Empty; } _proxyDetails.Replace(detail, JsonUtils.DeepCopy(detail)); } diff --git a/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs b/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs index 4c8cfb8b..680aa04c 100644 --- a/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/MainWindowViewModel.cs @@ -265,7 +265,7 @@ namespace ServiceLib.ViewModels try { Locator.Current.GetService()?.UpdateStatistics(update); - if ((update.proxyUp + update.proxyDown) > 0 && DateTime.Now.Second % 3 == 0) + if ((update.ProxyUp + update.ProxyDown) > 0 && DateTime.Now.Second % 3 == 0) { Locator.Current.GetService()?.UpdateStatistics(update); } diff --git a/v2rayN/ServiceLib/ViewModels/RoutingRuleDetailsViewModel.cs b/v2rayN/ServiceLib/ViewModels/RoutingRuleDetailsViewModel.cs index da7fba0c..950b12e2 100644 --- a/v2rayN/ServiceLib/ViewModels/RoutingRuleDetailsViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/RoutingRuleDetailsViewModel.cs @@ -36,10 +36,10 @@ namespace ServiceLib.ViewModels await SaveRulesAsync(); }); - if (rulesItem.id.IsNullOrEmpty()) + if (rulesItem.Id.IsNullOrEmpty()) { - rulesItem.id = Utils.GetGuid(false); - rulesItem.outboundTag = Global.ProxyTag; + rulesItem.Id = Utils.GetGuid(false); + rulesItem.OutboundTag = Global.ProxyTag; rulesItem.Enabled = true; SelectedSource = rulesItem; } @@ -48,9 +48,9 @@ namespace ServiceLib.ViewModels SelectedSource = rulesItem; } - Domain = Utils.List2String(SelectedSource.domain, true); - IP = Utils.List2String(SelectedSource.ip, true); - Process = Utils.List2String(SelectedSource.process, true); + Domain = Utils.List2String(SelectedSource.Domain, true); + IP = Utils.List2String(SelectedSource.Ip, true); + Process = Utils.List2String(SelectedSource.Process, true); } private async Task SaveRulesAsync() @@ -61,24 +61,24 @@ namespace ServiceLib.ViewModels if (AutoSort) { - SelectedSource.domain = Utils.String2ListSorted(Domain); - SelectedSource.ip = Utils.String2ListSorted(IP); - SelectedSource.process = Utils.String2ListSorted(Process); + SelectedSource.Domain = Utils.String2ListSorted(Domain); + SelectedSource.Ip = Utils.String2ListSorted(IP); + SelectedSource.Process = Utils.String2ListSorted(Process); } else { - SelectedSource.domain = Utils.String2List(Domain); - SelectedSource.ip = Utils.String2List(IP); - SelectedSource.process = Utils.String2List(Process); + SelectedSource.Domain = Utils.String2List(Domain); + SelectedSource.Ip = Utils.String2List(IP); + SelectedSource.Process = Utils.String2List(Process); } - SelectedSource.protocol = ProtocolItems?.ToList(); - SelectedSource.inboundTag = InboundTagItems?.ToList(); + SelectedSource.Protocol = ProtocolItems?.ToList(); + SelectedSource.InboundTag = InboundTagItems?.ToList(); - bool hasRule = SelectedSource.domain?.Count > 0 - || SelectedSource.ip?.Count > 0 - || SelectedSource.protocol?.Count > 0 - || SelectedSource.process?.Count > 0 - || Utils.IsNotEmpty(SelectedSource.port); + bool hasRule = SelectedSource.Domain?.Count > 0 + || SelectedSource.Ip?.Count > 0 + || SelectedSource.Protocol?.Count > 0 + || SelectedSource.Process?.Count > 0 + || Utils.IsNotEmpty(SelectedSource.Port); if (!hasRule) { diff --git a/v2rayN/ServiceLib/ViewModels/RoutingRuleSettingViewModel.cs b/v2rayN/ServiceLib/ViewModels/RoutingRuleSettingViewModel.cs index 5a0c5ede..6e452d82 100644 --- a/v2rayN/ServiceLib/ViewModels/RoutingRuleSettingViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/RoutingRuleSettingViewModel.cs @@ -40,7 +40,7 @@ namespace ServiceLib.ViewModels var canEditRemove = this.WhenAnyValue( x => x.SelectedSource, - selectedSource => selectedSource != null && !selectedSource.outboundTag.IsNullOrEmpty()); + selectedSource => selectedSource != null && !selectedSource.OutboundTag.IsNullOrEmpty()); RuleAddCmd = ReactiveCommand.CreateFromTask(async () => { @@ -105,14 +105,14 @@ namespace ServiceLib.ViewModels { var it = new RulesItemModel() { - id = item.id, - outboundTag = item.outboundTag, - port = item.port, - network = item.network, - Protocols = Utils.List2String(item.protocol), - InboundTags = Utils.List2String(item.inboundTag), - Domains = Utils.List2String(item.domain), - Ips = Utils.List2String(item.ip), + Id = item.Id, + OutboundTag = item.OutboundTag, + Port = item.Port, + Network = item.Network, + Protocols = Utils.List2String(item.Protocol), + InboundTags = Utils.List2String(item.InboundTag), + Domains = Utils.List2String(item.Domain), + Ips = Utils.List2String(item.Ip), Enabled = item.Enabled, Remarks = item.Remarks, }; @@ -129,7 +129,7 @@ namespace ServiceLib.ViewModels } else { - item = _rules.FirstOrDefault(t => t.id == SelectedSource?.id); + item = _rules.FirstOrDefault(t => t.Id == SelectedSource?.Id); if (item is null) { return; @@ -147,7 +147,7 @@ namespace ServiceLib.ViewModels public async Task RuleRemoveAsync() { - if (SelectedSource is null || SelectedSource.outboundTag.IsNullOrEmpty()) + if (SelectedSource is null || SelectedSource.OutboundTag.IsNullOrEmpty()) { NoticeHandler.Instance.Enqueue(ResUI.PleaseSelectRules); return; @@ -158,7 +158,7 @@ namespace ServiceLib.ViewModels } foreach (var it in SelectedSources ?? [SelectedSource]) { - var item = _rules.FirstOrDefault(t => t.id == it?.id); + var item = _rules.FirstOrDefault(t => t.Id == it?.Id); if (item != null) { _rules.Remove(item); @@ -170,7 +170,7 @@ namespace ServiceLib.ViewModels public async Task RuleExportSelectedAsync() { - if (SelectedSource is null || SelectedSource.outboundTag.IsNullOrEmpty()) + if (SelectedSource is null || SelectedSource.OutboundTag.IsNullOrEmpty()) { NoticeHandler.Instance.Enqueue(ResUI.PleaseSelectRules); return; @@ -179,7 +179,7 @@ namespace ServiceLib.ViewModels var lst = new List(); foreach (var it in SelectedSources ?? [SelectedSource]) { - var item = _rules.FirstOrDefault(t => t.id == it?.id); + var item = _rules.FirstOrDefault(t => t.Id == it?.Id); if (item != null) { var item2 = JsonUtils.Deserialize(JsonUtils.Serialize(item)); @@ -194,13 +194,13 @@ namespace ServiceLib.ViewModels public async Task MoveRule(EMove eMove) { - if (SelectedSource is null || SelectedSource.outboundTag.IsNullOrEmpty()) + if (SelectedSource is null || SelectedSource.OutboundTag.IsNullOrEmpty()) { NoticeHandler.Instance.Enqueue(ResUI.PleaseSelectRules); return; } - var item = _rules.FirstOrDefault(t => t.id == SelectedSource?.id); + var item = _rules.FirstOrDefault(t => t.Id == SelectedSource?.Id); if (item == null) { return; @@ -223,7 +223,7 @@ namespace ServiceLib.ViewModels var item = SelectedRouting; foreach (var it in _rules) { - it.id = Utils.GetGuid(false); + it.Id = Utils.GetGuid(false); } item.RuleNum = _rules.Count; item.RuleSet = JsonUtils.Serialize(_rules, false); @@ -313,7 +313,7 @@ namespace ServiceLib.ViewModels } foreach (var rule in lstRules) { - rule.id = Utils.GetGuid(false); + rule.Id = Utils.GetGuid(false); } if (blReplace) diff --git a/v2rayN/ServiceLib/ViewModels/RoutingSettingViewModel.cs b/v2rayN/ServiceLib/ViewModels/RoutingSettingViewModel.cs index 2b8a413f..2a4ea23e 100644 --- a/v2rayN/ServiceLib/ViewModels/RoutingSettingViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/RoutingSettingViewModel.cs @@ -140,14 +140,14 @@ namespace ServiceLib.ViewModels if (_lockedItem != null) { _lockedRules = JsonUtils.Deserialize>(_lockedItem.RuleSet); - ProxyDomain = Utils.List2String(_lockedRules[0].domain, true); - ProxyIP = Utils.List2String(_lockedRules[0].ip, true); + ProxyDomain = Utils.List2String(_lockedRules[0].Domain, true); + ProxyIP = Utils.List2String(_lockedRules[0].Ip, true); - DirectDomain = Utils.List2String(_lockedRules[1].domain, true); - DirectIP = Utils.List2String(_lockedRules[1].ip, true); + DirectDomain = Utils.List2String(_lockedRules[1].Domain, true); + DirectIP = Utils.List2String(_lockedRules[1].Ip, true); - BlockDomain = Utils.List2String(_lockedRules[2].domain, true); - BlockIP = Utils.List2String(_lockedRules[2].ip, true); + BlockDomain = Utils.List2String(_lockedRules[2].Domain, true); + BlockIP = Utils.List2String(_lockedRules[2].Ip, true); } } @@ -155,14 +155,14 @@ namespace ServiceLib.ViewModels { if (_lockedItem != null) { - _lockedRules[0].domain = Utils.String2List(Utils.Convert2Comma(ProxyDomain.TrimEx())); - _lockedRules[0].ip = Utils.String2List(Utils.Convert2Comma(ProxyIP.TrimEx())); + _lockedRules[0].Domain = Utils.String2List(Utils.Convert2Comma(ProxyDomain.TrimEx())); + _lockedRules[0].Ip = Utils.String2List(Utils.Convert2Comma(ProxyIP.TrimEx())); - _lockedRules[1].domain = Utils.String2List(Utils.Convert2Comma(DirectDomain.TrimEx())); - _lockedRules[1].ip = Utils.String2List(Utils.Convert2Comma(DirectIP.TrimEx())); + _lockedRules[1].Domain = Utils.String2List(Utils.Convert2Comma(DirectDomain.TrimEx())); + _lockedRules[1].Ip = Utils.String2List(Utils.Convert2Comma(DirectIP.TrimEx())); - _lockedRules[2].domain = Utils.String2List(Utils.Convert2Comma(BlockDomain.TrimEx())); - _lockedRules[2].ip = Utils.String2List(Utils.Convert2Comma(BlockIP.TrimEx())); + _lockedRules[2].Domain = Utils.String2List(Utils.Convert2Comma(BlockDomain.TrimEx())); + _lockedRules[2].Ip = Utils.String2List(Utils.Convert2Comma(BlockIP.TrimEx())); _lockedItem.RuleSet = JsonUtils.Serialize(_lockedRules, false); diff --git a/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs b/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs index 577a7136..d15d563c 100644 --- a/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs @@ -460,8 +460,8 @@ namespace ServiceLib.ViewModels public void UpdateStatistics(ServerSpeedItem update) { - SpeedProxyDisplay = string.Format(ResUI.SpeedDisplayText, Global.ProxyTag, Utils.HumanFy(update.proxyUp), Utils.HumanFy(update.proxyDown)); - SpeedDirectDisplay = string.Format(ResUI.SpeedDisplayText, Global.DirectTag, Utils.HumanFy(update.directUp), Utils.HumanFy(update.directDown)); + SpeedProxyDisplay = string.Format(ResUI.SpeedDisplayText, Global.ProxyTag, Utils.HumanFy(update.ProxyUp), Utils.HumanFy(update.ProxyDown)); + SpeedDirectDisplay = string.Format(ResUI.SpeedDisplayText, Global.DirectTag, Utils.HumanFy(update.DirectUp), Utils.HumanFy(update.DirectDown)); } #endregion UI diff --git a/v2rayN/v2rayN.Desktop/Views/ClashConnectionsView.axaml b/v2rayN/v2rayN.Desktop/Views/ClashConnectionsView.axaml index 622e6a11..cbf48f38 100644 --- a/v2rayN/v2rayN.Desktop/Views/ClashConnectionsView.axaml +++ b/v2rayN/v2rayN.Desktop/Views/ClashConnectionsView.axaml @@ -86,31 +86,31 @@ diff --git a/v2rayN/v2rayN.Desktop/Views/ClashProxiesView.axaml b/v2rayN/v2rayN.Desktop/Views/ClashProxiesView.axaml index 0c3477c2..dd410dba 100644 --- a/v2rayN/v2rayN.Desktop/Views/ClashProxiesView.axaml +++ b/v2rayN/v2rayN.Desktop/Views/ClashProxiesView.axaml @@ -116,10 +116,10 @@ - - + + - + @@ -163,14 +163,14 @@ - + Foreground="{Binding Path=Delay, Converter={StaticResource DelayColorConverter}}" + Text="{Binding DelayName}" /> + diff --git a/v2rayN/v2rayN.Desktop/Views/RoutingRuleDetailsWindow.axaml.cs b/v2rayN/v2rayN.Desktop/Views/RoutingRuleDetailsWindow.axaml.cs index edf2926e..5d1aeb25 100644 --- a/v2rayN/v2rayN.Desktop/Views/RoutingRuleDetailsWindow.axaml.cs +++ b/v2rayN/v2rayN.Desktop/Views/RoutingRuleDetailsWindow.axaml.cs @@ -39,13 +39,13 @@ namespace v2rayN.Desktop.Views cmbNetwork.Items.Add(it); }); - if (!rulesItem.id.IsNullOrEmpty()) + if (!rulesItem.Id.IsNullOrEmpty()) { - rulesItem.protocol?.ForEach(it => + rulesItem.Protocol?.ForEach(it => { clbProtocol.SelectedItems.Add(it); }); - rulesItem.inboundTag?.ForEach(it => + rulesItem.InboundTag?.ForEach(it => { clbInboundTag.SelectedItems.Add(it); }); @@ -54,9 +54,9 @@ namespace v2rayN.Desktop.Views this.WhenActivated(disposables => { this.Bind(ViewModel, vm => vm.SelectedSource.Remarks, v => v.txtRemarks.Text).DisposeWith(disposables); - this.Bind(ViewModel, vm => vm.SelectedSource.outboundTag, v => v.cmbOutboundTag.SelectedValue).DisposeWith(disposables); - this.Bind(ViewModel, vm => vm.SelectedSource.port, v => v.txtPort.Text).DisposeWith(disposables); - this.Bind(ViewModel, vm => vm.SelectedSource.network, v => v.cmbNetwork.SelectedValue).DisposeWith(disposables); + this.Bind(ViewModel, vm => vm.SelectedSource.OutboundTag, v => v.cmbOutboundTag.SelectedValue).DisposeWith(disposables); + this.Bind(ViewModel, vm => vm.SelectedSource.Port, v => v.txtPort.Text).DisposeWith(disposables); + this.Bind(ViewModel, vm => vm.SelectedSource.Network, v => v.cmbNetwork.SelectedValue).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.SelectedSource.Enabled, v => v.togEnabled.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.Domain, v => v.txtDomain.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.IP, v => v.txtIP.Text).DisposeWith(disposables); diff --git a/v2rayN/v2rayN.Desktop/Views/RoutingRuleSettingWindow.axaml b/v2rayN/v2rayN.Desktop/Views/RoutingRuleSettingWindow.axaml index fc3e7703..52a2939b 100644 --- a/v2rayN/v2rayN.Desktop/Views/RoutingRuleSettingWindow.axaml +++ b/v2rayN/v2rayN.Desktop/Views/RoutingRuleSettingWindow.axaml @@ -218,11 +218,11 @@ Header="{x:Static resx:ResUI.LvRemarks}" /> diff --git a/v2rayN/v2rayN/Views/ClashProxiesView.xaml b/v2rayN/v2rayN/Views/ClashProxiesView.xaml index 0e333222..15e01e5e 100644 --- a/v2rayN/v2rayN/Views/ClashProxiesView.xaml +++ b/v2rayN/v2rayN/Views/ClashProxiesView.xaml @@ -1,14 +1,14 @@ - + Text="{Binding Type}" /> + + Text="{Binding Now}" /> @@ -170,15 +170,15 @@ - + Text="{Binding DelayName}" /> + diff --git a/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml.cs b/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml.cs index a8203c3a..b893d504 100644 --- a/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml.cs +++ b/v2rayN/v2rayN/Views/RoutingRuleDetailsWindow.xaml.cs @@ -32,13 +32,13 @@ namespace v2rayN.Views cmbNetwork.Items.Add(it); }); - if (!rulesItem.id.IsNullOrEmpty()) + if (!rulesItem.Id.IsNullOrEmpty()) { - rulesItem.protocol?.ForEach(it => + rulesItem.Protocol?.ForEach(it => { clbProtocol.SelectedItems.Add(it); }); - rulesItem.inboundTag?.ForEach(it => + rulesItem.InboundTag?.ForEach(it => { clbInboundTag.SelectedItems.Add(it); }); @@ -47,9 +47,9 @@ namespace v2rayN.Views this.WhenActivated(disposables => { this.Bind(ViewModel, vm => vm.SelectedSource.Remarks, v => v.txtRemarks.Text).DisposeWith(disposables); - this.Bind(ViewModel, vm => vm.SelectedSource.outboundTag, v => v.cmbOutboundTag.Text).DisposeWith(disposables); - this.Bind(ViewModel, vm => vm.SelectedSource.port, v => v.txtPort.Text).DisposeWith(disposables); - this.Bind(ViewModel, vm => vm.SelectedSource.network, v => v.cmbNetwork.Text).DisposeWith(disposables); + this.Bind(ViewModel, vm => vm.SelectedSource.OutboundTag, v => v.cmbOutboundTag.Text).DisposeWith(disposables); + this.Bind(ViewModel, vm => vm.SelectedSource.Port, v => v.txtPort.Text).DisposeWith(disposables); + this.Bind(ViewModel, vm => vm.SelectedSource.Network, v => v.cmbNetwork.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.SelectedSource.Enabled, v => v.togEnabled.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.Domain, v => v.txtDomain.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.IP, v => v.txtIP.Text).DisposeWith(disposables); diff --git a/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml b/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml index 57eb563e..d8399a9d 100644 --- a/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml +++ b/v2rayN/v2rayN/Views/RoutingRuleSettingWindow.xaml @@ -308,11 +308,11 @@ Header="{x:Static resx:ResUI.LvRemarks}" />