Compare commits

..

33 Commits
7.5.0 ... 7.5.3

Author SHA1 Message Date
2dust
01039d0b47 up 7.5.3 2025-01-05 17:31:32 +08:00
2dust
7c1e5a3cba Fixed possible crash issues 2025-01-05 17:12:51 +08:00
2dust
038161527f Buf fix for CurrentFontSize 2025-01-05 17:11:32 +08:00
2dust
b12b7a17e6 Fix possible issues with load balancing 2025-01-05 16:31:32 +08:00
2dust
37cf23d5fe up PackageReference 2025-01-05 15:01:15 +08:00
2dust
ed7fb4f6e3 Code clean 2025-01-05 14:50:31 +08:00
2dust
5d4bd2fee6 Fix possible issues with load balancing
https://github.com/2dust/v2rayN/issues/6429
2025-01-05 14:49:53 +08:00
2dust
aae5906311 Fix GetListNetworkServices 2025-01-05 12:24:14 +08:00
2dust
4a7bafd011 Fix Linux restore backup function
Fixed the issue that the guiNConfig.json file cannot be restored in the backup and restore function
2025-01-05 10:22:18 +08:00
2dust
626ebfe65d Improved ModifyFontSize 2025-01-04 20:42:42 +08:00
2dust
3cc75cd46d up 7.5.2 2025-01-04 19:07:16 +08:00
2dust
f809ee7b20 Adjust the macos package icon
https://github.com/2dust/v2rayN/issues/6404
2025-01-04 19:06:26 +08:00
2dust
1295d8191c Fix DNS
https://github.com/2dust/v2rayN/issues/6416
2025-01-04 17:47:54 +08:00
2dust
bc2adbfa77 Add restart to Linux restore backup function 2025-01-04 17:03:12 +08:00
2dust
9583dff176 Added the function of restarting the main app to AmazTool 2025-01-04 17:01:57 +08:00
2dust
5732b84a7b Refactor KillProcess 2025-01-04 15:06:30 +08:00
2dust
c0d27504ac Refactor ProcessStart RebootAsAdmin 2025-01-03 20:56:51 +08:00
2dust
3db1dd7bbb Add a title to SaveLog 2025-01-03 15:02:31 +08:00
2dust
5392766c5e Improved KillProcess 2025-01-03 15:01:30 +08:00
2dust
730b7dea37 Adjust upgrade waiting time 2025-01-03 09:50:21 +08:00
2dust
02a13ce028 Add logging to KillProcess
https://github.com/2dust/v2rayN/issues/6386
2025-01-02 13:54:17 +08:00
2dust
7884853098 Improved backup and restore
Overwrite the configuration file directly in the main program
2025-01-02 13:36:26 +08:00
2dust
e122ea8146 Optimize VerticalAlignment="Center" 2025-01-02 12:20:43 +08:00
2dust
f500d2b9f4 up 7.5.1 2025-01-01 16:25:53 +08:00
2dust
79e53bf1f5 Improve macos system proxy code 2025-01-01 14:24:23 +08:00
2dust
31de7ec094 Bug fix SetLinuxChmod 2025-01-01 12:27:49 +08:00
2dust
2e4501187c Window title display adjustment
https://github.com/2dust/v2rayN/issues/6389
2025-01-01 10:38:55 +08:00
2dust
4430c9bd74 Remove the last rule from the Whitelist
https://github.com/2dust/v2rayN/issues/6378
2024-12-31 20:37:14 +08:00
2dust
cf8be85ff7 Remove the display of run as an administrator in Linux and macos 2024-12-31 16:30:27 +08:00
2dust
0759be1223 Fix rule required
https://github.com/2dust/v2rayN/issues/6378
2024-12-31 15:32:31 +08:00
2dust
21f8ddcf9f macos adds system proxy for USB
https://github.com/2dust/v2rayN/issues/6381
2024-12-31 14:55:35 +08:00
2dust
37cba5ee34 Fix export rule order issue
https://github.com/2dust/v2rayN/issues/6377
2024-12-31 14:15:09 +08:00
OnceUponATimeInAmerica
ff642fd1ac Add full support for (one-click) Iran regional preset by using Chocolate4U's github repos for iran routing rules (#6384) 2024-12-31 13:51:06 +08:00
85 changed files with 669 additions and 478 deletions

View File

@@ -73,4 +73,5 @@ jobs:
with:
file: ${{ github.workspace }}/v2rayN*.zip
tag: ${{ github.event.inputs.release_tag }}
file_glob: true
file_glob: true
prerelease: true

View File

@@ -74,4 +74,5 @@ jobs:
with:
file: ${{ github.workspace }}/v2rayN*.zip
tag: ${{ github.event.inputs.release_tag }}
file_glob: true
file_glob: true
prerelease: true

View File

@@ -64,4 +64,5 @@ jobs:
with:
file: ${{ github.workspace }}/v2rayN*.zip
tag: ${{ github.event.inputs.release_tag }}
file_glob: true
file_glob: true
prerelease: true

View File

@@ -11,16 +11,16 @@ echo "When this file exists, app will not store configs under this folder" > "$P
chmod +x "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN"
mkdir -p "$PackagePath/icons.iconset"
sips -z 16 16 "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN.png" --out "$PackagePath/icons.iconset/icon_16x16.png"
sips -z 32 32 "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN.png" --out "$PackagePath/icons.iconset/icon_16x16@2x.png"
sips -z 32 32 "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN.png" --out "$PackagePath/icons.iconset/icon_32x32.png"
sips -z 64 64 "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN.png" --out "$PackagePath/icons.iconset/icon_32x32@2x.png"
sips -z 128 128 "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN.png" --out "$PackagePath/icons.iconset/icon_128x128.png"
sips -z 256 256 "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN.png" --out "$PackagePath/icons.iconset/icon_128x128@2x.png"
sips -z 256 256 "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN.png" --out "$PackagePath/icons.iconset/icon_256x256.png"
sips -z 512 512 "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN.png" --out "$PackagePath/icons.iconset/icon_256x256@2x.png"
sips -z 512 512 "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN.png" --out "$PackagePath/icons.iconset/icon_512x512.png"
sips -z 1024 1024 "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN.png" --out "$PackagePath/icons.iconset/icon_512x512@2x.png"
sips -z 16 16 "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN2.png" --out "$PackagePath/icons.iconset/icon_16x16.png"
sips -z 32 32 "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN2.png" --out "$PackagePath/icons.iconset/icon_16x16@2x.png"
sips -z 32 32 "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN2.png" --out "$PackagePath/icons.iconset/icon_32x32.png"
sips -z 64 64 "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN2.png" --out "$PackagePath/icons.iconset/icon_32x32@2x.png"
sips -z 128 128 "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN2.png" --out "$PackagePath/icons.iconset/icon_128x128.png"
sips -z 256 256 "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN2.png" --out "$PackagePath/icons.iconset/icon_128x128@2x.png"
sips -z 256 256 "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN2.png" --out "$PackagePath/icons.iconset/icon_256x256.png"
sips -z 512 512 "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN2.png" --out "$PackagePath/icons.iconset/icon_256x256@2x.png"
sips -z 512 512 "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN2.png" --out "$PackagePath/icons.iconset/icon_512x512.png"
sips -z 1024 1024 "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN2.png" --out "$PackagePath/icons.iconset/icon_512x512@2x.png"
iconutil -c icns "$PackagePath/icons.iconset" -o "$PackagePath/v2rayN.app/Contents/Resources/AppIcon.icns"
cat >"$PackagePath/v2rayN.app/Contents/Info.plist" <<-EOF

View File

@@ -15,8 +15,15 @@
return;
}
var fileName = Uri.UnescapeDataString(string.Join(" ", args));
UpgradeApp.Upgrade(fileName);
var argData = Uri.UnescapeDataString(string.Join(" ", args));
if (argData.Equals("rebootas"))
{
Thread.Sleep(1000);
Utils.StartV2RayN();
return;
}
UpgradeApp.Upgrade(argData);
}
}
}

View File

@@ -10,7 +10,7 @@ namespace AmazTool
{
Console.WriteLine($"{Resx.Resource.StartUnzipping}\n{fileName}");
Waiting(8);
Waiting(3);
if (!File.Exists(fileName))
{
@@ -21,11 +21,11 @@ namespace AmazTool
Console.WriteLine(Resx.Resource.TryTerminateProcess);
try
{
var existing = Process.GetProcessesByName(V2rayN);
var existing = Process.GetProcessesByName(Utils.V2rayN);
foreach (var pp in existing)
{
var path = pp.MainModule?.FileName ?? "";
if (path.StartsWith(GetPath(V2rayN)))
if (path.StartsWith(Utils.GetPath(Utils.V2rayN)))
{
pp?.Kill();
pp?.WaitForExit(1000);
@@ -42,7 +42,7 @@ namespace AmazTool
StringBuilder sb = new();
try
{
string thisAppOldFile = $"{GetExePath()}.tmp";
string thisAppOldFile = $"{Utils.GetExePath()}.tmp";
File.Delete(thisAppOldFile);
string splitKey = "/";
@@ -62,12 +62,12 @@ namespace AmazTool
if (lst.Length == 1) continue;
string fullName = string.Join(splitKey, lst[1..lst.Length]);
if (string.Equals(GetExePath(), GetPath(fullName), StringComparison.OrdinalIgnoreCase))
if (string.Equals(Utils.GetExePath(), Utils.GetPath(fullName), StringComparison.OrdinalIgnoreCase))
{
File.Move(GetExePath(), thisAppOldFile);
File.Move(Utils.GetExePath(), thisAppOldFile);
}
string entryOutputPath = GetPath(fullName);
string entryOutputPath = Utils.GetPath(fullName);
Directory.CreateDirectory(Path.GetDirectoryName(entryOutputPath)!);
entry.ExtractToFile(entryOutputPath, true);
@@ -91,40 +91,12 @@ namespace AmazTool
}
Console.WriteLine(Resx.Resource.Restartv2rayN);
Waiting(3);
Process process = new()
{
StartInfo = new()
{
UseShellExecute = true,
FileName = V2rayN,
WorkingDirectory = StartupPath()
}
};
process.Start();
Waiting(2);
Utils.StartV2RayN();
}
private static string GetExePath()
{
return Environment.ProcessPath ?? Process.GetCurrentProcess().MainModule?.FileName ?? string.Empty;
}
private static string StartupPath()
{
return AppDomain.CurrentDomain.BaseDirectory;
}
private static string GetPath(string fileName)
{
string startupPath = StartupPath();
if (string.IsNullOrEmpty(fileName))
{
return startupPath;
}
return Path.Combine(startupPath, fileName);
}
private static void Waiting(int second)
public static void Waiting(int second)
{
for (var i = second; i > 0; i--)
{
@@ -132,7 +104,5 @@ namespace AmazTool
Thread.Sleep(1000);
}
}
private static string V2rayN => "v2rayN";
}
}

43
v2rayN/AmazTool/Utils.cs Normal file
View File

@@ -0,0 +1,43 @@
using System.Diagnostics;
namespace AmazTool
{
internal class Utils
{
public static string GetExePath()
{
return Environment.ProcessPath ?? Process.GetCurrentProcess().MainModule?.FileName ?? string.Empty;
}
public static string StartupPath()
{
return AppDomain.CurrentDomain.BaseDirectory;
}
public static string GetPath(string fileName)
{
string startupPath = StartupPath();
if (string.IsNullOrEmpty(fileName))
{
return startupPath;
}
return Path.Combine(startupPath, fileName);
}
public static string V2rayN => "v2rayN";
public static void StartV2RayN()
{
Process process = new()
{
StartInfo = new()
{
UseShellExecute = true,
FileName = V2rayN,
WorkingDirectory = StartupPath()
}
};
process.Start();
}
}
}

View File

@@ -6,6 +6,8 @@ namespace ServiceLib.Common
{
public static class FileManager
{
private static readonly string _tag = "FileManager";
public static bool ByteArrayToFile(string fileName, byte[] content)
{
try
@@ -15,7 +17,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
return false;
}
@@ -30,7 +32,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
}
@@ -46,7 +48,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
}
@@ -60,7 +62,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
}
@@ -79,7 +81,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
throw;
}
}
@@ -105,13 +107,13 @@ namespace ServiceLib.Common
}
catch (IOException ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
}
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
return false;
}
return true;
@@ -130,7 +132,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
return null;
}
}
@@ -148,7 +150,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
return false;
}
return true;

View File

@@ -6,6 +6,8 @@ namespace ServiceLib.Common
{
public class JsonUtils
{
private static readonly string _tag = "JsonUtils";
/// <summary>
/// DeepCopy
/// </summary>
@@ -90,7 +92,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
return result;
}

View File

@@ -0,0 +1,118 @@
using System.Diagnostics;
namespace ServiceLib.Common;
public static class ProcUtils
{
private static readonly string _tag = "ProcUtils";
public static void ProcessStart(string? fileName, string arguments = "")
{
ProcessStart(fileName, arguments, null);
}
public static int? ProcessStart(string? fileName, string arguments, string? dir)
{
if (fileName.IsNullOrEmpty())
{
return null;
}
try
{
if (fileName.Contains(' ')) fileName = fileName.AppendQuotes();
if (arguments.Contains(' ')) arguments = arguments.AppendQuotes();
Process process = new()
{
StartInfo = new ProcessStartInfo
{
UseShellExecute = true,
FileName = fileName,
Arguments = arguments,
WorkingDirectory = dir
}
};
process.Start();
return process.Id;
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
}
return null;
}
public static void RebootAsAdmin(bool blAdmin = true)
{
try
{
ProcessStartInfo startInfo = new()
{
UseShellExecute = true,
Arguments = Global.RebootAs,
WorkingDirectory = Utils.StartupPath(),
FileName = Utils.GetExePath().AppendQuotes(),
Verb = blAdmin ? "runas" : null,
};
Process.Start(startInfo);
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
}
}
public static async Task ProcessKill(int pid)
{
try
{
await ProcessKill(Process.GetProcessById(pid), false);
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
}
}
public static async Task ProcessKill(Process? proc, bool review)
{
if (proc is null)
{
return;
}
var procId = review ? proc?.Id : null;
var fileName = review ? proc?.MainModule?.FileName : null;
var processName = review ? proc?.ProcessName : null;
try { proc?.Kill(true); } catch (Exception ex) { Logging.SaveLog(_tag, ex); }
try { proc?.Kill(); } catch (Exception ex) { Logging.SaveLog(_tag, ex); }
try { proc?.Close(); } catch (Exception ex) { Logging.SaveLog(_tag, ex); }
try { proc?.Dispose(); } catch (Exception ex) { Logging.SaveLog(_tag, ex); }
await Task.Delay(300);
if (review && procId != null && fileName != null)
{
try
{
var lstProc = Process.GetProcessesByName(processName);
foreach (var proc2 in lstProc)
{
if (proc2.Id == procId)
{
Logging.SaveLog($"{_tag}, KillProcess not completing the job, procId");
await ProcessKill(proc2, false);
}
if (proc2.MainModule != null && proc2.MainModule?.FileName == fileName)
{
Logging.SaveLog($"{_tag}, KillProcess not completing the job, fileName");
}
}
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
}
}
}
}

View File

@@ -73,5 +73,19 @@ namespace ServiceLib.Common
{
return _dbAsync.Table<T>();
}
public async Task DisposeDbConnectionAsync()
{
await Task.Factory.StartNew(() =>
{
_db?.Close();
_db?.Dispose();
_db = null;
_dbAsync?.GetConnection()?.Close();
_dbAsync?.GetConnection()?.Dispose();
_dbAsync = null;
});
}
}
}

View File

@@ -15,6 +15,8 @@ namespace ServiceLib.Common
{
public class Utils
{
private static readonly string _tag = "Utils";
#region
/// <summary>
@@ -36,7 +38,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
return result;
@@ -57,7 +59,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
return null;
@@ -92,7 +94,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
return string.Empty;
@@ -117,7 +119,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
return null;
@@ -139,7 +141,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
return null;
@@ -159,7 +161,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog("Base64Encode", ex);
Logging.SaveLog(_tag, ex);
}
return string.Empty;
@@ -193,7 +195,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog("Base64Decode", ex);
Logging.SaveLog(_tag, ex);
}
return string.Empty;
@@ -483,7 +485,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
return false;
@@ -515,10 +517,10 @@ namespace ServiceLib.Common
#region
public static bool UpgradeAppExists(out string fileName)
public static bool UpgradeAppExists(out string upgradeFileName)
{
fileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, GetExeName("AmazTool"));
return File.Exists(fileName);
upgradeFileName = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, GetExeName("AmazTool"));
return File.Exists(upgradeFileName);
}
/// <summary>
@@ -530,12 +532,12 @@ namespace ServiceLib.Common
try
{
return blFull
? $"{Global.AppName} - V{GetVersionInfo()} - {RuntimeInformation.ProcessArchitecture} - {StartupPath()}"
? $"{Global.AppName} - V{GetVersionInfo()} - {RuntimeInformation.ProcessArchitecture}"
: $"{Global.AppName}/{GetVersionInfo()}";
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
return Global.AppName;
@@ -549,11 +551,16 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
return "0.0";
}
}
public static string GetRuntimeInfo()
{
return $"{Utils.GetVersion()} | {Utils.StartupPath()} | {Utils.GetExePath()} | {Environment.OSVersion} | {(Environment.Is64BitOperatingSystem ? 64 : 32)}";
}
/// <summary>
/// 取得GUID
/// </summary>
@@ -573,7 +580,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
return string.Empty;
@@ -584,26 +591,6 @@ namespace ServiceLib.Common
return Guid.TryParse(strSrc, out _);
}
public static void ProcessStart(string? fileName, string arguments = "")
{
try
{
if (fileName.IsNullOrEmpty())
{
return;
}
if (fileName.Contains(' ')) fileName = fileName.AppendQuotes();
if (arguments.Contains(' ')) arguments = arguments.AppendQuotes();
Process.Start(new ProcessStartInfo(fileName, arguments) { UseShellExecute = true });
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
}
}
public static Dictionary<string, string> GetSystemHosts()
{
var systemHosts = new Dictionary<string, string>();
@@ -626,7 +613,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
return systemHosts;
@@ -860,18 +847,19 @@ namespace ServiceLib.Common
{
return new WindowsPrincipal(WindowsIdentity.GetCurrent()).IsInRole(WindowsBuiltInRole.Administrator);
}
else
{
var id = GetLinuxUserId().Result ?? "1000";
if (int.TryParse(id, out var userId))
{
return userId == 0;
}
else
{
return false;
}
}
return false;
//else
//{
// var id = GetLinuxUserId().Result ?? "1000";
// if (int.TryParse(id, out var userId))
// {
// return userId == 0;
// }
// else
// {
// return false;
// }
//}
}
private static async Task<string?> GetLinuxUserId()
@@ -883,6 +871,7 @@ namespace ServiceLib.Common
public static async Task<string?> SetLinuxChmod(string? fileName)
{
if (fileName.IsNullOrEmpty()) return null;
if (fileName.Contains(' ')) fileName = fileName.AppendQuotes();
//File.SetUnixFileMode(fileName, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute);
var arg = new List<string>() { "-c", $"chmod +x {fileName}" };
return await GetCliWrapOutput("/bin/bash", arg);
@@ -902,6 +891,12 @@ namespace ServiceLib.Common
: Environment.GetEnvironmentVariable("HOME");
}
public static async Task<string?> GetListNetworkServices()
{
var arg = new List<string>() { "-c", $"networksetup -listallnetworkservices" };
return await GetCliWrapOutput("/bin/bash", arg);
}
#endregion Platform
}
}

View File

@@ -4,6 +4,8 @@ namespace ServiceLib.Common
{
internal static class WindowsUtils
{
private static readonly string _tag = "WindowsUtils";
public static string? RegReadValue(string path, string name, string def)
{
RegistryKey? regKey = null;
@@ -15,7 +17,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
finally
{
@@ -41,7 +43,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
finally
{

View File

@@ -6,6 +6,8 @@ namespace ServiceLib.Common
{
public class YamlUtils
{
private static readonly string _tag = "YamlUtils";
#region YAML
/// <summary>
@@ -26,7 +28,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog("FromYaml", ex);
Logging.SaveLog(_tag, ex);
return deserializer.Deserialize<T>("");
}
}
@@ -53,7 +55,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
return result;
}
@@ -71,7 +73,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog("PreprocessYaml", ex);
Logging.SaveLog(_tag, ex);
return null;
}
}

View File

@@ -4,5 +4,6 @@
{
Default = 0,
Russia = 1,
Iran = 2,
}
}

View File

@@ -124,21 +124,25 @@
public static readonly List<string> GeoFilesSources = new() {
"",
@"https://github.com/runetfreedom/russia-v2ray-rules-dat/releases/latest/download/{0}.dat",
@"https://cdn.jsdelivr.net/gh/chocolate4u/Iran-v2ray-rules@release/{0}.dat",
};
public static readonly List<string> SingboxRulesetSources = new() {
"",
@"https://cdn.jsdelivr.net/gh/runetfreedom/russia-v2ray-rules-dat@release/sing-box/rule-set-{0}/{1}.srs",
@"https://cdn.jsdelivr.net/gh/chocolate4u/Iran-sing-box-rules@rule-set/{1}.srs",
};
public static readonly List<string> RoutingRulesSources = new() {
"",
@"https://cdn.jsdelivr.net/gh/runetfreedom/russia-v2ray-custom-routing-list@main/v2rayN/template.json",
@"https://cdn.jsdelivr.net/gh/Chocolate4U/Iran-v2ray-rules@main/v2rayN/template.json",
};
public static readonly List<string> DNSTemplateSources = new() {
"",
@"https://cdn.jsdelivr.net/gh/runetfreedom/russia-v2ray-custom-routing-list@main/v2rayN/",
@"https://cdn.jsdelivr.net/gh/Chocolate4U/Iran-v2ray-rules@main/v2rayN/",
};
public static readonly Dictionary<string, string> UserAgentTexts = new()

View File

@@ -77,8 +77,7 @@
public bool InitComponents()
{
Logging.SaveLog($"v2rayN start up | {Utils.GetVersion()} | {Utils.GetExePath()}");
Logging.SaveLog($"{Environment.OSVersion} - {(Environment.Is64BitOperatingSystem ? 64 : 32)}");
Logging.SaveLog($"v2rayN start up | {Utils.GetRuntimeInfo()}");
Logging.LoggingEnabled(_config.GuiItem.EnableLog);
Logging.ClearLogs();

View File

@@ -5,6 +5,8 @@ namespace ServiceLib.Handler
{
public static class AutoStartupHandler
{
private static readonly string _tag = "AutoStartupHandler";
public static async Task<bool> UpdateTask(Config config)
{
if (Utils.IsWindows())
@@ -62,7 +64,7 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
}
@@ -123,7 +125,7 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
}
@@ -143,7 +145,7 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
}

View File

@@ -9,6 +9,7 @@ namespace ServiceLib.Handler
private Dictionary<string, ProxiesItem>? _proxies;
public Dictionary<string, object> ProfileContent { get; set; }
private static readonly string _tag = "ClashApiHandler";
public async Task<Tuple<ClashProxies, ClashProviders>?> GetClashProxiesAsync(Config config)
{
@@ -109,7 +110,7 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
Logging.SaveLog("GetClashProxyGroups", ex);
Logging.SaveLog(_tag, ex);
return null;
}
}
@@ -125,7 +126,7 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
}
@@ -153,7 +154,7 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
}
@@ -169,7 +170,7 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
return null;
@@ -184,7 +185,7 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
}

View File

@@ -9,6 +9,7 @@ namespace ServiceLib.Handler
public class ConfigHandler
{
private static readonly string _configRes = Global.ConfigFileName;
private static readonly string _tag = "ConfigHandler";
#region ConfigHandler
@@ -68,7 +69,7 @@ namespace ServiceLib.Handler
config.RoutingBasicItem ??= new();
if (Utils.IsNullOrEmpty(config.RoutingBasicItem.DomainStrategy))
{
config.RoutingBasicItem.DomainStrategy = Global.DomainStrategies.First();//"IPIfNonMatch";
config.RoutingBasicItem.DomainStrategy = Global.DomainStrategies.First();
}
config.KcpItem ??= new KcpItem
@@ -194,7 +195,7 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
Logging.SaveLog("ToJsonFile", ex);
Logging.SaveLog(_tag, ex);
return -1;
}
@@ -500,7 +501,7 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
return -1;
}
@@ -987,7 +988,7 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
Logging.SaveLog("Remove Item", ex);
Logging.SaveLog(_tag, ex);
}
return 0;
@@ -1868,6 +1869,16 @@ namespace ServiceLib.Handler
await SaveDNSItems(config, await GetExternalDNSItem(ECoreType.Xray, Global.DNSTemplateSources[1] + "v2ray.json"));
await SaveDNSItems(config, await GetExternalDNSItem(ECoreType.sing_box, Global.DNSTemplateSources[1] + "sing_box.json"));
return true;
case EPresetType.Iran:
config.ConstItem.GeoSourceUrl = Global.GeoFilesSources[2];
config.ConstItem.SrsSourceUrl = Global.SingboxRulesetSources[2];
config.ConstItem.RouteRulesTemplateSourceUrl = Global.RoutingRulesSources[2];
await SaveDNSItems(config, await GetExternalDNSItem(ECoreType.Xray, Global.DNSTemplateSources[2] + "v2ray.json"));
await SaveDNSItems(config, await GetExternalDNSItem(ECoreType.sing_box, Global.DNSTemplateSources[2] + "sing_box.json"));
return true;
}

View File

@@ -5,6 +5,8 @@
/// </summary>
public class CoreConfigHandler
{
private static readonly string _tag = "CoreConfigHandler";
public static async Task<RetResult> GenerateClientConfig(ProfileItem node, string? fileName)
{
var config = AppHandler.Instance.Config;
@@ -82,7 +84,7 @@
}
catch (Exception ex)
{
Logging.SaveLog("GenerateClientCustomConfig", ex);
Logging.SaveLog(_tag, ex);
ret.Msg = ResUI.FailedGenDefaultConfiguration;
return ret;
}

View File

@@ -15,6 +15,7 @@ namespace ServiceLib.Handler
private Process? _processPre;
private int _linuxSudoPid = -1;
private Action<bool, string>? _updateFunc;
private const string _tag = "CoreHandler";
public async Task Init(Config config, Action<bool, string> updateFunc)
{
@@ -31,9 +32,9 @@ namespace ServiceLib.Handler
{
if (it.CoreType == ECoreType.v2rayN)
{
if (Utils.UpgradeAppExists(out var fileName))
if (Utils.UpgradeAppExists(out var upgradeFileName))
{
await Utils.SetLinuxChmod(fileName);
await Utils.SetLinuxChmod(upgradeFileName);
}
continue;
}
@@ -54,7 +55,7 @@ namespace ServiceLib.Handler
{
if (node == null)
{
ShowMsg(false, ResUI.CheckServerSettings);
UpdateFunc(false, ResUI.CheckServerSettings);
return;
}
@@ -62,13 +63,13 @@ namespace ServiceLib.Handler
var result = await CoreConfigHandler.GenerateClientConfig(node, fileName);
if (result.Success != true)
{
ShowMsg(true, result.Msg);
UpdateFunc(true, result.Msg);
return;
}
ShowMsg(true, $"{node.GetSummary()}");
ShowMsg(false, $"{Environment.OSVersion} - {(Environment.Is64BitOperatingSystem ? 64 : 32)}");
ShowMsg(false, string.Format(ResUI.StartService, DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")));
UpdateFunc(true, $"{node.GetSummary()}");
UpdateFunc(false, $"{Utils.GetRuntimeInfo()}");
UpdateFunc(false, string.Format(ResUI.StartService, DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")));
await CoreStop();
await Task.Delay(100);
await CoreStart(node);
@@ -80,15 +81,23 @@ namespace ServiceLib.Handler
var coreType = selecteds.Exists(t => t.ConfigType is EConfigType.Hysteria2 or EConfigType.TUIC or EConfigType.WireGuard) ? ECoreType.sing_box : ECoreType.Xray;
var configPath = Utils.GetConfigPath(Global.CoreSpeedtestConfigFileName);
var result = await CoreConfigHandler.GenerateClientSpeedtestConfig(_config, configPath, selecteds, coreType);
ShowMsg(false, result.Msg);
UpdateFunc(false, result.Msg);
if (result.Success != true)
{
return -1;
}
ShowMsg(false, string.Format(ResUI.StartService, DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")));
ShowMsg(false, configPath);
return await CoreStartSpeedtest(configPath, coreType);
UpdateFunc(false, string.Format(ResUI.StartService, DateTime.Now.ToString("yyyy/MM/dd HH:mm:ss")));
UpdateFunc(false, configPath);
var coreInfo = CoreInfoHandler.Instance.GetCoreInfo(coreType);
var proc = await RunProcess(coreInfo, Global.CoreSpeedtestConfigFileName, true, false);
if (proc is null)
{
return -1;
}
return proc.Id;
}
public async Task CoreStop()
@@ -97,12 +106,14 @@ namespace ServiceLib.Handler
{
if (_process != null)
{
_process = await KillProcess(_process);
await ProcUtils.ProcessKill(_process, true);
_process = null;
}
if (_processPre != null)
{
_processPre = await KillProcess(_processPre);
await ProcUtils.ProcessKill(_processPre, true);
_processPre = null;
}
if (_linuxSudoPid > 0)
@@ -113,45 +124,12 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
}
}
public async Task CoreStopPid(int pid)
{
try
{
await KillProcess(Process.GetProcessById(pid));
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
}
#region Private
private string CoreFindExe(CoreInfo coreInfo)
{
var fileName = string.Empty;
foreach (var name in coreInfo.CoreExes)
{
var vName = Utils.GetBinPath(Utils.GetExeName(name), coreInfo.CoreType.ToString());
if (File.Exists(vName))
{
fileName = vName;
break;
}
}
if (Utils.IsNullOrEmpty(fileName))
{
var msg = string.Format(ResUI.NotFoundCore, Utils.GetBinPath("", coreInfo.CoreType.ToString()), string.Join(", ", coreInfo.CoreExes.ToArray()), coreInfo.Url);
Logging.SaveLog(msg);
ShowMsg(false, msg);
}
return fileName;
}
private async Task CoreStart(ProfileItem node)
{
var coreType = _config.RunningCoreType = AppHandler.Instance.GetCoreType(node, node.ConfigType);
@@ -191,28 +169,7 @@ namespace ServiceLib.Handler
}
}
private async Task<int> CoreStartSpeedtest(string configPath, ECoreType coreType)
{
try
{
var coreInfo = CoreInfoHandler.Instance.GetCoreInfo(coreType);
var proc = await RunProcess(coreInfo, Global.CoreSpeedtestConfigFileName, true, false);
if (proc is null)
{
return -1;
}
return proc.Id;
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
ShowMsg(false, ex.Message);
return -1;
}
}
private void ShowMsg(bool notify, string msg)
private void UpdateFunc(bool notify, string msg)
{
_updateFunc?.Invoke(notify, msg);
}
@@ -230,11 +187,12 @@ namespace ServiceLib.Handler
#region Process
private async Task<Process?> RunProcess(CoreInfo coreInfo, string configPath, bool displayLog, bool mayNeedSudo)
private async Task<Process?> RunProcess(CoreInfo? coreInfo, string configPath, bool displayLog, bool mayNeedSudo)
{
var fileName = CoreFindExe(coreInfo);
var fileName = CoreInfoHandler.Instance.GetCoreExecFile(coreInfo, out var msg);
if (Utils.IsNullOrEmpty(fileName))
{
UpdateFunc(false, msg);
return null;
}
@@ -269,12 +227,12 @@ namespace ServiceLib.Handler
proc.OutputDataReceived += (sender, e) =>
{
if (Utils.IsNullOrEmpty(e.Data)) return;
ShowMsg(false, e.Data + Environment.NewLine);
UpdateFunc(false, e.Data + Environment.NewLine);
};
proc.ErrorDataReceived += (sender, e) =>
{
if (Utils.IsNullOrEmpty(e.Data)) return;
ShowMsg(false, e.Data + Environment.NewLine);
UpdateFunc(false, e.Data + Environment.NewLine);
if (!startUpSuccessful)
{
@@ -315,26 +273,12 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
ShowMsg(true, ex.Message);
Logging.SaveLog(_tag, ex);
UpdateFunc(true, ex.Message);
return null;
}
}
private async Task<Process?> KillProcess(Process? proc)
{
if (proc is null)
{
return null;
}
try { proc?.Kill(true); } catch { }
try { proc?.Close(); } catch { }
try { proc?.Dispose(); } catch { }
await Task.Delay(100);
return null;
}
#endregion Process
#region Linux

View File

@@ -29,6 +29,27 @@
return _coreInfo ?? [];
}
public string GetCoreExecFile(CoreInfo? coreInfo, out string msg)
{
var fileName = string.Empty;
msg = string.Empty;
foreach (var name in coreInfo?.CoreExes)
{
var vName = Utils.GetBinPath(Utils.GetExeName(name), coreInfo.CoreType.ToString());
if (File.Exists(vName))
{
fileName = vName;
break;
}
}
if (fileName.IsNullOrEmpty())
{
msg = string.Format(ResUI.NotFoundCore, Utils.GetBinPath("", coreInfo.CoreType.ToString()), string.Join(", ", coreInfo.CoreExes.ToArray()), coreInfo.Url);
Logging.SaveLog(msg);
}
return fileName;
}
private void InitCoreInfo()
{
_coreInfo = [];

View File

@@ -2,6 +2,8 @@
{
public class FmtHandler
{
private static readonly string _tag = "FmtHandler";
public static string? GetShareUri(ProfileItem item)
{
try
@@ -23,7 +25,7 @@
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
return "";
}
}
@@ -81,7 +83,7 @@
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
msg = ResUI.Incorrectconfiguration;
return null;
}

View File

@@ -10,6 +10,7 @@ namespace ServiceLib.Handler
private ConcurrentBag<ProfileExItem> _lstProfileEx = [];
private Queue<string> _queIndexIds = new();
public static ProfileExHandler Instance => _instance.Value;
private static readonly string _tag = "ProfileExHandler";
public ProfileExHandler()
{
@@ -87,7 +88,7 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
Logging.SaveLog("ProfileExHandler", ex);
Logging.SaveLog(_tag, ex);
}
}
}
@@ -119,7 +120,7 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
}

View File

@@ -12,7 +12,7 @@
private StatisticsXrayService? _statisticsXray;
private StatisticsSingboxService? _statisticsSingbox;
private static readonly string _tag = "StatisticsHandler";
public List<ServerStatItem> ServerStat => _lstServerStat;
public async Task Init(Config config, Action<ServerSpeedItem> updateFunc)
@@ -39,7 +39,7 @@
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
}
@@ -61,7 +61,7 @@
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
}

View File

@@ -2,14 +2,10 @@
{
public class ProxySettingOSX
{
/*
* 仅测试了MacOS 13.7.1 x86 版本,其他版本有待确认
*/
/// <summary>
/// 应用接口类型
/// </summary>
private static readonly List<string> LstInterface = ["Ethernet", "Wi-Fi", "Thunderbolt Bridge"];
private static readonly List<string> LstInterface = ["Ethernet", "Wi-Fi", "Thunderbolt Bridge", "USB 10/100/1000 LAN"];
/// <summary>
/// 代理类型,对应 http,https,socks
@@ -18,13 +14,15 @@
public static async Task SetProxy(string host, int port, string exceptions)
{
var lstCmd = GetSetCmds(host, port, exceptions);
var lstInterface = await GetListNetworkServices();
var lstCmd = GetSetCmds(lstInterface, host, port, exceptions);
await ExecCmd(lstCmd);
}
public static async Task UnsetProxy()
{
var lstCmd = GetUnsetCmds();
var lstInterface = await GetListNetworkServices();
var lstCmd = GetUnsetCmds(lstInterface);
await ExecCmd(lstCmd);
}
@@ -42,10 +40,10 @@
}
}
private static List<CmdItem> GetSetCmds(string host, int port, string exceptions)
private static List<CmdItem> GetSetCmds(List<string> lstInterface, string host, int port, string exceptions)
{
List<CmdItem> lstCmd = [];
foreach (var interf in LstInterface)
foreach (var interf in lstInterface)
{
foreach (var type in LstTypes)
{
@@ -70,10 +68,10 @@
return lstCmd;
}
private static List<CmdItem> GetUnsetCmds()
private static List<CmdItem> GetUnsetCmds(List<string> lstInterface)
{
List<CmdItem> lstCmd = [];
foreach (var interf in LstInterface)
foreach (var interf in lstInterface)
{
foreach (var type in LstTypes)
{
@@ -87,5 +85,17 @@
return lstCmd;
}
public static async Task<List<string>> GetListNetworkServices()
{
var services = await Utils.GetListNetworkServices();
if (services.IsNullOrEmpty())
{
return LstInterface;
}
var lst = services.Split(Environment.NewLine).Where(t => t.Length > 0 && t.Contains('*') == false);
return lst.ToList();
}
}
}

View File

@@ -72,7 +72,6 @@ namespace ServiceLib.Handler.SysProxy
catch (Exception ex)
{
SetProxyFallback(strProxy, exceptions, type);
//Logging.SaveLog(ex.Message, ex);
return false;
}
}

View File

@@ -2,6 +2,8 @@
{
public static class SysProxyHandler
{
private static readonly string _tag = "SysProxyHandler";
public static async Task<bool> UpdateSysProxy(Config config, bool forceDisable)
{
var type = config.SystemProxyItem.SysProxyType;
@@ -59,7 +61,7 @@
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
return true;
}

View File

@@ -13,7 +13,7 @@ namespace ServiceLib.Handler
private string? _lastDescription;
private string _webDir = Global.AppName + "_backup";
private readonly string _webFileName = "backup.zip";
private string _logTitle = "WebDav--";
private readonly string _tag = "WebDav--";
public WebDavHandler()
{
@@ -81,13 +81,13 @@ namespace ServiceLib.Handler
private void SaveLog(string desc)
{
_lastDescription = desc;
Logging.SaveLog(_logTitle + desc);
Logging.SaveLog(_tag + desc);
}
private void SaveLog(Exception ex)
{
_lastDescription = ex.Message;
Logging.SaveLog(_logTitle, ex);
Logging.SaveLog(_tag, ex);
}
public async Task<bool> CheckConnection()

View File

@@ -1248,6 +1248,15 @@ namespace ServiceLib.Resx {
}
}
/// <summary>
/// 查找类似 Iran 的本地化字符串。
/// </summary>
public static string menuRegionalPresetsIran {
get {
return ResourceManager.GetString("menuRegionalPresetsIran", resourceCulture);
}
}
/// <summary>
/// 查找类似 Russia 的本地化字符串。
/// </summary>

View File

@@ -1129,6 +1129,9 @@
<data name="menuRegionalPresetsRussia" xml:space="preserve">
<value>روسیه</value>
</data>
<data name="menuRegionalPresetsIran" xml:space="preserve">
<value>ایران</value>
</data>
<data name="TbSettingsChinaUserTip" xml:space="preserve">
<value>کاربران در منطقه چین می توانند این مورد را نادیده بگیرند</value>
</data>

View File

@@ -1342,6 +1342,9 @@
<data name="menuRegionalPresetsRussia" xml:space="preserve">
<value>Oroszország</value>
</data>
<data name="menuRegionalPresetsIran" xml:space="preserve">
<value>Irán</value>
</data>
<data name="TbSettingsChinaUserTip" xml:space="preserve">
<value>A Kínában élő felhasználók figyelmen kívül hagyhatják ezt a tételt</value>
</data>

View File

@@ -1342,6 +1342,9 @@
<data name="menuRegionalPresetsRussia" xml:space="preserve">
<value>Russia</value>
</data>
<data name="menuRegionalPresetsIran" xml:space="preserve">
<value>Iran</value>
</data>
<data name="TbSettingsChinaUserTip" xml:space="preserve">
<value>Users in China region can ignore this item</value>
</data>

View File

@@ -1039,6 +1039,9 @@
<data name="menuRegionalPresetsRussia" xml:space="preserve">
<value>Россия</value>
</data>
<data name="menuRegionalPresetsIran" xml:space="preserve">
<value>Иран</value>
</data>
<data name="TbSettingsChinaUserTip" xml:space="preserve">
<value>Используйте Настройки -&gt; Региональные пресеты вместо изменения этого поля</value>
</data>

View File

@@ -1342,6 +1342,9 @@
<data name="menuRegionalPresetsRussia" xml:space="preserve">
<value>俄罗斯</value>
</data>
<data name="menuRegionalPresetsIran" xml:space="preserve">
<value>伊朗</value>
</data>
<data name="menuAddServerViaImage" xml:space="preserve">
<value>扫描图片中的二维码</value>
</data>

View File

@@ -1222,6 +1222,9 @@
<data name="menuRegionalPresetsRussia" xml:space="preserve">
<value>俄羅斯</value>
</data>
<data name="menuRegionalPresetsIran" xml:space="preserve">
<value>伊朗</value>
</data>
<data name="menuAddServerViaImage" xml:space="preserve">
<value>掃描圖片中的二維碼</value>
</data>

View File

@@ -5,24 +5,25 @@
"loglevel": "warning"
},
"inbounds": [],
"outbounds": [{
"outbounds": [
{
"tag": "proxy",
"protocol": "vmess",
"settings": {
"vnext": [{
"address": "v2ray.cool",
"port": 10086,
"address": "",
"port": 0,
"users": [{
"id": "a3482e88-686a-4a58-8126-99c9df64b7bf",
"id": "",
"security": "auto"
}]
}],
"servers": [{
"address": "v2ray.cool",
"method": "chacha20",
"address": "",
"method": "",
"ota": false,
"password": "123456",
"port": 10086,
"password": "",
"port": 0,
"level": 1
}]
},
@@ -35,27 +36,23 @@
},
{
"protocol": "freedom",
"settings": {},
"tag": "direct"
},
{
"protocol": "blackhole",
"tag": "block",
"settings": {
"response": {
"type": "http"
}
}
"tag": "block"
}
],
"routing": {
"domainStrategy": "IPIfNonMatch",
"rules": [
{
"inboundTag": ["api"],
"outboundTag": "api",
"type": "field"
}
{
"inboundTag": [
"api"
],
"outboundTag": "api",
"type": "field"
}
]
}
}

View File

@@ -99,10 +99,5 @@
"domain": [
"geosite:cn"
]
},
{
"remarks": "最终代理",
"port": "0-65535",
"outboundTag": "proxy"
}
]

View File

@@ -4,6 +4,15 @@
"proxy.example.com": "127.0.0.1"
},
"servers": [
{
"address": "1.1.1.1",
"domains": [
"geosite:geolocation-!cn"
],
"expectIPs": [
"geoip:!cn"
]
},
{
"address": "223.5.5.5",
"domains": [
@@ -13,7 +22,6 @@
"geoip:cn"
]
},
"1.1.1.1",
"8.8.8.8",
"https://dns.google/dns-query"
]

View File

@@ -4,7 +4,7 @@
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Version>7.5.0</Version>
<Version>7.5.3</Version>
</PropertyGroup>
<ItemGroup>

View File

@@ -6,6 +6,7 @@ namespace ServiceLib.Services.CoreConfig
public class CoreConfigClashService
{
private Config _config;
private static readonly string _tag = "CoreConfigClashService";
public CoreConfigClashService(Config config)
{
@@ -131,7 +132,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog("GenerateClientConfigClash-Mixin", ex);
Logging.SaveLog($"{_tag}-Mixin", ex);
}
var txtFileNew = YamlUtils.ToYaml(fileContent).Replace(tagYamlStr2, tagYamlStr3);
@@ -151,7 +152,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog("GenerateClientConfigClash", ex);
Logging.SaveLog(_tag, ex);
ret.Msg = ResUI.FailedGenDefaultConfiguration;
return ret;
}

View File

@@ -7,6 +7,7 @@ namespace ServiceLib.Services.CoreConfig
public class CoreConfigSingboxService
{
private Config _config;
private static readonly string _tag = "CoreConfigSingboxService";
public CoreConfigSingboxService(Config config)
{
@@ -71,7 +72,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog("GenerateClientConfig4Singbox", ex);
Logging.SaveLog(_tag, ex);
ret.Msg = ResUI.FailedGenDefaultConfiguration;
return ret;
}
@@ -114,7 +115,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
await GenLog(singboxConfig);
@@ -235,7 +236,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
ret.Msg = ResUI.FailedGenDefaultConfiguration;
return ret;
}
@@ -312,7 +313,7 @@ namespace ServiceLib.Services.CoreConfig
var outbound = JsonUtils.Deserialize<Outbound4Sbox>(txtOutbound);
await GenOutbound(item, outbound);
outbound.tag = $"{Global.ProxyTag}-{tagProxy.Count + 1}";
singboxConfig.outbounds.Add(outbound);
singboxConfig.outbounds.Insert(0, outbound);
tagProxy.Add(outbound.tag);
}
if (tagProxy.Count <= 0)
@@ -332,7 +333,7 @@ namespace ServiceLib.Services.CoreConfig
outbounds = tagProxy,
interrupt_exist_connections = false,
};
singboxConfig.outbounds.Add(outUrltest);
singboxConfig.outbounds.Insert(0, outUrltest);
//add selector outbound
var outSelector = new Outbound4Sbox
@@ -343,7 +344,7 @@ namespace ServiceLib.Services.CoreConfig
interrupt_exist_connections = false,
};
outSelector.outbounds.Insert(0, outUrltest.tag);
singboxConfig.outbounds.Add(outSelector);
singboxConfig.outbounds.Insert(0, outSelector);
ret.Success = true;
ret.Data = JsonUtils.Serialize(singboxConfig);
@@ -351,7 +352,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
ret.Msg = ResUI.FailedGenDefaultConfiguration;
return ret;
}
@@ -432,7 +433,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
ret.Msg = ResUI.FailedGenDefaultConfiguration;
return ret;
}
@@ -473,7 +474,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
return 0;
}
@@ -562,7 +563,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
return 0;
}
@@ -695,7 +696,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
return 0;
}
@@ -718,7 +719,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
return 0;
}
@@ -768,7 +769,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
return 0;
}
@@ -845,7 +846,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
return 0;
}
@@ -897,7 +898,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
return 0;
@@ -969,7 +970,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
return 0;
}
@@ -1085,7 +1086,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
return 0;
}
@@ -1184,7 +1185,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
return 0;
}

View File

@@ -7,6 +7,7 @@ namespace ServiceLib.Services.CoreConfig
public class CoreConfigV2rayService
{
private Config _config;
private static readonly string _tag = "CoreConfigV2rayService";
public CoreConfigV2rayService(Config config)
{
@@ -70,7 +71,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog("GenerateClientConfig4V2ray", ex);
Logging.SaveLog(_tag, ex);
ret.Msg = ResUI.FailedGenDefaultConfiguration;
return ret;
}
@@ -153,7 +154,7 @@ namespace ServiceLib.Services.CoreConfig
var outbound = JsonUtils.Deserialize<Outbounds4Ray>(txtOutbound);
await GenOutbound(item, outbound);
outbound.tag = $"{Global.ProxyTag}-{tagProxy.Count + 1}";
v2rayConfig.outbounds.Add(outbound);
v2rayConfig.outbounds.Insert(0, outbound);
tagProxy.Add(outbound.tag);
}
if (tagProxy.Count <= 0)
@@ -181,15 +182,12 @@ namespace ServiceLib.Services.CoreConfig
rule.balancerTag = balancer.tag;
}
}
else
v2rayConfig.routing.rules.Add(new()
{
v2rayConfig.routing.rules.Add(new()
{
network = "tcp,udp",
balancerTag = balancer.tag,
type = "field"
});
}
network = "tcp,udp",
balancerTag = balancer.tag,
type = "field"
});
ret.Success = true;
ret.Data = JsonUtils.Serialize(v2rayConfig);
@@ -197,7 +195,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
ret.Msg = ResUI.FailedGenDefaultConfiguration;
return ret;
}
@@ -240,7 +238,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
await GenLog(v2rayConfig);
@@ -349,7 +347,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
ret.Msg = ResUI.FailedGenDefaultConfiguration;
return ret;
}
@@ -379,7 +377,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
return 0;
}
@@ -423,7 +421,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
return 0;
}
@@ -482,7 +480,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
return 0;
}
@@ -560,7 +558,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
return 0;
}
@@ -754,7 +752,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
return 0;
}
@@ -778,7 +776,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
return 0;
}
@@ -1020,7 +1018,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
return 0;
}
@@ -1083,7 +1081,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
return 0;
}
@@ -1241,7 +1239,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
return 0;

View File

@@ -14,6 +14,8 @@ namespace ServiceLib.Services
public event ErrorEventHandler? Error;
private static readonly string _tag = "DownloadService";
public async Task<int> DownloadDataAsync(string url, WebProxy webProxy, int downloadTimeout, Action<bool, string> updateFunc)
{
try
@@ -68,7 +70,7 @@ namespace ServiceLib.Services
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
Error?.Invoke(this, new ErrorEventArgs(ex));
if (ex.InnerException != null)
@@ -113,7 +115,7 @@ namespace ServiceLib.Services
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
Error?.Invoke(this, new ErrorEventArgs(ex));
if (ex.InnerException != null)
{
@@ -131,7 +133,7 @@ namespace ServiceLib.Services
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
Error?.Invoke(this, new ErrorEventArgs(ex));
if (ex.InnerException != null)
{
@@ -177,7 +179,7 @@ namespace ServiceLib.Services
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
Error?.Invoke(this, new ErrorEventArgs(ex));
if (ex.InnerException != null)
{
@@ -208,7 +210,7 @@ namespace ServiceLib.Services
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
Error?.Invoke(this, new ErrorEventArgs(ex));
if (ex.InnerException != null)
{
@@ -232,13 +234,13 @@ namespace ServiceLib.Services
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
return -1;
}
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
return -1;
}
}

View File

@@ -11,6 +11,7 @@ namespace ServiceLib.Services
private Action<SpeedTestResult>? _updateFunc;
private bool _exitLoop = false;
private static readonly string _tag = "SpeedtestService";
public SpeedtestService(Config config, List<ProfileItem> selecteds, ESpeedActionType actionType, Action<SpeedTestResult> updateFunc)
{
@@ -146,7 +147,7 @@ namespace ServiceLib.Services
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
}));
}
@@ -154,7 +155,7 @@ namespace ServiceLib.Services
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
finally
{
@@ -201,7 +202,7 @@ namespace ServiceLib.Services
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
}));
}
@@ -209,13 +210,13 @@ namespace ServiceLib.Services
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
finally
{
if (pid > 0)
{
await CoreHandler.Instance.CoreStopPid(pid);
await ProcUtils.ProcessKill(pid);
}
await ProfileExHandler.Instance.SaveTo();
}
@@ -277,7 +278,7 @@ namespace ServiceLib.Services
if (pid > 0)
{
await CoreHandler.Instance.CoreStopPid(pid);
await ProcUtils.ProcessKill(pid);
}
await ProfileExHandler.Instance.SaveTo();
}
@@ -341,7 +342,7 @@ namespace ServiceLib.Services
if (pid > 0)
{
await CoreHandler.Instance.CoreStopPid(pid);
await ProcUtils.ProcessKill(pid);
}
await ProfileExHandler.Instance.SaveTo();
}
@@ -389,7 +390,7 @@ namespace ServiceLib.Services
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
return responseTime;
}

View File

@@ -10,6 +10,7 @@ namespace ServiceLib.Services.Statistics
private ClientWebSocket? webSocket;
private Action<ServerSpeedItem>? _updateFunc;
private string Url => $"ws://{Global.Loopback}:{AppHandler.Instance.StatePort2}/traffic";
private static readonly string _tag = "StatisticsSingboxService";
public StatisticsSingboxService(Config config, Action<ServerSpeedItem> updateFunc)
{
@@ -48,7 +49,7 @@ namespace ServiceLib.Services.Statistics
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
}

View File

@@ -7,6 +7,7 @@ namespace ServiceLib.Services
{
private Action<bool, string>? _updateFunc;
private int _timeout = 30;
private static readonly string _tag = "UpdateService";
public async Task CheckUpdateGuiN(Config config, Action<bool, string> updateFunc, bool preRelease)
{
@@ -272,7 +273,7 @@ namespace ServiceLib.Services
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
_updateFunc?.Invoke(false, ex.Message);
return new RetResult(false, ex.Message);
}
@@ -356,7 +357,7 @@ namespace ServiceLib.Services
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
_updateFunc?.Invoke(false, ex.Message);
return new SemanticVersion("");
}
@@ -415,7 +416,7 @@ namespace ServiceLib.Services
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
_updateFunc?.Invoke(false, ex.Message);
return new RetResult(false, ex.Message);
}

View File

@@ -103,7 +103,7 @@ namespace ServiceLib.ViewModels
address = Utils.GetConfigPath(address);
if (File.Exists(address))
{
Utils.ProcessStart(address);
ProcUtils.ProcessStart(address);
}
else
{

View File

@@ -130,18 +130,31 @@ namespace ServiceLib.ViewModels
DisplayOperationMsg(ResUI.LocalRestoreInvalidZipTips);
return;
}
if (!Utils.UpgradeAppExists(out _))
{
DisplayOperationMsg(ResUI.UpgradeAppNotExistTip);
return;
}
//backup first
var fileBackup = Utils.GetBackupPath(BackupFileName);
var result = await CreateZipFileFromDirectory(fileBackup);
if (result)
{
Locator.Current.GetService<MainWindowViewModel>()?.UpgradeApp(fileName);
var service = Locator.Current.GetService<MainWindowViewModel>();
await service?.MyAppExitAsync(true);
await SQLiteHelper.Instance.DisposeDbConnectionAsync();
var toPath = Utils.GetConfigPath();
FileManager.ZipExtractToFile(fileName, toPath, "");
if (Utils.IsWindows())
{
ProcUtils.RebootAsAdmin(false);
}
else
{
if (Utils.UpgradeAppExists(out var upgradeFileName))
{
ProcUtils.ProcessStart(upgradeFileName, Global.RebootAs, Utils.StartupPath());
}
}
service?.Shutdown(true);
}
else
{

View File

@@ -1,9 +1,7 @@
using ReactiveUI;
using ReactiveUI.Fody.Helpers;
using Splat;
using System.Diagnostics;
using System.Reactive;
using System.Reactive.Linq;
namespace ServiceLib.ViewModels
{
@@ -50,6 +48,8 @@ namespace ServiceLib.ViewModels
public ReactiveCommand<Unit, Unit> RegionalPresetRussiaCmd { get; }
public ReactiveCommand<Unit, Unit> RegionalPresetIranCmd { get; }
public ReactiveCommand<Unit, Unit> ReloadCmd { get; }
[Reactive]
@@ -197,6 +197,11 @@ namespace ServiceLib.ViewModels
await ApplyRegionalPreset(EPresetType.Russia);
});
RegionalPresetIranCmd = ReactiveCommand.CreateFromTask(async () =>
{
await ApplyRegionalPreset(EPresetType.Iran);
});
#endregion WhenAnyValue && ReactiveCommand
Init();
@@ -272,9 +277,8 @@ namespace ServiceLib.ViewModels
Locator.Current.GetService<ProfilesViewModel>()?.UpdateStatistics(update);
}
}
catch (Exception ex)
catch
{
Logging.SaveLog(ex.Message, ex);
}
}
@@ -299,34 +303,23 @@ namespace ServiceLib.ViewModels
{
if (!blWindowsShutDown)
{
_updateView?.Invoke(EViewAction.Shutdown, null);
_updateView?.Invoke(EViewAction.Shutdown, false);
}
}
}
public async Task UpgradeApp(string arg)
{
if (!Utils.UpgradeAppExists(out var fileName))
if (!Utils.UpgradeAppExists(out var upgradeFileName))
{
NoticeHandler.Instance.SendMessageAndEnqueue(ResUI.UpgradeAppNotExistTip);
Logging.SaveLog("UpgradeApp does not exist");
return;
}
Process process = new()
var id = ProcUtils.ProcessStart(upgradeFileName, arg, Utils.StartupPath());
if (id > 0)
{
StartInfo = new ProcessStartInfo
{
UseShellExecute = true,
FileName = fileName,
Arguments = arg.AppendQuotes(),
WorkingDirectory = Utils.StartupPath()
}
};
process.Start();
if (process.Id > 0)
{
await MyAppExitAsync(false);
await MyAppExitAsync(false);
}
}
@@ -336,6 +329,11 @@ namespace ServiceLib.ViewModels
_updateView?.Invoke(EViewAction.ShowHideWindow, blShow);
}
public void Shutdown(bool byUser)
{
_updateView?.Invoke(EViewAction.Shutdown, byUser);
}
#endregion Actions
#region Servers && Groups
@@ -504,20 +502,8 @@ namespace ServiceLib.ViewModels
public async Task RebootAsAdmin()
{
try
{
ProcessStartInfo startInfo = new()
{
UseShellExecute = true,
Arguments = Global.RebootAs,
WorkingDirectory = Utils.StartupPath(),
FileName = Utils.GetExePath().AppendQuotes(),
Verb = "runas",
};
Process.Start(startInfo);
await MyAppExitAsync(false);
}
catch { }
ProcUtils.RebootAsAdmin();
await MyAppExitAsync(false);
}
private async Task ClearServerStatistics()
@@ -531,15 +517,15 @@ namespace ServiceLib.ViewModels
var path = Utils.StartupPath();
if (Utils.IsWindows())
{
Utils.ProcessStart(path);
ProcUtils.ProcessStart(path);
}
else if (Utils.IsLinux())
{
Utils.ProcessStart("nautilus", path);
ProcUtils.ProcessStart("nautilus", path);
}
else if (Utils.IsOSX())
{
Utils.ProcessStart("open", path);
ProcUtils.ProcessStart("open", path);
}
}

View File

@@ -74,15 +74,16 @@ namespace ServiceLib.ViewModels
SelectedSource.Protocol = ProtocolItems?.ToList();
SelectedSource.InboundTag = InboundTagItems?.ToList();
bool hasRule = SelectedSource.Domain?.Count > 0
var hasRule = SelectedSource.Domain?.Count > 0
|| SelectedSource.Ip?.Count > 0
|| SelectedSource.Protocol?.Count > 0
|| SelectedSource.Process?.Count > 0
|| Utils.IsNotEmpty(SelectedSource.Port);
|| Utils.IsNotEmpty(SelectedSource.Port)
|| Utils.IsNotEmpty(SelectedSource.Network);
if (!hasRule)
{
NoticeHandler.Instance.Enqueue(string.Format(ResUI.RoutingRuleDetailRequiredTips, "Port/Protocol/Domain/IP/Process"));
NoticeHandler.Instance.Enqueue(string.Format(ResUI.RoutingRuleDetailRequiredTips, "Network/Port/Protocol/Domain/IP/Process"));
return;
}
//NoticeHandler.Instance.Enqueue(ResUI.OperationSuccess);

View File

@@ -177,12 +177,12 @@ namespace ServiceLib.ViewModels
}
var lst = new List<RulesItem>();
foreach (var it in SelectedSources ?? [SelectedSource])
var sources = SelectedSources ?? [SelectedSource];
foreach (var it in _rules)
{
var item = _rules.FirstOrDefault(t => t.Id == it?.Id);
if (item != null)
if (sources.Any(t => t.Id == it?.Id))
{
var item2 = JsonUtils.DeepCopy(item); //JsonUtils.Deserialize<RulesItem4Ray>(JsonUtils.Serialize(item));
var item2 = JsonUtils.DeepCopy(it);
item2.Id = null;
lst.Add(item2 ?? new());
}

View File

@@ -3,12 +3,13 @@
xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib"
xmlns:semi="https://irihi.tech/semi"
xmlns:vms="clr-namespace:ServiceLib.ViewModels;assembly=ServiceLib"
x:DataType="vms:StatusBarViewModel"
RequestedThemeVariant="Default">
<Application.Styles>
<semi:SemiTheme />
<StyleInclude Source="Assets/GlobalStyles.axaml" />
<StyleInclude Source="avares://Semi.Avalonia/Themes/Index.axaml" />
<StyleInclude Source="avares://Semi.Avalonia.DataGrid/Index.axaml" />
<StyleInclude Source="avares://DialogHost.Avalonia/Styles.xaml" />
</Application.Styles>

View File

@@ -71,12 +71,8 @@ public partial class App : Application
private async void MenuExit_Click(object? sender, EventArgs e)
{
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
var service = Locator.Current.GetService<MainWindowViewModel>();
if (service != null) await service.MyAppExitAsync(false);
desktop.Shutdown();
}
var service = Locator.Current.GetService<MainWindowViewModel>();
if (service != null) await service.MyAppExitAsync(true);
service?.Shutdown(true);
}
}

View File

@@ -31,6 +31,7 @@ namespace v2rayN.Desktop.ViewModels
{
ModifyTheme();
ModifyFontFamily();
ModifyFontSize();
}
private void BindingUI()
@@ -67,11 +68,10 @@ namespace v2rayN.Desktop.ViewModels
y => y > 0)
.Subscribe(c =>
{
if (CurrentFontSize >= Global.MinFontSize)
if (_config.UiItem.CurrentFontSize != CurrentFontSize && CurrentFontSize >= Global.MinFontSize)
{
_config.UiItem.CurrentFontSize = CurrentFontSize;
double size = CurrentFontSize;
ModifyFontSize(size);
ModifyFontSize();
ConfigHandler.SaveConfig(_config);
}
});
@@ -100,8 +100,9 @@ namespace v2rayN.Desktop.ViewModels
}
}
private void ModifyFontSize(double size)
private void ModifyFontSize()
{
double size = CurrentFontSize;
Style style = new(x => Selectors.Or(
x.OfType<Button>(),
x.OfType<TextBox>(),

View File

@@ -59,7 +59,7 @@
Grid.Column="0"
Margin="8"
HorizontalAlignment="Left"
VerticalAlignment="Top"
VerticalAlignment="Center"
IsChecked="{Binding IsSelected}" />
<TextBlock
Grid.Column="1"

View File

@@ -65,12 +65,12 @@ namespace v2rayN.Desktop.Views
private void linkDnsObjectDoc_Click(object? sender, RoutedEventArgs e)
{
Utils.ProcessStart("https://xtls.github.io/config/dns.html#dnsobject");
ProcUtils.ProcessStart("https://xtls.github.io/config/dns.html#dnsobject");
}
private void linkDnsSingboxObjectDoc_Click(object? sender, RoutedEventArgs e)
{
Utils.ProcessStart("https://sing-box.sagernet.org/zh/configuration/dns/");
ProcUtils.ProcessStart("https://sing-box.sagernet.org/zh/configuration/dns/");
}
}
}

View File

@@ -80,6 +80,7 @@
<MenuItem Header="{x:Static resx:ResUI.menuRegionalPresets}">
<MenuItem x:Name="menuRegionalPresetsDefault" Header="{x:Static resx:ResUI.menuRegionalPresetsDefault}" />
<MenuItem x:Name="menuRegionalPresetsRussia" Header="{x:Static resx:ResUI.menuRegionalPresetsRussia}" />
<MenuItem x:Name="menuRegionalPresetsIran" Header="{x:Static resx:ResUI.menuRegionalPresetsIran}" />
</MenuItem>
<MenuItem x:Name="menuBackupAndRestore" Header="{x:Static resx:ResUI.menuBackupAndRestore}" />
<MenuItem x:Name="menuOpenTheFileLocation" Header="{x:Static resx:ResUI.menuOpenTheFileLocation}" />

View File

@@ -104,6 +104,7 @@ namespace v2rayN.Desktop.Views
this.BindCommand(ViewModel, vm => vm.OpenTheFileLocationCmd, v => v.menuOpenTheFileLocation).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.RegionalPresetDefaultCmd, v => v.menuRegionalPresetsDefault).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.RegionalPresetRussiaCmd, v => v.menuRegionalPresetsRussia).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.RegionalPresetIranCmd, v => v.menuRegionalPresetsIran).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.ReloadCmd, v => v.menuReload).DisposeWith(disposables);
this.OneWayBind(ViewModel, vm => vm.BlReloadEnabled, v => v.menuReload.IsEnabled).DisposeWith(disposables);
@@ -133,7 +134,7 @@ namespace v2rayN.Desktop.Views
}
});
this.Title = $"{Utils.GetVersion()} - {(AppHandler.Instance.IsAdministrator ? ResUI.RunAsAdmin : ResUI.NotRunAsAdmin)}";
this.Title = $"{Utils.GetVersion()}";
if (Utils.IsWindows())
{
ThreadPool.RegisterWaitForSingleObject(Program.ProgramStarted, OnProgramStarted, null, -1, false);
@@ -222,6 +223,10 @@ namespace v2rayN.Desktop.Views
break;
case EViewAction.Shutdown:
if (obj != null && _blCloseByUser == false)
{
_blCloseByUser = (bool)obj;
}
StorageUI();
if (Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
{
@@ -329,12 +334,12 @@ namespace v2rayN.Desktop.Views
private void menuPromotion_Click(object? sender, RoutedEventArgs e)
{
Utils.ProcessStart($"{Utils.Base64Decode(Global.PromotionUrl)}?t={DateTime.Now.Ticks}");
ProcUtils.ProcessStart($"{Utils.Base64Decode(Global.PromotionUrl)}?t={DateTime.Now.Ticks}");
}
private void menuSettingsSetUWP_Click(object? sender, RoutedEventArgs e)
{
Utils.ProcessStart(Utils.GetBinPath("EnableLoopback.exe"));
ProcUtils.ProcessStart(Utils.GetBinPath("EnableLoopback.exe"));
}
public async Task ScanScreenTaskAsync()
@@ -480,7 +485,7 @@ namespace v2rayN.Desktop.Views
{
if (sender is MenuItem item)
{
Utils.ProcessStart(item.Tag?.ToString());
ProcUtils.ProcessStart(item.Tag?.ToString());
}
}

View File

@@ -235,7 +235,7 @@ namespace v2rayN.Desktop.Views
}
catch (Exception ex)
{
Logging.SaveLog("fill fonts error", ex);
Logging.SaveLog("GetFonts", ex);
}
return lstFonts;
}

View File

@@ -187,12 +187,7 @@ namespace v2rayN.Desktop.Views
private void lstProfiles_SelectionChanged(object? sender, SelectionChangedEventArgs e)
{
List<ProfileItemModel> lst = [];
foreach (var item in lstProfiles.SelectedItems)
{
lst.Add((ProfileItemModel)item);
}
ViewModel.SelectedProfiles = lst;
ViewModel.SelectedProfiles = lstProfiles.SelectedItems.Cast<ProfileItemModel>().ToList();
}
private void LstProfiles_DoubleTapped(object? sender, Avalonia.Input.TappedEventArgs e)

View File

@@ -95,7 +95,7 @@ namespace v2rayN.Desktop.Views
private void linkRuleobjectDoc_Click(object? sender, RoutedEventArgs e)
{
Utils.ProcessStart("https://xtls.github.io/config/routing.html#ruleobject");
ProcUtils.ProcessStart("https://xtls.github.io/config/routing.html#ruleobject");
}
}
}

View File

@@ -166,12 +166,7 @@ namespace v2rayN.Desktop.Views
private void lstRules_SelectionChanged(object? sender, SelectionChangedEventArgs e)
{
List<RulesItemModel> lst = [];
foreach (var item in lstRules.SelectedItems)
{
lst.Add((RulesItemModel)item);
}
ViewModel.SelectedSources = lst;
ViewModel.SelectedSources = lstRules.SelectedItems.Cast<RulesItemModel>().ToList();
}
private void LstRules_DoubleTapped(object? sender, Avalonia.Input.TappedEventArgs e)
@@ -208,7 +203,7 @@ namespace v2rayN.Desktop.Views
private void linkCustomRulesetPath4Singbox(object? sender, RoutedEventArgs e)
{
Utils.ProcessStart("https://github.com/2dust/v2rayCustomRoutingList/blob/master/singbox_custom_ruleset_example.json");
ProcUtils.ProcessStart("https://github.com/2dust/v2rayCustomRoutingList/blob/master/singbox_custom_ruleset_example.json");
}
}
}

View File

@@ -107,12 +107,7 @@ namespace v2rayN.Desktop.Views
private void lstRoutings_SelectionChanged(object? sender, SelectionChangedEventArgs e)
{
List<RoutingItemModel> lst = [];
foreach (var item in lstRoutings.SelectedItems)
{
lst.Add((RoutingItemModel)item);
}
ViewModel.SelectedSources = lst;
ViewModel.SelectedSources = lstRoutings.SelectedItems.Cast<RoutingItemModel>().ToList();
}
private void LstRoutings_DoubleTapped(object? sender, TappedEventArgs e)
@@ -122,12 +117,12 @@ namespace v2rayN.Desktop.Views
private void linkdomainStrategy_Click(object? sender, RoutedEventArgs e)
{
Utils.ProcessStart("https://xtls.github.io/config/routing.html");
ProcUtils.ProcessStart("https://xtls.github.io/config/routing.html");
}
private void linkdomainStrategy4Singbox_Click(object? sender, RoutedEventArgs e)
{
Utils.ProcessStart("https://sing-box.sagernet.org/zh/configuration/shared/listen/#domain_strategy");
ProcUtils.ProcessStart("https://sing-box.sagernet.org/zh/configuration/shared/listen/#domain_strategy");
}
private void btnCancel_Click(object? sender, RoutedEventArgs e)

View File

@@ -82,12 +82,7 @@ namespace v2rayN.Desktop.Views
private void LstSubscription_SelectionChanged(object? sender, SelectionChangedEventArgs e)
{
List<SubItem> lst = [];
foreach (var item in lstSubscription.SelectedItems)
{
lst.Add((SubItem)item);
}
ViewModel.SelectedSources = lst;
ViewModel.SelectedSources = lstSubscription.SelectedItems.Cast<SubItem>().ToList();
}
private void menuClose_Click(object? sender, RoutedEventArgs e)

View File

@@ -26,10 +26,10 @@
<PackageReference Include="Avalonia.Fonts.Inter" Version="11.2.3" />
<PackageReference Condition="'$(Configuration)' == 'Debug'" Include="Avalonia.Diagnostics" Version="11.2.3" />
<PackageReference Include="Avalonia.ReactiveUI" Version="11.2.3" />
<PackageReference Include="DialogHost.Avalonia" Version="0.8.1" />
<PackageReference Include="DialogHost.Avalonia" Version="0.9.1" />
<PackageReference Include="MessageBox.Avalonia" Version="3.2.0" />
<PackageReference Include="Semi.Avalonia" Version="11.2.1.2" />
<PackageReference Include="Semi.Avalonia.DataGrid" Version="11.2.1.2" />
<PackageReference Include="Semi.Avalonia" Version="11.2.1.3" />
<PackageReference Include="Semi.Avalonia.DataGrid" Version="11.2.1.3" />
<PackageReference Include="ReactiveUI" Version="20.1.63" />
<PackageReference Include="ReactiveUI.Fody" Version="19.5.41" />
</ItemGroup>
@@ -48,6 +48,9 @@
<None Update="v2rayN.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
<None Update="v2rayN2.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None>
</ItemGroup>
</Project>

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View File

@@ -13,6 +13,8 @@ namespace v2rayN
{
internal static class WindowsUtils
{
private static readonly string _tag = "WindowsUtils";
/// <summary>
/// 获取剪贴板数
/// </summary>
@@ -31,7 +33,7 @@ namespace v2rayN
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
}
return strData;
}

View File

@@ -8,6 +8,7 @@ namespace v2rayN.Handler
{
private static readonly Lazy<WindowsHandler> instance = new(() => new());
public static WindowsHandler Instance => instance.Value;
private static readonly string _tag = "WindowsHandler";
public async Task<Icon> GetNotifyIcon(Config config)
{
@@ -39,7 +40,7 @@ namespace v2rayN.Handler
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
return Properties.Resources.NotifyIcon1;
}
}
@@ -89,7 +90,7 @@ namespace v2rayN.Handler
}
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
Logging.SaveLog(_tag, ex);
return null;
}
}

View File

@@ -47,6 +47,7 @@ namespace v2rayN.ViewModels
private void RestoreUI()
{
ModifyTheme();
ModifyFontSize();
if (!_config.UiItem.ColorPrimaryName.IsNullOrEmpty())
{
var swatch = new SwatchesProvider().Swatches.FirstOrDefault(t => t.Name == _config.UiItem.ColorPrimaryName);
@@ -121,14 +122,10 @@ namespace v2rayN.ViewModels
y => y > 0)
.Subscribe(c =>
{
if (CurrentFontSize >= Global.MinFontSize)
if (_config.UiItem.CurrentFontSize != CurrentFontSize)
{
_config.UiItem.CurrentFontSize = CurrentFontSize;
double size = (long)CurrentFontSize;
Application.Current.Resources["StdFontSize"] = size;
Application.Current.Resources["StdFontSize1"] = size + 1;
Application.Current.Resources["StdFontSize-1"] = size - 1;
ModifyFontSize();
ConfigHandler.SaveConfig(_config);
}
});
@@ -158,6 +155,16 @@ namespace v2rayN.ViewModels
WindowsUtils.SetDarkBorder(Application.Current.MainWindow, isDarkTheme);
}
private void ModifyFontSize()
{
double size = (long)CurrentFontSize;
if (size < Global.MinFontSize) size = Global.MinFontSize;
Application.Current.Resources["StdFontSize"] = size;
Application.Current.Resources["StdFontSize1"] = size + 1;
Application.Current.Resources["StdFontSize-1"] = size - 1;
}
public void ChangePrimaryColor(System.Windows.Media.Color color)
{
var theme = _paletteHelper.GetTheme();

View File

@@ -85,7 +85,7 @@
Grid.Column="1"
Width="400"
Margin="{StaticResource Margin4}"
VerticalAlignment="Top"
VerticalAlignment="Center"
AcceptsReturn="True"
Style="{StaticResource MyOutlinedTextBox}" />
@@ -102,7 +102,7 @@
Grid.Column="1"
Width="400"
Margin="{StaticResource Margin4}"
VerticalAlignment="Top"
VerticalAlignment="Center"
AcceptsReturn="True"
IsReadOnly="True"
Style="{StaticResource MyOutlinedTextBox}" />

View File

@@ -705,7 +705,7 @@
x:Name="txtExtra"
Width="400"
Margin="{StaticResource Margin4}"
VerticalAlignment="Top"
VerticalAlignment="Center"
AcceptsReturn="True"
MinLines="6"
Style="{StaticResource MyOutlinedTextBox}"

View File

@@ -82,7 +82,7 @@
Grid.Column="0"
Margin="{StaticResource Margin8}"
HorizontalAlignment="Left"
VerticalAlignment="Top"
VerticalAlignment="Center"
IsChecked="{Binding IsSelected}" />
<TextBlock
Grid.Column="1"

View File

@@ -66,12 +66,12 @@ namespace v2rayN.Views
private void linkDnsObjectDoc_Click(object sender, RoutedEventArgs e)
{
Utils.ProcessStart("https://xtls.github.io/config/dns.html#dnsobject");
ProcUtils.ProcessStart("https://xtls.github.io/config/dns.html#dnsobject");
}
private void linkDnsSingboxObjectDoc_Click(object sender, RoutedEventArgs e)
{
Utils.ProcessStart("https://sing-box.sagernet.org/zh/configuration/dns/");
ProcUtils.ProcessStart("https://sing-box.sagernet.org/zh/configuration/dns/");
}
}
}

View File

@@ -89,7 +89,7 @@
Grid.Row="1"
Grid.Column="1"
Margin="{StaticResource Margin4}"
VerticalAlignment="Top"
VerticalAlignment="Center"
AcceptsReturn="True"
IsReadOnly="True"
PreviewKeyDown="TxtGlobalHotkey_PreviewKeyDown"
@@ -107,7 +107,7 @@
Grid.Row="2"
Grid.Column="1"
Margin="{StaticResource Margin4}"
VerticalAlignment="Top"
VerticalAlignment="Center"
AcceptsReturn="True"
IsReadOnly="True"
PreviewKeyDown="TxtGlobalHotkey_PreviewKeyDown"
@@ -125,7 +125,7 @@
Grid.Row="3"
Grid.Column="1"
Margin="{StaticResource Margin4}"
VerticalAlignment="Top"
VerticalAlignment="Center"
AcceptsReturn="True"
IsReadOnly="True"
PreviewKeyDown="TxtGlobalHotkey_PreviewKeyDown"
@@ -142,7 +142,7 @@
Grid.Row="4"
Grid.Column="1"
Margin="{StaticResource Margin4}"
VerticalAlignment="Top"
VerticalAlignment="Center"
AcceptsReturn="True"
IsReadOnly="True"
PreviewKeyDown="TxtGlobalHotkey_PreviewKeyDown"
@@ -159,7 +159,7 @@
Grid.Row="5"
Grid.Column="1"
Margin="{StaticResource Margin4}"
VerticalAlignment="Top"
VerticalAlignment="Center"
AcceptsReturn="True"
IsReadOnly="True"
PreviewKeyDown="TxtGlobalHotkey_PreviewKeyDown"

View File

@@ -194,6 +194,10 @@
x:Name="menuRegionalPresetsRussia"
Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuRegionalPresetsRussia}" />
<MenuItem
x:Name="menuRegionalPresetsIran"
Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuRegionalPresetsIran}" />
</MenuItem>
<MenuItem
x:Name="menuBackupAndRestore"

View File

@@ -102,6 +102,7 @@ namespace v2rayN.Views
this.BindCommand(ViewModel, vm => vm.OpenTheFileLocationCmd, v => v.menuOpenTheFileLocation).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.RegionalPresetDefaultCmd, v => v.menuRegionalPresetsDefault).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.RegionalPresetRussiaCmd, v => v.menuRegionalPresetsRussia).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.RegionalPresetIranCmd, v => v.menuRegionalPresetsIran).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.ReloadCmd, v => v.menuReload).DisposeWith(disposables);
this.OneWayBind(ViewModel, vm => vm.BlReloadEnabled, v => v.menuReload.IsEnabled).DisposeWith(disposables);
@@ -307,12 +308,12 @@ namespace v2rayN.Views
private void menuPromotion_Click(object sender, RoutedEventArgs e)
{
Utils.ProcessStart($"{Utils.Base64Decode(Global.PromotionUrl)}?t={DateTime.Now.Ticks}");
ProcUtils.ProcessStart($"{Utils.Base64Decode(Global.PromotionUrl)}?t={DateTime.Now.Ticks}");
}
private void menuSettingsSetUWP_Click(object sender, RoutedEventArgs e)
{
Utils.ProcessStart(Utils.GetBinPath("EnableLoopback.exe"));
ProcUtils.ProcessStart(Utils.GetBinPath("EnableLoopback.exe"));
}
private async Task ScanScreenTaskAsync()
@@ -442,7 +443,7 @@ namespace v2rayN.Views
{
if (sender is MenuItem item)
{
Utils.ProcessStart(item.Tag.ToString());
ProcUtils.ProcessStart(item.Tag.ToString());
}
}

View File

@@ -246,7 +246,7 @@ namespace v2rayN.Views
}
catch (Exception ex)
{
Logging.SaveLog("fill fonts error", ex);
Logging.SaveLog("GetFonts", ex);
}
return lstFonts.OrderBy(t => t).ToList();
}

View File

@@ -89,7 +89,7 @@ namespace v2rayN.Views
private void linkRuleobjectDoc_Click(object sender, RoutedEventArgs e)
{
Utils.ProcessStart("https://xtls.github.io/config/routing.html#ruleobject");
ProcUtils.ProcessStart("https://xtls.github.io/config/routing.html#ruleobject");
}
}
}

View File

@@ -121,7 +121,7 @@
Width="300"
Margin="{StaticResource Margin4}"
HorizontalAlignment="Left"
VerticalAlignment="Top"
VerticalAlignment="Center"
AcceptsReturn="True"
Style="{StaticResource DefTextBox}"
TextWrapping="Wrap" />
@@ -181,7 +181,7 @@
Grid.Column="1"
Width="600"
Margin="{StaticResource Margin4}"
VerticalAlignment="Top"
VerticalAlignment="Center"
AcceptsReturn="True"
Style="{StaticResource DefTextBox}"
TextWrapping="Wrap" />
@@ -199,7 +199,7 @@
Grid.Column="1"
Width="600"
Margin="{StaticResource Margin4}"
VerticalAlignment="Top"
VerticalAlignment="Center"
AcceptsReturn="True"
Style="{StaticResource DefTextBox}"
TextWrapping="Wrap" />
@@ -228,7 +228,7 @@
Grid.Column="1"
Width="600"
Margin="{StaticResource Margin4}"
VerticalAlignment="Top"
VerticalAlignment="Center"
AcceptsReturn="True"
Style="{StaticResource DefTextBox}"
TextWrapping="Wrap" />

View File

@@ -197,7 +197,7 @@ namespace v2rayN.Views
private void linkCustomRulesetPath4Singbox(object sender, RoutedEventArgs e)
{
Utils.ProcessStart("https://github.com/2dust/v2rayCustomRoutingList/blob/master/singbox_custom_ruleset_example.json");
ProcUtils.ProcessStart("https://github.com/2dust/v2rayCustomRoutingList/blob/master/singbox_custom_ruleset_example.json");
}
}
}

View File

@@ -122,12 +122,12 @@ namespace v2rayN.Views
private void linkdomainStrategy_Click(object sender, System.Windows.RoutedEventArgs e)
{
Utils.ProcessStart("https://xtls.github.io/config/routing.html");
ProcUtils.ProcessStart("https://xtls.github.io/config/routing.html");
}
private void linkdomainStrategy4Singbox_Click(object sender, RoutedEventArgs e)
{
Utils.ProcessStart("https://sing-box.sagernet.org/zh/configuration/shared/listen/#domain_strategy");
ProcUtils.ProcessStart("https://sing-box.sagernet.org/zh/configuration/shared/listen/#domain_strategy");
}
private void btnCancel_Click(object sender, System.Windows.RoutedEventArgs e)

View File

@@ -92,7 +92,7 @@
Grid.Row="1"
Grid.Column="1"
Margin="{StaticResource Margin4}"
VerticalAlignment="Top"
VerticalAlignment="Center"
AcceptsReturn="True"
Style="{StaticResource MyOutlinedTextBox}"
TextWrapping="Wrap" />
@@ -109,7 +109,7 @@
Grid.Row="2"
Grid.Column="1"
Margin="{StaticResource Margin4}"
VerticalAlignment="Top"
VerticalAlignment="Center"
materialDesign:HintAssist.Hint="{x:Static resx:ResUI.SubUrlTips}"
AcceptsReturn="True"
Style="{StaticResource MyOutlinedTextBox}"
@@ -131,7 +131,7 @@
x:Name="txtMoreUrl"
Width="400"
Margin="{StaticResource Margin4}"
VerticalAlignment="Top"
VerticalAlignment="Center"
materialDesign:HintAssist.Hint="{x:Static resx:ResUI.SubUrlTips}"
AcceptsReturn="True"
MinLines="4"
@@ -162,7 +162,7 @@
x:Name="txtAutoUpdateInterval"
Width="100"
Margin="{StaticResource Margin4}"
VerticalAlignment="Top"
VerticalAlignment="Center"
materialDesign:HintAssist.Hint="{x:Static resx:ResUI.SubUrlTips}"
AcceptsReturn="True"
DockPanel.Dock="Right"
@@ -188,7 +188,7 @@
Grid.Row="5"
Grid.Column="1"
Margin="{StaticResource Margin4}"
VerticalAlignment="Top"
VerticalAlignment="Center"
materialDesign:HintAssist.Hint="{x:Static resx:ResUI.SubUrlTips}"
AcceptsReturn="True"
Style="{StaticResource MyOutlinedTextBox}" />
@@ -220,7 +220,7 @@
Grid.Row="7"
Grid.Column="1"
Margin="{StaticResource Margin4}"
VerticalAlignment="Top"
VerticalAlignment="Center"
materialDesign:HintAssist.Hint="{x:Static resx:ResUI.SubUrlTips}"
AcceptsReturn="True"
Style="{StaticResource MyOutlinedTextBox}"
@@ -240,7 +240,7 @@
Width="100"
Margin="{StaticResource Margin4}"
HorizontalAlignment="Left"
VerticalAlignment="Top"
VerticalAlignment="Center"
AcceptsReturn="True"
Style="{StaticResource MyOutlinedTextBox}" />
@@ -256,7 +256,7 @@
Grid.Row="9"
Grid.Column="1"
Margin="{StaticResource Margin4}"
VerticalAlignment="Top"
VerticalAlignment="Center"
materialDesign:HintAssist.Hint="{x:Static resx:ResUI.LvPrevProfileTip}"
AcceptsReturn="True"
Style="{StaticResource MyOutlinedTextBox}" />
@@ -273,7 +273,7 @@
Grid.Row="10"
Grid.Column="1"
Margin="{StaticResource Margin4}"
VerticalAlignment="Top"
VerticalAlignment="Center"
materialDesign:HintAssist.Hint="{x:Static resx:ResUI.LvPrevProfileTip}"
AcceptsReturn="True"
Style="{StaticResource MyOutlinedTextBox}" />
@@ -308,7 +308,7 @@
Grid.Row="12"
Grid.Column="1"
Margin="{StaticResource Margin4}"
VerticalAlignment="Top"
VerticalAlignment="Center"
AcceptsReturn="True"
Style="{StaticResource MyOutlinedTextBox}"
TextWrapping="Wrap" />

View File

@@ -14,7 +14,7 @@
</PropertyGroup>
<ItemGroup>
<PackageReference Include="MaterialDesignThemes" Version="5.1.0" />
<PackageReference Include="MaterialDesignThemes" Version="5.2.0" />
<PackageReference Include="H.NotifyIcon.Wpf" Version="2.2.0" />
<PackageReference Include="ReactiveUI.Fody" Version="19.5.41" />
<PackageReference Include="ReactiveUI.WPF" Version="20.1.63" />