diff --git a/v2rayN/ServiceLib/Models/ConfigItems.cs b/v2rayN/ServiceLib/Models/ConfigItems.cs index 75943e2a..e7b8f079 100644 --- a/v2rayN/ServiceLib/Models/ConfigItems.cs +++ b/v2rayN/ServiceLib/Models/ConfigItems.cs @@ -222,7 +222,6 @@ public int ProxiesSorting { get; set; } public bool ProxiesAutoRefresh { get; set; } public int ProxiesAutoDelayTestInterval { get; set; } = 10; - public int ConnectionsSorting { get; set; } public bool ConnectionsAutoRefresh { get; set; } public int ConnectionsRefreshInterval { get; set; } = 2; } diff --git a/v2rayN/ServiceLib/ViewModels/ClashConnectionsViewModel.cs b/v2rayN/ServiceLib/ViewModels/ClashConnectionsViewModel.cs index e60ddbb9..f9b8cbda 100644 --- a/v2rayN/ServiceLib/ViewModels/ClashConnectionsViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/ClashConnectionsViewModel.cs @@ -21,9 +21,6 @@ namespace ServiceLib.ViewModels [Reactive] public string HostFilter { get; set; } - [Reactive] - public int SortingSelected { get; set; } - [Reactive] public bool AutoRefresh { get; set; } @@ -31,18 +28,12 @@ namespace ServiceLib.ViewModels { _config = AppHandler.Instance.Config; _updateView = updateView; - SortingSelected = _config.ClashUIItem.ConnectionsSorting; AutoRefresh = _config.ClashUIItem.ConnectionsAutoRefresh; var canEditRemove = this.WhenAnyValue( x => x.SelectedSource, selectedSource => selectedSource != null && Utils.IsNotEmpty(selectedSource.Id)); - this.WhenAnyValue( - x => x.SortingSelected, - y => y >= 0) - .Subscribe(async c => await DoSortingSelected(c)); - this.WhenAnyValue( x => x.AutoRefresh, y => y == true) @@ -84,20 +75,6 @@ namespace ServiceLib.ViewModels }); } - private async Task DoSortingSelected(bool c) - { - if (!c) - { - return; - } - if (SortingSelected != _config.ClashUIItem.ConnectionsSorting) - { - _config.ClashUIItem.ConnectionsSorting = SortingSelected; - } - - await GetClashConnections(); - } - private async Task GetClashConnections() { var ret = await ClashApiHandler.Instance.GetClashConnectionsAsync(_config); @@ -115,7 +92,7 @@ namespace ServiceLib.ViewModels var dtNow = DateTime.Now; var lstModel = new List(); - foreach (var item in connections ?? []) + foreach (var item in connections ?? new()) { var host = $"{(Utils.IsNullOrEmpty(item.metadata.host) ? item.metadata.destinationIP : item.metadata.host)}:{item.metadata.destinationPort}"; if (HostFilter.IsNotEmpty() && !host.Contains(HostFilter)) @@ -131,45 +108,14 @@ namespace ServiceLib.ViewModels 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; + item.chains?.Reverse(); + model.Chain = $"{item.rule} , {string.Join("->", item.chains ?? new())}"; lstModel.Add(model); } if (lstModel.Count <= 0) { return; } - //sort - switch (SortingSelected) - { - case 0: - lstModel = lstModel.OrderBy(t => t.Upload / t.Time).ToList(); - break; - - case 1: - lstModel = lstModel.OrderBy(t => t.Download / t.Time).ToList(); - break; - - case 2: - lstModel = lstModel.OrderBy(t => t.Upload).ToList(); - break; - - case 3: - lstModel = lstModel.OrderBy(t => t.Download).ToList(); - break; - - case 4: - lstModel = lstModel.OrderBy(t => t.Time).ToList(); - break; - - case 5: - lstModel = lstModel.OrderBy(t => t.Host).ToList(); - break; - } - _connectionItems.AddRange(lstModel); } diff --git a/v2rayN/v2rayN.Desktop/Views/ClashConnectionsView.axaml b/v2rayN/v2rayN.Desktop/Views/ClashConnectionsView.axaml index cbf48f38..dd1c94ac 100644 --- a/v2rayN/v2rayN.Desktop/Views/ClashConnectionsView.axaml +++ b/v2rayN/v2rayN.Desktop/Views/ClashConnectionsView.axaml @@ -25,22 +25,6 @@ VerticalContentAlignment="Center" Watermark="{x:Static resx:ResUI.ConnectionsHostFilterTitle}" /> - - - - - - - - - -