mirror of https://github.com/2dust/v2rayN
Optimizing and improving code
parent
6a17c539d1
commit
569e939492
|
@ -2,7 +2,7 @@ using System.Diagnostics.CodeAnalysis;
|
||||||
|
|
||||||
namespace ServiceLib.Common;
|
namespace ServiceLib.Common;
|
||||||
|
|
||||||
public static class StringEx
|
public static class Extension
|
||||||
{
|
{
|
||||||
public static bool IsNullOrEmpty([NotNullWhen(false)] this string? value)
|
public static bool IsNullOrEmpty([NotNullWhen(false)] this string? value)
|
||||||
{
|
{
|
||||||
|
@ -79,4 +79,9 @@ public static class StringEx
|
||||||
{
|
{
|
||||||
return int.TryParse(value, out var result) ? result : defaultValue;
|
return int.TryParse(value, out var result) ? result : defaultValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static List<string> AppendEmpty(this IEnumerable<string> source)
|
||||||
|
{
|
||||||
|
return source.Concat(new[] { string.Empty }).ToList();
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -323,6 +323,14 @@ public class Utils
|
||||||
return text.Replace(",", ",").Replace(Environment.NewLine, ",");
|
return text.Replace(",", ",").Replace(Environment.NewLine, ",");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static List<string> GetEnumNames<TEnum>() where TEnum : Enum
|
||||||
|
{
|
||||||
|
return Enum.GetValues(typeof(TEnum))
|
||||||
|
.Cast<TEnum>()
|
||||||
|
.Select(e => e.ToString())
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
|
||||||
#endregion 转换函数
|
#endregion 转换函数
|
||||||
|
|
||||||
#region 数据检查
|
#region 数据检查
|
||||||
|
|
|
@ -21,13 +21,7 @@ public partial class AddServer2Window : WindowBase<AddServer2ViewModel>
|
||||||
btnCancel.Click += (s, e) => this.Close();
|
btnCancel.Click += (s, e) => this.Close();
|
||||||
ViewModel = new AddServer2ViewModel(profileItem, UpdateViewHandler);
|
ViewModel = new AddServer2ViewModel(profileItem, UpdateViewHandler);
|
||||||
|
|
||||||
foreach (ECoreType it in Enum.GetValues(typeof(ECoreType)))
|
cmbCoreType.ItemsSource = Utils.GetEnumNames<ECoreType>().Where(t => t != ECoreType.v2rayN.ToString()).ToList().AppendEmpty();
|
||||||
{
|
|
||||||
if (it == ECoreType.v2rayN)
|
|
||||||
continue;
|
|
||||||
cmbCoreType.Items.Add(it.ToString());
|
|
||||||
}
|
|
||||||
cmbCoreType.Items.Add(string.Empty);
|
|
||||||
|
|
||||||
this.WhenActivated(disposables =>
|
this.WhenActivated(disposables =>
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,41 +26,22 @@ public partial class AddServerWindow : WindowBase<AddServerViewModel>
|
||||||
|
|
||||||
ViewModel = new AddServerViewModel(profileItem, UpdateViewHandler);
|
ViewModel = new AddServerViewModel(profileItem, UpdateViewHandler);
|
||||||
|
|
||||||
Global.CoreTypes.ForEach(it =>
|
cmbCoreType.ItemsSource = Global.CoreTypes.AppendEmpty();
|
||||||
{
|
cmbNetwork.ItemsSource = Global.Networks;
|
||||||
cmbCoreType.Items.Add(it);
|
cmbFingerprint.ItemsSource = Global.Fingerprints;
|
||||||
});
|
cmbFingerprint2.ItemsSource = Global.Fingerprints;
|
||||||
cmbCoreType.Items.Add(string.Empty);
|
cmbAllowInsecure.ItemsSource = Global.AllowInsecure;
|
||||||
|
cmbAlpn.ItemsSource = Global.Alpns;
|
||||||
|
|
||||||
cmbStreamSecurity.Items.Add(string.Empty);
|
var lstStreamSecurity = new List<string>();
|
||||||
cmbStreamSecurity.Items.Add(Global.StreamSecurity);
|
lstStreamSecurity.Add(string.Empty);
|
||||||
|
lstStreamSecurity.Add(Global.StreamSecurity);
|
||||||
Global.Networks.ForEach(it =>
|
|
||||||
{
|
|
||||||
cmbNetwork.Items.Add(it);
|
|
||||||
});
|
|
||||||
Global.Fingerprints.ForEach(it =>
|
|
||||||
{
|
|
||||||
cmbFingerprint.Items.Add(it);
|
|
||||||
cmbFingerprint2.Items.Add(it);
|
|
||||||
});
|
|
||||||
Global.AllowInsecure.ForEach(it =>
|
|
||||||
{
|
|
||||||
cmbAllowInsecure.Items.Add(it);
|
|
||||||
});
|
|
||||||
Global.Alpns.ForEach(it =>
|
|
||||||
{
|
|
||||||
cmbAlpn.Items.Add(it);
|
|
||||||
});
|
|
||||||
|
|
||||||
switch (profileItem.ConfigType)
|
switch (profileItem.ConfigType)
|
||||||
{
|
{
|
||||||
case EConfigType.VMess:
|
case EConfigType.VMess:
|
||||||
gridVMess.IsVisible = true;
|
gridVMess.IsVisible = true;
|
||||||
Global.VmessSecurities.ForEach(it =>
|
cmbSecurity.ItemsSource = Global.VmessSecurities;
|
||||||
{
|
|
||||||
cmbSecurity.Items.Add(it);
|
|
||||||
});
|
|
||||||
if (profileItem.Security.IsNullOrEmpty())
|
if (profileItem.Security.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
profileItem.Security = Global.DefaultSecurity;
|
profileItem.Security = Global.DefaultSecurity;
|
||||||
|
@ -69,10 +50,7 @@ public partial class AddServerWindow : WindowBase<AddServerViewModel>
|
||||||
|
|
||||||
case EConfigType.Shadowsocks:
|
case EConfigType.Shadowsocks:
|
||||||
gridSs.IsVisible = true;
|
gridSs.IsVisible = true;
|
||||||
AppHandler.Instance.GetShadowsocksSecurities(profileItem).ForEach(it =>
|
cmbSecurity3.ItemsSource = AppHandler.Instance.GetShadowsocksSecurities(profileItem);
|
||||||
{
|
|
||||||
cmbSecurity3.Items.Add(it);
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EConfigType.SOCKS:
|
case EConfigType.SOCKS:
|
||||||
|
@ -82,11 +60,8 @@ public partial class AddServerWindow : WindowBase<AddServerViewModel>
|
||||||
|
|
||||||
case EConfigType.VLESS:
|
case EConfigType.VLESS:
|
||||||
gridVLESS.IsVisible = true;
|
gridVLESS.IsVisible = true;
|
||||||
cmbStreamSecurity.Items.Add(Global.StreamSecurityReality);
|
lstStreamSecurity.Add(Global.StreamSecurityReality);
|
||||||
Global.Flows.ForEach(it =>
|
cmbFlow5.ItemsSource = Global.Flows;
|
||||||
{
|
|
||||||
cmbFlow5.Items.Add(it);
|
|
||||||
});
|
|
||||||
if (profileItem.Security.IsNullOrEmpty())
|
if (profileItem.Security.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
profileItem.Security = Global.None;
|
profileItem.Security = Global.None;
|
||||||
|
@ -95,11 +70,8 @@ public partial class AddServerWindow : WindowBase<AddServerViewModel>
|
||||||
|
|
||||||
case EConfigType.Trojan:
|
case EConfigType.Trojan:
|
||||||
gridTrojan.IsVisible = true;
|
gridTrojan.IsVisible = true;
|
||||||
cmbStreamSecurity.Items.Add(Global.StreamSecurityReality);
|
lstStreamSecurity.Add(Global.StreamSecurityReality);
|
||||||
Global.Flows.ForEach(it =>
|
cmbFlow6.ItemsSource = Global.Flows;
|
||||||
{
|
|
||||||
cmbFlow6.Items.Add(it);
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EConfigType.Hysteria2:
|
case EConfigType.Hysteria2:
|
||||||
|
@ -119,10 +91,7 @@ public partial class AddServerWindow : WindowBase<AddServerViewModel>
|
||||||
cmbFingerprint.IsEnabled = false;
|
cmbFingerprint.IsEnabled = false;
|
||||||
cmbFingerprint.SelectedValue = string.Empty;
|
cmbFingerprint.SelectedValue = string.Empty;
|
||||||
|
|
||||||
Global.TuicCongestionControls.ForEach(it =>
|
cmbHeaderType8.ItemsSource = Global.TuicCongestionControls;
|
||||||
{
|
|
||||||
cmbHeaderType8.Items.Add(it);
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EConfigType.WireGuard:
|
case EConfigType.WireGuard:
|
||||||
|
@ -134,6 +103,7 @@ public partial class AddServerWindow : WindowBase<AddServerViewModel>
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
cmbStreamSecurity.ItemsSource = lstStreamSecurity;
|
||||||
|
|
||||||
gridTlsMore.IsVisible = false;
|
gridTlsMore.IsVisible = false;
|
||||||
|
|
||||||
|
@ -272,44 +242,41 @@ public partial class AddServerWindow : WindowBase<AddServerViewModel>
|
||||||
|
|
||||||
private void SetHeaderType()
|
private void SetHeaderType()
|
||||||
{
|
{
|
||||||
cmbHeaderType.Items.Clear();
|
var lstHeaderType = new List<string>();
|
||||||
|
|
||||||
var network = cmbNetwork.SelectedItem.ToString();
|
var network = cmbNetwork.SelectedItem.ToString();
|
||||||
if (network.IsNullOrEmpty())
|
if (network.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
cmbHeaderType.Items.Add(Global.None);
|
lstHeaderType.Add(Global.None);
|
||||||
|
cmbHeaderType.ItemsSource = lstHeaderType;
|
||||||
|
cmbHeaderType.SelectedIndex = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (network == nameof(ETransport.tcp))
|
if (network == nameof(ETransport.tcp))
|
||||||
{
|
{
|
||||||
cmbHeaderType.Items.Add(Global.None);
|
lstHeaderType.Add(Global.None);
|
||||||
cmbHeaderType.Items.Add(Global.TcpHeaderHttp);
|
lstHeaderType.Add(Global.TcpHeaderHttp);
|
||||||
}
|
}
|
||||||
else if (network is nameof(ETransport.kcp) or nameof(ETransport.quic))
|
else if (network is nameof(ETransport.kcp) or nameof(ETransport.quic))
|
||||||
{
|
{
|
||||||
cmbHeaderType.Items.Add(Global.None);
|
lstHeaderType.Add(Global.None);
|
||||||
Global.KcpHeaderTypes.ForEach(it =>
|
lstHeaderType.AddRange(Global.KcpHeaderTypes);
|
||||||
{
|
|
||||||
cmbHeaderType.Items.Add(it);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
else if (network is nameof(ETransport.xhttp))
|
else if (network is nameof(ETransport.xhttp))
|
||||||
{
|
{
|
||||||
Global.XhttpMode.ForEach(it =>
|
lstHeaderType.AddRange(Global.XhttpMode);
|
||||||
{
|
|
||||||
cmbHeaderType.Items.Add(it);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
else if (network == nameof(ETransport.grpc))
|
else if (network == nameof(ETransport.grpc))
|
||||||
{
|
{
|
||||||
cmbHeaderType.Items.Add(Global.GrpcGunMode);
|
lstHeaderType.Add(Global.GrpcGunMode);
|
||||||
cmbHeaderType.Items.Add(Global.GrpcMultiMode);
|
lstHeaderType.Add(Global.GrpcMultiMode);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cmbHeaderType.Items.Add(Global.None);
|
lstHeaderType.Add(Global.None);
|
||||||
}
|
}
|
||||||
|
cmbHeaderType.ItemsSource = lstHeaderType;
|
||||||
cmbHeaderType.SelectedIndex = 0;
|
cmbHeaderType.SelectedIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,22 +17,10 @@ public partial class DNSSettingWindow : WindowBase<DNSSettingViewModel>
|
||||||
btnCancel.Click += (s, e) => this.Close();
|
btnCancel.Click += (s, e) => this.Close();
|
||||||
ViewModel = new DNSSettingViewModel(UpdateViewHandler);
|
ViewModel = new DNSSettingViewModel(UpdateViewHandler);
|
||||||
|
|
||||||
Global.DomainStrategy4Freedoms.ForEach(it =>
|
cmbdomainStrategy4Freedom.ItemsSource = Global.DomainStrategy4Freedoms;
|
||||||
{
|
cmbdomainStrategy4Out.ItemsSource = Global.SingboxDomainStrategy4Out;
|
||||||
cmbdomainStrategy4Freedom.Items.Add(it);
|
cmbdomainDNSAddress.ItemsSource = Global.DomainDNSAddress;
|
||||||
});
|
cmbdomainDNSAddress2.ItemsSource = Global.SingboxDomainDNSAddress;
|
||||||
Global.SingboxDomainStrategy4Out.ForEach(it =>
|
|
||||||
{
|
|
||||||
cmbdomainStrategy4Out.Items.Add(it);
|
|
||||||
});
|
|
||||||
Global.DomainDNSAddress.ForEach(it =>
|
|
||||||
{
|
|
||||||
cmbdomainDNSAddress.Items.Add(it);
|
|
||||||
});
|
|
||||||
Global.SingboxDomainDNSAddress.ForEach(it =>
|
|
||||||
{
|
|
||||||
cmbdomainDNSAddress2.Items.Add(it);
|
|
||||||
});
|
|
||||||
|
|
||||||
this.WhenActivated(disposables =>
|
this.WhenActivated(disposables =>
|
||||||
{
|
{
|
||||||
|
|
|
@ -134,7 +134,6 @@ public partial class MainWindow : WindowBase<MainWindowViewModel>
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
if (Utils.IsWindows())
|
if (Utils.IsWindows())
|
||||||
{
|
{
|
||||||
|
|
|
@ -19,87 +19,39 @@ public partial class OptionSettingWindow : WindowBase<OptionSettingViewModel>
|
||||||
ViewModel = new OptionSettingViewModel(UpdateViewHandler);
|
ViewModel = new OptionSettingViewModel(UpdateViewHandler);
|
||||||
|
|
||||||
clbdestOverride.SelectionChanged += ClbdestOverride_SelectionChanged;
|
clbdestOverride.SelectionChanged += ClbdestOverride_SelectionChanged;
|
||||||
Global.destOverrideProtocols.ForEach(it =>
|
clbdestOverride.ItemsSource = Global.destOverrideProtocols;
|
||||||
{
|
|
||||||
clbdestOverride.Items.Add(it);
|
|
||||||
});
|
|
||||||
_config.Inbound.First().DestOverride?.ForEach(it =>
|
_config.Inbound.First().DestOverride?.ForEach(it =>
|
||||||
{
|
{
|
||||||
clbdestOverride.SelectedItems.Add(it);
|
clbdestOverride.SelectedItems.Add(it);
|
||||||
});
|
});
|
||||||
Global.IEProxyProtocols.ForEach(it =>
|
|
||||||
{
|
|
||||||
cmbsystemProxyAdvancedProtocol.Items.Add(it);
|
|
||||||
});
|
|
||||||
Global.LogLevels.ForEach(it =>
|
|
||||||
{
|
|
||||||
cmbloglevel.Items.Add(it);
|
|
||||||
});
|
|
||||||
Global.Fingerprints.ForEach(it =>
|
|
||||||
{
|
|
||||||
cmbdefFingerprint.Items.Add(it);
|
|
||||||
});
|
|
||||||
Global.UserAgent.ForEach(it =>
|
|
||||||
{
|
|
||||||
cmbdefUserAgent.Items.Add(it);
|
|
||||||
});
|
|
||||||
Global.SingboxMuxs.ForEach(it =>
|
|
||||||
{
|
|
||||||
cmbmux4SboxProtocol.Items.Add(it);
|
|
||||||
});
|
|
||||||
|
|
||||||
Global.TunMtus.ForEach(it =>
|
cmbsystemProxyAdvancedProtocol.ItemsSource = Global.IEProxyProtocols;
|
||||||
{
|
cmbloglevel.ItemsSource = Global.LogLevels;
|
||||||
cmbMtu.Items.Add(it);
|
cmbdefFingerprint.ItemsSource = Global.Fingerprints;
|
||||||
});
|
cmbdefUserAgent.ItemsSource = Global.UserAgent;
|
||||||
Global.TunStacks.ForEach(it =>
|
cmbmux4SboxProtocol.ItemsSource = Global.SingboxMuxs;
|
||||||
{
|
cmbMtu.ItemsSource = Global.TunMtus;
|
||||||
cmbStack.Items.Add(it);
|
cmbStack.ItemsSource = Global.TunStacks;
|
||||||
});
|
|
||||||
Global.CoreTypes.ForEach(it =>
|
|
||||||
{
|
|
||||||
cmbCoreType1.Items.Add(it);
|
|
||||||
cmbCoreType2.Items.Add(it);
|
|
||||||
cmbCoreType3.Items.Add(it);
|
|
||||||
cmbCoreType4.Items.Add(it);
|
|
||||||
cmbCoreType5.Items.Add(it);
|
|
||||||
cmbCoreType6.Items.Add(it);
|
|
||||||
cmbCoreType9.Items.Add(it);
|
|
||||||
});
|
|
||||||
|
|
||||||
for (var i = 2; i <= 8; i++)
|
cmbCoreType1.ItemsSource = Global.CoreTypes;
|
||||||
{
|
cmbCoreType2.ItemsSource = Global.CoreTypes;
|
||||||
cmbMixedConcurrencyCount.Items.Add(i);
|
cmbCoreType3.ItemsSource = Global.CoreTypes;
|
||||||
}
|
cmbCoreType4.ItemsSource = Global.CoreTypes;
|
||||||
for (var i = 2; i <= 6; i++)
|
cmbCoreType5.ItemsSource = Global.CoreTypes;
|
||||||
{
|
cmbCoreType6.ItemsSource = Global.CoreTypes;
|
||||||
cmbSpeedTestTimeout.Items.Add(i * 5);
|
cmbCoreType9.ItemsSource = Global.CoreTypes;
|
||||||
}
|
|
||||||
|
|
||||||
|
cmbMixedConcurrencyCount.ItemsSource = Enumerable.Range(2, 7).ToList();
|
||||||
|
cmbSpeedTestTimeout.ItemsSource = Enumerable.Range(2, 5).Select(i => i * 5).ToList();
|
||||||
cmbSpeedTestUrl.ItemsSource = Global.SpeedTestUrls;
|
cmbSpeedTestUrl.ItemsSource = Global.SpeedTestUrls;
|
||||||
cmbSpeedPingTestUrl.ItemsSource = Global.SpeedPingTestUrls;
|
cmbSpeedPingTestUrl.ItemsSource = Global.SpeedPingTestUrls;
|
||||||
cmbSubConvertUrl.ItemsSource = Global.SubConvertUrls;
|
cmbSubConvertUrl.ItemsSource = Global.SubConvertUrls;
|
||||||
|
cmbGetFilesSourceUrl.ItemsSource = Global.GeoFilesSources;
|
||||||
|
cmbSrsFilesSourceUrl.ItemsSource = Global.SingboxRulesetSources;
|
||||||
|
cmbRoutingRulesSourceUrl.ItemsSource = Global.RoutingRulesSources;
|
||||||
|
cmbIPAPIUrl.ItemsSource = Global.IPAPIUrls;
|
||||||
|
|
||||||
Global.GeoFilesSources.ForEach(it =>
|
cmbMainGirdOrientation.ItemsSource = Utils.GetEnumNames<EGirdOrientation>();
|
||||||
{
|
|
||||||
cmbGetFilesSourceUrl.Items.Add(it);
|
|
||||||
});
|
|
||||||
Global.SingboxRulesetSources.ForEach(it =>
|
|
||||||
{
|
|
||||||
cmbSrsFilesSourceUrl.Items.Add(it);
|
|
||||||
});
|
|
||||||
Global.RoutingRulesSources.ForEach(it =>
|
|
||||||
{
|
|
||||||
cmbRoutingRulesSourceUrl.Items.Add(it);
|
|
||||||
});
|
|
||||||
Global.IPAPIUrls.ForEach(it =>
|
|
||||||
{
|
|
||||||
cmbIPAPIUrl.Items.Add(it);
|
|
||||||
});
|
|
||||||
foreach (EGirdOrientation it in Enum.GetValues(typeof(EGirdOrientation)))
|
|
||||||
{
|
|
||||||
cmbMainGirdOrientation.Items.Add(it.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
this.WhenActivated(disposables =>
|
this.WhenActivated(disposables =>
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,18 +25,9 @@ public partial class RoutingRuleDetailsWindow : WindowBase<RoutingRuleDetailsVie
|
||||||
ViewModel = new RoutingRuleDetailsViewModel(rulesItem, UpdateViewHandler);
|
ViewModel = new RoutingRuleDetailsViewModel(rulesItem, UpdateViewHandler);
|
||||||
|
|
||||||
cmbOutboundTag.ItemsSource = Global.OutboundTags;
|
cmbOutboundTag.ItemsSource = Global.OutboundTags;
|
||||||
Global.RuleProtocols.ForEach(it =>
|
clbProtocol.ItemsSource = Global.RuleProtocols;
|
||||||
{
|
clbInboundTag.ItemsSource = Global.InboundTags;
|
||||||
clbProtocol.Items.Add(it);
|
cmbNetwork.ItemsSource = Global.RuleNetworks;
|
||||||
});
|
|
||||||
Global.InboundTags.ForEach(it =>
|
|
||||||
{
|
|
||||||
clbInboundTag.Items.Add(it);
|
|
||||||
});
|
|
||||||
Global.RuleNetworks.ForEach(it =>
|
|
||||||
{
|
|
||||||
cmbNetwork.Items.Add(it);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!rulesItem.Id.IsNullOrEmpty())
|
if (!rulesItem.Id.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
|
|
|
@ -30,15 +30,9 @@ public partial class RoutingRuleSettingWindow : WindowBase<RoutingRuleSettingVie
|
||||||
btnBrowseCustomRulesetPath4Singbox.Click += btnBrowseCustomRulesetPath4Singbox_ClickAsync;
|
btnBrowseCustomRulesetPath4Singbox.Click += btnBrowseCustomRulesetPath4Singbox_ClickAsync;
|
||||||
|
|
||||||
ViewModel = new RoutingRuleSettingViewModel(routingItem, UpdateViewHandler);
|
ViewModel = new RoutingRuleSettingViewModel(routingItem, UpdateViewHandler);
|
||||||
Global.DomainStrategies.ForEach(it =>
|
|
||||||
{
|
cmbdomainStrategy.ItemsSource = Global.DomainStrategies.AppendEmpty();
|
||||||
cmbdomainStrategy.Items.Add(it);
|
cmbdomainStrategy4Singbox.ItemsSource = Global.DomainStrategies4Singbox;
|
||||||
});
|
|
||||||
cmbdomainStrategy.Items.Add(string.Empty);
|
|
||||||
Global.DomainStrategies4Singbox.ForEach(it =>
|
|
||||||
{
|
|
||||||
cmbdomainStrategy4Singbox.Items.Add(it);
|
|
||||||
});
|
|
||||||
|
|
||||||
this.WhenActivated(disposables =>
|
this.WhenActivated(disposables =>
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,18 +26,9 @@ public partial class RoutingSettingWindow : WindowBase<RoutingSettingViewModel>
|
||||||
|
|
||||||
ViewModel = new RoutingSettingViewModel(UpdateViewHandler);
|
ViewModel = new RoutingSettingViewModel(UpdateViewHandler);
|
||||||
|
|
||||||
Global.DomainStrategies.ForEach(it =>
|
cmbdomainStrategy.ItemsSource = Global.DomainStrategies;
|
||||||
{
|
cmbdomainMatcher.ItemsSource = Global.DomainMatchers;
|
||||||
cmbdomainStrategy.Items.Add(it);
|
cmbdomainStrategy4Singbox.ItemsSource = Global.DomainStrategies4Singbox;
|
||||||
});
|
|
||||||
Global.DomainMatchers.ForEach(it =>
|
|
||||||
{
|
|
||||||
cmbdomainMatcher.Items.Add(it);
|
|
||||||
});
|
|
||||||
Global.DomainStrategies4Singbox.ForEach(it =>
|
|
||||||
{
|
|
||||||
cmbdomainStrategy4Singbox.Items.Add(it);
|
|
||||||
});
|
|
||||||
|
|
||||||
this.WhenActivated(disposables =>
|
this.WhenActivated(disposables =>
|
||||||
{
|
{
|
||||||
|
|
|
@ -22,10 +22,7 @@ public partial class SubEditWindow : WindowBase<SubEditViewModel>
|
||||||
|
|
||||||
ViewModel = new SubEditViewModel(subItem, UpdateViewHandler);
|
ViewModel = new SubEditViewModel(subItem, UpdateViewHandler);
|
||||||
|
|
||||||
Global.SubConvertTargets.ForEach(it =>
|
cmbConvertTarget.ItemsSource = Global.SubConvertTargets;
|
||||||
{
|
|
||||||
cmbConvertTarget.Items.Add(it);
|
|
||||||
});
|
|
||||||
|
|
||||||
this.WhenActivated(disposables =>
|
this.WhenActivated(disposables =>
|
||||||
{
|
{
|
||||||
|
|
|
@ -16,20 +16,9 @@ public partial class ThemeSettingView : ReactiveUserControl<ThemeSettingViewMode
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
ViewModel = new ThemeSettingViewModel();
|
ViewModel = new ThemeSettingViewModel();
|
||||||
|
|
||||||
foreach (ETheme it in Enum.GetValues(typeof(ETheme)))
|
cmbCurrentTheme.ItemsSource = Utils.GetEnumNames<ETheme>();
|
||||||
{
|
cmbCurrentFontSize.ItemsSource = Enumerable.Range(Global.MinFontSize, 11).ToList();
|
||||||
cmbCurrentTheme.Items.Add(it.ToString());
|
cmbCurrentLanguage.ItemsSource = Global.Languages;
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = Global.MinFontSize; i <= Global.MinFontSize + 10; i++)
|
|
||||||
{
|
|
||||||
cmbCurrentFontSize.Items.Add(i);
|
|
||||||
}
|
|
||||||
|
|
||||||
Global.Languages.ForEach(it =>
|
|
||||||
{
|
|
||||||
cmbCurrentLanguage.Items.Add(it);
|
|
||||||
});
|
|
||||||
|
|
||||||
this.WhenActivated(disposables =>
|
this.WhenActivated(disposables =>
|
||||||
{
|
{
|
||||||
|
|
|
@ -14,13 +14,7 @@ public partial class AddServer2Window
|
||||||
this.Loaded += Window_Loaded;
|
this.Loaded += Window_Loaded;
|
||||||
ViewModel = new AddServer2ViewModel(profileItem, UpdateViewHandler);
|
ViewModel = new AddServer2ViewModel(profileItem, UpdateViewHandler);
|
||||||
|
|
||||||
foreach (ECoreType it in Enum.GetValues(typeof(ECoreType)))
|
cmbCoreType.ItemsSource = Utils.GetEnumNames<ECoreType>().Where(t => t != ECoreType.v2rayN.ToString()).ToList().AppendEmpty();
|
||||||
{
|
|
||||||
if (it == ECoreType.v2rayN)
|
|
||||||
continue;
|
|
||||||
cmbCoreType.Items.Add(it.ToString());
|
|
||||||
}
|
|
||||||
cmbCoreType.Items.Add(string.Empty);
|
|
||||||
|
|
||||||
this.WhenActivated(disposables =>
|
this.WhenActivated(disposables =>
|
||||||
{
|
{
|
||||||
|
|
|
@ -20,41 +20,22 @@ public partial class AddServerWindow
|
||||||
|
|
||||||
ViewModel = new AddServerViewModel(profileItem, UpdateViewHandler);
|
ViewModel = new AddServerViewModel(profileItem, UpdateViewHandler);
|
||||||
|
|
||||||
Global.CoreTypes.ForEach(it =>
|
cmbCoreType.ItemsSource = Global.CoreTypes.AppendEmpty();
|
||||||
{
|
cmbNetwork.ItemsSource = Global.Networks;
|
||||||
cmbCoreType.Items.Add(it);
|
cmbFingerprint.ItemsSource = Global.Fingerprints;
|
||||||
});
|
cmbFingerprint2.ItemsSource = Global.Fingerprints;
|
||||||
cmbCoreType.Items.Add(string.Empty);
|
cmbAllowInsecure.ItemsSource = Global.AllowInsecure;
|
||||||
|
cmbAlpn.ItemsSource = Global.Alpns;
|
||||||
|
|
||||||
cmbStreamSecurity.Items.Add(string.Empty);
|
var lstStreamSecurity = new List<string>();
|
||||||
cmbStreamSecurity.Items.Add(Global.StreamSecurity);
|
lstStreamSecurity.Add(string.Empty);
|
||||||
|
lstStreamSecurity.Add(Global.StreamSecurity);
|
||||||
Global.Networks.ForEach(it =>
|
|
||||||
{
|
|
||||||
cmbNetwork.Items.Add(it);
|
|
||||||
});
|
|
||||||
Global.Fingerprints.ForEach(it =>
|
|
||||||
{
|
|
||||||
cmbFingerprint.Items.Add(it);
|
|
||||||
cmbFingerprint2.Items.Add(it);
|
|
||||||
});
|
|
||||||
Global.AllowInsecure.ForEach(it =>
|
|
||||||
{
|
|
||||||
cmbAllowInsecure.Items.Add(it);
|
|
||||||
});
|
|
||||||
Global.Alpns.ForEach(it =>
|
|
||||||
{
|
|
||||||
cmbAlpn.Items.Add(it);
|
|
||||||
});
|
|
||||||
|
|
||||||
switch (profileItem.ConfigType)
|
switch (profileItem.ConfigType)
|
||||||
{
|
{
|
||||||
case EConfigType.VMess:
|
case EConfigType.VMess:
|
||||||
gridVMess.Visibility = Visibility.Visible;
|
gridVMess.Visibility = Visibility.Visible;
|
||||||
Global.VmessSecurities.ForEach(it =>
|
cmbSecurity.ItemsSource = Global.VmessSecurities;
|
||||||
{
|
|
||||||
cmbSecurity.Items.Add(it);
|
|
||||||
});
|
|
||||||
if (profileItem.Security.IsNullOrEmpty())
|
if (profileItem.Security.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
profileItem.Security = Global.DefaultSecurity;
|
profileItem.Security = Global.DefaultSecurity;
|
||||||
|
@ -63,10 +44,7 @@ public partial class AddServerWindow
|
||||||
|
|
||||||
case EConfigType.Shadowsocks:
|
case EConfigType.Shadowsocks:
|
||||||
gridSs.Visibility = Visibility.Visible;
|
gridSs.Visibility = Visibility.Visible;
|
||||||
AppHandler.Instance.GetShadowsocksSecurities(profileItem).ForEach(it =>
|
cmbSecurity3.ItemsSource = AppHandler.Instance.GetShadowsocksSecurities(profileItem);
|
||||||
{
|
|
||||||
cmbSecurity3.Items.Add(it);
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EConfigType.SOCKS:
|
case EConfigType.SOCKS:
|
||||||
|
@ -76,11 +54,8 @@ public partial class AddServerWindow
|
||||||
|
|
||||||
case EConfigType.VLESS:
|
case EConfigType.VLESS:
|
||||||
gridVLESS.Visibility = Visibility.Visible;
|
gridVLESS.Visibility = Visibility.Visible;
|
||||||
cmbStreamSecurity.Items.Add(Global.StreamSecurityReality);
|
lstStreamSecurity.Add(Global.StreamSecurityReality);
|
||||||
Global.Flows.ForEach(it =>
|
cmbFlow5.ItemsSource = Global.Flows;
|
||||||
{
|
|
||||||
cmbFlow5.Items.Add(it);
|
|
||||||
});
|
|
||||||
if (profileItem.Security.IsNullOrEmpty())
|
if (profileItem.Security.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
profileItem.Security = Global.None;
|
profileItem.Security = Global.None;
|
||||||
|
@ -89,11 +64,8 @@ public partial class AddServerWindow
|
||||||
|
|
||||||
case EConfigType.Trojan:
|
case EConfigType.Trojan:
|
||||||
gridTrojan.Visibility = Visibility.Visible;
|
gridTrojan.Visibility = Visibility.Visible;
|
||||||
cmbStreamSecurity.Items.Add(Global.StreamSecurityReality);
|
lstStreamSecurity.Add(Global.StreamSecurityReality);
|
||||||
Global.Flows.ForEach(it =>
|
cmbFlow6.ItemsSource = Global.Flows;
|
||||||
{
|
|
||||||
cmbFlow6.Items.Add(it);
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EConfigType.Hysteria2:
|
case EConfigType.Hysteria2:
|
||||||
|
@ -113,10 +85,7 @@ public partial class AddServerWindow
|
||||||
cmbFingerprint.IsEnabled = false;
|
cmbFingerprint.IsEnabled = false;
|
||||||
cmbFingerprint.Text = string.Empty;
|
cmbFingerprint.Text = string.Empty;
|
||||||
|
|
||||||
Global.TuicCongestionControls.ForEach(it =>
|
cmbHeaderType8.ItemsSource = Global.TuicCongestionControls;
|
||||||
{
|
|
||||||
cmbHeaderType8.Items.Add(it);
|
|
||||||
});
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EConfigType.WireGuard:
|
case EConfigType.WireGuard:
|
||||||
|
@ -128,6 +97,7 @@ public partial class AddServerWindow
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
cmbStreamSecurity.ItemsSource = lstStreamSecurity;
|
||||||
|
|
||||||
gridTlsMore.Visibility = Visibility.Hidden;
|
gridTlsMore.Visibility = Visibility.Hidden;
|
||||||
|
|
||||||
|
@ -267,44 +237,41 @@ public partial class AddServerWindow
|
||||||
|
|
||||||
private void SetHeaderType()
|
private void SetHeaderType()
|
||||||
{
|
{
|
||||||
cmbHeaderType.Items.Clear();
|
var lstHeaderType = new List<string>();
|
||||||
|
|
||||||
var network = cmbNetwork.SelectedItem.ToString();
|
var network = cmbNetwork.SelectedItem.ToString();
|
||||||
if (network.IsNullOrEmpty())
|
if (network.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
cmbHeaderType.Items.Add(Global.None);
|
lstHeaderType.Add(Global.None);
|
||||||
|
cmbHeaderType.ItemsSource = lstHeaderType;
|
||||||
|
cmbHeaderType.SelectedIndex = 0;
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (network == nameof(ETransport.tcp))
|
if (network == nameof(ETransport.tcp))
|
||||||
{
|
{
|
||||||
cmbHeaderType.Items.Add(Global.None);
|
lstHeaderType.Add(Global.None);
|
||||||
cmbHeaderType.Items.Add(Global.TcpHeaderHttp);
|
lstHeaderType.Add(Global.TcpHeaderHttp);
|
||||||
}
|
}
|
||||||
else if (network is nameof(ETransport.kcp) or nameof(ETransport.quic))
|
else if (network is nameof(ETransport.kcp) or nameof(ETransport.quic))
|
||||||
{
|
{
|
||||||
cmbHeaderType.Items.Add(Global.None);
|
lstHeaderType.Add(Global.None);
|
||||||
Global.KcpHeaderTypes.ForEach(it =>
|
lstHeaderType.AddRange(Global.KcpHeaderTypes);
|
||||||
{
|
|
||||||
cmbHeaderType.Items.Add(it);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
else if (network is nameof(ETransport.xhttp))
|
else if (network is nameof(ETransport.xhttp))
|
||||||
{
|
{
|
||||||
Global.XhttpMode.ForEach(it =>
|
lstHeaderType.AddRange(Global.XhttpMode);
|
||||||
{
|
|
||||||
cmbHeaderType.Items.Add(it);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
else if (network == nameof(ETransport.grpc))
|
else if (network == nameof(ETransport.grpc))
|
||||||
{
|
{
|
||||||
cmbHeaderType.Items.Add(Global.GrpcGunMode);
|
lstHeaderType.Add(Global.GrpcGunMode);
|
||||||
cmbHeaderType.Items.Add(Global.GrpcMultiMode);
|
lstHeaderType.Add(Global.GrpcMultiMode);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
cmbHeaderType.Items.Add(Global.None);
|
lstHeaderType.Add(Global.None);
|
||||||
}
|
}
|
||||||
|
cmbHeaderType.ItemsSource = lstHeaderType;
|
||||||
cmbHeaderType.SelectedIndex = 0;
|
cmbHeaderType.SelectedIndex = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -17,22 +17,10 @@ public partial class DNSSettingWindow
|
||||||
|
|
||||||
ViewModel = new DNSSettingViewModel(UpdateViewHandler);
|
ViewModel = new DNSSettingViewModel(UpdateViewHandler);
|
||||||
|
|
||||||
Global.DomainStrategy4Freedoms.ForEach(it =>
|
cmbdomainStrategy4Freedom.ItemsSource = Global.DomainStrategy4Freedoms;
|
||||||
{
|
cmbdomainStrategy4Out.ItemsSource = Global.SingboxDomainStrategy4Out;
|
||||||
cmbdomainStrategy4Freedom.Items.Add(it);
|
cmbdomainDNSAddress.ItemsSource = Global.DomainDNSAddress;
|
||||||
});
|
cmbdomainDNSAddress2.ItemsSource = Global.SingboxDomainDNSAddress;
|
||||||
Global.SingboxDomainStrategy4Out.ForEach(it =>
|
|
||||||
{
|
|
||||||
cmbdomainStrategy4Out.Items.Add(it);
|
|
||||||
});
|
|
||||||
Global.DomainDNSAddress.ForEach(it =>
|
|
||||||
{
|
|
||||||
cmbdomainDNSAddress.Items.Add(it);
|
|
||||||
});
|
|
||||||
Global.SingboxDomainDNSAddress.ForEach(it =>
|
|
||||||
{
|
|
||||||
cmbdomainDNSAddress2.Items.Add(it);
|
|
||||||
});
|
|
||||||
|
|
||||||
this.WhenActivated(disposables =>
|
this.WhenActivated(disposables =>
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,11 +25,8 @@ public partial class MsgView
|
||||||
menuMsgViewCopy.Click += menuMsgViewCopy_Click;
|
menuMsgViewCopy.Click += menuMsgViewCopy_Click;
|
||||||
menuMsgViewCopyAll.Click += menuMsgViewCopyAll_Click;
|
menuMsgViewCopyAll.Click += menuMsgViewCopyAll_Click;
|
||||||
menuMsgViewClear.Click += menuMsgViewClear_Click;
|
menuMsgViewClear.Click += menuMsgViewClear_Click;
|
||||||
|
|
||||||
Global.PresetMsgFilters.ForEach(it =>
|
cmbMsgFilter.ItemsSource = Global.PresetMsgFilters;
|
||||||
{
|
|
||||||
cmbMsgFilter.Items.Add(it);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<bool> UpdateViewHandler(EViewAction action, object? obj)
|
private async Task<bool> UpdateViewHandler(EViewAction action, object? obj)
|
||||||
|
|
|
@ -21,94 +21,39 @@ public partial class OptionSettingWindow
|
||||||
ViewModel = new OptionSettingViewModel(UpdateViewHandler);
|
ViewModel = new OptionSettingViewModel(UpdateViewHandler);
|
||||||
|
|
||||||
clbdestOverride.SelectionChanged += ClbdestOverride_SelectionChanged;
|
clbdestOverride.SelectionChanged += ClbdestOverride_SelectionChanged;
|
||||||
Global.destOverrideProtocols.ForEach(it =>
|
clbdestOverride.ItemsSource = Global.destOverrideProtocols;
|
||||||
{
|
|
||||||
clbdestOverride.Items.Add(it);
|
|
||||||
});
|
|
||||||
_config.Inbound.First().DestOverride?.ForEach(it =>
|
_config.Inbound.First().DestOverride?.ForEach(it =>
|
||||||
{
|
{
|
||||||
clbdestOverride.SelectedItems.Add(it);
|
clbdestOverride.SelectedItems.Add(it);
|
||||||
});
|
});
|
||||||
Global.IEProxyProtocols.ForEach(it =>
|
|
||||||
{
|
|
||||||
cmbsystemProxyAdvancedProtocol.Items.Add(it);
|
|
||||||
});
|
|
||||||
Global.LogLevels.ForEach(it =>
|
|
||||||
{
|
|
||||||
cmbloglevel.Items.Add(it);
|
|
||||||
});
|
|
||||||
Global.Fingerprints.ForEach(it =>
|
|
||||||
{
|
|
||||||
cmbdefFingerprint.Items.Add(it);
|
|
||||||
});
|
|
||||||
Global.UserAgent.ForEach(it =>
|
|
||||||
{
|
|
||||||
cmbdefUserAgent.Items.Add(it);
|
|
||||||
});
|
|
||||||
Global.SingboxMuxs.ForEach(it =>
|
|
||||||
{
|
|
||||||
cmbmux4SboxProtocol.Items.Add(it);
|
|
||||||
});
|
|
||||||
|
|
||||||
Global.TunMtus.ForEach(it =>
|
cmbsystemProxyAdvancedProtocol.ItemsSource = Global.IEProxyProtocols;
|
||||||
{
|
cmbloglevel.ItemsSource = Global.LogLevels;
|
||||||
cmbMtu.Items.Add(it);
|
cmbdefFingerprint.ItemsSource = Global.Fingerprints;
|
||||||
});
|
cmbdefUserAgent.ItemsSource = Global.UserAgent;
|
||||||
Global.TunStacks.ForEach(it =>
|
cmbmux4SboxProtocol.ItemsSource = Global.SingboxMuxs;
|
||||||
{
|
cmbMtu.ItemsSource = Global.TunMtus;
|
||||||
cmbStack.Items.Add(it);
|
cmbStack.ItemsSource = Global.TunStacks;
|
||||||
});
|
|
||||||
Global.CoreTypes.ForEach(it =>
|
|
||||||
{
|
|
||||||
cmbCoreType1.Items.Add(it);
|
|
||||||
cmbCoreType2.Items.Add(it);
|
|
||||||
cmbCoreType3.Items.Add(it);
|
|
||||||
cmbCoreType4.Items.Add(it);
|
|
||||||
cmbCoreType5.Items.Add(it);
|
|
||||||
cmbCoreType6.Items.Add(it);
|
|
||||||
cmbCoreType9.Items.Add(it);
|
|
||||||
});
|
|
||||||
|
|
||||||
for (var i = 2; i <= 8; i++)
|
cmbCoreType1.ItemsSource = Global.CoreTypes;
|
||||||
{
|
cmbCoreType2.ItemsSource = Global.CoreTypes;
|
||||||
cmbMixedConcurrencyCount.Items.Add(i);
|
cmbCoreType3.ItemsSource = Global.CoreTypes;
|
||||||
}
|
cmbCoreType4.ItemsSource = Global.CoreTypes;
|
||||||
for (var i = 2; i <= 6; i++)
|
cmbCoreType5.ItemsSource = Global.CoreTypes;
|
||||||
{
|
cmbCoreType6.ItemsSource = Global.CoreTypes;
|
||||||
cmbSpeedTestTimeout.Items.Add(i * 5);
|
cmbCoreType9.ItemsSource = Global.CoreTypes;
|
||||||
}
|
|
||||||
Global.SpeedTestUrls.ForEach(it =>
|
cmbMixedConcurrencyCount.ItemsSource = Enumerable.Range(2, 7).ToList();
|
||||||
{
|
cmbSpeedTestTimeout.ItemsSource = Enumerable.Range(2, 5).Select(i => i * 5).ToList();
|
||||||
cmbSpeedTestUrl.Items.Add(it);
|
cmbSpeedTestUrl.ItemsSource = Global.SpeedTestUrls;
|
||||||
});
|
cmbSpeedPingTestUrl.ItemsSource = Global.SpeedPingTestUrls;
|
||||||
Global.SpeedPingTestUrls.ForEach(it =>
|
cmbSubConvertUrl.ItemsSource = Global.SubConvertUrls;
|
||||||
{
|
cmbGetFilesSourceUrl.ItemsSource = Global.GeoFilesSources;
|
||||||
cmbSpeedPingTestUrl.Items.Add(it);
|
cmbSrsFilesSourceUrl.ItemsSource = Global.SingboxRulesetSources;
|
||||||
});
|
cmbRoutingRulesSourceUrl.ItemsSource = Global.RoutingRulesSources;
|
||||||
Global.SubConvertUrls.ForEach(it =>
|
cmbIPAPIUrl.ItemsSource = Global.IPAPIUrls;
|
||||||
{
|
|
||||||
cmbSubConvertUrl.Items.Add(it);
|
cmbMainGirdOrientation.ItemsSource = Utils.GetEnumNames<EGirdOrientation>();
|
||||||
});
|
|
||||||
Global.GeoFilesSources.ForEach(it =>
|
|
||||||
{
|
|
||||||
cmbGetFilesSourceUrl.Items.Add(it);
|
|
||||||
});
|
|
||||||
Global.SingboxRulesetSources.ForEach(it =>
|
|
||||||
{
|
|
||||||
cmbSrsFilesSourceUrl.Items.Add(it);
|
|
||||||
});
|
|
||||||
Global.RoutingRulesSources.ForEach(it =>
|
|
||||||
{
|
|
||||||
cmbRoutingRulesSourceUrl.Items.Add(it);
|
|
||||||
});
|
|
||||||
Global.IPAPIUrls.ForEach(it =>
|
|
||||||
{
|
|
||||||
cmbIPAPIUrl.Items.Add(it);
|
|
||||||
});
|
|
||||||
foreach (EGirdOrientation it in Enum.GetValues(typeof(EGirdOrientation)))
|
|
||||||
{
|
|
||||||
cmbMainGirdOrientation.Items.Add(it.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
this.WhenActivated(disposables =>
|
this.WhenActivated(disposables =>
|
||||||
{
|
{
|
||||||
|
@ -209,8 +154,7 @@ public partial class OptionSettingWindow
|
||||||
private async Task InitSettingFont()
|
private async Task InitSettingFont()
|
||||||
{
|
{
|
||||||
var lstFonts = await GetFonts(Utils.GetFontsPath());
|
var lstFonts = await GetFonts(Utils.GetFontsPath());
|
||||||
lstFonts.ForEach(it => { cmbcurrentFontFamily.Items.Add(it); });
|
cmbcurrentFontFamily.ItemsSource = lstFonts.AppendEmpty();
|
||||||
cmbcurrentFontFamily.Items.Add(string.Empty);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task<List<string>> GetFonts(string path)
|
private async Task<List<string>> GetFonts(string path)
|
||||||
|
|
|
@ -16,23 +16,11 @@ public partial class RoutingRuleDetailsWindow
|
||||||
clbInboundTag.SelectionChanged += ClbInboundTag_SelectionChanged;
|
clbInboundTag.SelectionChanged += ClbInboundTag_SelectionChanged;
|
||||||
|
|
||||||
ViewModel = new RoutingRuleDetailsViewModel(rulesItem, UpdateViewHandler);
|
ViewModel = new RoutingRuleDetailsViewModel(rulesItem, UpdateViewHandler);
|
||||||
|
|
||||||
Global.OutboundTags.ForEach(it =>
|
cmbOutboundTag.ItemsSource = Global.OutboundTags;
|
||||||
{
|
clbProtocol.ItemsSource = Global.RuleProtocols;
|
||||||
cmbOutboundTag.Items.Add(it);
|
clbInboundTag.ItemsSource = Global.InboundTags;
|
||||||
});
|
cmbNetwork.ItemsSource = Global.RuleNetworks;
|
||||||
Global.RuleProtocols.ForEach(it =>
|
|
||||||
{
|
|
||||||
clbProtocol.Items.Add(it);
|
|
||||||
});
|
|
||||||
Global.InboundTags.ForEach(it =>
|
|
||||||
{
|
|
||||||
clbInboundTag.Items.Add(it);
|
|
||||||
});
|
|
||||||
Global.RuleNetworks.ForEach(it =>
|
|
||||||
{
|
|
||||||
cmbNetwork.Items.Add(it);
|
|
||||||
});
|
|
||||||
|
|
||||||
if (!rulesItem.Id.IsNullOrEmpty())
|
if (!rulesItem.Id.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,15 +21,9 @@ public partial class RoutingRuleSettingWindow
|
||||||
btnBrowseCustomRulesetPath4Singbox.Click += btnBrowseCustomRulesetPath4Singbox_Click;
|
btnBrowseCustomRulesetPath4Singbox.Click += btnBrowseCustomRulesetPath4Singbox_Click;
|
||||||
|
|
||||||
ViewModel = new RoutingRuleSettingViewModel(routingItem, UpdateViewHandler);
|
ViewModel = new RoutingRuleSettingViewModel(routingItem, UpdateViewHandler);
|
||||||
Global.DomainStrategies.ForEach(it =>
|
|
||||||
{
|
cmbdomainStrategy.ItemsSource = Global.DomainStrategies.AppendEmpty();
|
||||||
cmbdomainStrategy.Items.Add(it);
|
cmbdomainStrategy4Singbox.ItemsSource = Global.DomainStrategies4Singbox;
|
||||||
});
|
|
||||||
cmbdomainStrategy.Items.Add(string.Empty);
|
|
||||||
Global.DomainStrategies4Singbox.ForEach(it =>
|
|
||||||
{
|
|
||||||
cmbdomainStrategy4Singbox.Items.Add(it);
|
|
||||||
});
|
|
||||||
|
|
||||||
this.WhenActivated(disposables =>
|
this.WhenActivated(disposables =>
|
||||||
{
|
{
|
||||||
|
|
|
@ -21,18 +21,9 @@ public partial class RoutingSettingWindow
|
||||||
|
|
||||||
ViewModel = new RoutingSettingViewModel(UpdateViewHandler);
|
ViewModel = new RoutingSettingViewModel(UpdateViewHandler);
|
||||||
|
|
||||||
Global.DomainStrategies.ForEach(it =>
|
cmbdomainStrategy.ItemsSource = Global.DomainStrategies;
|
||||||
{
|
cmbdomainMatcher.ItemsSource = Global.DomainMatchers;
|
||||||
cmbdomainStrategy.Items.Add(it);
|
cmbdomainStrategy4Singbox.ItemsSource = Global.DomainStrategies4Singbox;
|
||||||
});
|
|
||||||
Global.DomainMatchers.ForEach(it =>
|
|
||||||
{
|
|
||||||
cmbdomainMatcher.Items.Add(it);
|
|
||||||
});
|
|
||||||
Global.DomainStrategies4Singbox.ForEach(it =>
|
|
||||||
{
|
|
||||||
cmbdomainStrategy4Singbox.Items.Add(it);
|
|
||||||
});
|
|
||||||
|
|
||||||
this.WhenActivated(disposables =>
|
this.WhenActivated(disposables =>
|
||||||
{
|
{
|
||||||
|
|
|
@ -15,10 +15,7 @@ public partial class SubEditWindow
|
||||||
|
|
||||||
ViewModel = new SubEditViewModel(subItem, UpdateViewHandler);
|
ViewModel = new SubEditViewModel(subItem, UpdateViewHandler);
|
||||||
|
|
||||||
Global.SubConvertTargets.ForEach(it =>
|
cmbConvertTarget.ItemsSource = Global.SubConvertTargets;
|
||||||
{
|
|
||||||
cmbConvertTarget.Items.Add(it);
|
|
||||||
});
|
|
||||||
|
|
||||||
this.WhenActivated(disposables =>
|
this.WhenActivated(disposables =>
|
||||||
{
|
{
|
||||||
|
|
|
@ -13,22 +13,10 @@ public partial class ThemeSettingView
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
ViewModel = new ThemeSettingViewModel();
|
ViewModel = new ThemeSettingViewModel();
|
||||||
foreach (ETheme it in Enum.GetValues(typeof(ETheme)))
|
|
||||||
{
|
|
||||||
if ((int)it > 2)
|
|
||||||
continue;
|
|
||||||
cmbCurrentTheme.Items.Add(it.ToString());
|
|
||||||
}
|
|
||||||
|
|
||||||
for (int i = Global.MinFontSize; i <= Global.MinFontSize + 10; i++)
|
cmbCurrentTheme.ItemsSource = Utils.GetEnumNames<ETheme>().Take(3).ToList();
|
||||||
{
|
cmbCurrentFontSize.ItemsSource = Enumerable.Range(Global.MinFontSize, 11).ToList();
|
||||||
cmbCurrentFontSize.Items.Add(i.ToString());
|
cmbCurrentLanguage.ItemsSource = Global.Languages;
|
||||||
}
|
|
||||||
|
|
||||||
Global.Languages.ForEach(it =>
|
|
||||||
{
|
|
||||||
cmbCurrentLanguage.Items.Add(it);
|
|
||||||
});
|
|
||||||
|
|
||||||
this.WhenActivated(disposables =>
|
this.WhenActivated(disposables =>
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue