Compare commits

...

11 Commits
6.37 ... 6.38

Author SHA1 Message Date
2dust
9427340ab7 Update 6.38 2024-03-08 09:55:13 +08:00
2dust
63af5bae8a Bug fix 2024-03-08 09:41:38 +08:00
2dust
9232f1fa40 Merge pull request #4802 from Array-Cats/master
Update README.md
2024-03-08 09:40:28 +08:00
Array-Cats
15bdb551f4 Update README.md 2024-03-07 23:56:58 +08:00
2dust
2cda2b53ed Improve 2024-03-07 11:51:45 +08:00
2dust
028c9ea0b5 Bug fix 2024-03-07 09:06:35 +08:00
2dust
315b51e7ca Up PackageReference 2024-03-05 09:45:27 +08:00
2dust
0185b3b145 Remove some pop-up messages 2024-03-04 10:41:42 +08:00
2dust
afaad49879 Bug fix 2024-03-02 10:35:33 +08:00
2dust
4b2b45979b Return api port=socks port +11 2024-03-02 10:00:28 +08:00
2dust
66e40edd0e Bug fix singbox transport type http 2024-03-02 09:58:50 +08:00
24 changed files with 126 additions and 139 deletions

View File

@@ -14,7 +14,8 @@ A GUI client for Windows, support [Xray core](https://github.com/XTLS/Xray-core)
- Run v2rayN.exe - Run v2rayN.exe
## Requirements ## Requirements
- [Microsoft .NET 6.0 Desktop Runtime ](https://download.visualstudio.microsoft.com/download/pr/513d13b7-b456-45af-828b-b7b7981ff462/edf44a743b78f8b54a2cec97ce888346/windowsdesktop-runtime-6.0.15-win-x64.exe) - (6.35 and above)[Microsoft .NET 8.0 Desktop Runtime ](https://dotnet.microsoft.com/en-us/download/dotnet/8.0)
- (6.33 and below)[Microsoft .NET 6.0 Desktop Runtime ](https://dotnet.microsoft.com/en-us/download/dotnet/6.0)
- [Supported cores](https://github.com/2dust/v2rayN/wiki/List-of-supported-cores) - [Supported cores](https://github.com/2dust/v2rayN/wiki/List-of-supported-cores)

View File

@@ -9,9 +9,9 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Google.Protobuf" Version="3.25.2" /> <PackageReference Include="Google.Protobuf" Version="3.25.3" />
<PackageReference Include="Grpc.Net.Client" Version="2.60.0" /> <PackageReference Include="Grpc.Net.Client" Version="2.61.0" />
<PackageReference Include="Grpc.Tools" Version="2.61.0"> <PackageReference Include="Grpc.Tools" Version="2.62.0">
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>

View File

@@ -54,7 +54,7 @@ namespace v2rayN
{ {
if (ConfigHandler.LoadConfig(ref _config) != 0) if (ConfigHandler.LoadConfig(ref _config) != 0)
{ {
UI.ShowWarning($"Loading GUI configuration file is abnormal,please restart the application{Environment.NewLine}加载GUI配置文件异常,请重启应用"); UI.Show($"Loading GUI configuration file is abnormal,please restart the application{Environment.NewLine}加载GUI配置文件异常,请重启应用");
Application.Current.Shutdown(); Application.Current.Shutdown();
Environment.Exit(0); Environment.Exit(0);
return; return;

View File

@@ -12,11 +12,6 @@ namespace v2rayN
MessageBox.Show(msg, caption, MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK); MessageBox.Show(msg, caption, MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK);
} }
public static void ShowWarning(string msg)
{
MessageBox.Show(msg, caption, MessageBoxButton.OK, MessageBoxImage.Warning, MessageBoxResult.OK);
}
public static MessageBoxResult ShowYesNo(string msg) public static MessageBoxResult ShowYesNo(string msg)
{ {
return MessageBox.Show(msg, caption, MessageBoxButton.YesNo, MessageBoxImage.Question); return MessageBox.Show(msg, caption, MessageBoxButton.YesNo, MessageBoxImage.Question);

View File

@@ -368,7 +368,7 @@ namespace v2rayN
try try
{ {
Uri uri = new(url); Uri uri = new(url);
if (uri.Host == uri.IdnHost) if (uri.Host == uri.IdnHost || uri.Host == $"[{uri.IdnHost}]")
{ {
return url; return url;
} }
@@ -579,11 +579,10 @@ namespace v2rayN
return inUse; return inUse;
} }
public static int GetFreePort() public static int GetFreePort(int defaultPort = 9090)
{ {
try try
{ {
int defaultPort = 9090;
if (!Utile.PortInUse(defaultPort)) if (!Utile.PortInUse(defaultPort))
{ {
return defaultPort; return defaultPort;
@@ -598,7 +597,7 @@ namespace v2rayN
catch catch
{ {
} }
return 69090; return 59090;
} }
#endregion #endregion

View File

@@ -1186,7 +1186,7 @@ namespace v2rayN.Handler
ProfileItem profileItem = new(); ProfileItem profileItem = new();
//Is v2ray configuration //Is v2ray configuration
V2rayConfig? v2rayConfig = JsonUtile.Deserialize<V2rayConfig>(clipboardData); var v2rayConfig = JsonUtile.Deserialize<V2rayConfig>(clipboardData);
if (v2rayConfig?.inbounds?.Count > 0 if (v2rayConfig?.inbounds?.Count > 0
&& v2rayConfig.outbounds?.Count > 0) && v2rayConfig.outbounds?.Count > 0)
{ {

View File

@@ -238,14 +238,6 @@ namespace v2rayN.Handler
outbound.method = LazyConfig.Instance.GetShadowsocksSecurities(node).Contains(node.security) ? node.security : Global.None; outbound.method = LazyConfig.Instance.GetShadowsocksSecurities(node).Contains(node.security) ? node.security : Global.None;
outbound.password = node.id; outbound.password = node.id;
if (node.network == Global.DefaultNetwork
&& node.headerType == Global.TcpHeaderHttp
&& node.requestHost.IsNullOrEmpty() == false)
{
outbound.plugin = "obfs-local";
outbound.plugin_opts = $"obfs=http;obfs-host={node.requestHost};";
}
GenOutboundMux(node, outbound); GenOutboundMux(node, outbound);
} }
else if (node.configType == EConfigType.Socks) else if (node.configType == EConfigType.Socks)
@@ -419,6 +411,28 @@ namespace v2rayN.Handler
transport.path = Utile.IsNullOrEmpty(node.path) ? null : node.path; transport.path = Utile.IsNullOrEmpty(node.path) ? null : node.path;
break; break;
case "tcp": //http
if (node.headerType == Global.TcpHeaderHttp)
{
if (node.configType == EConfigType.Shadowsocks)
{
outbound.plugin = "obfs-local";
outbound.plugin_opts = $"obfs=http;obfs-host={node.requestHost};";
}
else
{
transport.type = "http";
transport.host = Utile.IsNullOrEmpty(node.requestHost) ? null : Utile.String2List(node.requestHost);
transport.path = Utile.IsNullOrEmpty(node.path) ? null : node.path;
}
}
else
{
transport = null;
}
break;
case "ws": case "ws":
transport.type = "ws"; transport.type = "ws";
transport.path = Utile.IsNullOrEmpty(node.path) ? null : node.path; transport.path = Utile.IsNullOrEmpty(node.path) ? null : node.path;

View File

@@ -195,7 +195,7 @@ namespace v2rayN.Handler
var coreInfo = LazyConfig.Instance.GetCoreInfo(coreType); var coreInfo = LazyConfig.Instance.GetCoreInfo(coreType);
var displayLog = node.configType != EConfigType.Custom || node.displayLog; var displayLog = node.configType != EConfigType.Custom || node.displayLog;
var proc = RunProcess(node, coreInfo, "", displayLog, ShowMsg); var proc = RunProcess(node, coreInfo, "", displayLog);
if (proc is null) if (proc is null)
{ {
return; return;
@@ -218,7 +218,7 @@ namespace v2rayN.Handler
if (CoreConfigHandler.GenerateClientConfig(itemSocks, fileName2, out string msg2, out string configStr) == 0) if (CoreConfigHandler.GenerateClientConfig(itemSocks, fileName2, out string msg2, out string configStr) == 0)
{ {
var coreInfo2 = LazyConfig.Instance.GetCoreInfo(ECoreType.sing_box); var coreInfo2 = LazyConfig.Instance.GetCoreInfo(ECoreType.sing_box);
var proc2 = RunProcess(node, coreInfo2, $" -c {Global.CorePreConfigFileName}", true, ShowMsg); var proc2 = RunProcess(node, coreInfo2, $" -c {Global.CorePreConfigFileName}", true);
if (proc2 is not null) if (proc2 is not null)
{ {
_processPre = proc2; _processPre = proc2;
@@ -236,7 +236,7 @@ namespace v2rayN.Handler
try try
{ {
var coreInfo = LazyConfig.Instance.GetCoreInfo(coreType); var coreInfo = LazyConfig.Instance.GetCoreInfo(coreType);
var proc = RunProcess(new(), coreInfo, $" -c {Global.CoreSpeedtestConfigFileName}", true, ShowMsg); var proc = RunProcess(new(), coreInfo, $" -c {Global.CoreSpeedtestConfigFileName}", true);
if (proc is null) if (proc is null)
{ {
return -1; return -1;
@@ -253,16 +253,16 @@ namespace v2rayN.Handler
} }
} }
private void ShowMsg(bool updateToTrayTooltip, string msg) private void ShowMsg(bool notify, string msg)
{ {
_updateFunc(updateToTrayTooltip, msg); _updateFunc(notify, msg);
} }
#endregion Private #endregion Private
#region Process #region Process
private Process? RunProcess(ProfileItem node, CoreInfo coreInfo, string configPath, bool displayLog, Action<bool, string> update) private Process? RunProcess(ProfileItem node, CoreInfo coreInfo, string configPath, bool displayLog)
{ {
try try
{ {
@@ -295,7 +295,7 @@ namespace v2rayN.Handler
if (!string.IsNullOrEmpty(e.Data)) if (!string.IsNullOrEmpty(e.Data))
{ {
string msg = e.Data + Environment.NewLine; string msg = e.Data + Environment.NewLine;
update(false, msg); ShowMsg(false, msg);
} }
}; };
proc.ErrorDataReceived += (sender, e) => proc.ErrorDataReceived += (sender, e) =>
@@ -303,7 +303,7 @@ namespace v2rayN.Handler
if (!string.IsNullOrEmpty(e.Data)) if (!string.IsNullOrEmpty(e.Data))
{ {
string msg = e.Data + Environment.NewLine; string msg = e.Data + Environment.NewLine;
update(false, msg); ShowMsg(false, msg);
if (!startUpSuccessful) if (!startUpSuccessful)
{ {
@@ -336,7 +336,7 @@ namespace v2rayN.Handler
{ {
Logging.SaveLog(ex.Message, ex); Logging.SaveLog(ex.Message, ex);
string msg = ex.Message; string msg = ex.Message;
update(true, msg); ShowMsg(true, msg);
return null; return null;
} }
} }
@@ -349,7 +349,7 @@ namespace v2rayN.Handler
} }
try try
{ {
proc.CloseMainWindow(); proc.Kill();
proc.WaitForExit(100); proc.WaitForExit(100);
if (!proc.HasExited) if (!proc.HasExited)
{ {

View File

@@ -19,7 +19,7 @@ namespace v2rayN.Handler
{ {
if (_statePort is null) if (_statePort is null)
{ {
_statePort = Utile.GetFreePort(); _statePort = Utile.GetFreePort(GetLocalPort(Global.InboundAPITagName));
} }
return _statePort.Value; return _statePort.Value;
@@ -52,32 +52,18 @@ namespace v2rayN.Handler
public int GetLocalPort(string protocol) public int GetLocalPort(string protocol)
{ {
int localPort = _config.inbound.FirstOrDefault(t => t.protocol == Global.InboundSocks).localPort; var localPort = _config.inbound.FirstOrDefault(t => t.protocol == Global.InboundSocks)?.localPort ?? 10808;
if (protocol == Global.InboundSocks) return protocol.ToLower() switch
{ {
return localPort; Global.InboundSocks => localPort,
} Global.InboundHttp => localPort + 1,
else if (protocol == Global.InboundHttp) Global.InboundSocks2 => localPort + 2,
{ Global.InboundHttp2 => localPort + 3,
return localPort + 1; "pac" => localPort + 4,
} Global.InboundAPITagName => localPort + 11,
else if (protocol == Global.InboundSocks2) "speedtest" => localPort + 21,
{ _ => localPort,
return localPort + 2; };
}
else if (protocol == Global.InboundHttp2)
{
return localPort + 3;
}
else if (protocol == ESysProxyType.Pac.ToString())
{
return localPort + 4;
}
else if (protocol == "speedtest")
{
return localPort + 103;
}
return localPort;
} }
public void AddProcess(IntPtr processHandle) public void AddProcess(IntPtr processHandle)

View File

@@ -1,4 +1,5 @@
using Microsoft.Win32; using Microsoft.Win32;
using Splat;
using System.Drawing; using System.Drawing;
using System.IO; using System.IO;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
@@ -125,7 +126,7 @@ namespace v2rayN.Handler
} }
if (item.configType == EConfigType.Custom) if (item.configType == EConfigType.Custom)
{ {
UI.Show(ResUI.NonVmessService); Locator.Current.GetService<NoticeHandler>()?.Enqueue(ResUI.NonVmessService);
return; return;
} }
@@ -146,11 +147,12 @@ namespace v2rayN.Handler
} }
if (CoreConfigHandler.GenerateClientConfig(item, fileName, out string msg, out string content) != 0) if (CoreConfigHandler.GenerateClientConfig(item, fileName, out string msg, out string content) != 0)
{ {
UI.Show(msg); Locator.Current.GetService<NoticeHandler>()?.Enqueue(msg);
} }
else else
{ {
UI.ShowWarning(string.Format(ResUI.SaveClientConfigurationIn, fileName)); msg = string.Format(ResUI.SaveClientConfigurationIn, fileName);
Locator.Current.GetService<NoticeHandler>()?.SendMessageAndEnqueue(msg);
} }
} }

View File

@@ -10,12 +10,14 @@ namespace v2rayN.Handler
public NoticeHandler(ISnackbarMessageQueue snackbarMessageQueue) public NoticeHandler(ISnackbarMessageQueue snackbarMessageQueue)
{ {
_snackbarMessageQueue = snackbarMessageQueue ?? throw new ArgumentNullException(nameof(snackbarMessageQueue)); _snackbarMessageQueue = snackbarMessageQueue ?? throw new ArgumentNullException(nameof(snackbarMessageQueue));
//_snackbarMessageQueue = snackbarMessageQueue;
} }
public void Enqueue(object content) public void Enqueue(string content)
{ {
if (content.IsNullOrEmpty())
{
return;
}
_snackbarMessageQueue?.Enqueue(content); _snackbarMessageQueue?.Enqueue(content);
} }
@@ -27,7 +29,13 @@ namespace v2rayN.Handler
public void SendMessage(string msg, bool time) public void SendMessage(string msg, bool time)
{ {
msg = $"{DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")} {msg}"; msg = $"{DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")} {msg}";
MessageBus.Current.SendMessage(msg, Global.CommandSendMsgView); SendMessage(msg);
}
public void SendMessageAndEnqueue(string msg)
{
Enqueue(msg);
SendMessage(msg);
} }
} }
} }

View File

@@ -132,28 +132,6 @@ namespace v2rayN.Handler
_serverStatItem.todayDown = 0; _serverStatItem.todayDown = 0;
_serverStatItem.dateNow = ticks; _serverStatItem.dateNow = ticks;
} }
} }
private int GetFreePort()
{
try
{
int defaultPort = 9090;
if (!Utile.PortInUse(defaultPort))
{
return defaultPort;
}
TcpListener l = new(IPAddress.Loopback, 0);
l.Start();
int port = ((IPEndPoint)l.LocalEndpoint).Port;
l.Stop();
return port;
}
catch
{
}
return 69090;
}
} }
} }

View File

@@ -15,7 +15,7 @@
public bool? disabled { get; set; } public bool? disabled { get; set; }
public string level { get; set; } public string level { get; set; }
public string output { get; set; } public string output { get; set; }
public bool timestamp { get; set; } public bool? timestamp { get; set; }
} }
public class Dns4Sbox public class Dns4Sbox
@@ -120,10 +120,10 @@
public int? mtu { get; set; } public int? mtu { get; set; }
public string? plugin { get; set; } public string? plugin { get; set; }
public string? plugin_opts { get; set; } public string? plugin_opts { get; set; }
public Tls4Sbox tls { get; set; } public Tls4Sbox? tls { get; set; }
public Multiplex4Sbox multiplex { get; set; } public Multiplex4Sbox? multiplex { get; set; }
public Transport4Sbox transport { get; set; } public Transport4Sbox? transport { get; set; }
public HyObfs4Sbox obfs { get; set; } public HyObfs4Sbox? obfs { get; set; }
} }
public class Tls4Sbox public class Tls4Sbox

View File

@@ -64,13 +64,13 @@ namespace v2rayN.ViewModels
string remarks = SelectedSource.remarks; string remarks = SelectedSource.remarks;
if (Utile.IsNullOrEmpty(remarks)) if (Utile.IsNullOrEmpty(remarks))
{ {
UI.Show(ResUI.PleaseFillRemarks); _noticeHandler?.Enqueue(ResUI.PleaseFillRemarks);
return; return;
} }
if (Utile.IsNullOrEmpty(SelectedSource.address)) if (Utile.IsNullOrEmpty(SelectedSource.address))
{ {
UI.Show(ResUI.FillServerAddressCustom); _noticeHandler?.Enqueue(ResUI.FillServerAddressCustom);
return; return;
} }
@@ -95,13 +95,13 @@ namespace v2rayN.ViewModels
} }
else else
{ {
UI.Show(ResUI.OperationFailed); _noticeHandler?.Enqueue(ResUI.OperationFailed);
} }
} }
private void BrowseServer() private void BrowseServer()
{ {
//UI.Show(ResUI.CustomServerTips); //_noticeHandler?.Enqueue(ResUI.CustomServerTips);
if (UI.OpenFileDialog(out string fileName, if (UI.OpenFileDialog(out string fileName,
"Config|*.json|YAML|*.yaml;*.yml|All|*.*") != true) "Config|*.json|YAML|*.yaml;*.yml|All|*.*") != true)
@@ -127,7 +127,7 @@ namespace v2rayN.ViewModels
} }
else else
{ {
UI.ShowWarning(ResUI.FailedImportedCustomServer); _noticeHandler?.Enqueue(ResUI.FailedImportedCustomServer);
} }
} }
@@ -136,7 +136,7 @@ namespace v2rayN.ViewModels
var address = SelectedSource.address; var address = SelectedSource.address;
if (Utile.IsNullOrEmpty(address)) if (Utile.IsNullOrEmpty(address))
{ {
UI.Show(ResUI.FillServerAddressCustom); _noticeHandler?.Enqueue(ResUI.FillServerAddressCustom);
return; return;
} }

View File

@@ -51,32 +51,32 @@ namespace v2rayN.ViewModels
{ {
if (Utile.IsNullOrEmpty(SelectedSource.remarks)) if (Utile.IsNullOrEmpty(SelectedSource.remarks))
{ {
UI.Show(ResUI.PleaseFillRemarks); _noticeHandler?.Enqueue(ResUI.PleaseFillRemarks);
return; return;
} }
if (Utile.IsNullOrEmpty(SelectedSource.address)) if (Utile.IsNullOrEmpty(SelectedSource.address))
{ {
UI.Show(ResUI.FillServerAddress); _noticeHandler?.Enqueue(ResUI.FillServerAddress);
return; return;
} }
var port = SelectedSource.port.ToString(); var port = SelectedSource.port.ToString();
if (Utile.IsNullOrEmpty(port) || !Utile.IsNumeric(port) if (Utile.IsNullOrEmpty(port) || !Utile.IsNumeric(port)
|| SelectedSource.port <= 0 || SelectedSource.port >= Global.MaxPort) || SelectedSource.port <= 0 || SelectedSource.port >= Global.MaxPort)
{ {
UI.Show(ResUI.FillCorrectServerPort); _noticeHandler?.Enqueue(ResUI.FillCorrectServerPort);
return; return;
} }
if (SelectedSource.configType == EConfigType.Shadowsocks) if (SelectedSource.configType == EConfigType.Shadowsocks)
{ {
if (Utile.IsNullOrEmpty(SelectedSource.id)) if (Utile.IsNullOrEmpty(SelectedSource.id))
{ {
UI.Show(ResUI.FillPassword); _noticeHandler?.Enqueue(ResUI.FillPassword);
return; return;
} }
if (Utile.IsNullOrEmpty(SelectedSource.security)) if (Utile.IsNullOrEmpty(SelectedSource.security))
{ {
UI.Show(ResUI.PleaseSelectEncryption); _noticeHandler?.Enqueue(ResUI.PleaseSelectEncryption);
return; return;
} }
} }
@@ -84,7 +84,7 @@ namespace v2rayN.ViewModels
{ {
if (Utile.IsNullOrEmpty(SelectedSource.id)) if (Utile.IsNullOrEmpty(SelectedSource.id))
{ {
UI.Show(ResUI.FillUUID); _noticeHandler?.Enqueue(ResUI.FillUUID);
return; return;
} }
} }
@@ -143,7 +143,7 @@ namespace v2rayN.ViewModels
} }
else else
{ {
UI.Show(ResUI.OperationFailed); _noticeHandler?.Enqueue(ResUI.OperationFailed);
} }
} }
} }

View File

@@ -71,7 +71,7 @@ namespace v2rayN.ViewModels
{ {
if (normalDNS.Contains("{") || normalDNS.Contains("}")) if (normalDNS.Contains("{") || normalDNS.Contains("}"))
{ {
UI.Show(ResUI.FillCorrectDNSText); _noticeHandler?.Enqueue(ResUI.FillCorrectDNSText);
return; return;
} }
} }
@@ -81,7 +81,7 @@ namespace v2rayN.ViewModels
var obj2 = JsonUtile.Deserialize<Dns4Sbox>(normalDNS2); var obj2 = JsonUtile.Deserialize<Dns4Sbox>(normalDNS2);
if (obj2 == null) if (obj2 == null)
{ {
UI.Show(ResUI.FillCorrectDNSText); _noticeHandler?.Enqueue(ResUI.FillCorrectDNSText);
return; return;
} }
} }
@@ -90,7 +90,7 @@ namespace v2rayN.ViewModels
var obj2 = JsonUtile.Deserialize<Dns4Sbox>(tunDNS2); var obj2 = JsonUtile.Deserialize<Dns4Sbox>(tunDNS2);
if (obj2 == null) if (obj2 == null)
{ {
UI.Show(ResUI.FillCorrectDNSText); _noticeHandler?.Enqueue(ResUI.FillCorrectDNSText);
return; return;
} }
} }

View File

@@ -610,6 +610,10 @@ namespace v2rayN.ViewModels
private void UpdateHandler(bool notify, string msg) private void UpdateHandler(bool notify, string msg)
{ {
_noticeHandler?.SendMessage(msg); _noticeHandler?.SendMessage(msg);
if (notify)
{
_noticeHandler?.Enqueue(msg);
}
} }
private void UpdateTaskHandler(bool success, string msg) private void UpdateTaskHandler(bool success, string msg)
@@ -1434,11 +1438,11 @@ namespace v2rayN.ViewModels
InitSubscriptionView(); InitSubscriptionView();
RefreshServers(); RefreshServers();
Reload(); Reload();
UI.Show(ResUI.OperationSuccess); _noticeHandler?.Enqueue(ResUI.OperationSuccess);
} }
else else
{ {
_noticeHandler.Enqueue(ResUI.OperationFailed); _noticeHandler?.Enqueue(ResUI.OperationFailed);
} }
} }
@@ -1466,7 +1470,7 @@ namespace v2rayN.ViewModels
_noticeHandler?.SendMessage(msg); _noticeHandler?.SendMessage(msg);
if (success) if (success)
{ {
CloseV2ray(); CloseCore();
string fileName = Utile.GetTempPath(Utile.GetDownloadFileName(msg)); string fileName = Utile.GetTempPath(Utile.GetDownloadFileName(msg));
string toPath = Utile.GetBinPath("", type.ToString()); string toPath = Utile.GetBinPath("", type.ToString());
@@ -1495,13 +1499,13 @@ namespace v2rayN.ViewModels
#endregion CheckUpdate #endregion CheckUpdate
#region v2ray job #region core job
public void Reload() public void Reload()
{ {
BlReloadEnabled = false; BlReloadEnabled = false;
LoadV2ray().ContinueWith(task => LoadCore().ContinueWith(task =>
{ {
TestServerAvailability(); TestServerAvailability();
@@ -1512,7 +1516,7 @@ namespace v2rayN.ViewModels
}); });
} }
private async Task LoadV2ray() private async Task LoadCore()
{ {
await Task.Run(() => await Task.Run(() =>
{ {
@@ -1524,7 +1528,7 @@ namespace v2rayN.ViewModels
}); });
} }
private void CloseV2ray() private void CloseCore()
{ {
ConfigHandler.SaveConfig(_config, false); ConfigHandler.SaveConfig(_config, false);
@@ -1533,7 +1537,7 @@ namespace v2rayN.ViewModels
_coreHandler.CoreStop(); _coreHandler.CoreStop();
} }
#endregion v2ray job #endregion core job
#region System proxy and Routings #region System proxy and Routings

View File

@@ -252,7 +252,7 @@ namespace v2rayN.ViewModels
if (Utile.IsNullOrEmpty(localPort.ToString()) || !Utile.IsNumeric(localPort.ToString()) if (Utile.IsNullOrEmpty(localPort.ToString()) || !Utile.IsNumeric(localPort.ToString())
|| localPort <= 0 || localPort >= Global.MaxPort) || localPort <= 0 || localPort >= Global.MaxPort)
{ {
UI.Show(ResUI.FillLocalListeningPort); _noticeHandler?.Enqueue(ResUI.FillLocalListeningPort);
return; return;
} }
@@ -263,7 +263,7 @@ namespace v2rayN.ViewModels
// || Utile.IsNullOrEmpty(KcpreadBufferSize.ToString()) || !Utile.IsNumeric(KcpreadBufferSize.ToString()) // || Utile.IsNullOrEmpty(KcpreadBufferSize.ToString()) || !Utile.IsNumeric(KcpreadBufferSize.ToString())
// || Utile.IsNullOrEmpty(KcpwriteBufferSize.ToString()) || !Utile.IsNumeric(KcpwriteBufferSize.ToString())) // || Utile.IsNullOrEmpty(KcpwriteBufferSize.ToString()) || !Utile.IsNumeric(KcpwriteBufferSize.ToString()))
//{ //{
// UI.Show(ResUI.FillKcpParameters); // _noticeHandler?.Enqueue(ResUI.FillKcpParameters);
// return; // return;
//} //}
@@ -342,7 +342,7 @@ namespace v2rayN.ViewModels
} }
else else
{ {
UI.ShowWarning(ResUI.OperationFailed); _noticeHandler?.Enqueue(ResUI.OperationFailed);
} }
} }

View File

@@ -94,7 +94,7 @@ namespace v2rayN.ViewModels
if (!hasRule) if (!hasRule)
{ {
UI.ShowWarning(string.Format(ResUI.RoutingRuleDetailRequiredTips, "Port/Protocol/Domain/IP/Process")); _noticeHandler?.Enqueue(string.Format(ResUI.RoutingRuleDetailRequiredTips, "Port/Protocol/Domain/IP/Process"));
return; return;
} }
//_noticeHandler?.Enqueue(ResUI.OperationSuccess); //_noticeHandler?.Enqueue(ResUI.OperationSuccess);

View File

@@ -169,7 +169,7 @@ namespace v2rayN.ViewModels
{ {
if (SelectedSource is null || SelectedSource.outboundTag.IsNullOrEmpty()) if (SelectedSource is null || SelectedSource.outboundTag.IsNullOrEmpty())
{ {
UI.Show(ResUI.PleaseSelectRules); _noticeHandler?.Enqueue(ResUI.PleaseSelectRules);
return; return;
} }
if (UI.ShowYesNo(ResUI.RemoveRules) == MessageBoxResult.No) if (UI.ShowYesNo(ResUI.RemoveRules) == MessageBoxResult.No)
@@ -192,7 +192,7 @@ namespace v2rayN.ViewModels
{ {
if (SelectedSource is null || SelectedSource.outboundTag.IsNullOrEmpty()) if (SelectedSource is null || SelectedSource.outboundTag.IsNullOrEmpty())
{ {
UI.Show(ResUI.PleaseSelectRules); _noticeHandler?.Enqueue(ResUI.PleaseSelectRules);
return; return;
} }
@@ -208,7 +208,7 @@ namespace v2rayN.ViewModels
if (lst.Count > 0) if (lst.Count > 0)
{ {
Utile.SetClipboardData(JsonUtile.Serialize(lst)); Utile.SetClipboardData(JsonUtile.Serialize(lst));
//UI.Show(ResUI.OperationSuccess")); //_noticeHandler?.Enqueue(ResUI.OperationSuccess"));
} }
} }
@@ -216,7 +216,7 @@ namespace v2rayN.ViewModels
{ {
if (SelectedSource is null || SelectedSource.outboundTag.IsNullOrEmpty()) if (SelectedSource is null || SelectedSource.outboundTag.IsNullOrEmpty())
{ {
UI.Show(ResUI.PleaseSelectRules); _noticeHandler?.Enqueue(ResUI.PleaseSelectRules);
return; return;
} }
@@ -237,7 +237,7 @@ namespace v2rayN.ViewModels
string remarks = SelectedRouting.remarks; string remarks = SelectedRouting.remarks;
if (Utile.IsNullOrEmpty(remarks)) if (Utile.IsNullOrEmpty(remarks))
{ {
UI.Show(ResUI.PleaseFillRemarks); _noticeHandler?.Enqueue(ResUI.PleaseFillRemarks);
return; return;
} }
var item = SelectedRouting; var item = SelectedRouting;
@@ -255,7 +255,7 @@ namespace v2rayN.ViewModels
} }
else else
{ {
UI.ShowWarning(ResUI.OperationFailed); _noticeHandler?.Enqueue(ResUI.OperationFailed);
} }
} }
@@ -282,7 +282,7 @@ namespace v2rayN.ViewModels
if (AddBatchRoutingRules(SelectedRouting, result) == 0) if (AddBatchRoutingRules(SelectedRouting, result) == 0)
{ {
RefreshRulesItems(); RefreshRulesItems();
UI.Show(ResUI.OperationSuccess); _noticeHandler?.Enqueue(ResUI.OperationSuccess);
} }
} }
@@ -292,7 +292,7 @@ namespace v2rayN.ViewModels
if (AddBatchRoutingRules(SelectedRouting, clipboardData) == 0) if (AddBatchRoutingRules(SelectedRouting, clipboardData) == 0)
{ {
RefreshRulesItems(); RefreshRulesItems();
UI.Show(ResUI.OperationSuccess); _noticeHandler?.Enqueue(ResUI.OperationSuccess);
} }
} }
@@ -301,7 +301,7 @@ namespace v2rayN.ViewModels
var url = SelectedRouting.url; var url = SelectedRouting.url;
if (Utile.IsNullOrEmpty(url)) if (Utile.IsNullOrEmpty(url))
{ {
UI.Show(ResUI.MsgNeedUrl); _noticeHandler?.Enqueue(ResUI.MsgNeedUrl);
return; return;
} }
@@ -313,7 +313,7 @@ namespace v2rayN.ViewModels
{ {
RefreshRulesItems(); RefreshRulesItems();
})); }));
UI.Show(ResUI.OperationSuccess); _noticeHandler?.Enqueue(ResUI.OperationSuccess);
} }
} }

View File

@@ -214,7 +214,7 @@ namespace v2rayN.ViewModels
} }
else else
{ {
UI.ShowWarning(ResUI.OperationFailed); _noticeHandler?.Enqueue(ResUI.OperationFailed);
} }
} }
@@ -229,7 +229,7 @@ namespace v2rayN.ViewModels
BlockDomain = "geosite:category-ads-all"; BlockDomain = "geosite:category-ads-all";
//_noticeHandler?.Enqueue(ResUI.OperationSuccess); //_noticeHandler?.Enqueue(ResUI.OperationSuccess);
UI.Show(ResUI.OperationSuccess); _noticeHandler?.Enqueue(ResUI.OperationSuccess);
} }
public void RoutingAdvancedEdit(bool blNew) public void RoutingAdvancedEdit(bool blNew)
@@ -259,7 +259,7 @@ namespace v2rayN.ViewModels
{ {
if (SelectedSource is null || SelectedSource.remarks.IsNullOrEmpty()) if (SelectedSource is null || SelectedSource.remarks.IsNullOrEmpty())
{ {
UI.Show(ResUI.PleaseSelectRules); _noticeHandler?.Enqueue(ResUI.PleaseSelectRules);
return; return;
} }
if (UI.ShowYesNo(ResUI.RemoveRules) == MessageBoxResult.No) if (UI.ShowYesNo(ResUI.RemoveRules) == MessageBoxResult.No)
@@ -284,7 +284,7 @@ namespace v2rayN.ViewModels
var item = LazyConfig.Instance.GetRoutingItem(SelectedSource?.id); var item = LazyConfig.Instance.GetRoutingItem(SelectedSource?.id);
if (item is null) if (item is null)
{ {
UI.Show(ResUI.PleaseSelectRules); _noticeHandler?.Enqueue(ResUI.PleaseSelectRules);
return; return;
} }

View File

@@ -48,7 +48,7 @@ namespace v2rayN.ViewModels
string remarks = SelectedSource.remarks; string remarks = SelectedSource.remarks;
if (string.IsNullOrEmpty(remarks)) if (string.IsNullOrEmpty(remarks))
{ {
UI.Show(ResUI.PleaseFillRemarks); _noticeHandler?.Enqueue(ResUI.PleaseFillRemarks);
return; return;
} }

View File

@@ -119,7 +119,7 @@ namespace v2rayN.Views
} }
else else
{ {
UI.ShowWarning(ResUI.OperationFailed); UI.Show(ResUI.OperationFailed);
} }
} }

View File

@@ -10,7 +10,7 @@
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<ApplicationIcon>v2rayN.ico</ApplicationIcon> <ApplicationIcon>v2rayN.ico</ApplicationIcon>
<Copyright>Copyright © 2017-2024 (GPLv3)</Copyright> <Copyright>Copyright © 2017-2024 (GPLv3)</Copyright>
<FileVersion>6.37</FileVersion> <FileVersion>6.38</FileVersion>
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion> <SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
</PropertyGroup> </PropertyGroup>