Compare commits

..

No commits in common. "364a24c5802ae40167e5a91a7405939bc2eb9854" and "4f8dae7fa0a9dbcae7294b3465ac85ec250be940" have entirely different histories.

68 changed files with 685 additions and 586 deletions

View file

@ -22,7 +22,7 @@ Fedora 30+
### macOS ### macOS
- `chmod +x v2rayN` Run `./v2rayN` under user permissions - `chmod +x v2rayN` Run `./v2rayN` under user permissions
``` ```
macOS 11+ macOS 10.14+
``` ```
## Requirements ## Requirements

View file

@ -7,10 +7,22 @@ Version="$3"
PackagePath="v2rayN-Package-${Arch}" PackagePath="v2rayN-Package-${Arch}"
mkdir -p "$PackagePath/v2rayN.app/Contents/Resources" mkdir -p "$PackagePath/v2rayN.app/Contents/Resources"
cp -rf "$OutputPath" "$PackagePath/v2rayN.app/Contents/MacOS" cp -rf "$OutputPath" "$PackagePath/v2rayN.app/Contents/MacOS"
cp -f "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN.icns" "$PackagePath/v2rayN.app/Contents/Resources/AppIcon.icns"
echo "When this file exists, app will not store configs under this folder" > "$PackagePath/v2rayN.app/Contents/MacOS/NotStoreConfigHere.txt" echo "When this file exists, app will not store configs under this folder" > "$PackagePath/v2rayN.app/Contents/MacOS/NotStoreConfigHere.txt"
chmod +x "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN" chmod +x "$PackagePath/v2rayN.app/Contents/MacOS/v2rayN"
mkdir -p "$PackagePath/icons.iconset"
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 cat >"$PackagePath/v2rayN.app/Contents/Info.plist" <<-EOF
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd"> <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">

View file

@ -5,7 +5,7 @@
<TargetFramework>net8.0</TargetFramework> <TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable> <Nullable>enable</Nullable>
<Copyright>Copyright © 2017-2025 (GPLv3)</Copyright> <Copyright>Copyright © 2017-2024 (GPLv3)</Copyright>
<FileVersion>1.3.1</FileVersion> <FileVersion>1.3.1</FileVersion>
</PropertyGroup> </PropertyGroup>

View file

@ -10,7 +10,7 @@ namespace AmazTool
{ {
Console.WriteLine($"{Resx.Resource.StartUnzipping}\n{fileName}"); Console.WriteLine($"{Resx.Resource.StartUnzipping}\n{fileName}");
Waiting(5); Waiting(3);
if (!File.Exists(fileName)) if (!File.Exists(fileName))
{ {

View file

@ -97,30 +97,6 @@ namespace ServiceLib.Common
return result; return result;
} }
/// <summary>
/// Serialize Object to Json string
/// </summary>
/// <param name="obj"></param>
/// <param name="options"></param>
/// <returns></returns>
public static string Serialize(object? obj, JsonSerializerOptions options)
{
var result = string.Empty;
try
{
if (obj == null)
{
return result;
}
result = JsonSerializer.Serialize(obj, options);
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
}
return result;
}
/// <summary> /// <summary>
/// SerializeToNode /// SerializeToNode
/// </summary> /// </summary>

View file

@ -81,7 +81,9 @@ public static class ProcUtils
return; return;
} }
GetProcessKeyInfo(proc, review, out var procId, out var fileName, out var processName); 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(true); } catch (Exception ex) { Logging.SaveLog(_tag, ex); }
try { proc?.Kill(); } catch (Exception ex) { Logging.SaveLog(_tag, ex); } try { proc?.Kill(); } catch (Exception ex) { Logging.SaveLog(_tag, ex); }
@ -89,29 +91,6 @@ public static class ProcUtils
try { proc?.Dispose(); } catch (Exception ex) { Logging.SaveLog(_tag, ex); } try { proc?.Dispose(); } catch (Exception ex) { Logging.SaveLog(_tag, ex); }
await Task.Delay(300); await Task.Delay(300);
await ProcessKillByKeyInfo(review, procId, fileName, processName);
}
private static void GetProcessKeyInfo(Process? proc, bool review, out int? procId, out string? fileName, out string? processName)
{
procId = null;
fileName = null;
processName = null;
if (!review) return;
try
{
procId = proc?.Id;
fileName = proc?.MainModule?.FileName;
processName = proc?.ProcessName;
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
}
}
private static async Task ProcessKillByKeyInfo(bool review, int? procId, string? fileName, string? processName)
{
if (review && procId != null && fileName != null) if (review && procId != null && fileName != null)
{ {
try try

View file

@ -558,7 +558,7 @@ namespace ServiceLib.Common
public static string GetRuntimeInfo() public static string GetRuntimeInfo()
{ {
return $"{Utils.GetVersion()} | {Utils.StartupPath()} | {Utils.GetExePath()} | {Environment.OSVersion}"; return $"{Utils.GetVersion()} | {Utils.StartupPath()} | {Utils.GetExePath()} | {Environment.OSVersion} | {(Environment.Is64BitOperatingSystem ? 64 : 32)}";
} }
/// <summary> /// <summary>

View file

@ -1,13 +0,0 @@
namespace ServiceLib.Enums
{
public enum ETheme
{
FollowSystem,
Dark,
Light,
Aquatic,
Desert,
Dusk,
NightSky
}
}

View file

@ -106,13 +106,7 @@
if (Utils.IsWindows()) if (Utils.IsWindows())
{ {
_processJob ??= new(); _processJob ??= new();
try _processJob?.AddProcess(processHandle);
{
_processJob?.AddProcess(processHandle);
}
catch
{
}
} }
} }

View file

@ -156,12 +156,6 @@ namespace ServiceLib.Handler
config.SystemProxyItem ??= new(); config.SystemProxyItem ??= new();
config.WebDavItem ??= new(); config.WebDavItem ??= new();
config.CheckUpdateItem ??= new(); config.CheckUpdateItem ??= new();
config.Fragment4RayItem ??= new()
{
Packets = "tlshello",
Length = "100-200",
Interval = "10-20"
};
if (Utils.IsNotEmpty(config.ConstItem.DefIEProxyExceptions)) if (Utils.IsNotEmpty(config.ConstItem.DefIEProxyExceptions))
{ {

View file

@ -258,7 +258,6 @@ namespace ServiceLib.Handler
proc.BeginErrorReadLine(); proc.BeginErrorReadLine();
} }
AppHandler.Instance.AddProcess(proc.Handle);
if (proc.WaitForExit(1000)) if (proc.WaitForExit(1000))
{ {
proc.CancelErrorRead(); proc.CancelErrorRead();

View file

@ -72,11 +72,6 @@
return; return;
} }
if(indexId == toIndexId)
{
return;
}
var stat = _lstServerStat.FirstOrDefault(t => t.IndexId == indexId); var stat = _lstServerStat.FirstOrDefault(t => t.IndexId == indexId);
if (stat == null) if (stat == null)
{ {

View file

@ -47,7 +47,6 @@
public SystemProxyItem SystemProxyItem { get; set; } public SystemProxyItem SystemProxyItem { get; set; }
public WebDavItem WebDavItem { get; set; } public WebDavItem WebDavItem { get; set; }
public CheckUpdateItem CheckUpdateItem { get; set; } public CheckUpdateItem CheckUpdateItem { get; set; }
public Fragment4RayItem? Fragment4RayItem { get; set; }
public List<InItem> Inbound { get; set; } public List<InItem> Inbound { get; set; }
public List<KeyEventItem> GlobalHotkeys { get; set; } public List<KeyEventItem> GlobalHotkeys { get; set; }
public List<CoreTypeItem> CoreTypeItem { get; set; } public List<CoreTypeItem> CoreTypeItem { get; set; }

View file

@ -102,8 +102,9 @@
public double MainGirdHeight1 { get; set; } public double MainGirdHeight1 { get; set; }
public double MainGirdHeight2 { get; set; } public double MainGirdHeight2 { get; set; }
public EGirdOrientation MainGirdOrientation { get; set; } = EGirdOrientation.Vertical; public EGirdOrientation MainGirdOrientation { get; set; } = EGirdOrientation.Vertical;
public bool ColorModeDark { get; set; }
public bool FollowSystemTheme { get; set; }
public string? ColorPrimaryName { get; set; } public string? ColorPrimaryName { get; set; }
public string? CurrentTheme { get; set; }
public string CurrentLanguage { get; set; } public string CurrentLanguage { get; set; }
public string CurrentFontFamily { get; set; } public string CurrentFontFamily { get; set; }
public int CurrentFontSize { get; set; } public int CurrentFontSize { get; set; }
@ -245,12 +246,4 @@
public bool CheckPreReleaseUpdate { get; set; } public bool CheckPreReleaseUpdate { get; set; }
public List<string>? SelectedCoreTypes { get; set; } public List<string>? SelectedCoreTypes { get; set; }
} }
[Serializable]
public class Fragment4RayItem
{
public string? Packets { get; set; }
public string? Length { get; set; }
public string? Interval { get; set; }
}
} }

View file

@ -942,6 +942,15 @@ namespace ServiceLib.Resx {
} }
} }
/// <summary>
/// 查找类似 Import old config (guiNConfig) 的本地化字符串。
/// </summary>
public static string menuImportOldGuiConfig {
get {
return ResourceManager.GetString("menuImportOldGuiConfig", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 Import Rules From Clipboard 的本地化字符串。 /// 查找类似 Import Rules From Clipboard 的本地化字符串。
/// </summary> /// </summary>
@ -1339,7 +1348,7 @@ namespace ServiceLib.Resx {
} }
/// <summary> /// <summary>
/// 查找类似 Import Rules 的本地化字符串。 /// 查找类似 Import Advanced Rules 的本地化字符串。
/// </summary> /// </summary>
public static string menuRoutingAdvancedImportRules { public static string menuRoutingAdvancedImportRules {
get { get {
@ -1527,6 +1536,15 @@ namespace ServiceLib.Resx {
} }
} }
/// <summary>
/// 查找类似 Save Interface Layout 的本地化字符串。
/// </summary>
public static string menuStorageUI {
get {
return ResourceManager.GetString("menuStorageUI", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 Add 的本地化字符串。 /// 查找类似 Add 的本地化字符串。
/// </summary> /// </summary>
@ -2338,6 +2356,15 @@ namespace ServiceLib.Resx {
} }
} }
/// <summary>
/// 查找类似 Enable advanced function 的本地化字符串。
/// </summary>
public static string TbenableRoutingAdvanced {
get {
return ResourceManager.GetString("TbenableRoutingAdvanced", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 Enable Tun 的本地化字符串。 /// 查找类似 Enable Tun 的本地化字符串。
/// </summary> /// </summary>
@ -2788,6 +2815,15 @@ namespace ServiceLib.Resx {
} }
} }
/// <summary>
/// 查找类似 Dark Mode 的本地化字符串。
/// </summary>
public static string TbSettingsColorMode {
get {
return ResourceManager.GetString("TbSettingsColorMode", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 Core: basic settings 的本地化字符串。 /// 查找类似 Core: basic settings 的本地化字符串。
/// </summary> /// </summary>
@ -3058,6 +3094,15 @@ namespace ServiceLib.Resx {
} }
} }
/// <summary>
/// 查找类似 Follow System Theme 的本地化字符串。
/// </summary>
public static string TbSettingsFollowSystemTheme {
get {
return ResourceManager.GetString("TbSettingsFollowSystemTheme", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 Font Size 的本地化字符串。 /// 查找类似 Font Size 的本地化字符串。
/// </summary> /// </summary>
@ -3418,15 +3463,6 @@ namespace ServiceLib.Resx {
} }
} }
/// <summary>
/// 查找类似 Theme 的本地化字符串。
/// </summary>
public static string TbSettingsTheme {
get {
return ResourceManager.GetString("TbSettingsTheme", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 Enable Security Protocol TLS v1.3 (subscription/update) 的本地化字符串。 /// 查找类似 Enable Security Protocol TLS v1.3 (subscription/update) 的本地化字符串。
/// </summary> /// </summary>

View file

@ -481,6 +481,9 @@
<data name="TbSettingsColor" xml:space="preserve"> <data name="TbSettingsColor" xml:space="preserve">
<value>رنگ</value> <value>رنگ</value>
</data> </data>
<data name="TbSettingsColorMode" xml:space="preserve">
<value>حالت تاریک</value>
</data>
<data name="TbSettingsLanguage" xml:space="preserve"> <data name="TbSettingsLanguage" xml:space="preserve">
<value>زبان</value> <value>زبان</value>
</data> </data>
@ -836,7 +839,7 @@
<value>اضافه کردن</value> <value>اضافه کردن</value>
</data> </data>
<data name="menuRoutingAdvancedImportRules" xml:space="preserve"> <data name="menuRoutingAdvancedImportRules" xml:space="preserve">
<value>وارد کردن مجموعه قوانین</value> <value>وارد کردن قوانین پیشرفته</value>
</data> </data>
<data name="menuRoutingAdvancedRemove" xml:space="preserve"> <data name="menuRoutingAdvancedRemove" xml:space="preserve">
<value>حذف انتخاب شده</value> <value>حذف انتخاب شده</value>
@ -850,6 +853,9 @@
<data name="TbdomainStrategy" xml:space="preserve"> <data name="TbdomainStrategy" xml:space="preserve">
<value>استراتژی دامنه</value> <value>استراتژی دامنه</value>
</data> </data>
<data name="TbenableRoutingAdvanced" xml:space="preserve">
<value>فعال کردن عملکرد پیشرفته</value>
</data>
<data name="TbRoutingTabBlock" xml:space="preserve"> <data name="TbRoutingTabBlock" xml:space="preserve">
<value>3. مسدود کردن دامنه یا آیپی</value> <value>3. مسدود کردن دامنه یا آیپی</value>
</data> </data>
@ -934,6 +940,9 @@
<data name="TbDisplayLog" xml:space="preserve"> <data name="TbDisplayLog" xml:space="preserve">
<value>نمایش گزارش</value> <value>نمایش گزارش</value>
</data> </data>
<data name="menuImportOldGuiConfig" xml:space="preserve">
<value>پیکربندی قدیمی guiNConfig را وارد شود</value>
</data>
<data name="TbEnableTunAs" xml:space="preserve"> <data name="TbEnableTunAs" xml:space="preserve">
<value>فعال سازی Tun</value> <value>فعال سازی Tun</value>
</data> </data>
@ -1096,6 +1105,9 @@
<data name="TipActiveServer" xml:space="preserve"> <data name="TipActiveServer" xml:space="preserve">
<value>فعال سازی</value> <value>فعال سازی</value>
</data> </data>
<data name="menuStorageUI" xml:space="preserve">
<value>ذخیره طرح رابط</value>
</data>
<data name="TbSettingsGeoFilesSource" xml:space="preserve"> <data name="TbSettingsGeoFilesSource" xml:space="preserve">
<value>منبع فایل های جغرافیایی (اختیاری)</value> <value>منبع فایل های جغرافیایی (اختیاری)</value>
</data> </data>
@ -1261,6 +1273,9 @@
<data name="TbSettingsHysteriaBandwidth" xml:space="preserve"> <data name="TbSettingsHysteriaBandwidth" xml:space="preserve">
<value>حداکتر پهنای باند هیستریا (آپلود/دانلود)</value> <value>حداکتر پهنای باند هیستریا (آپلود/دانلود)</value>
</data> </data>
<data name="TbSettingsFollowSystemTheme" xml:space="preserve">
<value>دنبال کردن تم سیستم</value>
</data>
<data name="menuAddTuicServer" xml:space="preserve"> <data name="menuAddTuicServer" xml:space="preserve">
<value>افزودن سرور [TUIC]</value> <value>افزودن سرور [TUIC]</value>
</data> </data>
@ -1387,7 +1402,4 @@
<data name="TbRoutingInboundTagTips" xml:space="preserve"> <data name="TbRoutingInboundTagTips" xml:space="preserve">
<value>socks:پورت محلی، socks2: پورت دوم محلی، socks3: پورت LAN</value> <value>socks:پورت محلی، socks2: پورت دوم محلی، socks3: پورت LAN</value>
</data> </data>
<data name="TbSettingsTheme" xml:space="preserve">
<value>تم</value>
</data>
</root> </root>

View file

@ -481,6 +481,12 @@
<data name="TbSettingsColor" xml:space="preserve"> <data name="TbSettingsColor" xml:space="preserve">
<value>Szín</value> <value>Szín</value>
</data> </data>
<data name="TbSettingsColorMode" xml:space="preserve">
<value>Sötét mód</value>
</data>
<data name="TbSettingsFollowSystemTheme" xml:space="preserve">
<value>Kövesse a rendszer témáját</value>
</data>
<data name="TbSettingsLanguage" xml:space="preserve"> <data name="TbSettingsLanguage" xml:space="preserve">
<value>Nyelv (Újraindítás)</value> <value>Nyelv (Újraindítás)</value>
</data> </data>
@ -850,6 +856,9 @@
<data name="TbdomainStrategy" xml:space="preserve"> <data name="TbdomainStrategy" xml:space="preserve">
<value>Domain stratégia</value> <value>Domain stratégia</value>
</data> </data>
<data name="TbenableRoutingAdvanced" xml:space="preserve">
<value>Fejlett funkció engedélyezése</value>
</data>
<data name="TbRoutingTabBlock" xml:space="preserve"> <data name="TbRoutingTabBlock" xml:space="preserve">
<value>3. Domain vagy IP blokkolása</value> <value>3. Domain vagy IP blokkolása</value>
</data> </data>
@ -934,6 +943,9 @@
<data name="TbDisplayLog" xml:space="preserve"> <data name="TbDisplayLog" xml:space="preserve">
<value>Napló megjelenítése</value> <value>Napló megjelenítése</value>
</data> </data>
<data name="menuImportOldGuiConfig" xml:space="preserve">
<value>Régi konfiguráció importálása (guiNConfig)</value>
</data>
<data name="TbEnableTunAs" xml:space="preserve"> <data name="TbEnableTunAs" xml:space="preserve">
<value>Tun engedélyezése</value> <value>Tun engedélyezése</value>
</data> </data>
@ -1306,6 +1318,9 @@
<data name="TipActiveServer" xml:space="preserve"> <data name="TipActiveServer" xml:space="preserve">
<value>Aktív</value> <value>Aktív</value>
</data> </data>
<data name="menuStorageUI" xml:space="preserve">
<value>Szoftverfelület elmentése</value>
</data>
<data name="TbSettingsGeoFilesSource" xml:space="preserve"> <data name="TbSettingsGeoFilesSource" xml:space="preserve">
<value>Geo fájlok forrása (opcionális)</value> <value>Geo fájlok forrása (opcionális)</value>
</data> </data>
@ -1387,7 +1402,4 @@
<data name="TbRoutingInboundTagTips" xml:space="preserve"> <data name="TbRoutingInboundTagTips" xml:space="preserve">
<value>socks: local port, socks2: second local port, socks3: LAN port</value> <value>socks: local port, socks2: second local port, socks3: LAN port</value>
</data> </data>
<data name="TbSettingsTheme" xml:space="preserve">
<value>Theme</value>
</data>
</root> </root>

View file

@ -481,6 +481,12 @@
<data name="TbSettingsColor" xml:space="preserve"> <data name="TbSettingsColor" xml:space="preserve">
<value>Color</value> <value>Color</value>
</data> </data>
<data name="TbSettingsColorMode" xml:space="preserve">
<value>Dark Mode</value>
</data>
<data name="TbSettingsFollowSystemTheme" xml:space="preserve">
<value>Follow System Theme</value>
</data>
<data name="TbSettingsLanguage" xml:space="preserve"> <data name="TbSettingsLanguage" xml:space="preserve">
<value>Language (Restart)</value> <value>Language (Restart)</value>
</data> </data>
@ -836,7 +842,7 @@
<value>Add</value> <value>Add</value>
</data> </data>
<data name="menuRoutingAdvancedImportRules" xml:space="preserve"> <data name="menuRoutingAdvancedImportRules" xml:space="preserve">
<value>Import Rules</value> <value>Import Advanced Rules</value>
</data> </data>
<data name="menuRoutingAdvancedRemove" xml:space="preserve"> <data name="menuRoutingAdvancedRemove" xml:space="preserve">
<value>Remove selected (Delete)</value> <value>Remove selected (Delete)</value>
@ -850,6 +856,9 @@
<data name="TbdomainStrategy" xml:space="preserve"> <data name="TbdomainStrategy" xml:space="preserve">
<value>Domain strategy</value> <value>Domain strategy</value>
</data> </data>
<data name="TbenableRoutingAdvanced" xml:space="preserve">
<value>Enable advanced function</value>
</data>
<data name="TbRoutingTabBlock" xml:space="preserve"> <data name="TbRoutingTabBlock" xml:space="preserve">
<value>3.Block Domain or IP</value> <value>3.Block Domain or IP</value>
</data> </data>
@ -934,6 +943,9 @@
<data name="TbDisplayLog" xml:space="preserve"> <data name="TbDisplayLog" xml:space="preserve">
<value>Display Log</value> <value>Display Log</value>
</data> </data>
<data name="menuImportOldGuiConfig" xml:space="preserve">
<value>Import old config (guiNConfig)</value>
</data>
<data name="TbEnableTunAs" xml:space="preserve"> <data name="TbEnableTunAs" xml:space="preserve">
<value>Enable Tun</value> <value>Enable Tun</value>
</data> </data>
@ -1306,6 +1318,9 @@
<data name="TipActiveServer" xml:space="preserve"> <data name="TipActiveServer" xml:space="preserve">
<value>Active</value> <value>Active</value>
</data> </data>
<data name="menuStorageUI" xml:space="preserve">
<value>Save Interface Layout</value>
</data>
<data name="TbSettingsGeoFilesSource" xml:space="preserve"> <data name="TbSettingsGeoFilesSource" xml:space="preserve">
<value>Geo files source (optional)</value> <value>Geo files source (optional)</value>
</data> </data>
@ -1387,7 +1402,4 @@
<data name="TbRoutingInboundTagTips" xml:space="preserve"> <data name="TbRoutingInboundTagTips" xml:space="preserve">
<value>socks: local port, socks2: second local port, socks3: LAN port</value> <value>socks: local port, socks2: second local port, socks3: LAN port</value>
</data> </data>
<data name="TbSettingsTheme" xml:space="preserve">
<value>Theme</value>
</data>
</root> </root>

View file

@ -481,6 +481,12 @@
<data name="TbSettingsColor" xml:space="preserve"> <data name="TbSettingsColor" xml:space="preserve">
<value>Цвет</value> <value>Цвет</value>
</data> </data>
<data name="TbSettingsColorMode" xml:space="preserve">
<value>Тёмный режим</value>
</data>
<data name="TbSettingsFollowSystemTheme" xml:space="preserve">
<value>Следить за системной темой</value>
</data>
<data name="TbSettingsLanguage" xml:space="preserve"> <data name="TbSettingsLanguage" xml:space="preserve">
<value>Язык (требуется перезапуск)</value> <value>Язык (требуется перезапуск)</value>
</data> </data>
@ -856,6 +862,9 @@
<data name="TbdomainStrategy" xml:space="preserve"> <data name="TbdomainStrategy" xml:space="preserve">
<value>Доменная стратегия</value> <value>Доменная стратегия</value>
</data> </data>
<data name="TbenableRoutingAdvanced" xml:space="preserve">
<value>Включить расширенные функции</value>
</data>
<data name="TbRoutingTabBlock" xml:space="preserve"> <data name="TbRoutingTabBlock" xml:space="preserve">
<value>3.Заблокировать домен или IP</value> <value>3.Заблокировать домен или IP</value>
</data> </data>
@ -940,6 +949,9 @@
<data name="TbDisplayLog" xml:space="preserve"> <data name="TbDisplayLog" xml:space="preserve">
<value>Показать логи</value> <value>Показать логи</value>
</data> </data>
<data name="menuImportOldGuiConfig" xml:space="preserve">
<value>Импортировать старый конфиг guiNConfig</value>
</data>
<data name="TbEnableTunAs" xml:space="preserve"> <data name="TbEnableTunAs" xml:space="preserve">
<value>Режим VPN</value> <value>Режим VPN</value>
</data> </data>
@ -1258,6 +1270,9 @@
<data name="LvConvertTarget" xml:space="preserve"> <data name="LvConvertTarget" xml:space="preserve">
<value>Convert target type</value> <value>Convert target type</value>
</data> </data>
<data name="menuStorageUI" xml:space="preserve">
<value>Save Interface Layout</value>
</data>
<data name="SpeedDisplayText" xml:space="preserve"> <data name="SpeedDisplayText" xml:space="preserve">
<value>{0} : {1}/s↑ | {2}/s↓</value> <value>{0} : {1}/s↑ | {2}/s↓</value>
</data> </data>
@ -1387,7 +1402,4 @@
<data name="TbRoutingInboundTagTips" xml:space="preserve"> <data name="TbRoutingInboundTagTips" xml:space="preserve">
<value>socks: local port, socks2: second local port, socks3: LAN port</value> <value>socks: local port, socks2: second local port, socks3: LAN port</value>
</data> </data>
<data name="TbSettingsTheme" xml:space="preserve">
<value>Theme</value>
</data>
</root> </root>

View file

@ -481,6 +481,12 @@
<data name="TbSettingsColor" xml:space="preserve"> <data name="TbSettingsColor" xml:space="preserve">
<value>颜色</value> <value>颜色</value>
</data> </data>
<data name="TbSettingsColorMode" xml:space="preserve">
<value>暗黑模式</value>
</data>
<data name="TbSettingsFollowSystemTheme" xml:space="preserve">
<value>跟随系统主题</value>
</data>
<data name="TbSettingsLanguage" xml:space="preserve"> <data name="TbSettingsLanguage" xml:space="preserve">
<value>语言(需重启)</value> <value>语言(需重启)</value>
</data> </data>
@ -836,7 +842,7 @@
<value>添加规则集</value> <value>添加规则集</value>
</data> </data>
<data name="menuRoutingAdvancedImportRules" xml:space="preserve"> <data name="menuRoutingAdvancedImportRules" xml:space="preserve">
<value>一键导入规则</value> <value>一键导入高级规则</value>
</data> </data>
<data name="menuRoutingAdvancedRemove" xml:space="preserve"> <data name="menuRoutingAdvancedRemove" xml:space="preserve">
<value>移除所选规则 (Delete)</value> <value>移除所选规则 (Delete)</value>
@ -850,6 +856,9 @@
<data name="TbdomainStrategy" xml:space="preserve"> <data name="TbdomainStrategy" xml:space="preserve">
<value>域名解析策略</value> <value>域名解析策略</value>
</data> </data>
<data name="TbenableRoutingAdvanced" xml:space="preserve">
<value>启用高级功能</value>
</data>
<data name="TbRoutingTabBlock" xml:space="preserve"> <data name="TbRoutingTabBlock" xml:space="preserve">
<value>3.阻止的Domain或IP</value> <value>3.阻止的Domain或IP</value>
</data> </data>
@ -934,6 +943,9 @@
<data name="TbDisplayLog" xml:space="preserve"> <data name="TbDisplayLog" xml:space="preserve">
<value>显示日志</value> <value>显示日志</value>
</data> </data>
<data name="menuImportOldGuiConfig" xml:space="preserve">
<value>导入旧的配置文件guiNConfig</value>
</data>
<data name="TbEnableTunAs" xml:space="preserve"> <data name="TbEnableTunAs" xml:space="preserve">
<value>启用Tun</value> <value>启用Tun</value>
</data> </data>
@ -1303,6 +1315,9 @@
<data name="TipActiveServer" xml:space="preserve"> <data name="TipActiveServer" xml:space="preserve">
<value>活动</value> <value>活动</value>
</data> </data>
<data name="menuStorageUI" xml:space="preserve">
<value>保存界面布局</value>
</data>
<data name="TbSettingsGeoFilesSource" xml:space="preserve"> <data name="TbSettingsGeoFilesSource" xml:space="preserve">
<value>Geo文件来源(可选)</value> <value>Geo文件来源(可选)</value>
</data> </data>
@ -1384,7 +1399,4 @@
<data name="TbRoutingInboundTagTips" xml:space="preserve"> <data name="TbRoutingInboundTagTips" xml:space="preserve">
<value>socks本地端口socks2第二个本地端口socks3局域网端口</value> <value>socks本地端口socks2第二个本地端口socks3局域网端口</value>
</data> </data>
<data name="TbSettingsTheme" xml:space="preserve">
<value>主题</value>
</data>
</root> </root>

View file

@ -481,6 +481,12 @@
<data name="TbSettingsColor" xml:space="preserve"> <data name="TbSettingsColor" xml:space="preserve">
<value>顏色</value> <value>顏色</value>
</data> </data>
<data name="TbSettingsColorMode" xml:space="preserve">
<value>暗黑模式</value>
</data>
<data name="TbSettingsFollowSystemTheme" xml:space="preserve">
<value>跟隨系統主題</value>
</data>
<data name="TbSettingsLanguage" xml:space="preserve"> <data name="TbSettingsLanguage" xml:space="preserve">
<value>語言(需重啟)</value> <value>語言(需重啟)</value>
</data> </data>
@ -837,7 +843,7 @@
<value>新增規則集</value> <value>新增規則集</value>
</data> </data>
<data name="menuRoutingAdvancedImportRules" xml:space="preserve"> <data name="menuRoutingAdvancedImportRules" xml:space="preserve">
<value>一鍵匯入規則</value> <value>一鍵匯入進階規則</value>
</data> </data>
<data name="menuRoutingAdvancedRemove" xml:space="preserve"> <data name="menuRoutingAdvancedRemove" xml:space="preserve">
<value>移除所選規則 (Delete)</value> <value>移除所選規則 (Delete)</value>
@ -851,6 +857,9 @@
<data name="TbdomainStrategy" xml:space="preserve"> <data name="TbdomainStrategy" xml:space="preserve">
<value>域名解析策略</value> <value>域名解析策略</value>
</data> </data>
<data name="TbenableRoutingAdvanced" xml:space="preserve">
<value>啟動進階功能</value>
</data>
<data name="TbRoutingTabBlock" xml:space="preserve"> <data name="TbRoutingTabBlock" xml:space="preserve">
<value>3.阻止的Domain或IP</value> <value>3.阻止的Domain或IP</value>
</data> </data>
@ -935,6 +944,9 @@
<data name="TbDisplayLog" xml:space="preserve"> <data name="TbDisplayLog" xml:space="preserve">
<value>顯示日誌</value> <value>顯示日誌</value>
</data> </data>
<data name="menuImportOldGuiConfig" xml:space="preserve">
<value>匯入舊的設定檔guiNConfig</value>
</data>
<data name="TbEnableTunAs" xml:space="preserve"> <data name="TbEnableTunAs" xml:space="preserve">
<value>啟用Tun</value> <value>啟用Tun</value>
</data> </data>
@ -1184,6 +1196,9 @@
<data name="TipActiveServer" xml:space="preserve"> <data name="TipActiveServer" xml:space="preserve">
<value>活動</value> <value>活動</value>
</data> </data>
<data name="menuStorageUI" xml:space="preserve">
<value>儲存介面佈局</value>
</data>
<data name="TbSettingsGeoFilesSource" xml:space="preserve"> <data name="TbSettingsGeoFilesSource" xml:space="preserve">
<value>Geo檔案來源(可選)</value> <value>Geo檔案來源(可選)</value>
</data> </data>
@ -1385,7 +1400,4 @@
<data name="TbRoutingInboundTagTips" xml:space="preserve"> <data name="TbRoutingInboundTagTips" xml:space="preserve">
<value>socks本地端口socks2第二個本地端口socks3區域網路端口</value> <value>socks本地端口socks2第二個本地端口socks3區域網路端口</value>
</data> </data>
<data name="TbSettingsTheme" xml:space="preserve">
<value>主題</value>
</data>
</root> </root>

View file

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

View file

@ -1259,8 +1259,7 @@ namespace ServiceLib.Services.CoreConfig
singboxConfig.experimental ??= new Experimental4Sbox(); singboxConfig.experimental ??= new Experimental4Sbox();
singboxConfig.experimental.cache_file = new CacheFile4Sbox() singboxConfig.experimental.cache_file = new CacheFile4Sbox()
{ {
enabled = true, enabled = true
path = Utils.GetConfigPath("cache.db")
}; };
} }

View file

@ -567,7 +567,6 @@ namespace ServiceLib.Services.CoreConfig
{ {
try try
{ {
var muxEnabled = _config.CoreBasicItem.MuxEnabled;
switch (node.ConfigType) switch (node.ConfigType)
{ {
case EConfigType.VMess: case EConfigType.VMess:
@ -608,7 +607,7 @@ namespace ServiceLib.Services.CoreConfig
usersItem.security = Global.DefaultSecurity; usersItem.security = Global.DefaultSecurity;
} }
await GenOutboundMux(node, outbound, muxEnabled, muxEnabled); await GenOutboundMux(node, outbound, _config.CoreBasicItem.MuxEnabled);
outbound.settings.servers = null; outbound.settings.servers = null;
break; break;
@ -633,7 +632,7 @@ namespace ServiceLib.Services.CoreConfig
serversItem.ota = false; serversItem.ota = false;
serversItem.level = 1; serversItem.level = 1;
await GenOutboundMux(node, outbound); await GenOutboundMux(node, outbound, false);
outbound.settings.vnext = null; outbound.settings.vnext = null;
break; break;
@ -669,7 +668,7 @@ namespace ServiceLib.Services.CoreConfig
serversItem.users = new List<SocksUsersItem4Ray>() { socksUsersItem }; serversItem.users = new List<SocksUsersItem4Ray>() { socksUsersItem };
} }
await GenOutboundMux(node, outbound); await GenOutboundMux(node, outbound, false);
outbound.settings.vnext = null; outbound.settings.vnext = null;
break; break;
@ -703,15 +702,22 @@ namespace ServiceLib.Services.CoreConfig
usersItem.email = Global.UserEMail; usersItem.email = Global.UserEMail;
usersItem.encryption = node.Security; usersItem.encryption = node.Security;
if (node.Flow.IsNullOrEmpty()) await GenOutboundMux(node, outbound, _config.CoreBasicItem.MuxEnabled);
if (node.StreamSecurity == Global.StreamSecurityReality || node.StreamSecurity == Global.StreamSecurity)
{ {
await GenOutboundMux(node, outbound, muxEnabled, muxEnabled); if (Utils.IsNotEmpty(node.Flow))
{
usersItem.flow = node.Flow;
await GenOutboundMux(node, outbound, false);
}
} }
else if (node.StreamSecurity == Global.StreamSecurityReality && Utils.IsNullOrEmpty(node.Flow))
{ {
usersItem.flow = node.Flow; await GenOutboundMux(node, outbound, _config.CoreBasicItem.MuxEnabled);
await GenOutboundMux(node, outbound, false, muxEnabled);
} }
outbound.settings.servers = null; outbound.settings.servers = null;
break; break;
} }
@ -734,7 +740,7 @@ namespace ServiceLib.Services.CoreConfig
serversItem.ota = false; serversItem.ota = false;
serversItem.level = 1; serversItem.level = 1;
await GenOutboundMux(node, outbound); await GenOutboundMux(node, outbound, false);
outbound.settings.vnext = null; outbound.settings.vnext = null;
break; break;
@ -751,24 +757,22 @@ namespace ServiceLib.Services.CoreConfig
return 0; return 0;
} }
private async Task<int> GenOutboundMux(ProfileItem node, Outbounds4Ray outbound, bool enabledTCP = false, bool enabledUDP = false) private async Task<int> GenOutboundMux(ProfileItem node, Outbounds4Ray outbound, bool enabled)
{ {
try try
{ {
outbound.mux.enabled = false; if (enabled)
outbound.mux.concurrency = -1;
if (enabledTCP)
{ {
outbound.mux.enabled = true; outbound.mux.enabled = true;
outbound.mux.concurrency = _config.Mux4RayItem.Concurrency; outbound.mux.concurrency = _config.Mux4RayItem.Concurrency;
}
else if (enabledUDP)
{
outbound.mux.enabled = true;
outbound.mux.xudpConcurrency = _config.Mux4RayItem.XudpConcurrency; outbound.mux.xudpConcurrency = _config.Mux4RayItem.XudpConcurrency;
outbound.mux.xudpProxyUDP443 = _config.Mux4RayItem.XudpProxyUDP443; outbound.mux.xudpProxyUDP443 = _config.Mux4RayItem.XudpProxyUDP443;
} }
else
{
outbound.mux.enabled = false;
outbound.mux.concurrency = -1;
}
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -924,7 +928,7 @@ namespace ServiceLib.Services.CoreConfig
} }
streamSettings.xhttpSettings = xhttpSettings; streamSettings.xhttpSettings = xhttpSettings;
await GenOutboundMux(node, outbound); await GenOutboundMux(node, outbound, false);
break; break;
//h2 //h2
@ -1034,13 +1038,9 @@ namespace ServiceLib.Services.CoreConfig
//Outbound Freedom domainStrategy //Outbound Freedom domainStrategy
if (Utils.IsNotEmpty(domainStrategy4Freedom)) if (Utils.IsNotEmpty(domainStrategy4Freedom))
{ {
var outbound = v2rayConfig.outbounds.FirstOrDefault(t => t is { protocol: "freedom", tag: Global.DirectTag }); var outbound = v2rayConfig.outbounds[1];
if (outbound != null) outbound.settings.domainStrategy = domainStrategy4Freedom;
{ outbound.settings.userLevel = 0;
outbound.settings = new();
outbound.settings.domainStrategy = domainStrategy4Freedom;
outbound.settings.userLevel = 0;
}
} }
var obj = JsonUtils.ParseJson(normalDNS); var obj = JsonUtils.ParseJson(normalDNS);
@ -1167,9 +1167,9 @@ namespace ServiceLib.Services.CoreConfig
{ {
fragment = new() fragment = new()
{ {
packets = _config.Fragment4RayItem?.Packets, packets = "tlshello",
length = _config.Fragment4RayItem?.Length, length = "100-200",
interval = _config.Fragment4RayItem?.Interval interval = "10-20"
} }
} }
}; };

View file

@ -59,14 +59,14 @@ namespace ServiceLib.ViewModels
{ {
return; return;
} }
if (!_config.UiItem.ShowInTaskbar)
{
return;
}
_blLockShow = true; _blLockShow = true;
if (!_config.UiItem.ShowInTaskbar)
{
await Task.Delay(1000);
}
await Task.Delay(500); await Task.Delay(100);
var txt = string.Join("", _queueMsg.ToArray()); var txt = string.Join("", _queueMsg.ToArray());
await _updateView?.Invoke(EViewAction.DispatcherShowMsg, txt); await _updateView?.Invoke(EViewAction.DispatcherShowMsg, txt);

View file

@ -2,8 +2,6 @@
using ReactiveUI; using ReactiveUI;
using ReactiveUI.Fody.Helpers; using ReactiveUI.Fody.Helpers;
using System.Reactive; using System.Reactive;
using System.Text.Json;
using System.Text.Json.Serialization;
namespace ServiceLib.ViewModels namespace ServiceLib.ViewModels
{ {
@ -191,13 +189,7 @@ namespace ServiceLib.ViewModels
} }
if (lst.Count > 0) if (lst.Count > 0)
{ {
var options = new JsonSerializerOptions await _updateView?.Invoke(EViewAction.SetClipboardData, JsonUtils.Serialize(lst));
{
WriteIndented = true,
DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull,
PropertyNamingPolicy = JsonNamingPolicy.CamelCase,
};
await _updateView?.Invoke(EViewAction.SetClipboardData, JsonUtils.Serialize(lst, options));
} }
} }

View file

@ -48,6 +48,18 @@ namespace ServiceLib.ViewModels
[Reactive] [Reactive]
public bool BlSystemProxyPac { get; set; } public bool BlSystemProxyPac { get; set; }
[Reactive]
public bool BlNotSystemProxyClear { get; set; }
[Reactive]
public bool BlNotSystemProxySet { get; set; }
[Reactive]
public bool BlNotSystemProxyNothing { get; set; }
[Reactive]
public bool BlNotSystemProxyPac { get; set; }
public ReactiveCommand<Unit, Unit> SystemProxyClearCmd { get; } public ReactiveCommand<Unit, Unit> SystemProxyClearCmd { get; }
public ReactiveCommand<Unit, Unit> SystemProxySetCmd { get; } public ReactiveCommand<Unit, Unit> SystemProxySetCmd { get; }
public ReactiveCommand<Unit, Unit> SystemProxyNothingCmd { get; } public ReactiveCommand<Unit, Unit> SystemProxyNothingCmd { get; }
@ -321,6 +333,11 @@ namespace ServiceLib.ViewModels
BlSystemProxyNothing = (type == ESysProxyType.Unchanged); BlSystemProxyNothing = (type == ESysProxyType.Unchanged);
BlSystemProxyPac = (type == ESysProxyType.Pac); BlSystemProxyPac = (type == ESysProxyType.Pac);
BlNotSystemProxyClear = !BlSystemProxyClear;
BlNotSystemProxySet = !BlSystemProxySet;
BlNotSystemProxyNothing = !BlSystemProxyNothing;
BlNotSystemProxyPac = !BlSystemProxyPac;
if (blChange) if (blChange)
{ {
_updateView?.Invoke(EViewAction.DispatcherRefreshIcon, null); _updateView?.Invoke(EViewAction.DispatcherRefreshIcon, null);

View file

@ -32,18 +32,32 @@
<NativeMenuItem <NativeMenuItem
Command="{Binding SystemProxyClearCmd}" Command="{Binding SystemProxyClearCmd}"
Header="{x:Static resx:ResUI.menuSystemProxyClear}" Header="{x:Static resx:ResUI.menuSystemProxyClear}"
IsChecked="{Binding BlSystemProxyClear}" IsVisible="{Binding BlNotSystemProxyClear}" />
ToggleType="Radio" /> <NativeMenuItem
Command="{Binding SystemProxyClearCmd}"
Header="{x:Static resx:ResUI.menuSystemProxyClear}"
Icon="/Assets/NotifyIcon1.ico"
IsVisible="{Binding BlSystemProxyClear}" />
<NativeMenuItem <NativeMenuItem
Command="{Binding SystemProxySetCmd}" Command="{Binding SystemProxySetCmd}"
Header="{x:Static resx:ResUI.menuSystemProxySet}" Header="{x:Static resx:ResUI.menuSystemProxySet}"
IsChecked="{Binding BlSystemProxySet}" IsVisible="{Binding BlNotSystemProxySet}" />
ToggleType="Radio" /> <NativeMenuItem
Command="{Binding SystemProxySetCmd}"
Header="{x:Static resx:ResUI.menuSystemProxySet}"
Icon="/Assets/NotifyIcon2.ico"
IsVisible="{Binding BlSystemProxySet}" />
<NativeMenuItem <NativeMenuItem
Command="{Binding SystemProxyNothingCmd}" Command="{Binding SystemProxyNothingCmd}"
Header="{x:Static resx:ResUI.menuSystemProxyNothing}" Header="{x:Static resx:ResUI.menuSystemProxyNothing}"
IsChecked="{Binding BlSystemProxyNothing}" IsVisible="{Binding BlNotSystemProxyNothing}" />
ToggleType="Radio" /> <NativeMenuItem
Command="{Binding SystemProxyNothingCmd}"
Header="{x:Static resx:ResUI.menuSystemProxyNothing}"
Icon="/Assets/NotifyIcon3.ico"
IsVisible="{Binding BlSystemProxyNothing}" />
<NativeMenuItemSeparator /> <NativeMenuItemSeparator />
<NativeMenuItem Click="MenuAddServerViaClipboardClick" Header="{x:Static resx:ResUI.menuAddServerViaClipboard}" /> <NativeMenuItem Click="MenuAddServerViaClipboardClick" Header="{x:Static resx:ResUI.menuAddServerViaClipboard}" />
<NativeMenuItem Header="{x:Static resx:ResUI.menuAddServerViaScan}" IsVisible="False" /> <NativeMenuItem Header="{x:Static resx:ResUI.menuAddServerViaScan}" IsVisible="False" />

View file

@ -40,12 +40,6 @@ namespace v2rayN.Desktop.Common
public static WindowIcon GetAppIcon(ESysProxyType sysProxyType) public static WindowIcon GetAppIcon(ESysProxyType sysProxyType)
{ {
var index = (int)sysProxyType + 1; var index = (int)sysProxyType + 1;
var fileName = Utils.GetPath($"NotifyIcon{index}.ico");
if (File.Exists(fileName))
{
return new(fileName);
}
var uri = new Uri(Path.Combine(Global.AvaAssets, $"NotifyIcon{index}.ico")); var uri = new Uri(Path.Combine(Global.AvaAssets, $"NotifyIcon{index}.ico"));
using var bitmap = new Bitmap(AssetLoader.Open(uri)); using var bitmap = new Bitmap(AssetLoader.Open(uri));
return new(bitmap); return new(bitmap);

View file

@ -17,11 +17,13 @@ namespace v2rayN.Desktop.Common
public static async Task<string?> OpenFileDialog(Window owner, FilePickerFileType? filter) public static async Task<string?> OpenFileDialog(Window owner, FilePickerFileType? filter)
{ {
var sp = GetStorageProvider(owner); var topLevel = TopLevel.GetTopLevel(owner);
if (sp is null) return null; if (topLevel == null)
{
return null;
}
// Start async operation to open the dialog. // Start async operation to open the dialog.
var files = await sp.OpenFilePickerAsync(new FilePickerOpenOptions var files = await topLevel.StorageProvider.OpenFilePickerAsync(new FilePickerOpenOptions
{ {
AllowMultiple = false, AllowMultiple = false,
FileTypeFilter = filter is null ? [FilePickerFileTypes.All, FilePickerFileTypes.ImagePng] : [filter] FileTypeFilter = filter is null ? [FilePickerFileTypes.All, FilePickerFileTypes.ImagePng] : [filter]
@ -32,21 +34,17 @@ namespace v2rayN.Desktop.Common
public static async Task<string?> SaveFileDialog(Window owner, string filter) public static async Task<string?> SaveFileDialog(Window owner, string filter)
{ {
var sp = GetStorageProvider(owner); var topLevel = TopLevel.GetTopLevel(owner);
if (sp is null) return null; if (topLevel == null)
{
return null;
}
// Start async operation to open the dialog. // Start async operation to open the dialog.
var files = await sp.SaveFilePickerAsync(new FilePickerSaveOptions var files = await topLevel.StorageProvider.SaveFilePickerAsync(new FilePickerSaveOptions
{ {
}); });
return files?.TryGetLocalPath(); return files?.TryGetLocalPath();
} }
private static IStorageProvider? GetStorageProvider(Window owner)
{
var topLevel = TopLevel.GetTopLevel(owner);
return topLevel?.StorageProvider;
}
} }
} }

View file

@ -6,14 +6,14 @@ using Avalonia.Media;
using Avalonia.Styling; using Avalonia.Styling;
using ReactiveUI; using ReactiveUI;
using ReactiveUI.Fody.Helpers; using ReactiveUI.Fody.Helpers;
using Semi.Avalonia;
using System.Reactive.Linq; using System.Reactive.Linq;
namespace v2rayN.Desktop.ViewModels namespace v2rayN.Desktop.ViewModels
{ {
public class ThemeSettingViewModel : MyReactiveObject public class ThemeSettingViewModel : MyReactiveObject
{ {
[Reactive] public string CurrentTheme { get; set; } [Reactive] public bool ColorModeDark { get; set; }
[Reactive] public bool FollowSystemTheme { get; set; }
[Reactive] public int CurrentFontSize { get; set; } [Reactive] public int CurrentFontSize { get; set; }
@ -36,16 +36,28 @@ namespace v2rayN.Desktop.ViewModels
private void BindingUI() private void BindingUI()
{ {
CurrentTheme = _config.UiItem.CurrentTheme; ColorModeDark = _config.UiItem.ColorModeDark;
FollowSystemTheme = _config.UiItem.FollowSystemTheme;
CurrentFontSize = _config.UiItem.CurrentFontSize; CurrentFontSize = _config.UiItem.CurrentFontSize;
CurrentLanguage = _config.UiItem.CurrentLanguage; CurrentLanguage = _config.UiItem.CurrentLanguage;
this.WhenAnyValue(x => x.CurrentTheme) this.WhenAnyValue(x => x.ColorModeDark)
.Subscribe(c => .Subscribe(c =>
{ {
if (_config.UiItem.CurrentTheme != CurrentTheme) if (_config.UiItem.ColorModeDark != ColorModeDark)
{ {
_config.UiItem.CurrentTheme = CurrentTheme; _config.UiItem.ColorModeDark = ColorModeDark;
ModifyTheme();
ConfigHandler.SaveConfig(_config);
}
});
this.WhenAnyValue(x => x.FollowSystemTheme,
y => y == true)
.Subscribe(c =>
{
if (_config.UiItem.FollowSystemTheme != FollowSystemTheme)
{
_config.UiItem.FollowSystemTheme = FollowSystemTheme;
ModifyTheme(); ModifyTheme();
ConfigHandler.SaveConfig(_config); ConfigHandler.SaveConfig(_config);
} }
@ -84,16 +96,7 @@ namespace v2rayN.Desktop.ViewModels
var app = Application.Current; var app = Application.Current;
if (app is not null) if (app is not null)
{ {
app.RequestedThemeVariant = CurrentTheme switch app.RequestedThemeVariant = FollowSystemTheme ? ThemeVariant.Default : (ColorModeDark ? ThemeVariant.Dark : ThemeVariant.Light);
{
nameof(ETheme.Dark) => ThemeVariant.Dark,
nameof(ETheme.Light) => ThemeVariant.Light,
nameof(ETheme.Aquatic) => SemiTheme.Aquatic,
nameof(ETheme.Desert) => SemiTheme.Desert,
nameof(ETheme.Dusk) => SemiTheme.Dusk,
nameof(ETheme.NightSky) => SemiTheme.NightSky,
_ => ThemeVariant.Default,
};
} }
} }

View file

@ -5,28 +5,25 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib" xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib"
xmlns:vms="clr-namespace:ServiceLib.ViewModels;assembly=ServiceLib"
d:DesignHeight="450" d:DesignHeight="450"
d:DesignWidth="800" d:DesignWidth="800"
x:DataType="vms:BackupAndRestoreViewModel"
mc:Ignorable="d"> mc:Ignorable="d">
<UserControl.Styles>
<Style Selector="Button">
<Setter Property="MinWidth" Value="180" />
</Style>
</UserControl.Styles>
<DockPanel Classes="Margin8"> <DockPanel Classes="Margin8">
<StackPanel Classes="Margin8" DockPanel.Dock="Bottom"> <DockPanel Classes="Margin8" DockPanel.Dock="Bottom">
<TextBlock <TextBlock
Name="txtMsg" Name="txtMsg"
HorizontalAlignment="Left" HorizontalAlignment="Left"
Classes="Margin8" /> Classes="Margin8" />
</StackPanel> </DockPanel>
<StackPanel> <StackPanel>
<Border <Border
Margin="4" Margin="4"
VerticalAlignment="Center" VerticalAlignment="Center"
Theme="{DynamicResource CardBorder}"> Theme="{StaticResource CardBorder}">
<Grid <Grid
Classes="Margin8" Classes="Margin8"
@ -52,10 +49,7 @@
Classes="Margin8" Classes="Margin8"
Content="{x:Static resx:ResUI.menuLocalBackup}" /> Content="{x:Static resx:ResUI.menuLocalBackup}" />
<Separator <Separator Grid.Row="2" Grid.ColumnSpan="2" />
Grid.Row="2"
Grid.Column="0"
Grid.ColumnSpan="2" />
<TextBlock <TextBlock
Grid.Row="3" Grid.Row="3"
@ -75,21 +69,21 @@
<Border <Border
Margin="4" Margin="4"
VerticalAlignment="Center" VerticalAlignment="Center"
Theme="{DynamicResource CardBorder}"> Theme="{StaticResource CardBorder}">
<Grid <Grid
Classes="Margin8" Classes="Margin8"
ColumnDefinitions="300,200" ColumnDefinitions="300,200"
RowDefinitions="Auto,Auto,Auto,Auto,Auto"> RowDefinitions="Auto,Auto,Auto,Auto,Auto">
<StackPanel <StackPanel Orientation="Horizontal">
Grid.Row="0" <TextBlock
Grid.Column="0" Grid.Row="0"
Orientation="Horizontal"> Grid.Column="0"
<TextBlock Classes="Margin8" Text="{x:Static resx:ResUI.menuRemoteBackupAndRestore}" /> Classes="Margin8"
Text="{x:Static resx:ResUI.menuRemoteBackupAndRestore}" />
<Button <Button
Width="30" Width="30"
Height="30" Height="30"
MinWidth="30"
Margin="10,0" Margin="10,0"
Theme="{DynamicResource BorderlessButton}"> Theme="{DynamicResource BorderlessButton}">
<Button.Content> <Button.Content>
@ -190,10 +184,7 @@
Classes="Margin8" Classes="Margin8"
Content="{x:Static resx:ResUI.menuRemoteBackup}" /> Content="{x:Static resx:ResUI.menuRemoteBackup}" />
<Separator <Separator Grid.Row="2" Grid.ColumnSpan="3" />
Grid.Row="2"
Grid.Column="0"
Grid.ColumnSpan="2" />
<TextBlock <TextBlock
Grid.Row="3" Grid.Row="3"
Grid.Column="0" Grid.Column="0"

View file

@ -9,12 +9,7 @@ namespace v2rayN.Desktop.Views
{ {
public partial class BackupAndRestoreView : ReactiveUserControl<BackupAndRestoreViewModel> public partial class BackupAndRestoreView : ReactiveUserControl<BackupAndRestoreViewModel>
{ {
private Window? _window; private Window _window;
public BackupAndRestoreView()
{
InitializeComponent();
}
public BackupAndRestoreView(Window window) public BackupAndRestoreView(Window window)
{ {

View file

@ -35,16 +35,11 @@
Content="{x:Static resx:ResUI.menuCheckUpdate}" /> Content="{x:Static resx:ResUI.menuCheckUpdate}" />
</StackPanel> </StackPanel>
<Border <StackPanel>
Margin="4"
VerticalAlignment="Center"
Theme="{DynamicResource CardBorder}">
<ListBox <ListBox
x:Name="lstCheckUpdates" x:Name="lstCheckUpdates"
BorderThickness="1" BorderThickness="1"
ItemsSource="{Binding CheckUpdateModels}" ItemsSource="{Binding CheckUpdateModels}">
Theme="{StaticResource ButtonRadioGroupListBox}">
<ItemsControl.ItemsPanel> <ItemsControl.ItemsPanel>
<ItemsPanelTemplate> <ItemsPanelTemplate>
<StackPanel Orientation="Vertical" /> <StackPanel Orientation="Vertical" />
@ -52,7 +47,12 @@
</ItemsControl.ItemsPanel> </ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate> <ItemsControl.ItemTemplate>
<DataTemplate> <DataTemplate>
<Panel Width="500" VerticalAlignment="Center"> <Border
Width="500"
Height="80"
Margin="-8"
VerticalAlignment="Center"
Theme="{StaticResource CardBorder}">
<Grid ColumnDefinitions="1*,1*,3*" RowDefinitions="Auto"> <Grid ColumnDefinitions="1*,1*,3*" RowDefinitions="Auto">
<ToggleSwitch <ToggleSwitch
x:Name="togAutoRefresh" x:Name="togAutoRefresh"
@ -73,10 +73,11 @@
Text="{Binding Remarks}" Text="{Binding Remarks}"
TextWrapping="WrapWithOverflow" /> TextWrapping="WrapWithOverflow" />
</Grid> </Grid>
</Panel> </Border>
</DataTemplate> </DataTemplate>
</ItemsControl.ItemTemplate> </ItemsControl.ItemTemplate>
</ListBox> </ListBox>
</Border> </StackPanel>
</DockPanel> </DockPanel>
</UserControl> </UserControl>

View file

@ -28,7 +28,7 @@
Text="{x:Static resx:ResUI.menuRulemode}" /> Text="{x:Static resx:ResUI.menuRulemode}" />
<ComboBox <ComboBox
x:Name="cmbRulemode" x:Name="cmbRulemode"
Width="100" Width="80"
Margin="8,0"> Margin="8,0">
<ComboBoxItem Content="{x:Static resx:ResUI.menuModeRule}" /> <ComboBoxItem Content="{x:Static resx:ResUI.menuModeRule}" />
<ComboBoxItem Content="{x:Static resx:ResUI.menuModeGlobal}" /> <ComboBoxItem Content="{x:Static resx:ResUI.menuModeGlobal}" />
@ -41,7 +41,7 @@
Text="{x:Static resx:ResUI.TbSorting}" /> Text="{x:Static resx:ResUI.TbSorting}" />
<ComboBox <ComboBox
x:Name="cmbSorting" x:Name="cmbSorting"
Width="100" Width="60"
Margin="8,0"> Margin="8,0">
<ComboBoxItem Content="{x:Static resx:ResUI.TbSortingDelay}" /> <ComboBoxItem Content="{x:Static resx:ResUI.TbSortingDelay}" />
<ComboBoxItem Content="{x:Static resx:ResUI.TbSortingName}" /> <ComboBoxItem Content="{x:Static resx:ResUI.TbSortingName}" />
@ -95,8 +95,7 @@
<ListBox <ListBox
x:Name="lstProxyGroups" x:Name="lstProxyGroups"
DockPanel.Dock="Left" DockPanel.Dock="Left"
ItemsSource="{Binding ProxyGroups}" ItemsSource="{Binding ProxyGroups}">
Theme="{StaticResource ButtonRadioGroupListBox}">
<ItemsControl.ItemsPanel> <ItemsControl.ItemsPanel>
<ItemsPanelTemplate> <ItemsPanelTemplate>
<StackPanel Orientation="Vertical" /> <StackPanel Orientation="Vertical" />
@ -106,25 +105,24 @@
<DataTemplate> <DataTemplate>
<Border <Border
Width="160" Width="160"
Margin="-8,-4" Margin="-6"
Padding="0" Padding="0"
Theme="{StaticResource CardBorder}"> Theme="{StaticResource CardBorder}">
<Grid Classes="Margin8" RowDefinitions="1*,8,1*"> <DockPanel>
<DockPanel Grid.Row="0"> <Grid Classes="Margin8" RowDefinitions="1*,8,1*">
<TextBlock DockPanel.Dock="Right" Text="{Binding Type}" /> <DockPanel Grid.Row="0">
<TextBlock Text="{Binding Name}" /> <TextBlock DockPanel.Dock="Right" Text="{Binding Type}" />
</DockPanel> <TextBlock Text="{Binding Name}" />
<TextBlock Grid.Row="2" Text="{Binding Now}" /> </DockPanel>
</Grid> <TextBlock Grid.Row="2" Text="{Binding Now}" />
</Grid>
</DockPanel>
</Border> </Border>
</DataTemplate> </DataTemplate>
</ItemsControl.ItemTemplate> </ItemsControl.ItemTemplate>
</ListBox> </ListBox>
<ListBox <ListBox x:Name="lstProxyDetails" ItemsSource="{Binding ProxyDetails}">
x:Name="lstProxyDetails"
ItemsSource="{Binding ProxyDetails}"
Theme="{StaticResource ButtonRadioGroupListBox}">
<ItemsControl.ContextMenu> <ItemsControl.ContextMenu>
<ContextMenu> <ContextMenu>
<MenuItem x:Name="menuProxiesDelaytestPart" Header="{x:Static resx:ResUI.menuProxiesDelaytestPart}" /> <MenuItem x:Name="menuProxiesDelaytestPart" Header="{x:Static resx:ResUI.menuProxiesDelaytestPart}" />
@ -140,7 +138,7 @@
<DataTemplate> <DataTemplate>
<Border <Border
Width="160" Width="160"
Margin="-12,-4" Margin="-6"
Padding="0" Padding="0"
Theme="{StaticResource CardBorder}"> Theme="{StaticResource CardBorder}">
<DockPanel> <DockPanel>

View file

@ -150,20 +150,71 @@
x:Name="tabMain1" x:Name="tabMain1"
Grid.Row="2" Grid.Row="2"
TabStripPlacement="Left"> TabStripPlacement="Left">
<TabItem x:Name="tabMsgView1" Header="{x:Static resx:ResUI.MsgInformationTitle}" /> <TabItem x:Name="tabMsgView1">
<TabItem x:Name="tabClashProxies1" Header="{x:Static resx:ResUI.TbProxies}" /> <TabItem.Header>
<TabItem x:Name="tabClashConnections1" Header="{x:Static resx:ResUI.TbConnections}" /> <StackPanel>
<TextBlock HorizontalAlignment="Center" Text="{x:Static resx:ResUI.MsgInformationTitle}" />
</StackPanel>
</TabItem.Header>
</TabItem>
<TabItem x:Name="tabClashProxies1">
<TabItem.Header>
<StackPanel>
<TextBlock HorizontalAlignment="Center" Text="{x:Static resx:ResUI.TbProxies}" />
</StackPanel>
</TabItem.Header>
</TabItem>
<TabItem x:Name="tabClashConnections1">
<TabItem.Header>
<StackPanel>
<TextBlock HorizontalAlignment="Center" Text="{x:Static resx:ResUI.TbConnections}" />
</StackPanel>
</TabItem.Header>
</TabItem>
</TabControl> </TabControl>
</Grid> </Grid>
<Grid x:Name="gridMain2" IsVisible="False"> <Grid x:Name="gridMain2" IsVisible="False">
<TabControl x:Name="tabMain2" TabStripPlacement="Left"> <TabControl x:Name="tabMain2" TabStripPlacement="Left">
<TabItem x:Name="tabProfiles2" Header="{x:Static resx:ResUI.menuServers}" /> <TabItem x:Name="tabProfiles2">
<TabItem x:Name="tabMsgView2" Header="{x:Static resx:ResUI.MsgInformationTitle}" /> <TabItem.Header>
<TabItem x:Name="tabClashProxies2" Header="{x:Static resx:ResUI.TbProxies}" /> <StackPanel>
<TabItem x:Name="tabClashConnections2" Header="{x:Static resx:ResUI.TbConnections}" />
<TextBlock HorizontalAlignment="Center" Text="{x:Static resx:ResUI.menuServers}" />
</StackPanel>
</TabItem.Header>
</TabItem>
<TabItem x:Name="tabMsgView2">
<TabItem.Header>
<StackPanel>
<TextBlock HorizontalAlignment="Center" Text="{x:Static resx:ResUI.MsgInformationTitle}" />
</StackPanel>
</TabItem.Header>
</TabItem>
<TabItem x:Name="tabClashProxies2">
<TabItem.Header>
<StackPanel>
<TextBlock HorizontalAlignment="Center" Text="{x:Static resx:ResUI.TbProxies}" />
</StackPanel>
</TabItem.Header>
</TabItem>
<TabItem x:Name="tabClashConnections2">
<TabItem.Header>
<StackPanel>
<TextBlock HorizontalAlignment="Center" Text="{x:Static resx:ResUI.TbConnections}" />
</StackPanel>
</TabItem.Header>
</TabItem>
</TabControl> </TabControl>
</Grid> </Grid>
</Grid> </Grid>
</DockPanel> </DockPanel>
</dialogHost:DialogHost> </dialogHost:DialogHost>
</Window> </Window>

View file

@ -65,7 +65,7 @@
Margin="8,0" Margin="8,0"
HorizontalAlignment="Left" HorizontalAlignment="Left"
IsChecked="True" IsChecked="True"
Theme="{DynamicResource SimpleToggleSwitch}" /> Theme="{StaticResource SimpleToggleSwitch}" />
<TextBlock <TextBlock
Margin="8,0" Margin="8,0"
VerticalAlignment="Center" VerticalAlignment="Center"
@ -75,7 +75,7 @@
Margin="8,0" Margin="8,0"
HorizontalAlignment="Left" HorizontalAlignment="Left"
IsChecked="True" IsChecked="True"
Theme="{DynamicResource SimpleToggleSwitch}" /> Theme="{StaticResource SimpleToggleSwitch}" />
</WrapPanel> </WrapPanel>
<TextBox <TextBox
Name="txtMsg" Name="txtMsg"

View file

@ -114,8 +114,8 @@
Grid.ColumnSpan="2" Grid.ColumnSpan="2"
HorizontalAlignment="Left" HorizontalAlignment="Left"
Classes="Margin8" Classes="Margin8"
SelectionMode="Multiple,Toggle" SelectionMode="Multiple"
Theme="{DynamicResource CardCheckGroupListBox}" /> Theme="{DynamicResource PureCardRadioGroupListBox}" />
<TextBlock <TextBlock
Grid.Row="6" Grid.Row="6"
@ -714,100 +714,102 @@
</TabItem> </TabItem>
<TabItem Header="{x:Static resx:ResUI.TbSettingsTunMode}"> <TabItem Header="{x:Static resx:ResUI.TbSettingsTunMode}">
<Grid <DockPanel Classes="Margin8">
Classes="Margin8" <Grid
ColumnDefinitions="Auto,Auto,Auto" Classes="Margin8"
DockPanel.Dock="Top" ColumnDefinitions="Auto,Auto,Auto"
RowDefinitions="Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto"> DockPanel.Dock="Top"
RowDefinitions="Auto,Auto,Auto,Auto,Auto,Auto,Auto,Auto">
<TextBlock <TextBlock
Grid.Row="2" Grid.Row="2"
Grid.Column="0" Grid.Column="0"
VerticalAlignment="Center" VerticalAlignment="Center"
Classes="Margin8" Classes="Margin8"
Text="Strict Route" /> Text="Strict Route" />
<ToggleSwitch <ToggleSwitch
x:Name="togStrictRoute" x:Name="togStrictRoute"
Grid.Row="2" Grid.Row="2"
Grid.Column="1" Grid.Column="1"
HorizontalAlignment="Left" HorizontalAlignment="Left"
Classes="Margin8" /> Classes="Margin8" />
<TextBlock <TextBlock
Grid.Row="3" Grid.Row="3"
Grid.Column="0" Grid.Column="0"
VerticalAlignment="Center" VerticalAlignment="Center"
Classes="Margin8" Classes="Margin8"
Text="Stack" /> Text="Stack" />
<ComboBox <ComboBox
x:Name="cmbStack" x:Name="cmbStack"
Grid.Row="3" Grid.Row="3"
Grid.Column="1" Grid.Column="1"
Width="200" Width="200"
HorizontalAlignment="Left" HorizontalAlignment="Left"
Classes="Margin8" /> Classes="Margin8" />
<TextBlock <TextBlock
Grid.Row="4" Grid.Row="4"
Grid.Column="0" Grid.Column="0"
VerticalAlignment="Center" VerticalAlignment="Center"
Classes="Margin8" Classes="Margin8"
Text="Mtu" /> Text="Mtu" />
<ComboBox <ComboBox
x:Name="cmbMtu" x:Name="cmbMtu"
Grid.Row="4" Grid.Row="4"
Grid.Column="1" Grid.Column="1"
Width="200" Width="200"
HorizontalAlignment="Left" HorizontalAlignment="Left"
Classes="Margin8" /> Classes="Margin8" />
<TextBlock <TextBlock
Grid.Row="5" Grid.Row="5"
Grid.Column="0" Grid.Column="0"
VerticalAlignment="Center" VerticalAlignment="Center"
Classes="Margin8" Classes="Margin8"
Text="{x:Static resx:ResUI.TbSettingsEnableExInbound}" /> Text="{x:Static resx:ResUI.TbSettingsEnableExInbound}" />
<ToggleSwitch <ToggleSwitch
x:Name="togEnableExInbound" x:Name="togEnableExInbound"
Grid.Row="5" Grid.Row="5"
Grid.Column="1" Grid.Column="1"
HorizontalAlignment="Left" HorizontalAlignment="Left"
Classes="Margin8" /> Classes="Margin8" />
<TextBlock <TextBlock
Grid.Row="6" Grid.Row="6"
Grid.Column="0" Grid.Column="0"
VerticalAlignment="Center" VerticalAlignment="Center"
Classes="Margin8" Classes="Margin8"
Text="{x:Static resx:ResUI.TbSettingsEnableIPv6Address}" /> Text="{x:Static resx:ResUI.TbSettingsEnableIPv6Address}" />
<ToggleSwitch <ToggleSwitch
x:Name="togEnableIPv6Address" x:Name="togEnableIPv6Address"
Grid.Row="6" Grid.Row="6"
Grid.Column="1" Grid.Column="1"
HorizontalAlignment="Left" HorizontalAlignment="Left"
Classes="Margin8" /> Classes="Margin8" />
<TextBlock <TextBlock
Grid.Row="7" Grid.Row="7"
Grid.Column="0" Grid.Column="0"
VerticalAlignment="Center" VerticalAlignment="Center"
Classes="Margin8" Classes="Margin8"
Text="{x:Static resx:ResUI.TbSettingsLinuxSudoPassword}" /> Text="{x:Static resx:ResUI.TbSettingsLinuxSudoPassword}" />
<TextBox <TextBox
x:Name="txtLinuxSudoPassword" x:Name="txtLinuxSudoPassword"
Grid.Row="7" Grid.Row="7"
Grid.Column="1" Grid.Column="1"
Width="200" Width="200"
HorizontalAlignment="Left" HorizontalAlignment="Left"
Classes="Margin8" /> Classes="Margin8" />
<TextBlock <TextBlock
Grid.Row="7" Grid.Row="7"
Grid.Column="2" Grid.Column="2"
VerticalAlignment="Center" VerticalAlignment="Center"
Classes="Margin8" Classes="Margin8"
Text="{x:Static resx:ResUI.TbSettingsLinuxSudoPasswordTip}" Text="{x:Static resx:ResUI.TbSettingsLinuxSudoPasswordTip}"
TextWrapping="Wrap" /> TextWrapping="Wrap" />
</Grid> </Grid>
</DockPanel>
</TabItem> </TabItem>
<TabItem Header="{x:Static resx:ResUI.TbSettingsCoreType}"> <TabItem Header="{x:Static resx:ResUI.TbSettingsCoreType}">

View file

@ -165,7 +165,7 @@
Classes="Solid Red" Classes="Solid Red"
Content="{x:Static resx:ResUI.TipActiveServer}" Content="{x:Static resx:ResUI.TipActiveServer}"
IsVisible="{Binding IsActive}" IsVisible="{Binding IsActive}"
Theme="{DynamicResource TagLabel}" /> Theme="{StaticResource TagLabel}" />
<TextBlock <TextBlock
HorizontalAlignment="Center" HorizontalAlignment="Center"
VerticalAlignment="Center" VerticalAlignment="Center"

View file

@ -15,12 +15,7 @@ namespace v2rayN.Desktop.Views
public partial class ProfilesView : ReactiveUserControl<ProfilesViewModel> public partial class ProfilesView : ReactiveUserControl<ProfilesViewModel>
{ {
private static Config _config; private static Config _config;
private Window? _window; private Window _window;
public ProfilesView()
{
InitializeComponent();
}
public ProfilesView(Window window) public ProfilesView(Window window)
{ {

View file

@ -4,10 +4,12 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib"
d:DesignHeight="480" d:DesignHeight="480"
d:DesignWidth="400" d:DesignWidth="400"
mc:Ignorable="d"> mc:Ignorable="d">
<Grid Margin="30" RowDefinitions="Auto,Auto"> <Grid Margin="30" RowDefinitions="Auto,Auto">
<Image <Image
Name="imgQrcode" Name="imgQrcode"
Width="300" Width="300"
@ -22,5 +24,6 @@
IsReadOnly="True" IsReadOnly="True"
MaxLines="1" /> MaxLines="1" />
</Grid> </Grid>
</UserControl> </UserControl>

View file

@ -5,11 +5,6 @@ namespace v2rayN.Desktop.Views
{ {
public partial class QrcodeView : UserControl public partial class QrcodeView : UserControl
{ {
public QrcodeView()
{
InitializeComponent();
}
public QrcodeView(string? url) public QrcodeView(string? url)
{ {
InitializeComponent(); InitializeComponent();

View file

@ -94,8 +94,8 @@
Grid.Column="1" Grid.Column="1"
HorizontalAlignment="Left" HorizontalAlignment="Left"
Classes="Margin8" Classes="Margin8"
SelectionMode="Multiple,Toggle" SelectionMode="Multiple"
Theme="{DynamicResource CardCheckGroupListBox}" /> Theme="{DynamicResource PureCardRadioGroupListBox}" />
<TextBlock <TextBlock
Grid.Row="4" Grid.Row="4"
@ -108,8 +108,8 @@
Grid.Row="4" Grid.Row="4"
Grid.Column="1" Grid.Column="1"
Classes="Margin8" Classes="Margin8"
SelectionMode="Multiple,Toggle" SelectionMode="Multiple"
Theme="{DynamicResource CardCheckGroupListBox}" /> Theme="{DynamicResource PureCardRadioGroupListBox}" />
<TextBlock <TextBlock
Grid.Row="4" Grid.Row="4"
Grid.Column="2" Grid.Column="2"

View file

@ -18,29 +18,40 @@
<StackPanel <StackPanel
Classes="Margin8" Classes="Margin8"
DockPanel.Dock="Top" DockPanel.Dock="Top"
Orientation="Horizontal" Orientation="Horizontal">
Spacing="4">
<Menu> <Menu>
<MenuItem x:Name="menuRoutingAdvancedAdd2" Header="{x:Static resx:ResUI.menuRoutingAdvancedAdd}" /> <MenuItem x:Name="menuRoutingAdvancedAdd2" Header="{x:Static resx:ResUI.menuRoutingAdvancedAdd}" />
<MenuItem x:Name="menuRoutingAdvancedImportRules2" Header="{x:Static resx:ResUI.menuRoutingAdvancedImportRules}" /> <MenuItem x:Name="menuRoutingAdvancedImportRules2" Header="{x:Static resx:ResUI.menuRoutingAdvancedImportRules}" />
</Menu> </Menu>
<TextBlock VerticalAlignment="Center"> <TextBlock Margin="8,0,0,0" VerticalAlignment="Center">
<HyperlinkButton Classes="WithIcon" Click="linkdomainStrategy_Click"> <HyperlinkButton Classes="WithIcon" Click="linkdomainStrategy_Click">
<TextBlock Text="{x:Static resx:ResUI.TbdomainStrategy}" /> <TextBlock Text="{x:Static resx:ResUI.TbdomainStrategy}" />
</HyperlinkButton> </HyperlinkButton>
</TextBlock> </TextBlock>
<ComboBox x:Name="cmbdomainStrategy" Width="110" /> <ComboBox
x:Name="cmbdomainStrategy"
Width="110"
Margin="8,0,0,0" />
<Separator /> <Separator />
<TextBlock VerticalAlignment="Center" Text="{x:Static resx:ResUI.TbdomainMatcher}" /> <TextBlock
<ComboBox x:Name="cmbdomainMatcher" Width="60" /> Margin="8,0,0,0"
VerticalAlignment="Center"
Text="{x:Static resx:ResUI.TbdomainMatcher}" />
<ComboBox
x:Name="cmbdomainMatcher"
Width="60"
Margin="8,0,0,0" />
<Separator /> <Separator />
<TextBlock VerticalAlignment="Center"> <TextBlock Margin="8,0,0,0" VerticalAlignment="Center">
<HyperlinkButton Classes="WithIcon" Click="linkdomainStrategy4Singbox_Click"> <HyperlinkButton Classes="WithIcon" Click="linkdomainStrategy4Singbox_Click">
<TextBlock Text="{x:Static resx:ResUI.TbdomainStrategy4Singbox}" /> <TextBlock Text="{x:Static resx:ResUI.TbdomainStrategy4Singbox}" />
</HyperlinkButton> </HyperlinkButton>
</TextBlock> </TextBlock>
<ComboBox x:Name="cmbdomainStrategy4Singbox" Width="100" /> <ComboBox
x:Name="cmbdomainStrategy4Singbox"
Width="100"
Margin="8,0,0,0" />
</StackPanel> </StackPanel>
<StackPanel <StackPanel

View file

@ -45,7 +45,7 @@
x:Name="togEnableTun" x:Name="togEnableTun"
HorizontalAlignment="Center" HorizontalAlignment="Center"
Classes="Margin8" Classes="Margin8"
Theme="{DynamicResource SimpleToggleSwitch}" /> Theme="{StaticResource SimpleToggleSwitch}" />
</StackPanel> </StackPanel>
<StackPanel <StackPanel

View file

@ -10,15 +10,6 @@
d:DesignWidth="800" d:DesignWidth="800"
x:DataType="vms:ThemeSettingViewModel" x:DataType="vms:ThemeSettingViewModel"
mc:Ignorable="d"> mc:Ignorable="d">
<UserControl.Styles>
<Style Selector="TextBlock">
<Setter Property="Width" Value="100" />
</Style>
<Style Selector="ComboBox">
<Setter Property="Width" Value="130" />
</Style>
</UserControl.Styles>
<Button <Button
Width="30" Width="30"
Height="30" Height="30"
@ -33,35 +24,43 @@
</Button.Content> </Button.Content>
<Button.Flyout> <Button.Flyout>
<Flyout> <Flyout>
<StackPanel Margin="0,12"> <StackPanel>
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<TextBlock <TextBlock
Width="100"
VerticalAlignment="Center" VerticalAlignment="Center"
Classes="Margin8" Classes="Margin8"
Text="{x:Static resx:ResUI.TbSettingsTheme}" /> Text="{x:Static resx:ResUI.TbSettingsColorMode}" />
<ComboBox <ToggleSwitch x:Name="togDarkMode" Classes="Margin8" />
x:Name="cmbCurrentTheme"
HorizontalAlignment="Center"
Classes="Margin8" />
</StackPanel> </StackPanel>
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<TextBlock <TextBlock
Width="100"
VerticalAlignment="Center"
Classes="Margin8"
Text="{x:Static resx:ResUI.TbSettingsFollowSystemTheme}" />
<ToggleSwitch x:Name="togFollowSystemTheme" Classes="Margin8" />
</StackPanel>
<StackPanel Orientation="Horizontal">
<TextBlock
Width="100"
VerticalAlignment="Center" VerticalAlignment="Center"
Classes="Margin8" Classes="Margin8"
Text="{x:Static resx:ResUI.TbSettingsFontSize}" /> Text="{x:Static resx:ResUI.TbSettingsFontSize}" />
<ComboBox <ComboBox
x:Name="cmbCurrentFontSize" x:Name="cmbCurrentFontSize"
HorizontalAlignment="Center" Width="100"
Classes="Margin8" /> Classes="Margin8" />
</StackPanel> </StackPanel>
<StackPanel Orientation="Horizontal"> <StackPanel Orientation="Horizontal">
<TextBlock <TextBlock
Width="100"
VerticalAlignment="Center" VerticalAlignment="Center"
Classes="Margin8" Classes="Margin8"
Text="{x:Static resx:ResUI.TbSettingsLanguage}" /> Text="{x:Static resx:ResUI.TbSettingsLanguage}" />
<ComboBox <ComboBox
x:Name="cmbCurrentLanguage" x:Name="cmbCurrentLanguage"
HorizontalAlignment="Center" Width="100"
Classes="Margin8" /> Classes="Margin8" />
</StackPanel> </StackPanel>
</StackPanel> </StackPanel>

View file

@ -16,11 +16,6 @@ namespace v2rayN.Desktop.Views
InitializeComponent(); InitializeComponent();
ViewModel = new ThemeSettingViewModel(); ViewModel = new ThemeSettingViewModel();
foreach (ETheme it in Enum.GetValues(typeof(ETheme)))
{
cmbCurrentTheme.Items.Add(it.ToString());
}
for (int i = Global.MinFontSize; i <= Global.MinFontSize + 10; i++) for (int i = Global.MinFontSize; i <= Global.MinFontSize + 10; i++)
{ {
cmbCurrentFontSize.Items.Add(i); cmbCurrentFontSize.Items.Add(i);
@ -33,7 +28,8 @@ namespace v2rayN.Desktop.Views
this.WhenActivated(disposables => this.WhenActivated(disposables =>
{ {
this.Bind(ViewModel, vm => vm.CurrentTheme, v => v.cmbCurrentTheme.SelectedValue).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.ColorModeDark, v => v.togDarkMode.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.FollowSystemTheme, v => v.togFollowSystemTheme.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.CurrentFontSize, v => v.cmbCurrentFontSize.SelectedValue).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.CurrentFontSize, v => v.cmbCurrentFontSize.SelectedValue).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.CurrentLanguage, v => v.cmbCurrentLanguage.SelectedValue).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.CurrentLanguage, v => v.cmbCurrentLanguage.SelectedValue).DisposeWith(disposables);
}); });

View file

@ -6,7 +6,7 @@
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<ApplicationIcon>Assets\v2rayN.ico</ApplicationIcon> <ApplicationIcon>Assets\v2rayN.ico</ApplicationIcon>
<BuiltInComInteropSupport>true</BuiltInComInteropSupport> <BuiltInComInteropSupport>true</BuiltInComInteropSupport>
<Copyright>Copyright © 2017-2025 (GPLv3)</Copyright> <Copyright>Copyright © 2017-2024 (GPLv3)</Copyright>
<AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault> <AvaloniaUseCompiledBindingsByDefault>true</AvaloniaUseCompiledBindingsByDefault>
<AssemblyName>v2rayN</AssemblyName> <AssemblyName>v2rayN</AssemblyName>
</PropertyGroup> </PropertyGroup>
@ -48,7 +48,7 @@
<None Update="v2rayN.png"> <None Update="v2rayN.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
<None Update="v2rayN.icns"> <None Update="v2rayN2.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>
</ItemGroup> </ItemGroup>

Binary file not shown.

Binary file not shown.

After

Width:  |  Height:  |  Size: 10 KiB

View file

@ -64,6 +64,14 @@ namespace v2rayN
BitmapSizeOptions.FromEmptyOptions()); BitmapSizeOptions.FromEmptyOptions());
} }
public static bool IsDarkTheme()
{
using var key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize");
var obj = key?.GetValue("AppsUseLightTheme");
int.TryParse(obj?.ToString(), out var value);
return value == 0;
}
public static void RemoveTunDevice() public static void RemoveTunDevice()
{ {
try try
@ -95,19 +103,7 @@ namespace v2rayN
} }
} }
public static void SetDarkBorder(Window window, string? theme) public static void SetDarkBorder(Window window, bool dark)
{
var isDark = theme switch
{
nameof(ETheme.Dark) => true,
nameof(ETheme.Light) => false,
_ => IsDarkTheme(),
};
SetDarkBorder(window, isDark);
}
private static void SetDarkBorder(Window window, bool dark)
{ {
// Make sure the handle is created before the window is shown // Make sure the handle is created before the window is shown
IntPtr hWnd = new WindowInteropHelper(window).EnsureHandle(); IntPtr hWnd = new WindowInteropHelper(window).EnsureHandle();
@ -117,14 +113,6 @@ namespace v2rayN
DwmSetWindowAttribute(hWnd, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE, ref attribute, attributeSize); DwmSetWindowAttribute(hWnd, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE, ref attribute, attributeSize);
} }
private static bool IsDarkTheme()
{
using var key = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Themes\Personalize");
var obj = key?.GetValue("AppsUseLightTheme");
int.TryParse(obj?.ToString(), out var value);
return value == 0;
}
#region Windows API #region Windows API
[Flags] [Flags]

View file

@ -16,17 +16,23 @@ namespace v2rayN.ViewModels
{ {
private readonly PaletteHelper _paletteHelper = new(); private readonly PaletteHelper _paletteHelper = new();
[Reactive]
public bool ColorModeDark { get; set; }
private IObservableCollection<Swatch> _swatches = new ObservableCollectionExtended<Swatch>(); private IObservableCollection<Swatch> _swatches = new ObservableCollectionExtended<Swatch>();
public IObservableCollection<Swatch> Swatches => _swatches; public IObservableCollection<Swatch> Swatches => _swatches;
[Reactive] [Reactive]
public Swatch SelectedSwatch { get; set; } public Swatch SelectedSwatch { get; set; }
[Reactive] public string CurrentTheme { get; set; } [Reactive]
public int CurrentFontSize { get; set; }
[Reactive] public int CurrentFontSize { get; set; } [Reactive]
public bool FollowSystemTheme { get; set; }
[Reactive] public string CurrentLanguage { get; set; } [Reactive]
public string CurrentLanguage { get; set; }
public ThemeSettingViewModel() public ThemeSettingViewModel()
{ {
@ -56,27 +62,40 @@ namespace v2rayN.ViewModels
private void BindingUI() private void BindingUI()
{ {
ColorModeDark = _config.UiItem.ColorModeDark;
FollowSystemTheme = _config.UiItem.FollowSystemTheme;
_swatches.AddRange(new SwatchesProvider().Swatches); _swatches.AddRange(new SwatchesProvider().Swatches);
if (!_config.UiItem.ColorPrimaryName.IsNullOrEmpty()) if (!_config.UiItem.ColorPrimaryName.IsNullOrEmpty())
{ {
SelectedSwatch = _swatches.FirstOrDefault(t => t.Name == _config.UiItem.ColorPrimaryName); SelectedSwatch = _swatches.FirstOrDefault(t => t.Name == _config.UiItem.ColorPrimaryName);
} }
CurrentTheme = _config.UiItem.CurrentTheme;
CurrentFontSize = _config.UiItem.CurrentFontSize; CurrentFontSize = _config.UiItem.CurrentFontSize;
CurrentLanguage = _config.UiItem.CurrentLanguage; CurrentLanguage = _config.UiItem.CurrentLanguage;
this.WhenAnyValue( this.WhenAnyValue(
x => x.CurrentTheme, x => x.ColorModeDark,
y => y != null && !y.IsNullOrEmpty()) y => y == true)
.Subscribe(c => .Subscribe(c =>
{ {
if (_config.UiItem.CurrentTheme != CurrentTheme) if (_config.UiItem.ColorModeDark != ColorModeDark)
{ {
_config.UiItem.CurrentTheme = CurrentTheme; _config.UiItem.ColorModeDark = ColorModeDark;
ModifyTheme(); ModifyTheme();
ConfigHandler.SaveConfig(_config); ConfigHandler.SaveConfig(_config);
} }
}); });
this.WhenAnyValue(x => x.FollowSystemTheme,
y => y == true)
.Subscribe(c =>
{
if (_config.UiItem.FollowSystemTheme != FollowSystemTheme)
{
_config.UiItem.FollowSystemTheme = FollowSystemTheme;
ModifyTheme();
ConfigHandler.SaveConfig(_config);
}
});
this.WhenAnyValue( this.WhenAnyValue(
x => x.SelectedSwatch, x => x.SelectedSwatch,
@ -128,18 +147,12 @@ namespace v2rayN.ViewModels
public void ModifyTheme() public void ModifyTheme()
{ {
var baseTheme = CurrentTheme switch
{
nameof(ETheme.Dark) => BaseTheme.Dark,
nameof(ETheme.Light) => BaseTheme.Light,
_ => BaseTheme.Inherit,
};
var theme = _paletteHelper.GetTheme(); var theme = _paletteHelper.GetTheme();
theme.SetBaseTheme(baseTheme);
_paletteHelper.SetTheme(theme);
WindowsUtils.SetDarkBorder(Application.Current.MainWindow, CurrentTheme); var isDarkTheme = FollowSystemTheme ? WindowsUtils.IsDarkTheme() : ColorModeDark;
theme.SetBaseTheme(isDarkTheme ? BaseTheme.Dark : BaseTheme.Light);
_paletteHelper.SetTheme(theme);
WindowsUtils.SetDarkBorder(Application.Current.MainWindow, isDarkTheme);
} }
private void ModifyFontSize() private void ModifyFontSize()
@ -169,7 +182,7 @@ namespace v2rayN.ViewModels
var hwndSource = HwndSource.FromHwnd(helper.EnsureHandle()); var hwndSource = HwndSource.FromHwnd(helper.EnsureHandle());
hwndSource.AddHook((IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) => hwndSource.AddHook((IntPtr hwnd, int msg, IntPtr wParam, IntPtr lParam, ref bool handled) =>
{ {
if (config.UiItem.CurrentTheme == nameof(ETheme.FollowSystem)) if (config.UiItem.FollowSystemTheme)
{ {
const int WM_SETTINGCHANGE = 0x001A; const int WM_SETTINGCHANGE = 0x001A;
if (msg == WM_SETTINGCHANGE) if (msg == WM_SETTINGCHANGE)

View file

@ -34,7 +34,7 @@ namespace v2rayN.Views
this.BindCommand(ViewModel, vm => vm.EditServerCmd, v => v.btnEdit).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.EditServerCmd, v => v.btnEdit).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.SaveServerCmd, v => v.btnSave).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.SaveServerCmd, v => v.btnSave).DisposeWith(disposables);
}); });
WindowsUtils.SetDarkBorder(this, AppHandler.Instance.Config.UiItem.CurrentTheme); WindowsUtils.SetDarkBorder(this, AppHandler.Instance.Config.UiItem.FollowSystemTheme ? WindowsUtils.IsDarkTheme() : AppHandler.Instance.Config.UiItem.ColorModeDark);
} }
private async Task<bool> UpdateViewHandler(EViewAction action, object? obj) private async Task<bool> UpdateViewHandler(EViewAction action, object? obj)

View file

@ -210,7 +210,7 @@ namespace v2rayN.Views
}); });
this.Title = $"{profileItem.ConfigType}"; this.Title = $"{profileItem.ConfigType}";
WindowsUtils.SetDarkBorder(this, AppHandler.Instance.Config.UiItem.CurrentTheme); WindowsUtils.SetDarkBorder(this, AppHandler.Instance.Config.UiItem.FollowSystemTheme ? WindowsUtils.IsDarkTheme() : AppHandler.Instance.Config.UiItem.ColorModeDark);
} }
private async Task<bool> UpdateViewHandler(EViewAction action, object? obj) private async Task<bool> UpdateViewHandler(EViewAction action, object? obj)

View file

@ -64,6 +64,7 @@
<DataTemplate> <DataTemplate>
<Border <Border
Width="500" Width="500"
Height="50"
Margin="{StaticResource Margin8}" Margin="{StaticResource Margin8}"
Padding="0" Padding="0"
VerticalAlignment="Center"> VerticalAlignment="Center">

View file

@ -1,14 +1,14 @@
<reactiveui:ReactiveUserControl <reactiveui:ReactiveUserControl
x:Class="v2rayN.Views.ClashProxiesView" x:Class="v2rayN.Views.ClashProxiesView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:converters="clr-namespace:v2rayN.Converters"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes" xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:reactiveui="http://reactiveui.net" xmlns:reactiveui="http://reactiveui.net"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib" xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib"
xmlns:vms="clr-namespace:ServiceLib.ViewModels;assembly=ServiceLib" xmlns:vms="clr-namespace:ServiceLib.ViewModels;assembly=ServiceLib"
xmlns:converters="clr-namespace:v2rayN.Converters"
d:DesignHeight="450" d:DesignHeight="450"
d:DesignWidth="800" d:DesignWidth="800"
x:TypeArguments="vms:ClashProxiesViewModel" x:TypeArguments="vms:ClashProxiesViewModel"
@ -34,7 +34,7 @@
Text="{x:Static resx:ResUI.menuRulemode}" /> Text="{x:Static resx:ResUI.menuRulemode}" />
<ComboBox <ComboBox
x:Name="cmbRulemode" x:Name="cmbRulemode"
Width="100" Width="80"
Margin="{StaticResource MarginLeftRight8}" Margin="{StaticResource MarginLeftRight8}"
Style="{StaticResource DefComboBox}"> Style="{StaticResource DefComboBox}">
<ComboBoxItem Content="{x:Static resx:ResUI.menuModeRule}" /> <ComboBoxItem Content="{x:Static resx:ResUI.menuModeRule}" />
@ -49,7 +49,7 @@
Text="{x:Static resx:ResUI.TbSorting}" /> Text="{x:Static resx:ResUI.TbSorting}" />
<ComboBox <ComboBox
x:Name="cmbSorting" x:Name="cmbSorting"
Width="100" Width="60"
Margin="{StaticResource MarginLeftRight8}" Margin="{StaticResource MarginLeftRight8}"
Style="{StaticResource DefComboBox}"> Style="{StaticResource DefComboBox}">
<ComboBoxItem Content="{x:Static resx:ResUI.TbSortingDelay}" /> <ComboBoxItem Content="{x:Static resx:ResUI.TbSortingDelay}" />

View file

@ -50,7 +50,7 @@ namespace v2rayN.Views
this.BindCommand(ViewModel, vm => vm.ImportDefConfig4V2rayCmd, v => v.btnImportDefConfig4V2ray).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.ImportDefConfig4V2rayCmd, v => v.btnImportDefConfig4V2ray).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.ImportDefConfig4SingboxCmd, v => v.btnImportDefConfig4Singbox).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.ImportDefConfig4SingboxCmd, v => v.btnImportDefConfig4Singbox).DisposeWith(disposables);
}); });
WindowsUtils.SetDarkBorder(this, AppHandler.Instance.Config.UiItem.CurrentTheme); WindowsUtils.SetDarkBorder(this, AppHandler.Instance.Config.UiItem.FollowSystemTheme ? WindowsUtils.IsDarkTheme() : AppHandler.Instance.Config.UiItem.ColorModeDark);
} }
private async Task<bool> UpdateViewHandler(EViewAction action, object? obj) private async Task<bool> UpdateViewHandler(EViewAction action, object? obj)

View file

@ -30,7 +30,7 @@ namespace v2rayN.Views
HotkeyHandler.Instance.IsPause = true; HotkeyHandler.Instance.IsPause = true;
this.Closing += (s, e) => HotkeyHandler.Instance.IsPause = false; this.Closing += (s, e) => HotkeyHandler.Instance.IsPause = false;
WindowsUtils.SetDarkBorder(this, _config.UiItem.CurrentTheme); WindowsUtils.SetDarkBorder(this, _config.UiItem.FollowSystemTheme ? WindowsUtils.IsDarkTheme() : _config.UiItem.ColorModeDark);
InitData(); InitData();
} }

View file

@ -997,96 +997,98 @@
</TabItem> </TabItem>
<TabItem Header="{x:Static resx:ResUI.TbSettingsTunMode}"> <TabItem Header="{x:Static resx:ResUI.TbSettingsTunMode}">
<Grid Margin="{StaticResource Margin8}" DockPanel.Dock="Top"> <DockPanel Margin="{StaticResource Margin8}">
<Grid.RowDefinitions> <Grid Margin="{StaticResource Margin8}" DockPanel.Dock="Top">
<RowDefinition Height="Auto" /> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
</Grid.RowDefinitions> <RowDefinition Height="Auto" />
<Grid.ColumnDefinitions> </Grid.RowDefinitions>
<ColumnDefinition Width="Auto" /> <Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions> <ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions>
<TextBlock <TextBlock
Grid.Row="2" Grid.Row="2"
Grid.Column="0" Grid.Column="0"
Margin="{StaticResource Margin8}" Margin="{StaticResource Margin8}"
VerticalAlignment="Center" VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}" Style="{StaticResource ToolbarTextBlock}"
Text="Strict Route" /> Text="Strict Route" />
<ToggleButton <ToggleButton
x:Name="togStrictRoute" x:Name="togStrictRoute"
Grid.Row="2" Grid.Row="2"
Grid.Column="1" Grid.Column="1"
Margin="{StaticResource Margin8}" Margin="{StaticResource Margin8}"
HorizontalAlignment="Left" /> HorizontalAlignment="Left" />
<TextBlock <TextBlock
Grid.Row="3" Grid.Row="3"
Grid.Column="0" Grid.Column="0"
Margin="{StaticResource Margin8}" Margin="{StaticResource Margin8}"
VerticalAlignment="Center" VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}" Style="{StaticResource ToolbarTextBlock}"
Text="Stack" /> Text="Stack" />
<ComboBox <ComboBox
x:Name="cmbStack" x:Name="cmbStack"
Grid.Row="3" Grid.Row="3"
Grid.Column="1" Grid.Column="1"
Width="200" Width="200"
Margin="{StaticResource Margin8}" Margin="{StaticResource Margin8}"
HorizontalAlignment="Left" HorizontalAlignment="Left"
Style="{StaticResource DefComboBox}" /> Style="{StaticResource DefComboBox}" />
<TextBlock <TextBlock
Grid.Row="4" Grid.Row="4"
Grid.Column="0" Grid.Column="0"
Margin="{StaticResource Margin8}" Margin="{StaticResource Margin8}"
VerticalAlignment="Center" VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}" Style="{StaticResource ToolbarTextBlock}"
Text="Mtu" /> Text="Mtu" />
<ComboBox <ComboBox
x:Name="cmbMtu" x:Name="cmbMtu"
Grid.Row="4" Grid.Row="4"
Grid.Column="1" Grid.Column="1"
Width="200" Width="200"
Margin="{StaticResource Margin8}" Margin="{StaticResource Margin8}"
HorizontalAlignment="Left" HorizontalAlignment="Left"
Style="{StaticResource DefComboBox}" /> Style="{StaticResource DefComboBox}" />
<TextBlock <TextBlock
Grid.Row="5" Grid.Row="5"
Grid.Column="0" Grid.Column="0"
Margin="{StaticResource Margin8}" Margin="{StaticResource Margin8}"
VerticalAlignment="Center" VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}" Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSettingsEnableExInbound}" /> Text="{x:Static resx:ResUI.TbSettingsEnableExInbound}" />
<ToggleButton <ToggleButton
x:Name="togEnableExInbound" x:Name="togEnableExInbound"
Grid.Row="5" Grid.Row="5"
Grid.Column="1" Grid.Column="1"
Margin="{StaticResource Margin8}" Margin="{StaticResource Margin8}"
HorizontalAlignment="Left" /> HorizontalAlignment="Left" />
<TextBlock <TextBlock
Grid.Row="6" Grid.Row="6"
Grid.Column="0" Grid.Column="0"
Margin="{StaticResource Margin8}" Margin="{StaticResource Margin8}"
VerticalAlignment="Center" VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}" Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSettingsEnableIPv6Address}" /> Text="{x:Static resx:ResUI.TbSettingsEnableIPv6Address}" />
<ToggleButton <ToggleButton
x:Name="togEnableIPv6Address" x:Name="togEnableIPv6Address"
Grid.Row="6" Grid.Row="6"
Grid.Column="1" Grid.Column="1"
Margin="{StaticResource Margin8}" Margin="{StaticResource Margin8}"
HorizontalAlignment="Left" /> HorizontalAlignment="Left" />
</Grid> </Grid>
</DockPanel>
</TabItem> </TabItem>
<TabItem Header="{x:Static resx:ResUI.TbSettingsCoreType}"> <TabItem Header="{x:Static resx:ResUI.TbSettingsCoreType}">

View file

@ -177,7 +177,7 @@ namespace v2rayN.Views
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables);
}); });
WindowsUtils.SetDarkBorder(this, AppHandler.Instance.Config.UiItem.CurrentTheme); WindowsUtils.SetDarkBorder(this, AppHandler.Instance.Config.UiItem.FollowSystemTheme ? WindowsUtils.IsDarkTheme() : AppHandler.Instance.Config.UiItem.ColorModeDark);
} }
private async Task<bool> UpdateViewHandler(EViewAction action, object? obj) private async Task<bool> UpdateViewHandler(EViewAction action, object? obj)

View file

@ -58,7 +58,7 @@ namespace v2rayN.Views
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables);
}); });
WindowsUtils.SetDarkBorder(this, AppHandler.Instance.Config.UiItem.CurrentTheme); WindowsUtils.SetDarkBorder(this, AppHandler.Instance.Config.UiItem.FollowSystemTheme ? WindowsUtils.IsDarkTheme() : AppHandler.Instance.Config.UiItem.ColorModeDark);
} }
private async Task<bool> UpdateViewHandler(EViewAction action, object? obj) private async Task<bool> UpdateViewHandler(EViewAction action, object? obj)

View file

@ -60,7 +60,7 @@ namespace v2rayN.Views
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables);
}); });
WindowsUtils.SetDarkBorder(this, AppHandler.Instance.Config.UiItem.CurrentTheme); WindowsUtils.SetDarkBorder(this, AppHandler.Instance.Config.UiItem.FollowSystemTheme ? WindowsUtils.IsDarkTheme() : AppHandler.Instance.Config.UiItem.ColorModeDark);
} }
private async Task<bool> UpdateViewHandler(EViewAction action, object? obj) private async Task<bool> UpdateViewHandler(EViewAction action, object? obj)

View file

@ -52,7 +52,7 @@ namespace v2rayN.Views
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables);
}); });
WindowsUtils.SetDarkBorder(this, AppHandler.Instance.Config.UiItem.CurrentTheme); WindowsUtils.SetDarkBorder(this, AppHandler.Instance.Config.UiItem.FollowSystemTheme ? WindowsUtils.IsDarkTheme() : AppHandler.Instance.Config.UiItem.ColorModeDark);
} }
private async Task<bool> UpdateViewHandler(EViewAction action, object? obj) private async Task<bool> UpdateViewHandler(EViewAction action, object? obj)

View file

@ -38,7 +38,7 @@ namespace v2rayN.Views
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables);
}); });
WindowsUtils.SetDarkBorder(this, AppHandler.Instance.Config.UiItem.CurrentTheme); WindowsUtils.SetDarkBorder(this, AppHandler.Instance.Config.UiItem.FollowSystemTheme ? WindowsUtils.IsDarkTheme() : AppHandler.Instance.Config.UiItem.ColorModeDark);
} }
private async Task<bool> UpdateViewHandler(EViewAction action, object? obj) private async Task<bool> UpdateViewHandler(EViewAction action, object? obj)

View file

@ -31,7 +31,7 @@ namespace v2rayN.Views
this.BindCommand(ViewModel, vm => vm.SubEditCmd, v => v.menuSubEdit).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.SubEditCmd, v => v.menuSubEdit).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.SubShareCmd, v => v.menuSubShare).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.SubShareCmd, v => v.menuSubShare).DisposeWith(disposables);
}); });
WindowsUtils.SetDarkBorder(this, AppHandler.Instance.Config.UiItem.CurrentTheme); WindowsUtils.SetDarkBorder(this, AppHandler.Instance.Config.UiItem.FollowSystemTheme ? WindowsUtils.IsDarkTheme() : AppHandler.Instance.Config.UiItem.ColorModeDark);
} }
private async Task<bool> UpdateViewHandler(EViewAction action, object? obj) private async Task<bool> UpdateViewHandler(EViewAction action, object? obj)

View file

@ -25,20 +25,29 @@
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" /> <ColumnDefinition Width="Auto" />
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBlock
Grid.Row="0"
Grid.Column="0"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSettingsColorMode}" />
<ToggleButton
x:Name="togDarkMode"
Grid.Row="0"
Grid.Column="1"
Margin="{StaticResource Margin8}" />
<TextBlock <TextBlock
Grid.Row="1" Grid.Row="1"
Grid.Column="0" Grid.Column="0"
VerticalAlignment="Center" VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}" Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSettingsTheme}" /> Text="{x:Static resx:ResUI.TbSettingsFollowSystemTheme}" />
<ComboBox <ToggleButton
x:Name="cmbCurrentTheme" x:Name="togFollowSystemTheme"
Grid.Row="1" Grid.Row="1"
Grid.Column="1" Grid.Column="1"
Width="120" Margin="{StaticResource Margin8}" />
Margin="{StaticResource Margin8}"
Style="{StaticResource DefComboBox}" />
<TextBlock <TextBlock
Grid.Row="2" Grid.Row="2"
@ -50,7 +59,7 @@
x:Name="cmbSwatches" x:Name="cmbSwatches"
Grid.Row="2" Grid.Row="2"
Grid.Column="1" Grid.Column="1"
Width="120" Width="100"
Margin="{StaticResource Margin8}" Margin="{StaticResource Margin8}"
DisplayMemberPath="Name" DisplayMemberPath="Name"
Style="{StaticResource DefComboBox}" /> Style="{StaticResource DefComboBox}" />
@ -65,7 +74,7 @@
x:Name="cmbCurrentFontSize" x:Name="cmbCurrentFontSize"
Grid.Row="3" Grid.Row="3"
Grid.Column="1" Grid.Column="1"
Width="120" Width="100"
Margin="{StaticResource Margin8}" Margin="{StaticResource Margin8}"
Style="{StaticResource DefComboBox}" /> Style="{StaticResource DefComboBox}" />
@ -79,7 +88,7 @@
x:Name="cmbCurrentLanguage" x:Name="cmbCurrentLanguage"
Grid.Row="4" Grid.Row="4"
Grid.Column="1" Grid.Column="1"
Width="120" Width="100"
Margin="{StaticResource Margin8}" Margin="{StaticResource Margin8}"
Style="{StaticResource DefComboBox}" /> Style="{StaticResource DefComboBox}" />
</Grid> </Grid>

View file

@ -13,11 +13,6 @@ namespace v2rayN.Views
{ {
InitializeComponent(); InitializeComponent();
ViewModel = new ThemeSettingViewModel(); ViewModel = new ThemeSettingViewModel();
foreach (ETheme it in Enum.GetValues(typeof(ETheme)))
{
if ((int)it > 2) continue;
cmbCurrentTheme.Items.Add(it.ToString());
}
for (int i = Global.MinFontSize; i <= Global.MinFontSize + 10; i++) for (int i = Global.MinFontSize; i <= Global.MinFontSize + 10; i++)
{ {
@ -31,7 +26,8 @@ namespace v2rayN.Views
this.WhenActivated(disposables => this.WhenActivated(disposables =>
{ {
this.Bind(ViewModel, vm => vm.CurrentTheme, v => v.cmbCurrentTheme.SelectedValue).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.ColorModeDark, v => v.togDarkMode.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.FollowSystemTheme, v => v.togFollowSystemTheme.IsChecked).DisposeWith(disposables);
this.OneWayBind(ViewModel, vm => vm.Swatches, v => v.cmbSwatches.ItemsSource).DisposeWith(disposables); this.OneWayBind(ViewModel, vm => vm.Swatches, v => v.cmbSwatches.ItemsSource).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedSwatch, v => v.cmbSwatches.SelectedItem).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.SelectedSwatch, v => v.cmbSwatches.SelectedItem).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.CurrentFontSize, v => v.cmbCurrentFontSize.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.CurrentFontSize, v => v.cmbCurrentFontSize.Text).DisposeWith(disposables);

View file

@ -9,12 +9,12 @@
<ApplicationManifest>app.manifest</ApplicationManifest> <ApplicationManifest>app.manifest</ApplicationManifest>
<ImplicitUsings>enable</ImplicitUsings> <ImplicitUsings>enable</ImplicitUsings>
<ApplicationIcon>Resources\v2rayN.ico</ApplicationIcon> <ApplicationIcon>Resources\v2rayN.ico</ApplicationIcon>
<Copyright>Copyright © 2017-2025 (GPLv3)</Copyright> <Copyright>Copyright © 2017-2024 (GPLv3)</Copyright>
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion> <SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="MaterialDesignThemes" Version="5.2.1" /> <PackageReference Include="MaterialDesignThemes" Version="5.2.0" />
<PackageReference Include="H.NotifyIcon.Wpf" Version="2.2.0" /> <PackageReference Include="H.NotifyIcon.Wpf" Version="2.2.0" />
<PackageReference Include="ReactiveUI.Fody" Version="19.5.41" /> <PackageReference Include="ReactiveUI.Fody" Version="19.5.41" />
<PackageReference Include="ReactiveUI.WPF" Version="20.1.63" /> <PackageReference Include="ReactiveUI.WPF" Version="20.1.63" />