mirror of
https://github.com/2dust/v2rayN.git
synced 2026-10-02 19:58:03 +03:00
@@ -13,6 +13,9 @@ public class FullConfigTemplateViewModel : MyReactiveObject
|
||||
[Reactive]
|
||||
public string FullConfigTemplate4Ray { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public string FullTunConfigTemplate4Ray { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public string FullConfigTemplate4Singbox { get; set; }
|
||||
|
||||
@@ -50,10 +53,15 @@ public class FullConfigTemplateViewModel : MyReactiveObject
|
||||
private async Task Init()
|
||||
{
|
||||
var item = await AppManager.Instance.GetFullConfigTemplateItem(ECoreType.Xray);
|
||||
EnableFullConfigTemplate4Ray = item?.Enabled ?? false;
|
||||
FullConfigTemplate4Ray = item?.Config ?? string.Empty;
|
||||
AddProxyOnly4Ray = item?.AddProxyOnly ?? false;
|
||||
ProxyDetour4Ray = item?.ProxyDetour ?? string.Empty;
|
||||
if (item == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
EnableFullConfigTemplate4Ray = item.Enabled;
|
||||
FullConfigTemplate4Ray = item.Config ?? string.Empty;
|
||||
FullTunConfigTemplate4Ray = item.TunConfig ?? string.Empty;
|
||||
AddProxyOnly4Ray = item.AddProxyOnly ?? false;
|
||||
ProxyDetour4Ray = item.ProxyDetour ?? string.Empty;
|
||||
|
||||
var item2 = await AppManager.Instance.GetFullConfigTemplateItem(ECoreType.sing_box);
|
||||
EnableFullConfigTemplate4Singbox = item2?.Enabled ?? false;
|
||||
@@ -82,10 +90,13 @@ public class FullConfigTemplateViewModel : MyReactiveObject
|
||||
private async Task<bool> SaveXrayConfigAsync()
|
||||
{
|
||||
var item = await AppManager.Instance.GetFullConfigTemplateItem(ECoreType.Xray);
|
||||
if (item == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
item.Enabled = EnableFullConfigTemplate4Ray;
|
||||
item.Config = null;
|
||||
|
||||
item.Config = FullConfigTemplate4Ray;
|
||||
item.TunConfig = FullTunConfigTemplate4Ray;
|
||||
|
||||
item.AddProxyOnly = AddProxyOnly4Ray;
|
||||
item.ProxyDetour = ProxyDetour4Ray;
|
||||
@@ -97,10 +108,11 @@ public class FullConfigTemplateViewModel : MyReactiveObject
|
||||
private async Task<bool> SaveSingboxConfigAsync()
|
||||
{
|
||||
var item = await AppManager.Instance.GetFullConfigTemplateItem(ECoreType.sing_box);
|
||||
if (item == null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
item.Enabled = EnableFullConfigTemplate4Singbox;
|
||||
item.Config = null;
|
||||
item.TunConfig = null;
|
||||
|
||||
item.Config = FullConfigTemplate4Singbox;
|
||||
item.TunConfig = FullTunConfigTemplate4Singbox;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user