From 776d37b7aa2c65686b18d4fd3087247feb967a65 Mon Sep 17 00:00:00 2001 From: 2dust <31833384+2dust@users.noreply.github.com> Date: Mon, 23 Dec 2024 10:37:43 +0800 Subject: [PATCH] Optimize port display --- .../ViewModels/StatusBarViewModel.cs | 21 +++++++++---------- 1 file changed, 10 insertions(+), 11 deletions(-) diff --git a/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs b/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs index 2a5e13a9..a2b89a9d 100644 --- a/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs +++ b/v2rayN/ServiceLib/ViewModels/StatusBarViewModel.cs @@ -451,21 +451,20 @@ namespace ServiceLib.ViewModels public async Task InboundDisplayStatus() { StringBuilder sb = new(); - sb.Append($"[{EInboundProtocol.mixed}:{AppHandler.Instance.GetLocalPort(EInboundProtocol.socks)}]"); + sb.Append($"[{EInboundProtocol.mixed}:{AppHandler.Instance.GetLocalPort(EInboundProtocol.socks)}"); + if (_config.Inbound.First().SecondLocalPortEnabled) + { + sb.Append($",{AppHandler.Instance.GetLocalPort(EInboundProtocol.socks2)}"); + } + sb.Append(']'); InboundDisplay = $"{ResUI.LabLocal}:{sb}"; if (_config.Inbound.First().AllowLANConn) { - if (_config.Inbound.First().NewPort4LAN) - { - StringBuilder sb2 = new(); - sb2.Append($"[{EInboundProtocol.mixed}:{AppHandler.Instance.GetLocalPort(EInboundProtocol.socks3)}]"); - InboundLanDisplay = $"{ResUI.LabLAN}:{sb2}"; - } - else - { - InboundLanDisplay = $"{ResUI.LabLAN}:{sb}"; - } + var lan = _config.Inbound.First().NewPort4LAN + ? $"[{EInboundProtocol.mixed}:{AppHandler.Instance.GetLocalPort(EInboundProtocol.socks3)}]" + : $"[{EInboundProtocol.mixed}:{AppHandler.Instance.GetLocalPort(EInboundProtocol.socks)}]"; + InboundLanDisplay = $"{ResUI.LabLAN}:{lan}"; } else {