mirror of
https://github.com/2dust/v2rayN.git
synced 2025-08-23 03:16:53 +00:00
Rename
This commit is contained in:
parent
916e6d2050
commit
10ac9cfeea
24 changed files with 364 additions and 306 deletions
|
@ -29,7 +29,7 @@ public enum EViewAction
|
|||
DNSSettingWindow,
|
||||
RoutingSettingWindow,
|
||||
OptionSettingWindow,
|
||||
CustomConfigWindow,
|
||||
FullConfigTemplateWindow,
|
||||
GlobalHotkeySettingWindow,
|
||||
SubSettingWindow,
|
||||
DispatcherSpeedTest,
|
||||
|
|
|
@ -64,7 +64,7 @@ public sealed class AppHandler
|
|||
SQLiteHelper.Instance.CreateTable<RoutingItem>();
|
||||
SQLiteHelper.Instance.CreateTable<ProfileExItem>();
|
||||
SQLiteHelper.Instance.CreateTable<DNSItem>();
|
||||
SQLiteHelper.Instance.CreateTable<CustomConfigItem>();
|
||||
SQLiteHelper.Instance.CreateTable<FullConfigTemplateItem>();
|
||||
return true;
|
||||
}
|
||||
|
||||
|
@ -204,14 +204,14 @@ public sealed class AppHandler
|
|||
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
|
||||
|
|
|
@ -2240,29 +2240,29 @@ public class ConfigHandler
|
|||
|
||||
#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)
|
||||
{
|
||||
var item = new CustomConfigItem()
|
||||
var item = new FullConfigTemplateItem()
|
||||
{
|
||||
Remarks = "V2ray",
|
||||
CoreType = ECoreType.Xray,
|
||||
};
|
||||
await SaveCustomConfigItem(config, item);
|
||||
await SaveFullConfigTemplate(config, item);
|
||||
|
||||
var item2 = new CustomConfigItem()
|
||||
var item2 = new FullConfigTemplateItem()
|
||||
{
|
||||
Remarks = "sing-box",
|
||||
CoreType = ECoreType.sing_box,
|
||||
};
|
||||
await SaveCustomConfigItem(config, item2);
|
||||
await SaveFullConfigTemplate(config, item2);
|
||||
}
|
||||
|
||||
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)
|
||||
{
|
||||
|
|
|
@ -3,7 +3,7 @@ using SQLite;
|
|||
namespace ServiceLib.Models;
|
||||
|
||||
[Serializable]
|
||||
public class CustomConfigItem
|
||||
public class FullConfigTemplateItem
|
||||
{
|
||||
[PrimaryKey]
|
||||
public string Id { get; set; }
|
97
v2rayN/ServiceLib/Resx/ResUI.Designer.cs
generated
97
v2rayN/ServiceLib/Resx/ResUI.Designer.cs
generated
|
@ -187,11 +187,11 @@ namespace ServiceLib.Resx {
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Please fill in the correct custom config 的本地化字符串。
|
||||
/// 查找类似 Please fill in the correct config template 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string FillCorrectConfigText {
|
||||
public static string FillCorrectConfigTemplateText {
|
||||
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>
|
||||
/// 查找类似 DNS Settings 的本地化字符串。
|
||||
/// </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>
|
||||
/// 查找类似 Global Hotkey Setting 的本地化字符串。
|
||||
/// </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>
|
||||
/// 查找类似 Enable Custom DNS 的本地化字符串。
|
||||
/// </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'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>
|
||||
/// 查找类似 Global Hotkey Settings 的本地化字符串。
|
||||
/// </summary>
|
||||
|
@ -2770,20 +2770,20 @@ namespace ServiceLib.Resx {
|
|||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 v2ray Custom Config 的本地化字符串。
|
||||
/// 查找类似 v2ray Full Config Template 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string TbRayCustomConfig {
|
||||
public static string TbRayFullConfigTemplate {
|
||||
get {
|
||||
return ResourceManager.GetString("TbRayCustomConfig", resourceCulture);
|
||||
return ResourceManager.GetString("TbRayFullConfigTemplate", resourceCulture);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 查找类似 Add Outbound Config Only, routing.balancers and routing.rules.outboundTag 的本地化字符串。
|
||||
/// </summary>
|
||||
public static string TbRayCustomConfigDesc {
|
||||
public static string TbRayFullConfigTemplateDesc {
|
||||
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>
|
||||
/// 查找类似 sing-box Direct Resolution Strategy 的本地化字符串。
|
||||
/// </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>
|
||||
/// 查找类似 Resolve Outbound Domains 的本地化字符串。
|
||||
/// </summary>
|
||||
|
|
|
@ -1470,31 +1470,34 @@
|
|||
<data name="TbCustomDNSEnabledPageInvalid" xml:space="preserve">
|
||||
<value>Custom DNS Enabled, This Page's Settings Invalid</value>
|
||||
</data>
|
||||
<data name="FillCorrectConfigText" xml:space="preserve">
|
||||
<value>Please fill in the correct custom config</value>
|
||||
<data name="FillCorrectConfigTemplateText" xml:space="preserve">
|
||||
<value>Please fill in the correct config template</value>
|
||||
</data>
|
||||
<data name="menuCustomConfig" xml:space="preserve">
|
||||
<value>Custom Config</value>
|
||||
<data name="menuFullConfigTemplate" xml:space="preserve">
|
||||
<value>Full Config Template Setting</value>
|
||||
</data>
|
||||
<data name="TbCustomConfigEnable" xml:space="preserve">
|
||||
<value>Enable Custom Config</value>
|
||||
<data name="TbFullConfigTemplateEnable" xml:space="preserve">
|
||||
<value>Enable Full Config Template</value>
|
||||
</data>
|
||||
<data name="TbRayCustomConfig" xml:space="preserve">
|
||||
<value>v2ray Custom Config</value>
|
||||
<data name="TbRayFullConfigTemplate" xml:space="preserve">
|
||||
<value>v2ray Full Config Template</value>
|
||||
</data>
|
||||
<data name="TbCustomConfigSingbox" xml:space="preserve">
|
||||
<value>sing-box Custom Config</value>
|
||||
</data>
|
||||
<data name="TbRayCustomConfigDesc" xml:space="preserve">
|
||||
<data name="TbRayFullConfigTemplateDesc" xml:space="preserve">
|
||||
<value>Add Outbound Config Only, routing.balancers and routing.rules.outboundTag</value>
|
||||
</data>
|
||||
<data name="TbSBCustomConfigDesc" xml:space="preserve">
|
||||
<value>Add Outbound and Endpoint Config Only</value>
|
||||
</data>
|
||||
<data name="TbAddProxyProtocolOutboundOnly" xml:space="preserve">
|
||||
<value>Do Not Add Non-Proxy Protocol Outbound</value>
|
||||
</data>
|
||||
<data name="TbSetUpstreamProxyDetour" xml:space="preserve">
|
||||
<value>Set Upstream Proxy Tag</value>
|
||||
</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>
|
|
@ -1470,31 +1470,34 @@
|
|||
<data name="TbCustomDNSEnabledPageInvalid" xml:space="preserve">
|
||||
<value>Custom DNS Enabled, This Page's Settings Invalid</value>
|
||||
</data>
|
||||
<data name="FillCorrectConfigText" xml:space="preserve">
|
||||
<value>Please fill in the correct custom config</value>
|
||||
<data name="FillCorrectConfigTemplateText" xml:space="preserve">
|
||||
<value>Please fill in the correct config template</value>
|
||||
</data>
|
||||
<data name="menuCustomConfig" xml:space="preserve">
|
||||
<value>Custom Config</value>
|
||||
<data name="menuFullConfigTemplate" xml:space="preserve">
|
||||
<value>Full Config Template Setting</value>
|
||||
</data>
|
||||
<data name="TbCustomConfigEnable" xml:space="preserve">
|
||||
<value>Enable Custom Config</value>
|
||||
<data name="TbFullConfigTemplateEnable" xml:space="preserve">
|
||||
<value>Enable Full Config Template</value>
|
||||
</data>
|
||||
<data name="TbRayCustomConfig" xml:space="preserve">
|
||||
<value>v2ray Custom Config</value>
|
||||
<data name="TbRayFullConfigTemplate" xml:space="preserve">
|
||||
<value>v2ray Full Config Template</value>
|
||||
</data>
|
||||
<data name="TbCustomConfigSingbox" xml:space="preserve">
|
||||
<value>sing-box Custom Config</value>
|
||||
</data>
|
||||
<data name="TbRayCustomConfigDesc" xml:space="preserve">
|
||||
<data name="TbRayFullConfigTemplateDesc" xml:space="preserve">
|
||||
<value>Add Outbound Config Only, routing.balancers and routing.rules.outboundTag</value>
|
||||
</data>
|
||||
<data name="TbSBCustomConfigDesc" xml:space="preserve">
|
||||
<value>Add Outbound and Endpoint Config Only</value>
|
||||
</data>
|
||||
<data name="TbAddProxyProtocolOutboundOnly" xml:space="preserve">
|
||||
<value>Do Not Add Non-Proxy Protocol Outbound</value>
|
||||
</data>
|
||||
<data name="TbSetUpstreamProxyDetour" xml:space="preserve">
|
||||
<value>Set Upstream Proxy Tag</value>
|
||||
</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>
|
|
@ -1470,31 +1470,34 @@
|
|||
<data name="TbCustomDNSEnabledPageInvalid" xml:space="preserve">
|
||||
<value>Custom DNS Enabled, This Page's Settings Invalid</value>
|
||||
</data>
|
||||
<data name="FillCorrectConfigText" xml:space="preserve">
|
||||
<value>Please fill in the correct custom config</value>
|
||||
<data name="FillCorrectConfigTemplateText" xml:space="preserve">
|
||||
<value>Please fill in the correct config template</value>
|
||||
</data>
|
||||
<data name="menuCustomConfig" xml:space="preserve">
|
||||
<value>Custom Config</value>
|
||||
<data name="menuFullConfigTemplate" xml:space="preserve">
|
||||
<value>Full Config Template Setting</value>
|
||||
</data>
|
||||
<data name="TbCustomConfigEnable" xml:space="preserve">
|
||||
<value>Enable Custom Config</value>
|
||||
<data name="TbFullConfigTemplateEnable" xml:space="preserve">
|
||||
<value>Enable Full Config Template</value>
|
||||
</data>
|
||||
<data name="TbRayCustomConfig" xml:space="preserve">
|
||||
<value>v2ray Custom Config</value>
|
||||
<data name="TbRayFullConfigTemplate" xml:space="preserve">
|
||||
<value>v2ray Full Config Template</value>
|
||||
</data>
|
||||
<data name="TbCustomConfigSingbox" xml:space="preserve">
|
||||
<value>sing-box Custom Config</value>
|
||||
</data>
|
||||
<data name="TbRayCustomConfigDesc" xml:space="preserve">
|
||||
<data name="TbRayFullConfigTemplateDesc" xml:space="preserve">
|
||||
<value>Add Outbound Config Only, routing.balancers and routing.rules.outboundTag</value>
|
||||
</data>
|
||||
<data name="TbSBCustomConfigDesc" xml:space="preserve">
|
||||
<value>Add Outbound and Endpoint Config Only</value>
|
||||
</data>
|
||||
<data name="TbAddProxyProtocolOutboundOnly" xml:space="preserve">
|
||||
<value>Do Not Add Non-Proxy Protocol Outbound</value>
|
||||
</data>
|
||||
<data name="TbSetUpstreamProxyDetour" xml:space="preserve">
|
||||
<value>Set Upstream Proxy Tag</value>
|
||||
</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>
|
|
@ -1470,31 +1470,34 @@
|
|||
<data name="TbCustomDNSEnabledPageInvalid" xml:space="preserve">
|
||||
<value>Custom DNS Enabled, This Page's Settings Invalid</value>
|
||||
</data>
|
||||
<data name="FillCorrectConfigText" xml:space="preserve">
|
||||
<value>Please fill in the correct custom config</value>
|
||||
<data name="FillCorrectConfigTemplateText" xml:space="preserve">
|
||||
<value>Please fill in the correct config template</value>
|
||||
</data>
|
||||
<data name="menuCustomConfig" xml:space="preserve">
|
||||
<value>Custom Config</value>
|
||||
<data name="menuFullConfigTemplate" xml:space="preserve">
|
||||
<value>Full Config Template Setting</value>
|
||||
</data>
|
||||
<data name="TbCustomConfigEnable" xml:space="preserve">
|
||||
<value>Enable Custom Config</value>
|
||||
<data name="TbFullConfigTemplateEnable" xml:space="preserve">
|
||||
<value>Enable Full Config Template</value>
|
||||
</data>
|
||||
<data name="TbRayCustomConfig" xml:space="preserve">
|
||||
<value>v2ray Custom Config</value>
|
||||
<data name="TbRayFullConfigTemplate" xml:space="preserve">
|
||||
<value>v2ray Full Config Template</value>
|
||||
</data>
|
||||
<data name="TbCustomConfigSingbox" xml:space="preserve">
|
||||
<value>sing-box Custom Config</value>
|
||||
</data>
|
||||
<data name="TbRayCustomConfigDesc" xml:space="preserve">
|
||||
<data name="TbRayFullConfigTemplateDesc" xml:space="preserve">
|
||||
<value>Add Outbound Config Only, routing.balancers and routing.rules.outboundTag</value>
|
||||
</data>
|
||||
<data name="TbSBCustomConfigDesc" xml:space="preserve">
|
||||
<value>Add Outbound and Endpoint Config Only</value>
|
||||
</data>
|
||||
<data name="TbAddProxyProtocolOutboundOnly" xml:space="preserve">
|
||||
<value>Do Not Add Non-Proxy Protocol Outbound</value>
|
||||
</data>
|
||||
<data name="TbSetUpstreamProxyDetour" xml:space="preserve">
|
||||
<value>Set Upstream Proxy Tag</value>
|
||||
</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>
|
|
@ -1467,31 +1467,34 @@
|
|||
<data name="TbCustomDNSEnabledPageInvalid" xml:space="preserve">
|
||||
<value>自定义 DNS 已启用,此页面配置将无效</value>
|
||||
</data>
|
||||
<data name="FillCorrectConfigText" xml:space="preserve">
|
||||
<value>请填写正确的自定义配置</value>
|
||||
<data name="FillCorrectConfigTemplateText" xml:space="preserve">
|
||||
<value>请填写正确的配置模板</value>
|
||||
</data>
|
||||
<data name="menuCustomConfig" xml:space="preserve">
|
||||
<value>自定义配置</value>
|
||||
<data name="menuFullConfigTemplate" xml:space="preserve">
|
||||
<value>完整配置模板设置</value>
|
||||
</data>
|
||||
<data name="TbCustomConfigEnable" xml:space="preserve">
|
||||
<value>启用自定义配置</value>
|
||||
<data name="TbFullConfigTemplateEnable" xml:space="preserve">
|
||||
<value>启用完整配置模板</value>
|
||||
</data>
|
||||
<data name="TbRayCustomConfig" xml:space="preserve">
|
||||
<value>v2ray 自定义配置</value>
|
||||
<data name="TbRayFullConfigTemplate" xml:space="preserve">
|
||||
<value>v2ray 完整配置模板</value>
|
||||
</data>
|
||||
<data name="TbCustomConfigSingbox" xml:space="preserve">
|
||||
<value>sing-box 自定义配置</value>
|
||||
</data>
|
||||
<data name="TbRayCustomConfigDesc" xml:space="preserve">
|
||||
<data name="TbRayFullConfigTemplateDesc" xml:space="preserve">
|
||||
<value>仅添加出站配置,routing.balancers 和 routing.rules.outboundTag</value>
|
||||
</data>
|
||||
<data name="TbSBCustomConfigDesc" xml:space="preserve">
|
||||
<value>仅添加出站和端点配置</value>
|
||||
</data>
|
||||
<data name="TbAddProxyProtocolOutboundOnly" xml:space="preserve">
|
||||
<value>不添加非代理协议出站</value>
|
||||
</data>
|
||||
<data name="TbSetUpstreamProxyDetour" xml:space="preserve">
|
||||
<value>设置上游代理 tag</value>
|
||||
</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>
|
|
@ -1467,31 +1467,34 @@
|
|||
<data name="TbCustomDNSEnabledPageInvalid" xml:space="preserve">
|
||||
<value>Custom DNS Enabled, This Page's Settings Invalid</value>
|
||||
</data>
|
||||
<data name="FillCorrectConfigText" xml:space="preserve">
|
||||
<value>Please fill in the correct custom config</value>
|
||||
<data name="FillCorrectConfigTemplateText" xml:space="preserve">
|
||||
<value>Please fill in the correct config template</value>
|
||||
</data>
|
||||
<data name="menuCustomConfig" xml:space="preserve">
|
||||
<value>Custom Config</value>
|
||||
<data name="menuFullConfigTemplate" xml:space="preserve">
|
||||
<value>Full Config Template Setting</value>
|
||||
</data>
|
||||
<data name="TbCustomConfigEnable" xml:space="preserve">
|
||||
<value>Enable Custom Config</value>
|
||||
<data name="TbFullConfigTemplateEnable" xml:space="preserve">
|
||||
<value>Enable Full Config Template</value>
|
||||
</data>
|
||||
<data name="TbRayCustomConfig" xml:space="preserve">
|
||||
<value>v2ray Custom Config</value>
|
||||
<data name="TbRayFullConfigTemplate" xml:space="preserve">
|
||||
<value>v2ray Full Config Template</value>
|
||||
</data>
|
||||
<data name="TbCustomConfigSingbox" xml:space="preserve">
|
||||
<value>sing-box Custom Config</value>
|
||||
</data>
|
||||
<data name="TbRayCustomConfigDesc" xml:space="preserve">
|
||||
<data name="TbRayFullConfigTemplateDesc" xml:space="preserve">
|
||||
<value>Add Outbound Config Only, routing.balancers and routing.rules.outboundTag</value>
|
||||
</data>
|
||||
<data name="TbSBCustomConfigDesc" xml:space="preserve">
|
||||
<value>Add Outbound and Endpoint Config Only</value>
|
||||
</data>
|
||||
<data name="TbAddProxyProtocolOutboundOnly" xml:space="preserve">
|
||||
<value>Do Not Add Non-Proxy Protocol Outbound</value>
|
||||
</data>
|
||||
<data name="TbSetUpstreamProxyDetour" xml:space="preserve">
|
||||
<value>Set Upstream Proxy Tag</value>
|
||||
</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>
|
|
@ -80,8 +80,8 @@ public class CoreConfigSingboxService
|
|||
ret.Msg = string.Format(ResUI.SuccessfulConfiguration, "");
|
||||
ret.Success = true;
|
||||
|
||||
var customConfig = await AppHandler.Instance.GetCustomConfigItem(ECoreType.sing_box);
|
||||
ret.Data = await ApplyCustomConfig(customConfig, singboxConfig);
|
||||
var fullConfigTemplate = await AppHandler.Instance.GetFullConfigTemplateItem(ECoreType.sing_box);
|
||||
ret.Data = await ApplyFullConfigTemplate(fullConfigTemplate, singboxConfig);
|
||||
return ret;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -434,8 +434,8 @@ public class CoreConfigSingboxService
|
|||
|
||||
ret.Success = true;
|
||||
|
||||
var customConfig = await AppHandler.Instance.GetCustomConfigItem(ECoreType.sing_box);
|
||||
ret.Data = await ApplyCustomConfig(customConfig, singboxConfig);
|
||||
var fullConfigTemplate = await AppHandler.Instance.GetFullConfigTemplateItem(ECoreType.sing_box);
|
||||
ret.Data = await ApplyFullConfigTemplate(fullConfigTemplate, singboxConfig);
|
||||
return ret;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -2202,60 +2202,60 @@ public class CoreConfigSingboxService
|
|||
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)
|
||||
{
|
||||
customConfigItem = customConfig.TunConfig;
|
||||
fullConfigTemplateItem = fullConfigTemplate.TunConfig;
|
||||
}
|
||||
|
||||
if (!customConfig.Enabled || customConfigItem.IsNullOrEmpty())
|
||||
if (!fullConfigTemplate.Enabled || fullConfigTemplateItem.IsNullOrEmpty())
|
||||
{
|
||||
return JsonUtils.Serialize(singboxConfig);
|
||||
}
|
||||
|
||||
var customConfigNode = JsonNode.Parse(customConfigItem);
|
||||
if (customConfigNode == null)
|
||||
var fullConfigTemplateNode = JsonNode.Parse(fullConfigTemplateItem);
|
||||
if (fullConfigTemplateNode == null)
|
||||
{
|
||||
return JsonUtils.Serialize(singboxConfig);
|
||||
}
|
||||
|
||||
// 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)
|
||||
{
|
||||
if (outbound.type.ToLower() is "direct" or "block")
|
||||
{
|
||||
if (customConfig.AddProxyOnly == true)
|
||||
if (fullConfigTemplate.AddProxyOnly == true)
|
||||
{
|
||||
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));
|
||||
}
|
||||
customConfigNode["outbounds"] = customOutboundsNode;
|
||||
fullConfigTemplateNode["outbounds"] = customOutboundsNode;
|
||||
|
||||
// Process endpoints
|
||||
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)
|
||||
{
|
||||
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));
|
||||
}
|
||||
customConfigNode["endpoints"] = customEndpointsNode;
|
||||
fullConfigTemplateNode["endpoints"] = customEndpointsNode;
|
||||
}
|
||||
|
||||
return await Task.FromResult(JsonUtils.Serialize(customConfigNode));
|
||||
return await Task.FromResult(JsonUtils.Serialize(fullConfigTemplateNode));
|
||||
}
|
||||
|
||||
#endregion private gen function
|
||||
|
|
|
@ -70,8 +70,8 @@ public class CoreConfigV2rayService
|
|||
ret.Msg = string.Format(ResUI.SuccessfulConfiguration, "");
|
||||
ret.Success = true;
|
||||
|
||||
var customConfig = await AppHandler.Instance.GetCustomConfigItem(ECoreType.Xray);
|
||||
ret.Data = await ApplyCustomConfig(customConfig, v2rayConfig);
|
||||
var fullConfigTemplate = await AppHandler.Instance.GetFullConfigTemplateItem(ECoreType.Xray);
|
||||
ret.Data = await ApplyFullConfigTemplate(fullConfigTemplate, v2rayConfig);
|
||||
return ret;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -201,8 +201,8 @@ public class CoreConfigV2rayService
|
|||
|
||||
ret.Success = true;
|
||||
|
||||
var customConfig = await AppHandler.Instance.GetCustomConfigItem(ECoreType.Xray);
|
||||
ret.Data = await ApplyCustomConfig(customConfig, v2rayConfig, true);
|
||||
var fullConfigTemplate = await AppHandler.Instance.GetFullConfigTemplateItem(ECoreType.Xray);
|
||||
ret.Data = await ApplyFullConfigTemplate(fullConfigTemplate, v2rayConfig, true);
|
||||
return ret;
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -1844,15 +1844,15 @@ public class CoreConfigV2rayService
|
|||
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);
|
||||
}
|
||||
|
||||
var customConfigNode = JsonNode.Parse(customConfig.Config);
|
||||
if (customConfigNode == null)
|
||||
var fullConfigTemplateNode = JsonNode.Parse(fullConfigTemplate.Config);
|
||||
if (fullConfigTemplateNode == null)
|
||||
{
|
||||
return JsonUtils.Serialize(v2rayConfig);
|
||||
}
|
||||
|
@ -1863,7 +1863,7 @@ public class CoreConfigV2rayService
|
|||
var balancer = v2rayConfig.routing.balancers.First();
|
||||
|
||||
// Modify existing rules in custom config
|
||||
var rulesNode = customConfigNode["routing"]?["rules"];
|
||||
var rulesNode = fullConfigTemplateNode["routing"]?["rules"];
|
||||
if (rulesNode != null)
|
||||
{
|
||||
foreach (var rule in rulesNode.AsArray())
|
||||
|
@ -1877,13 +1877,13 @@ public class CoreConfigV2rayService
|
|||
}
|
||||
|
||||
// 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
|
||||
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)
|
||||
{
|
||||
|
@ -1895,31 +1895,31 @@ public class CoreConfigV2rayService
|
|||
}
|
||||
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
|
||||
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)
|
||||
{
|
||||
if (outbound.protocol.ToLower() is "blackhole" or "dns" or "freedom")
|
||||
{
|
||||
if (customConfig.AddProxyOnly == true)
|
||||
if (fullConfigTemplate.AddProxyOnly == true)
|
||||
{
|
||||
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.sockopt ??= new Sockopt4Ray();
|
||||
outbound.streamSettings.sockopt.dialerProxy = customConfig.ProxyDetour;
|
||||
outbound.streamSettings.sockopt.dialerProxy = fullConfigTemplate.ProxyDetour;
|
||||
}
|
||||
customOutboundsNode.Add(JsonUtils.DeepCopy(outbound));
|
||||
}
|
||||
|
||||
return await Task.FromResult(JsonUtils.Serialize(customConfigNode));
|
||||
return await Task.FromResult(JsonUtils.Serialize(fullConfigTemplateNode));
|
||||
}
|
||||
|
||||
#endregion private gen function
|
||||
|
|
|
@ -4,23 +4,23 @@ using ReactiveUI;
|
|||
using ReactiveUI.Fody.Helpers;
|
||||
|
||||
namespace ServiceLib.ViewModels;
|
||||
public class CustomConfigViewModel : MyReactiveObject
|
||||
public class FullConfigTemplateViewModel : MyReactiveObject
|
||||
{
|
||||
#region Reactive
|
||||
[Reactive]
|
||||
public bool EnableCustomConfig4Ray { get; set; }
|
||||
public bool EnableFullConfigTemplate4Ray { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public bool EnableCustomConfig4Singbox { get; set; }
|
||||
public bool EnableFullConfigTemplate4Singbox { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public string CustomConfig4Ray { get; set; }
|
||||
public string FullConfigTemplate4Ray { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public string CustomConfig4Singbox { get; set; }
|
||||
public string FullConfigTemplate4Singbox { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public string CustomTunConfig4Singbox { get; set; }
|
||||
public string FullTunConfigTemplate4Singbox { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public bool AddProxyOnly4Ray { get; set; }
|
||||
|
@ -37,7 +37,7 @@ public class CustomConfigViewModel : MyReactiveObject
|
|||
public ReactiveCommand<Unit, Unit> SaveCmd { get; }
|
||||
#endregion Reactive
|
||||
|
||||
public CustomConfigViewModel(Func<EViewAction, object?, Task<bool>>? updateView)
|
||||
public FullConfigTemplateViewModel(Func<EViewAction, object?, Task<bool>>? updateView)
|
||||
{
|
||||
_config = AppHandler.Instance.Config;
|
||||
_updateView = updateView;
|
||||
|
@ -50,16 +50,16 @@ public class CustomConfigViewModel : MyReactiveObject
|
|||
}
|
||||
private async Task Init()
|
||||
{
|
||||
var item = await AppHandler.Instance.GetCustomConfigItem(ECoreType.Xray);
|
||||
EnableCustomConfig4Ray = item?.Enabled ?? false;
|
||||
CustomConfig4Ray = item?.Config ?? string.Empty;
|
||||
var item = await AppHandler.Instance.GetFullConfigTemplateItem(ECoreType.Xray);
|
||||
EnableFullConfigTemplate4Ray = item?.Enabled ?? false;
|
||||
FullConfigTemplate4Ray = item?.Config ?? string.Empty;
|
||||
AddProxyOnly4Ray = item?.AddProxyOnly ?? false;
|
||||
ProxyDetour4Ray = item?.ProxyDetour ?? string.Empty;
|
||||
|
||||
var item2 = await AppHandler.Instance.GetCustomConfigItem(ECoreType.sing_box);
|
||||
EnableCustomConfig4Singbox = item2?.Enabled ?? false;
|
||||
CustomConfig4Singbox = item2?.Config ?? string.Empty;
|
||||
CustomTunConfig4Singbox = item2?.TunConfig ?? string.Empty;
|
||||
var item2 = await AppHandler.Instance.GetFullConfigTemplateItem(ECoreType.sing_box);
|
||||
EnableFullConfigTemplate4Singbox = item2?.Enabled ?? false;
|
||||
FullConfigTemplate4Singbox = item2?.Config ?? string.Empty;
|
||||
FullTunConfigTemplate4Singbox = item2?.TunConfig ?? string.Empty;
|
||||
AddProxyOnly4Singbox = item2?.AddProxyOnly ?? false;
|
||||
ProxyDetour4Singbox = item2?.ProxyDetour ?? string.Empty;
|
||||
}
|
||||
|
@ -78,33 +78,33 @@ public class CustomConfigViewModel : MyReactiveObject
|
|||
|
||||
private async Task<bool> SaveXrayConfigAsync()
|
||||
{
|
||||
var item = await AppHandler.Instance.GetCustomConfigItem(ECoreType.Xray);
|
||||
item.Enabled = EnableCustomConfig4Ray;
|
||||
var item = await AppHandler.Instance.GetFullConfigTemplateItem(ECoreType.Xray);
|
||||
item.Enabled = EnableFullConfigTemplate4Ray;
|
||||
item.Config = null;
|
||||
|
||||
item.Config = CustomConfig4Ray;
|
||||
item.Config = FullConfigTemplate4Ray;
|
||||
|
||||
item.AddProxyOnly = AddProxyOnly4Ray;
|
||||
item.ProxyDetour = ProxyDetour4Ray;
|
||||
|
||||
await ConfigHandler.SaveCustomConfigItem(_config, item);
|
||||
await ConfigHandler.SaveFullConfigTemplate(_config, item);
|
||||
return true;
|
||||
}
|
||||
|
||||
private async Task<bool> SaveSingboxConfigAsync()
|
||||
{
|
||||
var item = await AppHandler.Instance.GetCustomConfigItem(ECoreType.sing_box);
|
||||
item.Enabled = EnableCustomConfig4Singbox;
|
||||
var item = await AppHandler.Instance.GetFullConfigTemplateItem(ECoreType.sing_box);
|
||||
item.Enabled = EnableFullConfigTemplate4Singbox;
|
||||
item.Config = null;
|
||||
item.TunConfig = null;
|
||||
|
||||
item.Config = CustomConfig4Singbox;
|
||||
item.TunConfig = CustomTunConfig4Singbox;
|
||||
item.Config = FullConfigTemplate4Singbox;
|
||||
item.TunConfig = FullTunConfigTemplate4Singbox;
|
||||
|
||||
item.AddProxyOnly = AddProxyOnly4Singbox;
|
||||
item.ProxyDetour = ProxyDetour4Singbox;
|
||||
|
||||
await ConfigHandler.SaveCustomConfigItem(_config, item);
|
||||
await ConfigHandler.SaveFullConfigTemplate(_config, item);
|
||||
return true;
|
||||
}
|
||||
}
|
|
@ -39,7 +39,7 @@ public class MainWindowViewModel : MyReactiveObject
|
|||
|
||||
public ReactiveCommand<Unit, Unit> RoutingSettingCmd { 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> RebootAsAdminCmd { get; }
|
||||
public ReactiveCommand<Unit, Unit> ClearServerStatisticsCmd { get; }
|
||||
|
@ -170,9 +170,9 @@ public class MainWindowViewModel : MyReactiveObject
|
|||
{
|
||||
await DNSSettingAsync();
|
||||
});
|
||||
CustomConfigCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||
FullConfigTemplateCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||
{
|
||||
await CustomConfigAsync();
|
||||
await FullConfigTemplateAsync();
|
||||
});
|
||||
GlobalHotkeySettingCmd = ReactiveCommand.CreateFromTask(async () =>
|
||||
{
|
||||
|
@ -225,7 +225,7 @@ public class MainWindowViewModel : MyReactiveObject
|
|||
|
||||
await ConfigHandler.InitBuiltinRouting(_config);
|
||||
await ConfigHandler.InitBuiltinDNS(_config);
|
||||
await ConfigHandler.InitBuiltinCustomConfig(_config);
|
||||
await ConfigHandler.InitBuiltinFullConfigTemplate(_config);
|
||||
await ProfileExHandler.Instance.Init();
|
||||
await CoreHandler.Instance.Init(_config, UpdateHandler);
|
||||
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)
|
||||
{
|
||||
await Reload();
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
<Window
|
||||
x:Class="v2rayN.Desktop.Views.CustomConfigWindow"
|
||||
x:Class="v2rayN.Desktop.Views.FullConfigTemplateWindow"
|
||||
xmlns="https://github.com/avaloniaui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib"
|
||||
xmlns:vms="clr-namespace:ServiceLib.ViewModels;assembly=ServiceLib"
|
||||
Title="{x:Static resx:ResUI.menuCustomConfig}"
|
||||
Title="{x:Static resx:ResUI.menuFullConfigTemplate}"
|
||||
Width="900"
|
||||
Height="600"
|
||||
x:DataType="vms:CustomConfigViewModel"
|
||||
x:DataType="vms:FullConfigTemplateViewModel"
|
||||
ShowInTaskbar="False"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
mc:Ignorable="d">
|
||||
|
@ -35,25 +35,31 @@
|
|||
</StackPanel>
|
||||
|
||||
<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}">
|
||||
<Grid DockPanel.Dock="Top" RowDefinitions="Auto,Auto">
|
||||
<Grid DockPanel.Dock="Top" RowDefinitions="Auto,Auto,Auto">
|
||||
|
||||
<StackPanel Grid.Row="0" Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Grid.Row="0"
|
||||
Margin="{StaticResource Margin4}"
|
||||
VerticalAlignment="Center"
|
||||
Text="{x:Static resx:ResUI.TbRayCustomConfigDesc}" />
|
||||
</StackPanel>
|
||||
Text="{x:Static resx:ResUI.TbFullConfigTemplateDesc}"
|
||||
TextWrapping="Wrap" />
|
||||
|
||||
<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
|
||||
Margin="{StaticResource Margin4}"
|
||||
VerticalAlignment="Center"
|
||||
Text="{x:Static resx:ResUI.TbCustomConfigEnable}" />
|
||||
Text="{x:Static resx:ResUI.TbFullConfigTemplateEnable}" />
|
||||
<ToggleSwitch
|
||||
x:Name="rayCustomConfigEnable"
|
||||
x:Name="rayFullConfigTemplateEnable"
|
||||
Margin="{StaticResource Margin4}"
|
||||
HorizontalAlignment="Left" />
|
||||
</StackPanel>
|
||||
|
@ -87,9 +93,9 @@
|
|||
Margin="{StaticResource Margin4}"
|
||||
BorderBrush="Gray"
|
||||
BorderThickness="1"
|
||||
Header="xray json config">
|
||||
Header="xray config template json">
|
||||
<TextBox
|
||||
x:Name="rayCustomConfig"
|
||||
x:Name="rayFullConfigTemplate"
|
||||
VerticalAlignment="Stretch"
|
||||
Classes="TextArea"
|
||||
MinLines="10"
|
||||
|
@ -97,25 +103,31 @@
|
|||
</HeaderedContentControl>
|
||||
</DockPanel>
|
||||
</TabItem>
|
||||
<TabItem HorizontalAlignment="Left" Header="{x:Static resx:ResUI.TbCustomConfigSingbox}">
|
||||
<TabItem HorizontalAlignment="Left" Header="{x:Static resx:ResUI.TbSBFullConfigTemplate}">
|
||||
<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
|
||||
Grid.Row="0"
|
||||
Margin="{StaticResource Margin4}"
|
||||
VerticalAlignment="Center"
|
||||
Text="{x:Static resx:ResUI.TbSBCustomConfigDesc}" />
|
||||
</StackPanel>
|
||||
Text="{x:Static resx:ResUI.TbFullConfigTemplateDesc}"
|
||||
TextWrapping="Wrap" />
|
||||
|
||||
<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
|
||||
Margin="{StaticResource Margin4}"
|
||||
VerticalAlignment="Center"
|
||||
Text="{x:Static resx:ResUI.TbCustomConfigEnable}" />
|
||||
Text="{x:Static resx:ResUI.TbFullConfigTemplateEnable}" />
|
||||
<ToggleSwitch
|
||||
x:Name="sbCustomConfigEnable"
|
||||
x:Name="sbFullConfigTemplateEnable"
|
||||
Margin="{StaticResource Margin4}"
|
||||
HorizontalAlignment="Left" />
|
||||
</StackPanel>
|
||||
|
@ -151,9 +163,9 @@
|
|||
Grid.Column="0"
|
||||
BorderBrush="Gray"
|
||||
BorderThickness="1"
|
||||
Header="sing-box json config">
|
||||
Header="sing-box config template json">
|
||||
<TextBox
|
||||
x:Name="sbCustomConfig"
|
||||
x:Name="sbFullConfigTemplate"
|
||||
VerticalAlignment="Stretch"
|
||||
Classes="TextArea"
|
||||
MinLines="10"
|
||||
|
@ -166,9 +178,9 @@
|
|||
Grid.Column="2"
|
||||
BorderBrush="Gray"
|
||||
BorderThickness="1"
|
||||
Header="sing-box json tun config">
|
||||
Header="sing-box tun config template json">
|
||||
<TextBox
|
||||
x:Name="sbCustomTunConfig"
|
||||
x:Name="sbFullTunConfigTemplate"
|
||||
VerticalAlignment="Stretch"
|
||||
Classes="TextArea"
|
||||
MinLines="10"
|
|
@ -5,27 +5,27 @@ using v2rayN.Desktop.Base;
|
|||
|
||||
namespace v2rayN.Desktop.Views;
|
||||
|
||||
public partial class CustomConfigWindow : WindowBase<CustomConfigViewModel>
|
||||
public partial class FullConfigTemplateWindow : WindowBase<FullConfigTemplateViewModel>
|
||||
{
|
||||
private static Config _config;
|
||||
|
||||
public CustomConfigWindow()
|
||||
public FullConfigTemplateWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
_config = AppHandler.Instance.Config;
|
||||
btnCancel.Click += (s, e) => this.Close();
|
||||
ViewModel = new CustomConfigViewModel(UpdateViewHandler);
|
||||
ViewModel = new FullConfigTemplateViewModel(UpdateViewHandler);
|
||||
|
||||
this.WhenActivated(disposables =>
|
||||
{
|
||||
this.Bind(ViewModel, vm => vm.EnableCustomConfig4Ray, v => v.rayCustomConfigEnable.IsChecked).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.CustomConfig4Ray, v => v.rayCustomConfig.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.EnableFullConfigTemplate4Ray, v => v.rayFullConfigTemplateEnable.IsChecked).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.ProxyDetour4Ray, v => v.txtProxyDetour4Ray.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.EnableCustomConfig4Singbox, v => v.sbCustomConfigEnable.IsChecked).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.CustomConfig4Singbox, v => v.sbCustomConfig.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.CustomTunConfig4Singbox, v => v.sbCustomTunConfig.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.EnableFullConfigTemplate4Singbox, v => v.sbFullConfigTemplateEnable.IsChecked).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.FullConfigTemplate4Singbox, v => v.sbFullConfigTemplate.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.ProxyDetour4Singbox, v => v.txtProxyDetour4Singbox.Text).DisposeWith(disposables);
|
||||
|
|
@ -72,7 +72,7 @@
|
|||
<MenuItem x:Name="menuOptionSetting" Header="{x:Static resx:ResUI.menuOptionSetting}" />
|
||||
<MenuItem x:Name="menuRoutingSetting" Header="{x:Static resx:ResUI.menuRoutingSetting}" />
|
||||
<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}" />
|
||||
<Separator />
|
||||
<MenuItem x:Name="menuRebootAsAdmin" Header="{x:Static resx:ResUI.menuRebootAsAdmin}" />
|
||||
|
|
|
@ -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.RoutingSettingCmd, v => v.menuRoutingSetting).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.RebootAsAdminCmd, v => v.menuRebootAsAdmin).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:
|
||||
return await new DNSSettingWindow().ShowDialog<bool>(this);
|
||||
|
||||
case EViewAction.CustomConfigWindow:
|
||||
return await new CustomConfigWindow().ShowDialog<bool>(this);
|
||||
case EViewAction.FullConfigTemplateWindow:
|
||||
return await new FullConfigTemplateWindow().ShowDialog<bool>(this);
|
||||
|
||||
case EViewAction.RoutingSettingWindow:
|
||||
return await new RoutingSettingWindow().ShowDialog<bool>(this);
|
||||
|
|
|
@ -39,6 +39,9 @@
|
|||
<EmbeddedResource Include="Assets\v2rayN.ico">
|
||||
<CopyToOutputDirectory>Never</CopyToOutputDirectory>
|
||||
</EmbeddedResource>
|
||||
<Compile Update="Views\FullConfigTemplateWindow.axaml.cs">
|
||||
<DependentUpon>FullConfigTemplateWindow.axaml</DependentUpon>
|
||||
</Compile>
|
||||
<None Update="v2rayN.png">
|
||||
<CopyToOutputDirectory>Always</CopyToOutputDirectory>
|
||||
</None>
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
<base:WindowBase
|
||||
x:Class="v2rayN.Views.CustomConfigWindow"
|
||||
x:Class="v2rayN.Views.FullConfigTemplateWindow"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:base="clr-namespace:v2rayN.Base"
|
||||
|
@ -9,10 +9,10 @@
|
|||
xmlns:reactiveui="http://reactiveui.net"
|
||||
xmlns:resx="clr-namespace:ServiceLib.Resx;assembly=ServiceLib"
|
||||
xmlns:vms="clr-namespace:ServiceLib.ViewModels;assembly=ServiceLib"
|
||||
Title="{x:Static resx:ResUI.menuCustomConfig}"
|
||||
Title="{x:Static resx:ResUI.menuFullConfigTemplate}"
|
||||
Width="1000"
|
||||
Height="700"
|
||||
x:TypeArguments="vms:CustomConfigViewModel"
|
||||
x:TypeArguments="vms:FullConfigTemplateViewModel"
|
||||
ShowInTaskbar="False"
|
||||
Style="{StaticResource WindowGlobal}"
|
||||
WindowStartupLocation="CenterScreen"
|
||||
|
@ -41,31 +41,39 @@
|
|||
</StackPanel>
|
||||
|
||||
<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}">
|
||||
<Grid DockPanel.Dock="Top">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel Grid.Row="0" Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Grid.Row="0"
|
||||
Margin="{StaticResource Margin8}"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource ToolbarTextBlock}"
|
||||
Text="{x:Static resx:ResUI.TbRayCustomConfigDesc}" />
|
||||
</StackPanel>
|
||||
Text="{x:Static resx:ResUI.TbFullConfigTemplateDesc}"
|
||||
TextWrapping="Wrap" />
|
||||
|
||||
<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
|
||||
Margin="{StaticResource Margin8}"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource ToolbarTextBlock}"
|
||||
Text="{x:Static resx:ResUI.TbCustomConfigEnable}" />
|
||||
Text="{x:Static resx:ResUI.TbFullConfigTemplateEnable}" />
|
||||
<ToggleButton
|
||||
x:Name="rayCustomConfigEnable"
|
||||
x:Name="rayFullConfigTemplateEnable"
|
||||
Margin="{StaticResource Margin8}"
|
||||
HorizontalAlignment="Left" />
|
||||
</StackPanel>
|
||||
|
@ -99,10 +107,10 @@
|
|||
</WrapPanel>
|
||||
|
||||
<TextBox
|
||||
x:Name="rayCustomConfig"
|
||||
x:Name="rayFullConfigTemplate"
|
||||
Margin="{StaticResource Margin8}"
|
||||
VerticalAlignment="Stretch"
|
||||
materialDesign:HintAssist.Hint="xray json config"
|
||||
materialDesign:HintAssist.Hint="xray config template json"
|
||||
AcceptsReturn="True"
|
||||
BorderThickness="1"
|
||||
Style="{StaticResource MaterialDesignOutlinedTextBox}"
|
||||
|
@ -110,31 +118,39 @@
|
|||
VerticalScrollBarVisibility="Auto" />
|
||||
</DockPanel>
|
||||
</TabItem>
|
||||
<TabItem HorizontalAlignment="Left" Header="{x:Static resx:ResUI.TbCustomConfigSingbox}">
|
||||
<TabItem HorizontalAlignment="Left" Header="{x:Static resx:ResUI.TbSBFullConfigTemplate}">
|
||||
<DockPanel Margin="{StaticResource Margin8}">
|
||||
<Grid DockPanel.Dock="Top">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
</Grid.RowDefinitions>
|
||||
|
||||
<StackPanel Grid.Row="0" Orientation="Horizontal">
|
||||
<TextBlock
|
||||
Grid.Row="0"
|
||||
Margin="{StaticResource Margin8}"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource ToolbarTextBlock}"
|
||||
Text="{x:Static resx:ResUI.TbSBCustomConfigDesc}" />
|
||||
</StackPanel>
|
||||
Text="{x:Static resx:ResUI.TbFullConfigTemplateDesc}"
|
||||
TextWrapping="Wrap" />
|
||||
|
||||
<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
|
||||
Margin="{StaticResource Margin8}"
|
||||
VerticalAlignment="Center"
|
||||
Style="{StaticResource ToolbarTextBlock}"
|
||||
Text="{x:Static resx:ResUI.TbCustomConfigEnable}" />
|
||||
Text="{x:Static resx:ResUI.TbFullConfigTemplateEnable}" />
|
||||
<ToggleButton
|
||||
x:Name="sbCustomConfigEnable"
|
||||
x:Name="sbFullConfigTemplateEnable"
|
||||
Margin="{StaticResource Margin8}"
|
||||
HorizontalAlignment="Left" />
|
||||
</StackPanel>
|
||||
|
@ -175,10 +191,10 @@
|
|||
</Grid.ColumnDefinitions>
|
||||
|
||||
<TextBox
|
||||
x:Name="sbCustomConfig"
|
||||
x:Name="sbFullConfigTemplate"
|
||||
Grid.Column="0"
|
||||
VerticalAlignment="Stretch"
|
||||
materialDesign:HintAssist.Hint="sing-box json config"
|
||||
materialDesign:HintAssist.Hint="sing-box config template json"
|
||||
AcceptsReturn="True"
|
||||
BorderThickness="1"
|
||||
Style="{StaticResource MaterialDesignOutlinedTextBox}"
|
||||
|
@ -188,10 +204,10 @@
|
|||
<GridSplitter Grid.Column="1" HorizontalAlignment="Stretch" />
|
||||
|
||||
<TextBox
|
||||
x:Name="sbCustomTunConfig"
|
||||
x:Name="sbFullTunConfigTemplate"
|
||||
Grid.Column="2"
|
||||
VerticalAlignment="Stretch"
|
||||
materialDesign:HintAssist.Hint="sing-box json tun config"
|
||||
materialDesign:HintAssist.Hint="sing-box tun config template json"
|
||||
AcceptsReturn="True"
|
||||
BorderThickness="1"
|
||||
Style="{StaticResource MaterialDesignOutlinedTextBox}"
|
|
@ -4,28 +4,28 @@ using ReactiveUI;
|
|||
|
||||
namespace v2rayN.Views;
|
||||
|
||||
public partial class CustomConfigWindow
|
||||
public partial class FullConfigTemplateWindow
|
||||
{
|
||||
private static Config _config;
|
||||
|
||||
public CustomConfigWindow()
|
||||
public FullConfigTemplateWindow()
|
||||
{
|
||||
InitializeComponent();
|
||||
|
||||
this.Owner = Application.Current.MainWindow;
|
||||
_config = AppHandler.Instance.Config;
|
||||
|
||||
ViewModel = new CustomConfigViewModel(UpdateViewHandler);
|
||||
ViewModel = new FullConfigTemplateViewModel(UpdateViewHandler);
|
||||
|
||||
this.WhenActivated(disposables =>
|
||||
{
|
||||
this.Bind(ViewModel, vm => vm.EnableCustomConfig4Ray, v => v.rayCustomConfigEnable.IsChecked).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.CustomConfig4Ray, v => v.rayCustomConfig.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.EnableFullConfigTemplate4Ray, v => v.rayFullConfigTemplateEnable.IsChecked).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.ProxyDetour4Ray, v => v.txtProxyDetour4Ray.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.EnableCustomConfig4Singbox, v => v.sbCustomConfigEnable.IsChecked).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.CustomConfig4Singbox, v => v.sbCustomConfig.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.CustomTunConfig4Singbox, v => v.sbCustomTunConfig.Text).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.EnableFullConfigTemplate4Singbox, v => v.sbFullConfigTemplateEnable.IsChecked).DisposeWith(disposables);
|
||||
this.Bind(ViewModel, vm => vm.FullConfigTemplate4Singbox, v => v.sbFullConfigTemplate.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.ProxyDetour4Singbox, v => v.txtProxyDetour4Singbox.Text).DisposeWith(disposables);
|
||||
|
|
@ -174,9 +174,9 @@
|
|||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuDNSSetting}" />
|
||||
<MenuItem
|
||||
x:Name="menuCustomConfig"
|
||||
x:Name="menuFullConfigTemplate"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
Header="{x:Static resx:ResUI.menuCustomConfig}" />
|
||||
Header="{x:Static resx:ResUI.menuFullConfigTemplate}" />
|
||||
<MenuItem
|
||||
x:Name="menuGlobalHotkeySetting"
|
||||
Height="{StaticResource MenuItemHeight}"
|
||||
|
|
|
@ -97,7 +97,7 @@ public partial class MainWindow
|
|||
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.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.RebootAsAdminCmd, v => v.menuRebootAsAdmin).DisposeWith(disposables);
|
||||
this.BindCommand(ViewModel, vm => vm.ClearServerStatisticsCmd, v => v.menuClearServerStatistics).DisposeWith(disposables);
|
||||
|
@ -187,8 +187,8 @@ public partial class MainWindow
|
|||
case EViewAction.OptionSettingWindow:
|
||||
return (new OptionSettingWindow().ShowDialog() ?? false);
|
||||
|
||||
case EViewAction.CustomConfigWindow:
|
||||
return (new CustomConfigWindow().ShowDialog() ?? false);
|
||||
case EViewAction.FullConfigTemplateWindow:
|
||||
return (new FullConfigTemplateWindow().ShowDialog() ?? false);
|
||||
|
||||
case EViewAction.GlobalHotkeySettingWindow:
|
||||
return (new GlobalHotkeySettingWindow().ShowDialog() ?? false);
|
||||
|
|
Loading…
Reference in a new issue