2021-03-16 12:22:00 +03:00
|
|
|
|
using Newtonsoft.Json;
|
|
|
|
|
using ProxySU_Core.Common;
|
|
|
|
|
using ProxySU_Core.Models;
|
2021-03-04 11:25:36 +03:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading.Tasks;
|
2021-03-15 12:58:20 +03:00
|
|
|
|
using System.Web;
|
2021-03-04 11:25:36 +03:00
|
|
|
|
using System.Windows;
|
|
|
|
|
|
|
|
|
|
namespace ProxySU_Core.ViewModels
|
|
|
|
|
{
|
|
|
|
|
public class XraySettingsViewModel : BaseViewModel
|
|
|
|
|
{
|
2021-03-04 13:25:52 +03:00
|
|
|
|
public XraySettings settings;
|
2021-03-04 11:25:36 +03:00
|
|
|
|
|
|
|
|
|
public XraySettingsViewModel(XraySettings parameters)
|
|
|
|
|
{
|
2021-03-04 13:25:52 +03:00
|
|
|
|
this.settings = parameters;
|
2021-03-04 11:25:36 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string UUID
|
|
|
|
|
{
|
2021-03-04 13:25:52 +03:00
|
|
|
|
get => settings.UUID;
|
|
|
|
|
set => settings.UUID = value;
|
2021-03-04 11:25:36 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string Domain
|
|
|
|
|
{
|
2021-03-04 13:25:52 +03:00
|
|
|
|
get => settings.Domain;
|
|
|
|
|
set => settings.Domain = value;
|
2021-03-04 11:25:36 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string MaskDomain
|
|
|
|
|
{
|
2021-03-04 13:25:52 +03:00
|
|
|
|
get => settings.MaskDomain;
|
|
|
|
|
set => settings.MaskDomain = value;
|
2021-03-04 11:25:36 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string VLESS_TCP_Path
|
|
|
|
|
{
|
2021-03-04 13:25:52 +03:00
|
|
|
|
get => settings.VLESS_TCP_Path;
|
|
|
|
|
set => settings.VLESS_TCP_Path = value;
|
2021-03-04 11:25:36 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string VLESS_WS_Path
|
|
|
|
|
{
|
2021-03-04 13:25:52 +03:00
|
|
|
|
get => settings.VLESS_WS_Path;
|
|
|
|
|
set => settings.VLESS_WS_Path = value;
|
2021-03-04 11:25:36 +03:00
|
|
|
|
}
|
|
|
|
|
|
2021-03-18 10:17:07 +03:00
|
|
|
|
public string VLESS_H2_Path
|
|
|
|
|
{
|
|
|
|
|
get => settings.VLESS_H2_Path;
|
|
|
|
|
set => settings.VLESS_H2_Path = value;
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-04 11:25:36 +03:00
|
|
|
|
public string VMESS_TCP_Path
|
|
|
|
|
{
|
2021-03-04 13:25:52 +03:00
|
|
|
|
get => settings.VMESS_TCP_Path;
|
|
|
|
|
set => settings.VMESS_TCP_Path = value;
|
2021-03-04 11:25:36 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public string VMESS_WS_Path
|
|
|
|
|
{
|
2021-03-04 13:25:52 +03:00
|
|
|
|
get => settings.VMESS_WS_Path;
|
|
|
|
|
set => settings.VMESS_WS_Path = value;
|
2021-03-04 11:25:36 +03:00
|
|
|
|
}
|
|
|
|
|
|
2021-03-18 10:17:07 +03:00
|
|
|
|
public string VMESS_H2_Path
|
|
|
|
|
{
|
|
|
|
|
get => settings.VMESS_H2_Path;
|
|
|
|
|
set => settings.VMESS_H2_Path = value;
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-04 11:25:36 +03:00
|
|
|
|
public string TrojanPassword
|
|
|
|
|
{
|
2021-03-04 13:25:52 +03:00
|
|
|
|
get => settings.TrojanPassword;
|
|
|
|
|
set => settings.TrojanPassword = value;
|
2021-03-04 11:25:36 +03:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool Checked_VLESS_TCP
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2021-03-04 13:25:52 +03:00
|
|
|
|
return settings.Types.Contains(XrayType.VLESS_TCP_TLS);
|
2021-03-04 11:25:36 +03:00
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (value == true)
|
|
|
|
|
{
|
2021-03-06 12:26:17 +03:00
|
|
|
|
if (!settings.Types.Contains(XrayType.VLESS_TCP_TLS))
|
|
|
|
|
settings.Types.Add(XrayType.VLESS_TCP_TLS);
|
|
|
|
|
|
2021-03-04 11:25:36 +03:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2021-03-04 13:25:52 +03:00
|
|
|
|
settings.Types.Remove(XrayType.VLESS_TCP_TLS);
|
2021-03-04 11:25:36 +03:00
|
|
|
|
}
|
|
|
|
|
Notify("Checked_VLESS_TCP");
|
|
|
|
|
Notify("VLESS_TCP_Path_Visibility");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool Checked_VLESS_XTLS
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2021-03-04 13:25:52 +03:00
|
|
|
|
return settings.Types.Contains(XrayType.VLESS_TCP_XTLS);
|
2021-03-04 11:25:36 +03:00
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (value == true)
|
|
|
|
|
{
|
2021-03-06 12:26:17 +03:00
|
|
|
|
if (!settings.Types.Contains(XrayType.VLESS_TCP_XTLS))
|
|
|
|
|
settings.Types.Add(XrayType.VLESS_TCP_XTLS);
|
2021-03-04 11:25:36 +03:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2021-03-04 13:25:52 +03:00
|
|
|
|
settings.Types.Remove(XrayType.VLESS_TCP_XTLS);
|
2021-03-04 11:25:36 +03:00
|
|
|
|
}
|
|
|
|
|
Notify("Checked_VLESS_XTLS");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool Checked_VLESS_WS
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2021-03-04 13:25:52 +03:00
|
|
|
|
return settings.Types.Contains(XrayType.VLESS_WS_TLS);
|
2021-03-04 11:25:36 +03:00
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (value == true)
|
|
|
|
|
{
|
2021-03-06 12:26:17 +03:00
|
|
|
|
if (!settings.Types.Contains(XrayType.VLESS_WS_TLS))
|
|
|
|
|
settings.Types.Add(XrayType.VLESS_WS_TLS);
|
2021-03-04 11:25:36 +03:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2021-03-04 13:25:52 +03:00
|
|
|
|
settings.Types.Remove(XrayType.VLESS_WS_TLS);
|
2021-03-04 11:25:36 +03:00
|
|
|
|
}
|
|
|
|
|
Notify("Checked_VLESS_WS");
|
|
|
|
|
Notify("VLESS_WS_Path_Visibility");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-18 10:17:07 +03:00
|
|
|
|
public bool Checked_VLESS_H2
|
|
|
|
|
{
|
|
|
|
|
get => settings.Types.Contains(XrayType.VLESS_H2_TLS);
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (value == true)
|
|
|
|
|
{
|
|
|
|
|
if (!settings.Types.Contains(XrayType.VLESS_H2_TLS))
|
|
|
|
|
settings.Types.Add(XrayType.VLESS_H2_TLS);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
settings.Types.Remove(XrayType.VLESS_H2_TLS);
|
|
|
|
|
}
|
|
|
|
|
Notify("Checked_VLESS_H2");
|
|
|
|
|
Notify("VLESS_H2_Path_Visibility");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-04 11:25:36 +03:00
|
|
|
|
public bool Checked_VMESS_TCP
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2021-03-04 13:25:52 +03:00
|
|
|
|
return settings.Types.Contains(XrayType.VMESS_TCP_TLS);
|
2021-03-04 11:25:36 +03:00
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (value == true)
|
|
|
|
|
{
|
2021-03-06 12:26:17 +03:00
|
|
|
|
if (!settings.Types.Contains(XrayType.VMESS_TCP_TLS))
|
|
|
|
|
settings.Types.Add(XrayType.VMESS_TCP_TLS);
|
2021-03-04 11:25:36 +03:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2021-03-04 13:25:52 +03:00
|
|
|
|
settings.Types.Remove(XrayType.VMESS_TCP_TLS);
|
2021-03-04 11:25:36 +03:00
|
|
|
|
}
|
|
|
|
|
Notify("Checked_VMESS_TCP");
|
|
|
|
|
Notify("VMESS_TCP_Path_Visibility");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public bool Checked_VMESS_WS
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2021-03-04 13:25:52 +03:00
|
|
|
|
return settings.Types.Contains(XrayType.VMESS_WS_TLS);
|
2021-03-04 11:25:36 +03:00
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (value == true)
|
|
|
|
|
{
|
2021-03-06 12:26:17 +03:00
|
|
|
|
if (!settings.Types.Contains(XrayType.VMESS_WS_TLS))
|
|
|
|
|
settings.Types.Add(XrayType.VMESS_WS_TLS);
|
2021-03-04 11:25:36 +03:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2021-03-04 13:25:52 +03:00
|
|
|
|
settings.Types.Remove(XrayType.VMESS_WS_TLS);
|
2021-03-04 11:25:36 +03:00
|
|
|
|
}
|
|
|
|
|
Notify("Checked_VMESS_WS");
|
|
|
|
|
Notify("VMESS_WS_Path_Visibility");
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-18 10:17:07 +03:00
|
|
|
|
public bool Checked_VMESS_H2
|
|
|
|
|
{
|
|
|
|
|
get => settings.Types.Contains(XrayType.VMESS_H2_TLS);
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (value == true)
|
|
|
|
|
{
|
|
|
|
|
if (!settings.Types.Contains(XrayType.VMESS_H2_TLS))
|
|
|
|
|
settings.Types.Add(XrayType.VMESS_H2_TLS);
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
settings.Types.Remove(XrayType.VMESS_H2_TLS);
|
|
|
|
|
}
|
|
|
|
|
Notify("Checked_VMESS_H2");
|
|
|
|
|
Notify("VMESS_H2_Path_Visibility");
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-03-04 11:25:36 +03:00
|
|
|
|
public bool Checked_Trojan_TCP
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2021-03-04 13:25:52 +03:00
|
|
|
|
return settings.Types.Contains(XrayType.Trojan_TCP_TLS);
|
2021-03-04 11:25:36 +03:00
|
|
|
|
}
|
|
|
|
|
set
|
|
|
|
|
{
|
|
|
|
|
if (value == true)
|
|
|
|
|
{
|
2021-03-06 12:26:17 +03:00
|
|
|
|
if (!settings.Types.Contains(XrayType.Trojan_TCP_TLS))
|
|
|
|
|
settings.Types.Add(XrayType.Trojan_TCP_TLS);
|
2021-03-04 11:25:36 +03:00
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
2021-03-04 13:25:52 +03:00
|
|
|
|
settings.Types.Remove(XrayType.Trojan_TCP_TLS);
|
2021-03-04 11:25:36 +03:00
|
|
|
|
}
|
|
|
|
|
Notify("Checked_Trojan_TCP");
|
2021-03-05 05:34:39 +03:00
|
|
|
|
Notify("Trojan_TCP_Pwd_Visibility");
|
2021-03-04 11:25:36 +03:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public Visibility VLESS_TCP_Path_Visibility
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return Checked_VLESS_TCP ? Visibility.Visible : Visibility.Hidden;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public Visibility VLESS_WS_Path_Visibility
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return Checked_VLESS_WS ? Visibility.Visible : Visibility.Hidden;
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-03-18 10:17:07 +03:00
|
|
|
|
public Visibility VLESS_H2_Path_Visibility
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return Checked_VLESS_H2 ? Visibility.Visible : Visibility.Hidden;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-04 11:25:36 +03:00
|
|
|
|
public Visibility VMESS_TCP_Path_Visibility
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return Checked_VMESS_TCP ? Visibility.Visible : Visibility.Hidden;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
public Visibility VMESS_WS_Path_Visibility
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return Checked_VMESS_WS ? Visibility.Visible : Visibility.Hidden;
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-03-18 10:17:07 +03:00
|
|
|
|
public Visibility VMESS_H2_Path_Visibility
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return Checked_VMESS_H2 ? Visibility.Visible : Visibility.Hidden;
|
|
|
|
|
}
|
|
|
|
|
}
|
2021-03-05 05:34:39 +03:00
|
|
|
|
public Visibility Trojan_TCP_Pwd_Visibility
|
2021-03-04 11:25:36 +03:00
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
|
|
|
|
return Checked_Trojan_TCP ? Visibility.Visible : Visibility.Hidden;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2021-03-15 12:58:20 +03:00
|
|
|
|
public string VLESS_TCP_XTLS_ShareLink
|
|
|
|
|
{
|
2021-03-17 06:58:56 +03:00
|
|
|
|
get => ShareLink.Build(XrayType.VLESS_TCP_XTLS, settings);
|
2021-03-15 12:58:20 +03:00
|
|
|
|
}
|
|
|
|
|
public string VLESS_TCP_TLS_ShareLink
|
|
|
|
|
{
|
2021-03-17 06:58:56 +03:00
|
|
|
|
get => ShareLink.Build(XrayType.VLESS_TCP_TLS, settings);
|
2021-03-15 12:58:20 +03:00
|
|
|
|
}
|
|
|
|
|
public string VLESS_WS_TLS_ShareLink
|
|
|
|
|
{
|
2021-03-17 06:58:56 +03:00
|
|
|
|
get => ShareLink.Build(XrayType.VLESS_WS_TLS, settings);
|
2021-03-15 12:58:20 +03:00
|
|
|
|
}
|
2021-03-18 10:17:07 +03:00
|
|
|
|
public string VLESS_H2_TLS_ShareLink
|
|
|
|
|
{
|
|
|
|
|
get => ShareLink.Build(XrayType.VLESS_H2_TLS, settings);
|
|
|
|
|
}
|
2021-03-15 12:58:20 +03:00
|
|
|
|
public string VMESS_TCP_TLS_ShareLink
|
|
|
|
|
{
|
2021-03-17 06:58:56 +03:00
|
|
|
|
get => ShareLink.Build(XrayType.VMESS_TCP_TLS, settings);
|
2021-03-15 12:58:20 +03:00
|
|
|
|
}
|
|
|
|
|
public string VMESS_WS_TLS_ShareLink
|
|
|
|
|
{
|
2021-03-17 06:58:56 +03:00
|
|
|
|
get => ShareLink.Build(XrayType.VMESS_WS_TLS, settings);
|
2021-03-15 12:58:20 +03:00
|
|
|
|
}
|
2021-03-18 10:17:07 +03:00
|
|
|
|
public string VMESS_H2_TLS_ShareLink
|
|
|
|
|
{
|
|
|
|
|
get => ShareLink.Build(XrayType.VMESS_H2_TLS, settings);
|
|
|
|
|
}
|
2021-03-15 12:58:20 +03:00
|
|
|
|
public string Trojan_TCP_TLS_ShareLink
|
|
|
|
|
{
|
2021-03-17 06:58:56 +03:00
|
|
|
|
get => ShareLink.Build(XrayType.Trojan_TCP_TLS, settings);
|
2021-03-15 12:58:20 +03:00
|
|
|
|
}
|
|
|
|
|
|
2021-03-04 11:25:36 +03:00
|
|
|
|
}
|
2021-03-16 12:22:00 +03:00
|
|
|
|
|
2021-03-04 11:25:36 +03:00
|
|
|
|
}
|