This commit is contained in:
DHR60 2025-08-10 22:25:51 +08:00
parent 916e6d2050
commit 10ac9cfeea
24 changed files with 364 additions and 306 deletions

View file

@ -29,7 +29,7 @@ public enum EViewAction
DNSSettingWindow, DNSSettingWindow,
RoutingSettingWindow, RoutingSettingWindow,
OptionSettingWindow, OptionSettingWindow,
CustomConfigWindow, FullConfigTemplateWindow,
GlobalHotkeySettingWindow, GlobalHotkeySettingWindow,
SubSettingWindow, SubSettingWindow,
DispatcherSpeedTest, DispatcherSpeedTest,

View file

@ -64,7 +64,7 @@ public sealed class AppHandler
SQLiteHelper.Instance.CreateTable<RoutingItem>(); SQLiteHelper.Instance.CreateTable<RoutingItem>();
SQLiteHelper.Instance.CreateTable<ProfileExItem>(); SQLiteHelper.Instance.CreateTable<ProfileExItem>();
SQLiteHelper.Instance.CreateTable<DNSItem>(); SQLiteHelper.Instance.CreateTable<DNSItem>();
SQLiteHelper.Instance.CreateTable<CustomConfigItem>(); SQLiteHelper.Instance.CreateTable<FullConfigTemplateItem>();
return true; return true;
} }
@ -204,14 +204,14 @@ public sealed class AppHandler
return await SQLiteHelper.Instance.TableAsync<DNSItem>().FirstOrDefaultAsync(it => it.CoreType == eCoreType); return await SQLiteHelper.Instance.TableAsync<DNSItem>().FirstOrDefaultAsync(it => it.CoreType == eCoreType);
} }
public async Task<List<CustomConfigItem>?> CustomConfigItem() public async Task<List<FullConfigTemplateItem>?> FullConfigTemplateItem()
{ {
return await SQLiteHelper.Instance.TableAsync<CustomConfigItem>().ToListAsync(); return await SQLiteHelper.Instance.TableAsync<FullConfigTemplateItem>().ToListAsync();
} }
public async Task<CustomConfigItem?> GetCustomConfigItem(ECoreType eCoreType) public async Task<FullConfigTemplateItem?> GetFullConfigTemplateItem(ECoreType eCoreType)
{ {
return await SQLiteHelper.Instance.TableAsync<CustomConfigItem>().FirstOrDefaultAsync(it => it.CoreType == eCoreType); return await SQLiteHelper.Instance.TableAsync<FullConfigTemplateItem>().FirstOrDefaultAsync(it => it.CoreType == eCoreType);
} }
#endregion SqliteHelper #endregion SqliteHelper

View file

@ -2240,29 +2240,29 @@ public class ConfigHandler
#region Custom Config #region Custom Config
public static async Task<int> InitBuiltinCustomConfig(Config config) public static async Task<int> InitBuiltinFullConfigTemplate(Config config)
{ {
var items = await AppHandler.Instance.CustomConfigItem(); var items = await AppHandler.Instance.FullConfigTemplateItem();
if (items.Count <= 0) if (items.Count <= 0)
{ {
var item = new CustomConfigItem() var item = new FullConfigTemplateItem()
{ {
Remarks = "V2ray", Remarks = "V2ray",
CoreType = ECoreType.Xray, CoreType = ECoreType.Xray,
}; };
await SaveCustomConfigItem(config, item); await SaveFullConfigTemplate(config, item);
var item2 = new CustomConfigItem() var item2 = new FullConfigTemplateItem()
{ {
Remarks = "sing-box", Remarks = "sing-box",
CoreType = ECoreType.sing_box, CoreType = ECoreType.sing_box,
}; };
await SaveCustomConfigItem(config, item2); await SaveFullConfigTemplate(config, item2);
} }
return 0; return 0;
} }
public static async Task<int> SaveCustomConfigItem(Config config, CustomConfigItem item) public static async Task<int> SaveFullConfigTemplate(Config config, FullConfigTemplateItem item)
{ {
if (item == null) if (item == null)
{ {

View file

@ -3,7 +3,7 @@ using SQLite;
namespace ServiceLib.Models; namespace ServiceLib.Models;
[Serializable] [Serializable]
public class CustomConfigItem public class FullConfigTemplateItem
{ {
[PrimaryKey] [PrimaryKey]
public string Id { get; set; } public string Id { get; set; }

View file

@ -187,11 +187,11 @@ namespace ServiceLib.Resx {
} }
/// <summary> /// <summary>
/// 查找类似 Please fill in the correct custom config 的本地化字符串。 /// 查找类似 Please fill in the correct config template 的本地化字符串。
/// </summary> /// </summary>
public static string FillCorrectConfigText { public static string FillCorrectConfigTemplateText {
get { get {
return ResourceManager.GetString("FillCorrectConfigText", resourceCulture); return ResourceManager.GetString("FillCorrectConfigTemplateText", resourceCulture);
} }
} }
@ -861,15 +861,6 @@ namespace ServiceLib.Resx {
} }
} }
/// <summary>
/// 查找类似 Custom Config 的本地化字符串。
/// </summary>
public static string menuCustomConfig {
get {
return ResourceManager.GetString("menuCustomConfig", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 DNS Settings 的本地化字符串。 /// 查找类似 DNS Settings 的本地化字符串。
/// </summary> /// </summary>
@ -951,6 +942,15 @@ namespace ServiceLib.Resx {
} }
} }
/// <summary>
/// 查找类似 Full Config Template Setting 的本地化字符串。
/// </summary>
public static string menuFullConfigTemplate {
get {
return ResourceManager.GetString("menuFullConfigTemplate", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 Global Hotkey Setting 的本地化字符串。 /// 查找类似 Global Hotkey Setting 的本地化字符串。
/// </summary> /// </summary>
@ -2391,24 +2391,6 @@ namespace ServiceLib.Resx {
} }
} }
/// <summary>
/// 查找类似 Enable Custom Config 的本地化字符串。
/// </summary>
public static string TbCustomConfigEnable {
get {
return ResourceManager.GetString("TbCustomConfigEnable", resourceCulture);
}
}
/// <summary>
/// 查找类似 sing-box Custom Config 的本地化字符串。
/// </summary>
public static string TbCustomConfigSingbox {
get {
return ResourceManager.GetString("TbCustomConfigSingbox", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 Enable Custom DNS 的本地化字符串。 /// 查找类似 Enable Custom DNS 的本地化字符串。
/// </summary> /// </summary>
@ -2553,6 +2535,24 @@ namespace ServiceLib.Resx {
} }
} }
/// <summary>
/// 查找类似 This feature is intended for advanced users and those with special requirements. Once enabled, it will ignore the Core&apos;s basic settings, DNS settings, and routing settings. You must ensure that the system proxy port, traffic statistics, and other related configurations are set correctly — everything will be configured by you. 的本地化字符串。
/// </summary>
public static string TbFullConfigTemplateDesc {
get {
return ResourceManager.GetString("TbFullConfigTemplateDesc", resourceCulture);
}
}
/// <summary>
/// 查找类似 Enable Full Config Template 的本地化字符串。
/// </summary>
public static string TbFullConfigTemplateEnable {
get {
return ResourceManager.GetString("TbFullConfigTemplateEnable", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 Global Hotkey Settings 的本地化字符串。 /// 查找类似 Global Hotkey Settings 的本地化字符串。
/// </summary> /// </summary>
@ -2770,20 +2770,20 @@ namespace ServiceLib.Resx {
} }
/// <summary> /// <summary>
/// 查找类似 v2ray Custom Config 的本地化字符串。 /// 查找类似 v2ray Full Config Template 的本地化字符串。
/// </summary> /// </summary>
public static string TbRayCustomConfig { public static string TbRayFullConfigTemplate {
get { get {
return ResourceManager.GetString("TbRayCustomConfig", resourceCulture); return ResourceManager.GetString("TbRayFullConfigTemplate", resourceCulture);
} }
} }
/// <summary> /// <summary>
/// 查找类似 Add Outbound Config Only, routing.balancers and routing.rules.outboundTag 的本地化字符串。 /// 查找类似 Add Outbound Config Only, routing.balancers and routing.rules.outboundTag 的本地化字符串。
/// </summary> /// </summary>
public static string TbRayCustomConfigDesc { public static string TbRayFullConfigTemplateDesc {
get { get {
return ResourceManager.GetString("TbRayCustomConfigDesc", resourceCulture); return ResourceManager.GetString("TbRayFullConfigTemplateDesc", resourceCulture);
} }
} }
@ -2913,15 +2913,6 @@ namespace ServiceLib.Resx {
} }
} }
/// <summary>
/// 查找类似 Add Outbound and Endpoint Config Only 的本地化字符串。
/// </summary>
public static string TbSBCustomConfigDesc {
get {
return ResourceManager.GetString("TbSBCustomConfigDesc", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 sing-box Direct Resolution Strategy 的本地化字符串。 /// 查找类似 sing-box Direct Resolution Strategy 的本地化字符串。
/// </summary> /// </summary>
@ -2958,6 +2949,24 @@ namespace ServiceLib.Resx {
} }
} }
/// <summary>
/// 查找类似 sing-box Full Config Template 的本地化字符串。
/// </summary>
public static string TbSBFullConfigTemplate {
get {
return ResourceManager.GetString("TbSBFullConfigTemplate", resourceCulture);
}
}
/// <summary>
/// 查找类似 Add Outbound and Endpoint Config Only 的本地化字符串。
/// </summary>
public static string TbSBFullConfigTemplateDesc {
get {
return ResourceManager.GetString("TbSBFullConfigTemplateDesc", resourceCulture);
}
}
/// <summary> /// <summary>
/// 查找类似 Resolve Outbound Domains 的本地化字符串。 /// 查找类似 Resolve Outbound Domains 的本地化字符串。
/// </summary> /// </summary>

View file

@ -1470,31 +1470,34 @@
<data name="TbCustomDNSEnabledPageInvalid" xml:space="preserve"> <data name="TbCustomDNSEnabledPageInvalid" xml:space="preserve">
<value>Custom DNS Enabled, This Page's Settings Invalid</value> <value>Custom DNS Enabled, This Page's Settings Invalid</value>
</data> </data>
<data name="FillCorrectConfigText" xml:space="preserve"> <data name="FillCorrectConfigTemplateText" xml:space="preserve">
<value>Please fill in the correct custom config</value> <value>Please fill in the correct config template</value>
</data> </data>
<data name="menuCustomConfig" xml:space="preserve"> <data name="menuFullConfigTemplate" xml:space="preserve">
<value>Custom Config</value> <value>Full Config Template Setting</value>
</data> </data>
<data name="TbCustomConfigEnable" xml:space="preserve"> <data name="TbFullConfigTemplateEnable" xml:space="preserve">
<value>Enable Custom Config</value> <value>Enable Full Config Template</value>
</data> </data>
<data name="TbRayCustomConfig" xml:space="preserve"> <data name="TbRayFullConfigTemplate" xml:space="preserve">
<value>v2ray Custom Config</value> <value>v2ray Full Config Template</value>
</data> </data>
<data name="TbCustomConfigSingbox" xml:space="preserve"> <data name="TbRayFullConfigTemplateDesc" xml:space="preserve">
<value>sing-box Custom Config</value>
</data>
<data name="TbRayCustomConfigDesc" xml:space="preserve">
<value>Add Outbound Config Only, routing.balancers and routing.rules.outboundTag</value> <value>Add Outbound Config Only, routing.balancers and routing.rules.outboundTag</value>
</data> </data>
<data name="TbSBCustomConfigDesc" xml:space="preserve">
<value>Add Outbound and Endpoint Config Only</value>
</data>
<data name="TbAddProxyProtocolOutboundOnly" xml:space="preserve"> <data name="TbAddProxyProtocolOutboundOnly" xml:space="preserve">
<value>Do Not Add Non-Proxy Protocol Outbound</value> <value>Do Not Add Non-Proxy Protocol Outbound</value>
</data> </data>
<data name="TbSetUpstreamProxyDetour" xml:space="preserve"> <data name="TbSetUpstreamProxyDetour" xml:space="preserve">
<value>Set Upstream Proxy Tag</value> <value>Set Upstream Proxy Tag</value>
</data> </data>
<data name="TbSBFullConfigTemplate" xml:space="preserve">
<value>sing-box Full Config Template</value>
</data>
<data name="TbSBFullConfigTemplateDesc" xml:space="preserve">
<value>Add Outbound and Endpoint Config Only</value>
</data>
<data name="TbFullConfigTemplateDesc" xml:space="preserve">
<value>This feature is intended for advanced users and those with special requirements. Once enabled, it will ignore the Core's basic settings, DNS settings, and routing settings. You must ensure that the system proxy port, traffic statistics, and other related configurations are set correctly — everything will be configured by you.</value>
</data>
</root> </root>

View file

@ -1470,31 +1470,34 @@
<data name="TbCustomDNSEnabledPageInvalid" xml:space="preserve"> <data name="TbCustomDNSEnabledPageInvalid" xml:space="preserve">
<value>Custom DNS Enabled, This Page's Settings Invalid</value> <value>Custom DNS Enabled, This Page's Settings Invalid</value>
</data> </data>
<data name="FillCorrectConfigText" xml:space="preserve"> <data name="FillCorrectConfigTemplateText" xml:space="preserve">
<value>Please fill in the correct custom config</value> <value>Please fill in the correct config template</value>
</data> </data>
<data name="menuCustomConfig" xml:space="preserve"> <data name="menuFullConfigTemplate" xml:space="preserve">
<value>Custom Config</value> <value>Full Config Template Setting</value>
</data> </data>
<data name="TbCustomConfigEnable" xml:space="preserve"> <data name="TbFullConfigTemplateEnable" xml:space="preserve">
<value>Enable Custom Config</value> <value>Enable Full Config Template</value>
</data> </data>
<data name="TbRayCustomConfig" xml:space="preserve"> <data name="TbRayFullConfigTemplate" xml:space="preserve">
<value>v2ray Custom Config</value> <value>v2ray Full Config Template</value>
</data> </data>
<data name="TbCustomConfigSingbox" xml:space="preserve"> <data name="TbRayFullConfigTemplateDesc" xml:space="preserve">
<value>sing-box Custom Config</value>
</data>
<data name="TbRayCustomConfigDesc" xml:space="preserve">
<value>Add Outbound Config Only, routing.balancers and routing.rules.outboundTag</value> <value>Add Outbound Config Only, routing.balancers and routing.rules.outboundTag</value>
</data> </data>
<data name="TbSBCustomConfigDesc" xml:space="preserve">
<value>Add Outbound and Endpoint Config Only</value>
</data>
<data name="TbAddProxyProtocolOutboundOnly" xml:space="preserve"> <data name="TbAddProxyProtocolOutboundOnly" xml:space="preserve">
<value>Do Not Add Non-Proxy Protocol Outbound</value> <value>Do Not Add Non-Proxy Protocol Outbound</value>
</data> </data>
<data name="TbSetUpstreamProxyDetour" xml:space="preserve"> <data name="TbSetUpstreamProxyDetour" xml:space="preserve">
<value>Set Upstream Proxy Tag</value> <value>Set Upstream Proxy Tag</value>
</data> </data>
<data name="TbSBFullConfigTemplate" xml:space="preserve">
<value>sing-box Full Config Template</value>
</data>
<data name="TbSBFullConfigTemplateDesc" xml:space="preserve">
<value>Add Outbound and Endpoint Config Only</value>
</data>
<data name="TbFullConfigTemplateDesc" xml:space="preserve">
<value>This feature is intended for advanced users and those with special requirements. Once enabled, it will ignore the Core's basic settings, DNS settings, and routing settings. You must ensure that the system proxy port, traffic statistics, and other related configurations are set correctly — everything will be configured by you.</value>
</data>
</root> </root>

View file

@ -1470,31 +1470,34 @@
<data name="TbCustomDNSEnabledPageInvalid" xml:space="preserve"> <data name="TbCustomDNSEnabledPageInvalid" xml:space="preserve">
<value>Custom DNS Enabled, This Page's Settings Invalid</value> <value>Custom DNS Enabled, This Page's Settings Invalid</value>
</data> </data>
<data name="FillCorrectConfigText" xml:space="preserve"> <data name="FillCorrectConfigTemplateText" xml:space="preserve">
<value>Please fill in the correct custom config</value> <value>Please fill in the correct config template</value>
</data> </data>
<data name="menuCustomConfig" xml:space="preserve"> <data name="menuFullConfigTemplate" xml:space="preserve">
<value>Custom Config</value> <value>Full Config Template Setting</value>
</data> </data>
<data name="TbCustomConfigEnable" xml:space="preserve"> <data name="TbFullConfigTemplateEnable" xml:space="preserve">
<value>Enable Custom Config</value> <value>Enable Full Config Template</value>
</data> </data>
<data name="TbRayCustomConfig" xml:space="preserve"> <data name="TbRayFullConfigTemplate" xml:space="preserve">
<value>v2ray Custom Config</value> <value>v2ray Full Config Template</value>
</data> </data>
<data name="TbCustomConfigSingbox" xml:space="preserve"> <data name="TbRayFullConfigTemplateDesc" xml:space="preserve">
<value>sing-box Custom Config</value>
</data>
<data name="TbRayCustomConfigDesc" xml:space="preserve">
<value>Add Outbound Config Only, routing.balancers and routing.rules.outboundTag</value> <value>Add Outbound Config Only, routing.balancers and routing.rules.outboundTag</value>
</data> </data>
<data name="TbSBCustomConfigDesc" xml:space="preserve">
<value>Add Outbound and Endpoint Config Only</value>
</data>
<data name="TbAddProxyProtocolOutboundOnly" xml:space="preserve"> <data name="TbAddProxyProtocolOutboundOnly" xml:space="preserve">
<value>Do Not Add Non-Proxy Protocol Outbound</value> <value>Do Not Add Non-Proxy Protocol Outbound</value>
</data> </data>
<data name="TbSetUpstreamProxyDetour" xml:space="preserve"> <data name="TbSetUpstreamProxyDetour" xml:space="preserve">
<value>Set Upstream Proxy Tag</value> <value>Set Upstream Proxy Tag</value>
</data> </data>
<data name="TbSBFullConfigTemplate" xml:space="preserve">
<value>sing-box Full Config Template</value>
</data>
<data name="TbSBFullConfigTemplateDesc" xml:space="preserve">
<value>Add Outbound and Endpoint Config Only</value>
</data>
<data name="TbFullConfigTemplateDesc" xml:space="preserve">
<value>This feature is intended for advanced users and those with special requirements. Once enabled, it will ignore the Core's basic settings, DNS settings, and routing settings. You must ensure that the system proxy port, traffic statistics, and other related configurations are set correctly — everything will be configured by you.</value>
</data>
</root> </root>

View file

@ -1470,31 +1470,34 @@
<data name="TbCustomDNSEnabledPageInvalid" xml:space="preserve"> <data name="TbCustomDNSEnabledPageInvalid" xml:space="preserve">
<value>Custom DNS Enabled, This Page's Settings Invalid</value> <value>Custom DNS Enabled, This Page's Settings Invalid</value>
</data> </data>
<data name="FillCorrectConfigText" xml:space="preserve"> <data name="FillCorrectConfigTemplateText" xml:space="preserve">
<value>Please fill in the correct custom config</value> <value>Please fill in the correct config template</value>
</data> </data>
<data name="menuCustomConfig" xml:space="preserve"> <data name="menuFullConfigTemplate" xml:space="preserve">
<value>Custom Config</value> <value>Full Config Template Setting</value>
</data> </data>
<data name="TbCustomConfigEnable" xml:space="preserve"> <data name="TbFullConfigTemplateEnable" xml:space="preserve">
<value>Enable Custom Config</value> <value>Enable Full Config Template</value>
</data> </data>
<data name="TbRayCustomConfig" xml:space="preserve"> <data name="TbRayFullConfigTemplate" xml:space="preserve">
<value>v2ray Custom Config</value> <value>v2ray Full Config Template</value>
</data> </data>
<data name="TbCustomConfigSingbox" xml:space="preserve"> <data name="TbRayFullConfigTemplateDesc" xml:space="preserve">
<value>sing-box Custom Config</value>
</data>
<data name="TbRayCustomConfigDesc" xml:space="preserve">
<value>Add Outbound Config Only, routing.balancers and routing.rules.outboundTag</value> <value>Add Outbound Config Only, routing.balancers and routing.rules.outboundTag</value>
</data> </data>
<data name="TbSBCustomConfigDesc" xml:space="preserve">
<value>Add Outbound and Endpoint Config Only</value>
</data>
<data name="TbAddProxyProtocolOutboundOnly" xml:space="preserve"> <data name="TbAddProxyProtocolOutboundOnly" xml:space="preserve">
<value>Do Not Add Non-Proxy Protocol Outbound</value> <value>Do Not Add Non-Proxy Protocol Outbound</value>
</data> </data>
<data name="TbSetUpstreamProxyDetour" xml:space="preserve"> <data name="TbSetUpstreamProxyDetour" xml:space="preserve">
<value>Set Upstream Proxy Tag</value> <value>Set Upstream Proxy Tag</value>
</data> </data>
<data name="TbSBFullConfigTemplate" xml:space="preserve">
<value>sing-box Full Config Template</value>
</data>
<data name="TbSBFullConfigTemplateDesc" xml:space="preserve">
<value>Add Outbound and Endpoint Config Only</value>
</data>
<data name="TbFullConfigTemplateDesc" xml:space="preserve">
<value>This feature is intended for advanced users and those with special requirements. Once enabled, it will ignore the Core's basic settings, DNS settings, and routing settings. You must ensure that the system proxy port, traffic statistics, and other related configurations are set correctly — everything will be configured by you.</value>
</data>
</root> </root>

View file

@ -1467,31 +1467,34 @@
<data name="TbCustomDNSEnabledPageInvalid" xml:space="preserve"> <data name="TbCustomDNSEnabledPageInvalid" xml:space="preserve">
<value>自定义 DNS 已启用,此页面配置将无效</value> <value>自定义 DNS 已启用,此页面配置将无效</value>
</data> </data>
<data name="FillCorrectConfigText" xml:space="preserve"> <data name="FillCorrectConfigTemplateText" xml:space="preserve">
<value>请填写正确的自定义配置</value> <value>请填写正确的配置模板</value>
</data> </data>
<data name="menuCustomConfig" xml:space="preserve"> <data name="menuFullConfigTemplate" xml:space="preserve">
<value>自定义配置</value> <value>完整配置模板设置</value>
</data> </data>
<data name="TbCustomConfigEnable" xml:space="preserve"> <data name="TbFullConfigTemplateEnable" xml:space="preserve">
<value>启用自定义配置</value> <value>启用完整配置模板</value>
</data> </data>
<data name="TbRayCustomConfig" xml:space="preserve"> <data name="TbRayFullConfigTemplate" xml:space="preserve">
<value>v2ray 自定义配置</value> <value>v2ray 完整配置模板</value>
</data> </data>
<data name="TbCustomConfigSingbox" xml:space="preserve"> <data name="TbRayFullConfigTemplateDesc" xml:space="preserve">
<value>sing-box 自定义配置</value>
</data>
<data name="TbRayCustomConfigDesc" xml:space="preserve">
<value>仅添加出站配置routing.balancers 和 routing.rules.outboundTag</value> <value>仅添加出站配置routing.balancers 和 routing.rules.outboundTag</value>
</data> </data>
<data name="TbSBCustomConfigDesc" xml:space="preserve">
<value>仅添加出站和端点配置</value>
</data>
<data name="TbAddProxyProtocolOutboundOnly" xml:space="preserve"> <data name="TbAddProxyProtocolOutboundOnly" xml:space="preserve">
<value>不添加非代理协议出站</value> <value>不添加非代理协议出站</value>
</data> </data>
<data name="TbSetUpstreamProxyDetour" xml:space="preserve"> <data name="TbSetUpstreamProxyDetour" xml:space="preserve">
<value>设置上游代理 tag</value> <value>设置上游代理 tag</value>
</data> </data>
<data name="TbSBFullConfigTemplate" xml:space="preserve">
<value>sing-box 完整配置模板</value>
</data>
<data name="TbSBFullConfigTemplateDesc" xml:space="preserve">
<value>仅添加出站和端点配置</value>
</data>
<data name="TbFullConfigTemplateDesc" xml:space="preserve">
<value>此功能供高级用户和有特殊需求的用户使用。 启用此功能后,将忽略 Core 的基础设置DNS 设置 ,路由设置。你需要保证系统代理的端口和流量统计等功能的配置正确,一切都由你来设置。</value>
</data>
</root> </root>

View file

@ -1467,31 +1467,34 @@
<data name="TbCustomDNSEnabledPageInvalid" xml:space="preserve"> <data name="TbCustomDNSEnabledPageInvalid" xml:space="preserve">
<value>Custom DNS Enabled, This Page's Settings Invalid</value> <value>Custom DNS Enabled, This Page's Settings Invalid</value>
</data> </data>
<data name="FillCorrectConfigText" xml:space="preserve"> <data name="FillCorrectConfigTemplateText" xml:space="preserve">
<value>Please fill in the correct custom config</value> <value>Please fill in the correct config template</value>
</data> </data>
<data name="menuCustomConfig" xml:space="preserve"> <data name="menuFullConfigTemplate" xml:space="preserve">
<value>Custom Config</value> <value>Full Config Template Setting</value>
</data> </data>
<data name="TbCustomConfigEnable" xml:space="preserve"> <data name="TbFullConfigTemplateEnable" xml:space="preserve">
<value>Enable Custom Config</value> <value>Enable Full Config Template</value>
</data> </data>
<data name="TbRayCustomConfig" xml:space="preserve"> <data name="TbRayFullConfigTemplate" xml:space="preserve">
<value>v2ray Custom Config</value> <value>v2ray Full Config Template</value>
</data> </data>
<data name="TbCustomConfigSingbox" xml:space="preserve"> <data name="TbRayFullConfigTemplateDesc" xml:space="preserve">
<value>sing-box Custom Config</value>
</data>
<data name="TbRayCustomConfigDesc" xml:space="preserve">
<value>Add Outbound Config Only, routing.balancers and routing.rules.outboundTag</value> <value>Add Outbound Config Only, routing.balancers and routing.rules.outboundTag</value>
</data> </data>
<data name="TbSBCustomConfigDesc" xml:space="preserve">
<value>Add Outbound and Endpoint Config Only</value>
</data>
<data name="TbAddProxyProtocolOutboundOnly" xml:space="preserve"> <data name="TbAddProxyProtocolOutboundOnly" xml:space="preserve">
<value>Do Not Add Non-Proxy Protocol Outbound</value> <value>Do Not Add Non-Proxy Protocol Outbound</value>
</data> </data>
<data name="TbSetUpstreamProxyDetour" xml:space="preserve"> <data name="TbSetUpstreamProxyDetour" xml:space="preserve">
<value>Set Upstream Proxy Tag</value> <value>Set Upstream Proxy Tag</value>
</data> </data>
<data name="TbSBFullConfigTemplate" xml:space="preserve">
<value>sing-box Full Config Template</value>
</data>
<data name="TbSBFullConfigTemplateDesc" xml:space="preserve">
<value>Add Outbound and Endpoint Config Only</value>
</data>
<data name="TbFullConfigTemplateDesc" xml:space="preserve">
<value>This feature is intended for advanced users and those with special requirements. Once enabled, it will ignore the Core's basic settings, DNS settings, and routing settings. You must ensure that the system proxy port, traffic statistics, and other related configurations are set correctly — everything will be configured by you.</value>
</data>
</root> </root>

View file

@ -80,8 +80,8 @@ public class CoreConfigSingboxService
ret.Msg = string.Format(ResUI.SuccessfulConfiguration, ""); ret.Msg = string.Format(ResUI.SuccessfulConfiguration, "");
ret.Success = true; ret.Success = true;
var customConfig = await AppHandler.Instance.GetCustomConfigItem(ECoreType.sing_box); var fullConfigTemplate = await AppHandler.Instance.GetFullConfigTemplateItem(ECoreType.sing_box);
ret.Data = await ApplyCustomConfig(customConfig, singboxConfig); ret.Data = await ApplyFullConfigTemplate(fullConfigTemplate, singboxConfig);
return ret; return ret;
} }
catch (Exception ex) catch (Exception ex)
@ -434,8 +434,8 @@ public class CoreConfigSingboxService
ret.Success = true; ret.Success = true;
var customConfig = await AppHandler.Instance.GetCustomConfigItem(ECoreType.sing_box); var fullConfigTemplate = await AppHandler.Instance.GetFullConfigTemplateItem(ECoreType.sing_box);
ret.Data = await ApplyCustomConfig(customConfig, singboxConfig); ret.Data = await ApplyFullConfigTemplate(fullConfigTemplate, singboxConfig);
return ret; return ret;
} }
catch (Exception ex) catch (Exception ex)
@ -2202,60 +2202,60 @@ public class CoreConfigSingboxService
return 0; return 0;
} }
private async Task<string> ApplyCustomConfig(CustomConfigItem customConfig, SingboxConfig singboxConfig) private async Task<string> ApplyFullConfigTemplate(FullConfigTemplateItem fullConfigTemplate, SingboxConfig singboxConfig)
{ {
var customConfigItem = customConfig.Config; var fullConfigTemplateItem = fullConfigTemplate.Config;
if (_config.TunModeItem.EnableTun) if (_config.TunModeItem.EnableTun)
{ {
customConfigItem = customConfig.TunConfig; fullConfigTemplateItem = fullConfigTemplate.TunConfig;
} }
if (!customConfig.Enabled || customConfigItem.IsNullOrEmpty()) if (!fullConfigTemplate.Enabled || fullConfigTemplateItem.IsNullOrEmpty())
{ {
return JsonUtils.Serialize(singboxConfig); return JsonUtils.Serialize(singboxConfig);
} }
var customConfigNode = JsonNode.Parse(customConfigItem); var fullConfigTemplateNode = JsonNode.Parse(fullConfigTemplateItem);
if (customConfigNode == null) if (fullConfigTemplateNode == null)
{ {
return JsonUtils.Serialize(singboxConfig); return JsonUtils.Serialize(singboxConfig);
} }
// Process outbounds // Process outbounds
var customOutboundsNode = customConfigNode["outbounds"] is JsonArray outbounds ? outbounds : new JsonArray(); var customOutboundsNode = fullConfigTemplateNode["outbounds"] is JsonArray outbounds ? outbounds : new JsonArray();
foreach (var outbound in singboxConfig.outbounds) foreach (var outbound in singboxConfig.outbounds)
{ {
if (outbound.type.ToLower() is "direct" or "block") if (outbound.type.ToLower() is "direct" or "block")
{ {
if (customConfig.AddProxyOnly == true) if (fullConfigTemplate.AddProxyOnly == true)
{ {
continue; continue;
} }
} }
else if (outbound.detour.IsNullOrEmpty() && (!customConfig.ProxyDetour.IsNullOrEmpty()) && !Utils.IsPrivateNetwork(outbound.server ?? string.Empty)) else if (outbound.detour.IsNullOrEmpty() && (!fullConfigTemplate.ProxyDetour.IsNullOrEmpty()) && !Utils.IsPrivateNetwork(outbound.server ?? string.Empty))
{ {
outbound.detour = customConfig.ProxyDetour; outbound.detour = fullConfigTemplate.ProxyDetour;
} }
customOutboundsNode.Add(JsonUtils.DeepCopy(outbound)); customOutboundsNode.Add(JsonUtils.DeepCopy(outbound));
} }
customConfigNode["outbounds"] = customOutboundsNode; fullConfigTemplateNode["outbounds"] = customOutboundsNode;
// Process endpoints // Process endpoints
if (singboxConfig.endpoints != null && singboxConfig.endpoints.Count > 0) if (singboxConfig.endpoints != null && singboxConfig.endpoints.Count > 0)
{ {
var customEndpointsNode = customConfigNode["endpoints"] is JsonArray endpoints ? endpoints : new JsonArray(); var customEndpointsNode = fullConfigTemplateNode["endpoints"] is JsonArray endpoints ? endpoints : new JsonArray();
foreach (var endpoint in singboxConfig.endpoints) foreach (var endpoint in singboxConfig.endpoints)
{ {
if (endpoint.detour.IsNullOrEmpty() && (!customConfig.ProxyDetour.IsNullOrEmpty())) if (endpoint.detour.IsNullOrEmpty() && (!fullConfigTemplate.ProxyDetour.IsNullOrEmpty()))
{ {
endpoint.detour = customConfig.ProxyDetour; endpoint.detour = fullConfigTemplate.ProxyDetour;
} }
customEndpointsNode.Add(JsonUtils.DeepCopy(endpoint)); customEndpointsNode.Add(JsonUtils.DeepCopy(endpoint));
} }
customConfigNode["endpoints"] = customEndpointsNode; fullConfigTemplateNode["endpoints"] = customEndpointsNode;
} }
return await Task.FromResult(JsonUtils.Serialize(customConfigNode)); return await Task.FromResult(JsonUtils.Serialize(fullConfigTemplateNode));
} }
#endregion private gen function #endregion private gen function

View file

@ -70,8 +70,8 @@ public class CoreConfigV2rayService
ret.Msg = string.Format(ResUI.SuccessfulConfiguration, ""); ret.Msg = string.Format(ResUI.SuccessfulConfiguration, "");
ret.Success = true; ret.Success = true;
var customConfig = await AppHandler.Instance.GetCustomConfigItem(ECoreType.Xray); var fullConfigTemplate = await AppHandler.Instance.GetFullConfigTemplateItem(ECoreType.Xray);
ret.Data = await ApplyCustomConfig(customConfig, v2rayConfig); ret.Data = await ApplyFullConfigTemplate(fullConfigTemplate, v2rayConfig);
return ret; return ret;
} }
catch (Exception ex) catch (Exception ex)
@ -201,8 +201,8 @@ public class CoreConfigV2rayService
ret.Success = true; ret.Success = true;
var customConfig = await AppHandler.Instance.GetCustomConfigItem(ECoreType.Xray); var fullConfigTemplate = await AppHandler.Instance.GetFullConfigTemplateItem(ECoreType.Xray);
ret.Data = await ApplyCustomConfig(customConfig, v2rayConfig, true); ret.Data = await ApplyFullConfigTemplate(fullConfigTemplate, v2rayConfig, true);
return ret; return ret;
} }
catch (Exception ex) catch (Exception ex)
@ -1844,15 +1844,15 @@ public class CoreConfigV2rayService
return await Task.FromResult(0); return await Task.FromResult(0);
} }
private async Task<string> ApplyCustomConfig(CustomConfigItem customConfig, V2rayConfig v2rayConfig, bool handleBalancerAndRules = false) private async Task<string> ApplyFullConfigTemplate(FullConfigTemplateItem fullConfigTemplate, V2rayConfig v2rayConfig, bool handleBalancerAndRules = false)
{ {
if (!customConfig.Enabled || customConfig.Config.IsNullOrEmpty()) if (!fullConfigTemplate.Enabled || fullConfigTemplate.Config.IsNullOrEmpty())
{ {
return JsonUtils.Serialize(v2rayConfig); return JsonUtils.Serialize(v2rayConfig);
} }
var customConfigNode = JsonNode.Parse(customConfig.Config); var fullConfigTemplateNode = JsonNode.Parse(fullConfigTemplate.Config);
if (customConfigNode == null) if (fullConfigTemplateNode == null)
{ {
return JsonUtils.Serialize(v2rayConfig); return JsonUtils.Serialize(v2rayConfig);
} }
@ -1863,7 +1863,7 @@ public class CoreConfigV2rayService
var balancer = v2rayConfig.routing.balancers.First(); var balancer = v2rayConfig.routing.balancers.First();
// Modify existing rules in custom config // Modify existing rules in custom config
var rulesNode = customConfigNode["routing"]?["rules"]; var rulesNode = fullConfigTemplateNode["routing"]?["rules"];
if (rulesNode != null) if (rulesNode != null)
{ {
foreach (var rule in rulesNode.AsArray()) foreach (var rule in rulesNode.AsArray())
@ -1877,13 +1877,13 @@ public class CoreConfigV2rayService
} }
// Ensure routing node exists // Ensure routing node exists
if (customConfigNode["routing"] == null) if (fullConfigTemplateNode["routing"] == null)
{ {
customConfigNode["routing"] = new JsonObject(); fullConfigTemplateNode["routing"] = new JsonObject();
} }
// Handle balancers - append instead of override // Handle balancers - append instead of override
if (customConfigNode["routing"]["balancers"] is JsonArray customBalancersNode) if (fullConfigTemplateNode["routing"]["balancers"] is JsonArray customBalancersNode)
{ {
if (JsonNode.Parse(JsonUtils.Serialize(v2rayConfig.routing.balancers)) is JsonArray newBalancers) if (JsonNode.Parse(JsonUtils.Serialize(v2rayConfig.routing.balancers)) is JsonArray newBalancers)
{ {
@ -1895,31 +1895,31 @@ public class CoreConfigV2rayService
} }
else else
{ {
customConfigNode["routing"]["balancers"] = JsonNode.Parse(JsonUtils.Serialize(v2rayConfig.routing.balancers)); fullConfigTemplateNode["routing"]["balancers"] = JsonNode.Parse(JsonUtils.Serialize(v2rayConfig.routing.balancers));
} }
} }
// Handle outbounds - append instead of override // Handle outbounds - append instead of override
var customOutboundsNode = customConfigNode["outbounds"] is JsonArray outbounds ? outbounds : new JsonArray(); var customOutboundsNode = fullConfigTemplateNode["outbounds"] is JsonArray outbounds ? outbounds : new JsonArray();
foreach (var outbound in v2rayConfig.outbounds) foreach (var outbound in v2rayConfig.outbounds)
{ {
if (outbound.protocol.ToLower() is "blackhole" or "dns" or "freedom") if (outbound.protocol.ToLower() is "blackhole" or "dns" or "freedom")
{ {
if (customConfig.AddProxyOnly == true) if (fullConfigTemplate.AddProxyOnly == true)
{ {
continue; continue;
} }
} }
else if ((outbound.streamSettings?.sockopt?.dialerProxy.IsNullOrEmpty() == true) && (!customConfig.ProxyDetour.IsNullOrEmpty()) && !(Utils.IsPrivateNetwork(outbound.settings?.servers?.FirstOrDefault()?.address ?? string.Empty) || Utils.IsPrivateNetwork(outbound.settings?.vnext?.FirstOrDefault()?.address ?? string.Empty))) else if ((outbound.streamSettings?.sockopt?.dialerProxy.IsNullOrEmpty() == true) && (!fullConfigTemplate.ProxyDetour.IsNullOrEmpty()) && !(Utils.IsPrivateNetwork(outbound.settings?.servers?.FirstOrDefault()?.address ?? string.Empty) || Utils.IsPrivateNetwork(outbound.settings?.vnext?.FirstOrDefault()?.address ?? string.Empty)))
{ {
outbound.streamSettings ??= new StreamSettings4Ray(); outbound.streamSettings ??= new StreamSettings4Ray();
outbound.streamSettings.sockopt ??= new Sockopt4Ray(); outbound.streamSettings.sockopt ??= new Sockopt4Ray();
outbound.streamSettings.sockopt.dialerProxy = customConfig.ProxyDetour; outbound.streamSettings.sockopt.dialerProxy = fullConfigTemplate.ProxyDetour;
} }
customOutboundsNode.Add(JsonUtils.DeepCopy(outbound)); customOutboundsNode.Add(JsonUtils.DeepCopy(outbound));
} }
return await Task.FromResult(JsonUtils.Serialize(customConfigNode)); return await Task.FromResult(JsonUtils.Serialize(fullConfigTemplateNode));
} }
#endregion private gen function #endregion private gen function

View file

@ -4,23 +4,23 @@ using ReactiveUI;
using ReactiveUI.Fody.Helpers; using ReactiveUI.Fody.Helpers;
namespace ServiceLib.ViewModels; namespace ServiceLib.ViewModels;
public class CustomConfigViewModel : MyReactiveObject public class FullConfigTemplateViewModel : MyReactiveObject
{ {
#region Reactive #region Reactive
[Reactive] [Reactive]
public bool EnableCustomConfig4Ray { get; set; } public bool EnableFullConfigTemplate4Ray { get; set; }
[Reactive] [Reactive]
public bool EnableCustomConfig4Singbox { get; set; } public bool EnableFullConfigTemplate4Singbox { get; set; }
[Reactive] [Reactive]
public string CustomConfig4Ray { get; set; } public string FullConfigTemplate4Ray { get; set; }
[Reactive] [Reactive]
public string CustomConfig4Singbox { get; set; } public string FullConfigTemplate4Singbox { get; set; }
[Reactive] [Reactive]
public string CustomTunConfig4Singbox { get; set; } public string FullTunConfigTemplate4Singbox { get; set; }
[Reactive] [Reactive]
public bool AddProxyOnly4Ray { get; set; } public bool AddProxyOnly4Ray { get; set; }
@ -37,7 +37,7 @@ public class CustomConfigViewModel : MyReactiveObject
public ReactiveCommand<Unit, Unit> SaveCmd { get; } public ReactiveCommand<Unit, Unit> SaveCmd { get; }
#endregion Reactive #endregion Reactive
public CustomConfigViewModel(Func<EViewAction, object?, Task<bool>>? updateView) public FullConfigTemplateViewModel(Func<EViewAction, object?, Task<bool>>? updateView)
{ {
_config = AppHandler.Instance.Config; _config = AppHandler.Instance.Config;
_updateView = updateView; _updateView = updateView;
@ -50,16 +50,16 @@ public class CustomConfigViewModel : MyReactiveObject
} }
private async Task Init() private async Task Init()
{ {
var item = await AppHandler.Instance.GetCustomConfigItem(ECoreType.Xray); var item = await AppHandler.Instance.GetFullConfigTemplateItem(ECoreType.Xray);
EnableCustomConfig4Ray = item?.Enabled ?? false; EnableFullConfigTemplate4Ray = item?.Enabled ?? false;
CustomConfig4Ray = item?.Config ?? string.Empty; FullConfigTemplate4Ray = item?.Config ?? string.Empty;
AddProxyOnly4Ray = item?.AddProxyOnly ?? false; AddProxyOnly4Ray = item?.AddProxyOnly ?? false;
ProxyDetour4Ray = item?.ProxyDetour ?? string.Empty; ProxyDetour4Ray = item?.ProxyDetour ?? string.Empty;
var item2 = await AppHandler.Instance.GetCustomConfigItem(ECoreType.sing_box); var item2 = await AppHandler.Instance.GetFullConfigTemplateItem(ECoreType.sing_box);
EnableCustomConfig4Singbox = item2?.Enabled ?? false; EnableFullConfigTemplate4Singbox = item2?.Enabled ?? false;
CustomConfig4Singbox = item2?.Config ?? string.Empty; FullConfigTemplate4Singbox = item2?.Config ?? string.Empty;
CustomTunConfig4Singbox = item2?.TunConfig ?? string.Empty; FullTunConfigTemplate4Singbox = item2?.TunConfig ?? string.Empty;
AddProxyOnly4Singbox = item2?.AddProxyOnly ?? false; AddProxyOnly4Singbox = item2?.AddProxyOnly ?? false;
ProxyDetour4Singbox = item2?.ProxyDetour ?? string.Empty; ProxyDetour4Singbox = item2?.ProxyDetour ?? string.Empty;
} }
@ -78,33 +78,33 @@ public class CustomConfigViewModel : MyReactiveObject
private async Task<bool> SaveXrayConfigAsync() private async Task<bool> SaveXrayConfigAsync()
{ {
var item = await AppHandler.Instance.GetCustomConfigItem(ECoreType.Xray); var item = await AppHandler.Instance.GetFullConfigTemplateItem(ECoreType.Xray);
item.Enabled = EnableCustomConfig4Ray; item.Enabled = EnableFullConfigTemplate4Ray;
item.Config = null; item.Config = null;
item.Config = CustomConfig4Ray; item.Config = FullConfigTemplate4Ray;
item.AddProxyOnly = AddProxyOnly4Ray; item.AddProxyOnly = AddProxyOnly4Ray;
item.ProxyDetour = ProxyDetour4Ray; item.ProxyDetour = ProxyDetour4Ray;
await ConfigHandler.SaveCustomConfigItem(_config, item); await ConfigHandler.SaveFullConfigTemplate(_config, item);
return true; return true;
} }
private async Task<bool> SaveSingboxConfigAsync() private async Task<bool> SaveSingboxConfigAsync()
{ {
var item = await AppHandler.Instance.GetCustomConfigItem(ECoreType.sing_box); var item = await AppHandler.Instance.GetFullConfigTemplateItem(ECoreType.sing_box);
item.Enabled = EnableCustomConfig4Singbox; item.Enabled = EnableFullConfigTemplate4Singbox;
item.Config = null; item.Config = null;
item.TunConfig = null; item.TunConfig = null;
item.Config = CustomConfig4Singbox; item.Config = FullConfigTemplate4Singbox;
item.TunConfig = CustomTunConfig4Singbox; item.TunConfig = FullTunConfigTemplate4Singbox;
item.AddProxyOnly = AddProxyOnly4Singbox; item.AddProxyOnly = AddProxyOnly4Singbox;
item.ProxyDetour = ProxyDetour4Singbox; item.ProxyDetour = ProxyDetour4Singbox;
await ConfigHandler.SaveCustomConfigItem(_config, item); await ConfigHandler.SaveFullConfigTemplate(_config, item);
return true; return true;
} }
} }

View file

@ -39,7 +39,7 @@ public class MainWindowViewModel : MyReactiveObject
public ReactiveCommand<Unit, Unit> RoutingSettingCmd { get; } public ReactiveCommand<Unit, Unit> RoutingSettingCmd { get; }
public ReactiveCommand<Unit, Unit> DNSSettingCmd { get; } public ReactiveCommand<Unit, Unit> DNSSettingCmd { get; }
public ReactiveCommand<Unit, Unit> CustomConfigCmd { get; } public ReactiveCommand<Unit, Unit> FullConfigTemplateCmd { get; }
public ReactiveCommand<Unit, Unit> GlobalHotkeySettingCmd { get; } public ReactiveCommand<Unit, Unit> GlobalHotkeySettingCmd { get; }
public ReactiveCommand<Unit, Unit> RebootAsAdminCmd { get; } public ReactiveCommand<Unit, Unit> RebootAsAdminCmd { get; }
public ReactiveCommand<Unit, Unit> ClearServerStatisticsCmd { get; } public ReactiveCommand<Unit, Unit> ClearServerStatisticsCmd { get; }
@ -170,9 +170,9 @@ public class MainWindowViewModel : MyReactiveObject
{ {
await DNSSettingAsync(); await DNSSettingAsync();
}); });
CustomConfigCmd = ReactiveCommand.CreateFromTask(async () => FullConfigTemplateCmd = ReactiveCommand.CreateFromTask(async () =>
{ {
await CustomConfigAsync(); await FullConfigTemplateAsync();
}); });
GlobalHotkeySettingCmd = ReactiveCommand.CreateFromTask(async () => GlobalHotkeySettingCmd = ReactiveCommand.CreateFromTask(async () =>
{ {
@ -225,7 +225,7 @@ public class MainWindowViewModel : MyReactiveObject
await ConfigHandler.InitBuiltinRouting(_config); await ConfigHandler.InitBuiltinRouting(_config);
await ConfigHandler.InitBuiltinDNS(_config); await ConfigHandler.InitBuiltinDNS(_config);
await ConfigHandler.InitBuiltinCustomConfig(_config); await ConfigHandler.InitBuiltinFullConfigTemplate(_config);
await ProfileExHandler.Instance.Init(); await ProfileExHandler.Instance.Init();
await CoreHandler.Instance.Init(_config, UpdateHandler); await CoreHandler.Instance.Init(_config, UpdateHandler);
TaskHandler.Instance.RegUpdateTask(_config, UpdateTaskHandler); TaskHandler.Instance.RegUpdateTask(_config, UpdateTaskHandler);
@ -514,9 +514,9 @@ public class MainWindowViewModel : MyReactiveObject
} }
} }
private async Task CustomConfigAsync() private async Task FullConfigTemplateAsync()
{ {
var ret = await _updateView?.Invoke(EViewAction.CustomConfigWindow, null); var ret = await _updateView?.Invoke(EViewAction.FullConfigTemplateWindow, null);
if (ret == true) if (ret == true)
{ {
await Reload(); await Reload();

View file

@ -1,15 +1,15 @@
<Window <Window
x:Class="v2rayN.Desktop.Views.CustomConfigWindow" x:Class="v2rayN.Desktop.Views.FullConfigTemplateWindow"
xmlns="https://github.com/avaloniaui" xmlns="https://github.com/avaloniaui"
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" xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib"
xmlns:vms="clr-namespace:ServiceLib.ViewModels;assembly=ServiceLib" xmlns:vms="clr-namespace:ServiceLib.ViewModels;assembly=ServiceLib"
Title="{x:Static resx:ResUI.menuCustomConfig}" Title="{x:Static resx:ResUI.menuFullConfigTemplate}"
Width="900" Width="900"
Height="600" Height="600"
x:DataType="vms:CustomConfigViewModel" x:DataType="vms:FullConfigTemplateViewModel"
ShowInTaskbar="False" ShowInTaskbar="False"
WindowStartupLocation="CenterScreen" WindowStartupLocation="CenterScreen"
mc:Ignorable="d"> mc:Ignorable="d">
@ -35,25 +35,31 @@
</StackPanel> </StackPanel>
<TabControl HorizontalContentAlignment="Stretch"> <TabControl HorizontalContentAlignment="Stretch">
<TabItem HorizontalAlignment="Left" Header="{x:Static resx:ResUI.TbRayCustomConfig}"> <TabItem HorizontalAlignment="Left" Header="{x:Static resx:ResUI.TbRayFullConfigTemplate}">
<DockPanel Margin="{StaticResource Margin4}"> <DockPanel Margin="{StaticResource Margin4}">
<Grid DockPanel.Dock="Top" RowDefinitions="Auto,Auto"> <Grid DockPanel.Dock="Top" RowDefinitions="Auto,Auto,Auto">
<StackPanel Grid.Row="0" Orientation="Horizontal"> <TextBlock
<TextBlock Grid.Row="0"
Grid.Row="0" Margin="{StaticResource Margin4}"
Margin="{StaticResource Margin4}" VerticalAlignment="Center"
VerticalAlignment="Center" Text="{x:Static resx:ResUI.TbFullConfigTemplateDesc}"
Text="{x:Static resx:ResUI.TbRayCustomConfigDesc}" /> TextWrapping="Wrap" />
</StackPanel>
<StackPanel Grid.Row="1" Orientation="Horizontal"> <TextBlock
Grid.Row="1"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Text="{x:Static resx:ResUI.TbRayFullConfigTemplateDesc}"
TextWrapping="Wrap" />
<StackPanel Grid.Row="2" Orientation="Horizontal">
<TextBlock <TextBlock
Margin="{StaticResource Margin4}" Margin="{StaticResource Margin4}"
VerticalAlignment="Center" VerticalAlignment="Center"
Text="{x:Static resx:ResUI.TbCustomConfigEnable}" /> Text="{x:Static resx:ResUI.TbFullConfigTemplateEnable}" />
<ToggleSwitch <ToggleSwitch
x:Name="rayCustomConfigEnable" x:Name="rayFullConfigTemplateEnable"
Margin="{StaticResource Margin4}" Margin="{StaticResource Margin4}"
HorizontalAlignment="Left" /> HorizontalAlignment="Left" />
</StackPanel> </StackPanel>
@ -87,9 +93,9 @@
Margin="{StaticResource Margin4}" Margin="{StaticResource Margin4}"
BorderBrush="Gray" BorderBrush="Gray"
BorderThickness="1" BorderThickness="1"
Header="xray json config"> Header="xray config template json">
<TextBox <TextBox
x:Name="rayCustomConfig" x:Name="rayFullConfigTemplate"
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
Classes="TextArea" Classes="TextArea"
MinLines="10" MinLines="10"
@ -97,25 +103,31 @@
</HeaderedContentControl> </HeaderedContentControl>
</DockPanel> </DockPanel>
</TabItem> </TabItem>
<TabItem HorizontalAlignment="Left" Header="{x:Static resx:ResUI.TbCustomConfigSingbox}"> <TabItem HorizontalAlignment="Left" Header="{x:Static resx:ResUI.TbSBFullConfigTemplate}">
<DockPanel Margin="{StaticResource Margin4}"> <DockPanel Margin="{StaticResource Margin4}">
<Grid DockPanel.Dock="Top" RowDefinitions="Auto,Auto"> <Grid DockPanel.Dock="Top" RowDefinitions="Auto,Auto,Auto">
<StackPanel Grid.Row="0" Orientation="Horizontal"> <TextBlock
<TextBlock Grid.Row="0"
Grid.Row="0" Margin="{StaticResource Margin4}"
Margin="{StaticResource Margin4}" VerticalAlignment="Center"
VerticalAlignment="Center" Text="{x:Static resx:ResUI.TbFullConfigTemplateDesc}"
Text="{x:Static resx:ResUI.TbSBCustomConfigDesc}" /> TextWrapping="Wrap" />
</StackPanel>
<StackPanel Grid.Row="1" Orientation="Horizontal"> <TextBlock
Grid.Row="1"
Margin="{StaticResource Margin4}"
VerticalAlignment="Center"
Text="{x:Static resx:ResUI.TbSBFullConfigTemplateDesc}"
TextWrapping="Wrap" />
<StackPanel Grid.Row="2" Orientation="Horizontal">
<TextBlock <TextBlock
Margin="{StaticResource Margin4}" Margin="{StaticResource Margin4}"
VerticalAlignment="Center" VerticalAlignment="Center"
Text="{x:Static resx:ResUI.TbCustomConfigEnable}" /> Text="{x:Static resx:ResUI.TbFullConfigTemplateEnable}" />
<ToggleSwitch <ToggleSwitch
x:Name="sbCustomConfigEnable" x:Name="sbFullConfigTemplateEnable"
Margin="{StaticResource Margin4}" Margin="{StaticResource Margin4}"
HorizontalAlignment="Left" /> HorizontalAlignment="Left" />
</StackPanel> </StackPanel>
@ -151,9 +163,9 @@
Grid.Column="0" Grid.Column="0"
BorderBrush="Gray" BorderBrush="Gray"
BorderThickness="1" BorderThickness="1"
Header="sing-box json config"> Header="sing-box config template json">
<TextBox <TextBox
x:Name="sbCustomConfig" x:Name="sbFullConfigTemplate"
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
Classes="TextArea" Classes="TextArea"
MinLines="10" MinLines="10"
@ -166,9 +178,9 @@
Grid.Column="2" Grid.Column="2"
BorderBrush="Gray" BorderBrush="Gray"
BorderThickness="1" BorderThickness="1"
Header="sing-box json tun config"> Header="sing-box tun config template json">
<TextBox <TextBox
x:Name="sbCustomTunConfig" x:Name="sbFullTunConfigTemplate"
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
Classes="TextArea" Classes="TextArea"
MinLines="10" MinLines="10"

View file

@ -5,27 +5,27 @@ using v2rayN.Desktop.Base;
namespace v2rayN.Desktop.Views; namespace v2rayN.Desktop.Views;
public partial class CustomConfigWindow : WindowBase<CustomConfigViewModel> public partial class FullConfigTemplateWindow : WindowBase<FullConfigTemplateViewModel>
{ {
private static Config _config; private static Config _config;
public CustomConfigWindow() public FullConfigTemplateWindow()
{ {
InitializeComponent(); InitializeComponent();
_config = AppHandler.Instance.Config; _config = AppHandler.Instance.Config;
btnCancel.Click += (s, e) => this.Close(); btnCancel.Click += (s, e) => this.Close();
ViewModel = new CustomConfigViewModel(UpdateViewHandler); ViewModel = new FullConfigTemplateViewModel(UpdateViewHandler);
this.WhenActivated(disposables => this.WhenActivated(disposables =>
{ {
this.Bind(ViewModel, vm => vm.EnableCustomConfig4Ray, v => v.rayCustomConfigEnable.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.EnableFullConfigTemplate4Ray, v => v.rayFullConfigTemplateEnable.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.CustomConfig4Ray, v => v.rayCustomConfig.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.FullConfigTemplate4Ray, v => v.rayFullConfigTemplate.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.AddProxyOnly4Ray, v => v.togAddProxyProtocolOutboundOnly4Ray.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.AddProxyOnly4Ray, v => v.togAddProxyProtocolOutboundOnly4Ray.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.ProxyDetour4Ray, v => v.txtProxyDetour4Ray.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.ProxyDetour4Ray, v => v.txtProxyDetour4Ray.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.EnableCustomConfig4Singbox, v => v.sbCustomConfigEnable.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.EnableFullConfigTemplate4Singbox, v => v.sbFullConfigTemplateEnable.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.CustomConfig4Singbox, v => v.sbCustomConfig.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.FullConfigTemplate4Singbox, v => v.sbFullConfigTemplate.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.CustomTunConfig4Singbox, v => v.sbCustomTunConfig.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.FullTunConfigTemplate4Singbox, v => v.sbFullTunConfigTemplate.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.AddProxyOnly4Singbox, v => v.togAddProxyProtocolOutboundOnly4Singbox.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.AddProxyOnly4Singbox, v => v.togAddProxyProtocolOutboundOnly4Singbox.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.ProxyDetour4Singbox, v => v.txtProxyDetour4Singbox.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.ProxyDetour4Singbox, v => v.txtProxyDetour4Singbox.Text).DisposeWith(disposables);

View file

@ -72,7 +72,7 @@
<MenuItem x:Name="menuOptionSetting" Header="{x:Static resx:ResUI.menuOptionSetting}" /> <MenuItem x:Name="menuOptionSetting" Header="{x:Static resx:ResUI.menuOptionSetting}" />
<MenuItem x:Name="menuRoutingSetting" Header="{x:Static resx:ResUI.menuRoutingSetting}" /> <MenuItem x:Name="menuRoutingSetting" Header="{x:Static resx:ResUI.menuRoutingSetting}" />
<MenuItem x:Name="menuDNSSetting" Header="{x:Static resx:ResUI.menuDNSSetting}" /> <MenuItem x:Name="menuDNSSetting" Header="{x:Static resx:ResUI.menuDNSSetting}" />
<MenuItem x:Name="menuCustomConfig" Header="{x:Static resx:ResUI.menuCustomConfig}" /> <MenuItem x:Name="menuFullConfigTemplate" Header="{x:Static resx:ResUI.menuFullConfigTemplate}" />
<MenuItem x:Name="menuGlobalHotkeySetting" Header="{x:Static resx:ResUI.menuGlobalHotkeySetting}" /> <MenuItem x:Name="menuGlobalHotkeySetting" Header="{x:Static resx:ResUI.menuGlobalHotkeySetting}" />
<Separator /> <Separator />
<MenuItem x:Name="menuRebootAsAdmin" Header="{x:Static resx:ResUI.menuRebootAsAdmin}" /> <MenuItem x:Name="menuRebootAsAdmin" Header="{x:Static resx:ResUI.menuRebootAsAdmin}" />

View file

@ -100,7 +100,7 @@ public partial class MainWindow : WindowBase<MainWindowViewModel>
this.BindCommand(ViewModel, vm => vm.OptionSettingCmd, v => v.menuOptionSetting).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.OptionSettingCmd, v => v.menuOptionSetting).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.RoutingSettingCmd, v => v.menuRoutingSetting).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.RoutingSettingCmd, v => v.menuRoutingSetting).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.DNSSettingCmd, v => v.menuDNSSetting).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.DNSSettingCmd, v => v.menuDNSSetting).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.CustomConfigCmd, v => v.menuCustomConfig).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.FullConfigTemplateCmd, v => v.menuFullConfigTemplate).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.GlobalHotkeySettingCmd, v => v.menuGlobalHotkeySetting).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.GlobalHotkeySettingCmd, v => v.menuGlobalHotkeySetting).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.RebootAsAdminCmd, v => v.menuRebootAsAdmin).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.RebootAsAdminCmd, v => v.menuRebootAsAdmin).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.ClearServerStatisticsCmd, v => v.menuClearServerStatistics).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.ClearServerStatisticsCmd, v => v.menuClearServerStatistics).DisposeWith(disposables);
@ -191,8 +191,8 @@ public partial class MainWindow : WindowBase<MainWindowViewModel>
case EViewAction.DNSSettingWindow: case EViewAction.DNSSettingWindow:
return await new DNSSettingWindow().ShowDialog<bool>(this); return await new DNSSettingWindow().ShowDialog<bool>(this);
case EViewAction.CustomConfigWindow: case EViewAction.FullConfigTemplateWindow:
return await new CustomConfigWindow().ShowDialog<bool>(this); return await new FullConfigTemplateWindow().ShowDialog<bool>(this);
case EViewAction.RoutingSettingWindow: case EViewAction.RoutingSettingWindow:
return await new RoutingSettingWindow().ShowDialog<bool>(this); return await new RoutingSettingWindow().ShowDialog<bool>(this);

View file

@ -39,6 +39,9 @@
<EmbeddedResource Include="Assets\v2rayN.ico"> <EmbeddedResource Include="Assets\v2rayN.ico">
<CopyToOutputDirectory>Never</CopyToOutputDirectory> <CopyToOutputDirectory>Never</CopyToOutputDirectory>
</EmbeddedResource> </EmbeddedResource>
<Compile Update="Views\FullConfigTemplateWindow.axaml.cs">
<DependentUpon>FullConfigTemplateWindow.axaml</DependentUpon>
</Compile>
<None Update="v2rayN.png"> <None Update="v2rayN.png">
<CopyToOutputDirectory>Always</CopyToOutputDirectory> <CopyToOutputDirectory>Always</CopyToOutputDirectory>
</None> </None>

View file

@ -1,5 +1,5 @@
<base:WindowBase <base:WindowBase
x:Class="v2rayN.Views.CustomConfigWindow" x:Class="v2rayN.Views.FullConfigTemplateWindow"
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:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:base="clr-namespace:v2rayN.Base" xmlns:base="clr-namespace:v2rayN.Base"
@ -9,10 +9,10 @@
xmlns:reactiveui="http://reactiveui.net" xmlns:reactiveui="http://reactiveui.net"
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"
Title="{x:Static resx:ResUI.menuCustomConfig}" Title="{x:Static resx:ResUI.menuFullConfigTemplate}"
Width="1000" Width="1000"
Height="700" Height="700"
x:TypeArguments="vms:CustomConfigViewModel" x:TypeArguments="vms:FullConfigTemplateViewModel"
ShowInTaskbar="False" ShowInTaskbar="False"
Style="{StaticResource WindowGlobal}" Style="{StaticResource WindowGlobal}"
WindowStartupLocation="CenterScreen" WindowStartupLocation="CenterScreen"
@ -41,31 +41,39 @@
</StackPanel> </StackPanel>
<TabControl HorizontalContentAlignment="Left"> <TabControl HorizontalContentAlignment="Left">
<TabItem HorizontalAlignment="Left" Header="{x:Static resx:ResUI.TbRayCustomConfig}"> <TabItem HorizontalAlignment="Left" Header="{x:Static resx:ResUI.TbRayFullConfigTemplate}">
<DockPanel Margin="{StaticResource Margin8}"> <DockPanel Margin="{StaticResource Margin8}">
<Grid DockPanel.Dock="Top"> <Grid DockPanel.Dock="Top">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal"> <TextBlock
<TextBlock Grid.Row="0"
Grid.Row="0" Margin="{StaticResource Margin8}"
Margin="{StaticResource Margin8}" VerticalAlignment="Center"
VerticalAlignment="Center" Style="{StaticResource ToolbarTextBlock}"
Style="{StaticResource ToolbarTextBlock}" Text="{x:Static resx:ResUI.TbFullConfigTemplateDesc}"
Text="{x:Static resx:ResUI.TbRayCustomConfigDesc}" /> TextWrapping="Wrap" />
</StackPanel>
<StackPanel Grid.Row="1" Orientation="Horizontal"> <TextBlock
Grid.Row="1"
Margin="{StaticResource Margin8}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbRayFullConfigTemplateDesc}"
TextWrapping="Wrap" />
<StackPanel Grid.Row="2" Orientation="Horizontal">
<TextBlock <TextBlock
Margin="{StaticResource Margin8}" Margin="{StaticResource Margin8}"
VerticalAlignment="Center" VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}" Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbCustomConfigEnable}" /> Text="{x:Static resx:ResUI.TbFullConfigTemplateEnable}" />
<ToggleButton <ToggleButton
x:Name="rayCustomConfigEnable" x:Name="rayFullConfigTemplateEnable"
Margin="{StaticResource Margin8}" Margin="{StaticResource Margin8}"
HorizontalAlignment="Left" /> HorizontalAlignment="Left" />
</StackPanel> </StackPanel>
@ -99,10 +107,10 @@
</WrapPanel> </WrapPanel>
<TextBox <TextBox
x:Name="rayCustomConfig" x:Name="rayFullConfigTemplate"
Margin="{StaticResource Margin8}" Margin="{StaticResource Margin8}"
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
materialDesign:HintAssist.Hint="xray json config" materialDesign:HintAssist.Hint="xray config template json"
AcceptsReturn="True" AcceptsReturn="True"
BorderThickness="1" BorderThickness="1"
Style="{StaticResource MaterialDesignOutlinedTextBox}" Style="{StaticResource MaterialDesignOutlinedTextBox}"
@ -110,31 +118,39 @@
VerticalScrollBarVisibility="Auto" /> VerticalScrollBarVisibility="Auto" />
</DockPanel> </DockPanel>
</TabItem> </TabItem>
<TabItem HorizontalAlignment="Left" Header="{x:Static resx:ResUI.TbCustomConfigSingbox}"> <TabItem HorizontalAlignment="Left" Header="{x:Static resx:ResUI.TbSBFullConfigTemplate}">
<DockPanel Margin="{StaticResource Margin8}"> <DockPanel Margin="{StaticResource Margin8}">
<Grid DockPanel.Dock="Top"> <Grid DockPanel.Dock="Top">
<Grid.RowDefinitions> <Grid.RowDefinitions>
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" /> <RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions> </Grid.RowDefinitions>
<StackPanel Grid.Row="0" Orientation="Horizontal"> <TextBlock
<TextBlock Grid.Row="0"
Grid.Row="0" Margin="{StaticResource Margin8}"
Margin="{StaticResource Margin8}" VerticalAlignment="Center"
VerticalAlignment="Center" Style="{StaticResource ToolbarTextBlock}"
Style="{StaticResource ToolbarTextBlock}" Text="{x:Static resx:ResUI.TbFullConfigTemplateDesc}"
Text="{x:Static resx:ResUI.TbSBCustomConfigDesc}" /> TextWrapping="Wrap" />
</StackPanel>
<StackPanel Grid.Row="1" Orientation="Horizontal"> <TextBlock
Grid.Row="1"
Margin="{StaticResource Margin8}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSBFullConfigTemplateDesc}"
TextWrapping="Wrap" />
<StackPanel Grid.Row="2" Orientation="Horizontal">
<TextBlock <TextBlock
Margin="{StaticResource Margin8}" Margin="{StaticResource Margin8}"
VerticalAlignment="Center" VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}" Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbCustomConfigEnable}" /> Text="{x:Static resx:ResUI.TbFullConfigTemplateEnable}" />
<ToggleButton <ToggleButton
x:Name="sbCustomConfigEnable" x:Name="sbFullConfigTemplateEnable"
Margin="{StaticResource Margin8}" Margin="{StaticResource Margin8}"
HorizontalAlignment="Left" /> HorizontalAlignment="Left" />
</StackPanel> </StackPanel>
@ -175,10 +191,10 @@
</Grid.ColumnDefinitions> </Grid.ColumnDefinitions>
<TextBox <TextBox
x:Name="sbCustomConfig" x:Name="sbFullConfigTemplate"
Grid.Column="0" Grid.Column="0"
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
materialDesign:HintAssist.Hint="sing-box json config" materialDesign:HintAssist.Hint="sing-box config template json"
AcceptsReturn="True" AcceptsReturn="True"
BorderThickness="1" BorderThickness="1"
Style="{StaticResource MaterialDesignOutlinedTextBox}" Style="{StaticResource MaterialDesignOutlinedTextBox}"
@ -188,10 +204,10 @@
<GridSplitter Grid.Column="1" HorizontalAlignment="Stretch" /> <GridSplitter Grid.Column="1" HorizontalAlignment="Stretch" />
<TextBox <TextBox
x:Name="sbCustomTunConfig" x:Name="sbFullTunConfigTemplate"
Grid.Column="2" Grid.Column="2"
VerticalAlignment="Stretch" VerticalAlignment="Stretch"
materialDesign:HintAssist.Hint="sing-box json tun config" materialDesign:HintAssist.Hint="sing-box tun config template json"
AcceptsReturn="True" AcceptsReturn="True"
BorderThickness="1" BorderThickness="1"
Style="{StaticResource MaterialDesignOutlinedTextBox}" Style="{StaticResource MaterialDesignOutlinedTextBox}"

View file

@ -4,28 +4,28 @@ using ReactiveUI;
namespace v2rayN.Views; namespace v2rayN.Views;
public partial class CustomConfigWindow public partial class FullConfigTemplateWindow
{ {
private static Config _config; private static Config _config;
public CustomConfigWindow() public FullConfigTemplateWindow()
{ {
InitializeComponent(); InitializeComponent();
this.Owner = Application.Current.MainWindow; this.Owner = Application.Current.MainWindow;
_config = AppHandler.Instance.Config; _config = AppHandler.Instance.Config;
ViewModel = new CustomConfigViewModel(UpdateViewHandler); ViewModel = new FullConfigTemplateViewModel(UpdateViewHandler);
this.WhenActivated(disposables => this.WhenActivated(disposables =>
{ {
this.Bind(ViewModel, vm => vm.EnableCustomConfig4Ray, v => v.rayCustomConfigEnable.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.EnableFullConfigTemplate4Ray, v => v.rayFullConfigTemplateEnable.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.CustomConfig4Ray, v => v.rayCustomConfig.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.FullConfigTemplate4Ray, v => v.rayFullConfigTemplate.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.AddProxyOnly4Ray, v => v.togAddProxyProtocolOutboundOnly4Ray.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.AddProxyOnly4Ray, v => v.togAddProxyProtocolOutboundOnly4Ray.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.ProxyDetour4Ray, v => v.txtProxyDetour4Ray.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.ProxyDetour4Ray, v => v.txtProxyDetour4Ray.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.EnableCustomConfig4Singbox, v => v.sbCustomConfigEnable.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.EnableFullConfigTemplate4Singbox, v => v.sbFullConfigTemplateEnable.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.CustomConfig4Singbox, v => v.sbCustomConfig.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.FullConfigTemplate4Singbox, v => v.sbFullConfigTemplate.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.CustomTunConfig4Singbox, v => v.sbCustomTunConfig.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.FullTunConfigTemplate4Singbox, v => v.sbFullTunConfigTemplate.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.AddProxyOnly4Singbox, v => v.togAddProxyProtocolOutboundOnly4Singbox.IsChecked).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.AddProxyOnly4Singbox, v => v.togAddProxyProtocolOutboundOnly4Singbox.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.ProxyDetour4Singbox, v => v.txtProxyDetour4Singbox.Text).DisposeWith(disposables); this.Bind(ViewModel, vm => vm.ProxyDetour4Singbox, v => v.txtProxyDetour4Singbox.Text).DisposeWith(disposables);

View file

@ -174,9 +174,9 @@
Height="{StaticResource MenuItemHeight}" Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuDNSSetting}" /> Header="{x:Static resx:ResUI.menuDNSSetting}" />
<MenuItem <MenuItem
x:Name="menuCustomConfig" x:Name="menuFullConfigTemplate"
Height="{StaticResource MenuItemHeight}" Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuCustomConfig}" /> Header="{x:Static resx:ResUI.menuFullConfigTemplate}" />
<MenuItem <MenuItem
x:Name="menuGlobalHotkeySetting" x:Name="menuGlobalHotkeySetting"
Height="{StaticResource MenuItemHeight}" Height="{StaticResource MenuItemHeight}"

View file

@ -97,7 +97,7 @@ public partial class MainWindow
this.BindCommand(ViewModel, vm => vm.OptionSettingCmd, v => v.menuOptionSetting).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.OptionSettingCmd, v => v.menuOptionSetting).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.RoutingSettingCmd, v => v.menuRoutingSetting).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.RoutingSettingCmd, v => v.menuRoutingSetting).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.DNSSettingCmd, v => v.menuDNSSetting).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.DNSSettingCmd, v => v.menuDNSSetting).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.CustomConfigCmd, v => v.menuCustomConfig).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.FullConfigTemplateCmd, v => v.menuFullConfigTemplate).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.GlobalHotkeySettingCmd, v => v.menuGlobalHotkeySetting).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.GlobalHotkeySettingCmd, v => v.menuGlobalHotkeySetting).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.RebootAsAdminCmd, v => v.menuRebootAsAdmin).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.RebootAsAdminCmd, v => v.menuRebootAsAdmin).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.ClearServerStatisticsCmd, v => v.menuClearServerStatistics).DisposeWith(disposables); this.BindCommand(ViewModel, vm => vm.ClearServerStatisticsCmd, v => v.menuClearServerStatistics).DisposeWith(disposables);
@ -187,8 +187,8 @@ public partial class MainWindow
case EViewAction.OptionSettingWindow: case EViewAction.OptionSettingWindow:
return (new OptionSettingWindow().ShowDialog() ?? false); return (new OptionSettingWindow().ShowDialog() ?? false);
case EViewAction.CustomConfigWindow: case EViewAction.FullConfigTemplateWindow:
return (new CustomConfigWindow().ShowDialog() ?? false); return (new FullConfigTemplateWindow().ShowDialog() ?? false);
case EViewAction.GlobalHotkeySettingWindow: case EViewAction.GlobalHotkeySettingWindow:
return (new GlobalHotkeySettingWindow().ShowDialog() ?? false); return (new GlobalHotkeySettingWindow().ShowDialog() ?? false);