Compare commits
36 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
b57ba6a98b | ||
|
|
d748e6eff4 | ||
|
|
315d4b75b2 | ||
|
|
31267cbc33 | ||
|
|
c23379b3b6 | ||
|
|
568144d6a2 | ||
|
|
5857042963 | ||
|
|
28e41dc621 | ||
|
|
baef3b364b | ||
|
|
4b9ddb803f | ||
|
|
c07c7ad82f | ||
|
|
e223b80b95 | ||
|
|
5fe468fa1b | ||
|
|
60068d8d16 | ||
|
|
b6c5b46afe | ||
|
|
124cbfadb4 | ||
|
|
8d21f9b900 | ||
|
|
398dbbd2e5 | ||
|
|
e9b392d1c0 | ||
|
|
9d7c7e3225 | ||
|
|
855fd4f0b7 | ||
|
|
807839929d | ||
|
|
870955fee1 | ||
|
|
e0cea929ea | ||
|
|
315f4c35f0 | ||
|
|
d961ea22a6 | ||
|
|
5c0c07c78f | ||
|
|
bba93a0fb7 | ||
|
|
5683df2fc0 | ||
|
|
b5cb9ce67e | ||
|
|
06a32dc895 | ||
|
|
dff12a8a3a | ||
|
|
dc3f07ee84 | ||
|
|
1aef49ee11 | ||
|
|
ee3159b00e | ||
|
|
86d2c307f1 |
@@ -11,7 +11,7 @@
|
|||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Google.Protobuf" Version="3.26.1" />
|
<PackageReference Include="Google.Protobuf" Version="3.26.1" />
|
||||||
<PackageReference Include="Grpc.Net.Client" Version="2.62.0" />
|
<PackageReference Include="Grpc.Net.Client" Version="2.62.0" />
|
||||||
<PackageReference Include="Grpc.Tools" Version="2.62.0">
|
<PackageReference Include="Grpc.Tools" Version="2.63.0">
|
||||||
<PrivateAssets>all</PrivateAssets>
|
<PrivateAssets>all</PrivateAssets>
|
||||||
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
|
||||||
</PackageReference>
|
</PackageReference>
|
||||||
|
|||||||
@@ -13,7 +13,7 @@
|
|||||||
BaseTheme="Light"
|
BaseTheme="Light"
|
||||||
PrimaryColor="Blue"
|
PrimaryColor="Blue"
|
||||||
SecondaryColor="Lime" />
|
SecondaryColor="Lime" />
|
||||||
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesignTheme.Defaults.xaml" />
|
<ResourceDictionary Source="pack://application:,,,/MaterialDesignThemes.Wpf;component/Themes/MaterialDesign2.Defaults.xaml" />
|
||||||
</ResourceDictionary.MergedDictionaries>
|
</ResourceDictionary.MergedDictionaries>
|
||||||
<system:Double x:Key="MenuItemHeight">26</system:Double>
|
<system:Double x:Key="MenuItemHeight">26</system:Double>
|
||||||
<system:Double x:Key="StdFontSize">12</system:Double>
|
<system:Double x:Key="StdFontSize">12</system:Double>
|
||||||
@@ -72,10 +72,10 @@
|
|||||||
<Setter Property="FontSize" Value="{DynamicResource StdFontSize}" />
|
<Setter Property="FontSize" Value="{DynamicResource StdFontSize}" />
|
||||||
<Style.Triggers>
|
<Style.Triggers>
|
||||||
<Trigger Property="IsSelected" Value="true">
|
<Trigger Property="IsSelected" Value="true">
|
||||||
<Setter Property="Background" Value="{DynamicResource PrimaryHueLightBrush}" />
|
<Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Primary.Light}" />
|
||||||
</Trigger>
|
</Trigger>
|
||||||
<Trigger Property="IsMouseOver" Value="true">
|
<Trigger Property="IsMouseOver" Value="true">
|
||||||
<Setter Property="Background" Value="{DynamicResource PrimaryHueMidBrush}" />
|
<Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Primary}" />
|
||||||
</Trigger>
|
</Trigger>
|
||||||
</Style.Triggers>
|
</Style.Triggers>
|
||||||
</Style>
|
</Style>
|
||||||
|
|||||||
@@ -1,6 +1,13 @@
|
|||||||
using QRCoder;
|
using QRCoder;
|
||||||
using QRCoder.Xaml;
|
using QRCoder.Xaml;
|
||||||
|
using System.Drawing;
|
||||||
|
using System.Windows.Interop;
|
||||||
|
using System.Windows;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
|
using ZXing.Common;
|
||||||
|
using ZXing.QrCode;
|
||||||
|
using ZXing.Windows.Compatibility;
|
||||||
|
using ZXing;
|
||||||
|
|
||||||
namespace v2rayN
|
namespace v2rayN
|
||||||
{
|
{
|
||||||
@@ -28,5 +35,70 @@ namespace v2rayN
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string ScanScreen(float dpiX, float dpiY)
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var left = (int)(SystemParameters.WorkArea.Left);
|
||||||
|
var top = (int)(SystemParameters.WorkArea.Top);
|
||||||
|
var width = (int)(SystemParameters.WorkArea.Width / dpiX);
|
||||||
|
var height = (int)(SystemParameters.WorkArea.Height / dpiY);
|
||||||
|
|
||||||
|
using Bitmap fullImage = new Bitmap(width, height);
|
||||||
|
using (Graphics g = Graphics.FromImage(fullImage))
|
||||||
|
{
|
||||||
|
g.CopyFromScreen(left, top, 0, 0, fullImage.Size, CopyPixelOperation.SourceCopy);
|
||||||
|
}
|
||||||
|
int maxTry = 10;
|
||||||
|
for (int i = 0; i < maxTry; i++)
|
||||||
|
{
|
||||||
|
int marginLeft = (int)((double)fullImage.Width * i / 2.5 / maxTry);
|
||||||
|
int marginTop = (int)((double)fullImage.Height * i / 2.5 / maxTry);
|
||||||
|
Rectangle cropRect = new(marginLeft, marginTop, fullImage.Width - marginLeft * 2, fullImage.Height - marginTop * 2);
|
||||||
|
Bitmap target = new(width, height);
|
||||||
|
|
||||||
|
double imageScale = (double)width / (double)cropRect.Width;
|
||||||
|
using (Graphics g = Graphics.FromImage(target))
|
||||||
|
{
|
||||||
|
g.DrawImage(fullImage, new Rectangle(0, 0, target.Width, target.Height),
|
||||||
|
cropRect,
|
||||||
|
GraphicsUnit.Pixel);
|
||||||
|
}
|
||||||
|
|
||||||
|
BitmapLuminanceSource source = new(target);
|
||||||
|
QRCodeReader reader = new();
|
||||||
|
|
||||||
|
BinaryBitmap bitmap = new(new HybridBinarizer(source));
|
||||||
|
var result = reader.decode(bitmap);
|
||||||
|
if (result != null)
|
||||||
|
{
|
||||||
|
return result.Text;
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BinaryBitmap bitmap2 = new(new HybridBinarizer(source.invert()));
|
||||||
|
var result2 = reader.decode(bitmap2);
|
||||||
|
if (result2 != null)
|
||||||
|
{
|
||||||
|
return result2.Text;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logging.SaveLog(ex.Message, ex);
|
||||||
|
}
|
||||||
|
return string.Empty;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Tuple<float, float> GetDpiXY(Window window)
|
||||||
|
{
|
||||||
|
IntPtr hWnd = new WindowInteropHelper(window).EnsureHandle();
|
||||||
|
Graphics g = Graphics.FromHwnd(hWnd);
|
||||||
|
|
||||||
|
return new(96 / g.DpiX, 96 / g.DpiY);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -18,10 +18,6 @@ using System.Windows;
|
|||||||
using System.Windows.Interop;
|
using System.Windows.Interop;
|
||||||
using System.Windows.Media;
|
using System.Windows.Media;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
using ZXing;
|
|
||||||
using ZXing.Common;
|
|
||||||
using ZXing.QrCode;
|
|
||||||
using ZXing.Windows.Compatibility;
|
|
||||||
|
|
||||||
namespace v2rayN
|
namespace v2rayN
|
||||||
{
|
{
|
||||||
@@ -57,11 +53,14 @@ namespace v2rayN
|
|||||||
/// 取得存储资源
|
/// 取得存储资源
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static string? LoadResource(string res)
|
public static string? LoadResource(string? res)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!File.Exists(res)) return null;
|
if (!File.Exists(res))
|
||||||
|
{
|
||||||
|
return null;
|
||||||
|
}
|
||||||
return File.ReadAllText(res);
|
return File.ReadAllText(res);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -478,7 +477,7 @@ namespace v2rayN
|
|||||||
/// 验证Domain地址是否合法
|
/// 验证Domain地址是否合法
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="domain"></param>
|
/// <param name="domain"></param>
|
||||||
public static bool IsDomain(string domain)
|
public static bool IsDomain(string? domain)
|
||||||
{
|
{
|
||||||
//如果为空
|
//如果为空
|
||||||
if (IsNullOrEmpty(domain))
|
if (IsNullOrEmpty(domain))
|
||||||
@@ -741,11 +740,11 @@ namespace v2rayN
|
|||||||
return Guid.TryParse(strSrc, out Guid g);
|
return Guid.TryParse(strSrc, out Guid g);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ProcessStart(string fileName)
|
public static void ProcessStart(string fileName, string arguments = "")
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Process.Start(new ProcessStartInfo(fileName) { UseShellExecute = true });
|
Process.Start(new ProcessStartInfo(fileName, arguments) { UseShellExecute = true });
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -947,66 +946,6 @@ namespace v2rayN
|
|||||||
|
|
||||||
#endregion TempPath
|
#endregion TempPath
|
||||||
|
|
||||||
#region scan screen
|
|
||||||
|
|
||||||
public static string ScanScreen(float dpiX, float dpiY)
|
|
||||||
{
|
|
||||||
try
|
|
||||||
{
|
|
||||||
var left = (int)(SystemParameters.WorkArea.Left);
|
|
||||||
var top = (int)(SystemParameters.WorkArea.Top);
|
|
||||||
var width = (int)(SystemParameters.WorkArea.Width / dpiX);
|
|
||||||
var height = (int)(SystemParameters.WorkArea.Height / dpiY);
|
|
||||||
|
|
||||||
using Bitmap fullImage = new Bitmap(width, height);
|
|
||||||
using (Graphics g = Graphics.FromImage(fullImage))
|
|
||||||
{
|
|
||||||
g.CopyFromScreen(left, top, 0, 0, fullImage.Size, CopyPixelOperation.SourceCopy);
|
|
||||||
}
|
|
||||||
int maxTry = 10;
|
|
||||||
for (int i = 0; i < maxTry; i++)
|
|
||||||
{
|
|
||||||
int marginLeft = (int)((double)fullImage.Width * i / 2.5 / maxTry);
|
|
||||||
int marginTop = (int)((double)fullImage.Height * i / 2.5 / maxTry);
|
|
||||||
Rectangle cropRect = new(marginLeft, marginTop, fullImage.Width - marginLeft * 2, fullImage.Height - marginTop * 2);
|
|
||||||
Bitmap target = new(width, height);
|
|
||||||
|
|
||||||
double imageScale = (double)width / (double)cropRect.Width;
|
|
||||||
using (Graphics g = Graphics.FromImage(target))
|
|
||||||
{
|
|
||||||
g.DrawImage(fullImage, new Rectangle(0, 0, target.Width, target.Height),
|
|
||||||
cropRect,
|
|
||||||
GraphicsUnit.Pixel);
|
|
||||||
}
|
|
||||||
|
|
||||||
BitmapLuminanceSource source = new(target);
|
|
||||||
BinaryBitmap bitmap = new(new HybridBinarizer(source));
|
|
||||||
QRCodeReader reader = new();
|
|
||||||
Result result = reader.decode(bitmap);
|
|
||||||
if (result != null)
|
|
||||||
{
|
|
||||||
string ret = result.Text;
|
|
||||||
return ret;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
Logging.SaveLog(ex.Message, ex);
|
|
||||||
}
|
|
||||||
return string.Empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static Tuple<float, float> GetDpiXY(Window window)
|
|
||||||
{
|
|
||||||
IntPtr hWnd = new WindowInteropHelper(window).EnsureHandle();
|
|
||||||
Graphics g = Graphics.FromHwnd(hWnd);
|
|
||||||
|
|
||||||
return new(96 / g.DpiX, 96 / g.DpiY);
|
|
||||||
}
|
|
||||||
|
|
||||||
#endregion scan screen
|
|
||||||
|
|
||||||
#region 开机自动启动等
|
#region 开机自动启动等
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@@ -23,6 +23,7 @@ namespace v2rayN
|
|||||||
public const string SpeedPingTestUrl = @"https://www.google.com/generate_204";
|
public const string SpeedPingTestUrl = @"https://www.google.com/generate_204";
|
||||||
public const string JuicityCoreUrl = "https://github.com/juicity/juicity/releases";
|
public const string JuicityCoreUrl = "https://github.com/juicity/juicity/releases";
|
||||||
public const string CustomRoutingListUrl = @"https://raw.githubusercontent.com/2dust/v2rayCustomRoutingList/master/";
|
public const string CustomRoutingListUrl = @"https://raw.githubusercontent.com/2dust/v2rayCustomRoutingList/master/";
|
||||||
|
public const string SingboxRulesetUrl = @"https://raw.githubusercontent.com/SagerNet/sing-{0}/rule-set/{1}.srs";
|
||||||
|
|
||||||
public const string PromotionUrl = @"aHR0cHM6Ly85LjIzNDQ1Ni54eXovYWJjLmh0bWw=";
|
public const string PromotionUrl = @"aHR0cHM6Ly85LjIzNDQ1Ni54eXovYWJjLmh0bWw=";
|
||||||
public const string ConfigFileName = "guiNConfig.json";
|
public const string ConfigFileName = "guiNConfig.json";
|
||||||
@@ -143,6 +144,7 @@ namespace v2rayN
|
|||||||
{EConfigType.VMess,"vmess"},
|
{EConfigType.VMess,"vmess"},
|
||||||
{EConfigType.Shadowsocks,"shadowsocks"},
|
{EConfigType.Shadowsocks,"shadowsocks"},
|
||||||
{EConfigType.Socks,"socks"},
|
{EConfigType.Socks,"socks"},
|
||||||
|
{EConfigType.Http,"http"},
|
||||||
{EConfigType.VLESS,"vless"},
|
{EConfigType.VLESS,"vless"},
|
||||||
{EConfigType.Trojan,"trojan"},
|
{EConfigType.Trojan,"trojan"},
|
||||||
{EConfigType.Hysteria2,"hysteria2"},
|
{EConfigType.Hysteria2,"hysteria2"},
|
||||||
@@ -173,6 +175,7 @@ namespace v2rayN
|
|||||||
public static readonly List<string> LogLevels = new() { "debug", "info", "warning", "error", "none" };
|
public static readonly List<string> LogLevels = new() { "debug", "info", "warning", "error", "none" };
|
||||||
public static readonly List<string> InboundTags = new() { "socks", "http", "socks2", "http2" };
|
public static readonly List<string> InboundTags = new() { "socks", "http", "socks2", "http2" };
|
||||||
public static readonly List<string> RuleProtocols = new() { "http", "tls", "bittorrent" };
|
public static readonly List<string> RuleProtocols = new() { "http", "tls", "bittorrent" };
|
||||||
|
public static readonly List<string> destOverrideProtocols = ["http", "tls", "quic", "fakedns", "fakedns+others"];
|
||||||
public static readonly List<string> TunMtus = new() { "1280", "1408", "1500", "9000" };
|
public static readonly List<string> TunMtus = new() { "1280", "1408", "1500", "9000" };
|
||||||
public static readonly List<string> TunStacks = new() { "gvisor", "system" };
|
public static readonly List<string> TunStacks = new() { "gvisor", "system" };
|
||||||
public static readonly List<string> PresetMsgFilters = new() { "proxy", "direct", "block", "" };
|
public static readonly List<string> PresetMsgFilters = new() { "proxy", "direct", "block", "" };
|
||||||
|
|||||||
@@ -50,7 +50,6 @@ namespace v2rayN.Handler
|
|||||||
{
|
{
|
||||||
logEnabled = false,
|
logEnabled = false,
|
||||||
loglevel = "warning",
|
loglevel = "warning",
|
||||||
|
|
||||||
muxEnabled = false,
|
muxEnabled = false,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
@@ -180,7 +179,7 @@ namespace v2rayN.Handler
|
|||||||
config.mux4SboxItem = new()
|
config.mux4SboxItem = new()
|
||||||
{
|
{
|
||||||
protocol = Global.SingboxMuxs[0],
|
protocol = Global.SingboxMuxs[0],
|
||||||
max_connections = 4
|
max_connections = 8
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -241,103 +240,103 @@ namespace v2rayN.Handler
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int ImportOldGuiConfig(Config config, string fileName)
|
//public static int ImportOldGuiConfig(Config config, string fileName)
|
||||||
{
|
//{
|
||||||
var result = Utils.LoadResource(fileName);
|
// var result = Utils.LoadResource(fileName);
|
||||||
if (Utils.IsNullOrEmpty(result))
|
// if (Utils.IsNullOrEmpty(result))
|
||||||
{
|
// {
|
||||||
return -1;
|
// return -1;
|
||||||
}
|
// }
|
||||||
|
|
||||||
var configOld = JsonUtils.Deserialize<ConfigOld>(result);
|
// var configOld = JsonUtils.Deserialize<ConfigOld>(result);
|
||||||
if (configOld == null)
|
// if (configOld == null)
|
||||||
{
|
// {
|
||||||
return -1;
|
// return -1;
|
||||||
}
|
// }
|
||||||
|
|
||||||
var subItem = JsonUtils.Deserialize<List<SubItem>>(JsonUtils.Serialize(configOld.subItem));
|
// var subItem = JsonUtils.Deserialize<List<SubItem>>(JsonUtils.Serialize(configOld.subItem));
|
||||||
foreach (var it in subItem)
|
// foreach (var it in subItem)
|
||||||
{
|
// {
|
||||||
if (Utils.IsNullOrEmpty(it.id))
|
// if (Utils.IsNullOrEmpty(it.id))
|
||||||
{
|
// {
|
||||||
it.id = Utils.GetGUID(false);
|
// it.id = Utils.GetGUID(false);
|
||||||
}
|
// }
|
||||||
SQLiteHelper.Instance.Replace(it);
|
// SQLiteHelper.Instance.Replace(it);
|
||||||
}
|
// }
|
||||||
|
|
||||||
var profileItems = JsonUtils.Deserialize<List<ProfileItem>>(JsonUtils.Serialize(configOld.vmess));
|
// var profileItems = JsonUtils.Deserialize<List<ProfileItem>>(JsonUtils.Serialize(configOld.vmess));
|
||||||
foreach (var it in profileItems)
|
// foreach (var it in profileItems)
|
||||||
{
|
// {
|
||||||
if (Utils.IsNullOrEmpty(it.indexId))
|
// if (Utils.IsNullOrEmpty(it.indexId))
|
||||||
{
|
// {
|
||||||
it.indexId = Utils.GetGUID(false);
|
// it.indexId = Utils.GetGUID(false);
|
||||||
}
|
// }
|
||||||
SQLiteHelper.Instance.Replace(it);
|
// SQLiteHelper.Instance.Replace(it);
|
||||||
}
|
// }
|
||||||
|
|
||||||
foreach (var it in configOld.routings)
|
// foreach (var it in configOld.routings)
|
||||||
{
|
// {
|
||||||
if (it.locked)
|
// if (it.locked)
|
||||||
{
|
// {
|
||||||
continue;
|
// continue;
|
||||||
}
|
// }
|
||||||
var routing = JsonUtils.Deserialize<RoutingItem>(JsonUtils.Serialize(it));
|
// var routing = JsonUtils.Deserialize<RoutingItem>(JsonUtils.Serialize(it));
|
||||||
foreach (var it2 in it.rules)
|
// foreach (var it2 in it.rules)
|
||||||
{
|
// {
|
||||||
it2.id = Utils.GetGUID(false);
|
// it2.id = Utils.GetGUID(false);
|
||||||
}
|
// }
|
||||||
routing.ruleNum = it.rules.Count;
|
// routing.ruleNum = it.rules.Count;
|
||||||
routing.ruleSet = JsonUtils.Serialize(it.rules, false);
|
// routing.ruleSet = JsonUtils.Serialize(it.rules, false);
|
||||||
|
|
||||||
if (Utils.IsNullOrEmpty(routing.id))
|
// if (Utils.IsNullOrEmpty(routing.id))
|
||||||
{
|
// {
|
||||||
routing.id = Utils.GetGUID(false);
|
// routing.id = Utils.GetGUID(false);
|
||||||
}
|
// }
|
||||||
SQLiteHelper.Instance.Replace(routing);
|
// SQLiteHelper.Instance.Replace(routing);
|
||||||
}
|
// }
|
||||||
|
|
||||||
config = JsonUtils.Deserialize<Config>(JsonUtils.Serialize(configOld));
|
// config = JsonUtils.Deserialize<Config>(JsonUtils.Serialize(configOld));
|
||||||
|
|
||||||
if (config.coreBasicItem == null)
|
// if (config.coreBasicItem == null)
|
||||||
{
|
// {
|
||||||
config.coreBasicItem = new()
|
// config.coreBasicItem = new()
|
||||||
{
|
// {
|
||||||
logEnabled = configOld.logEnabled,
|
// logEnabled = configOld.logEnabled,
|
||||||
loglevel = configOld.loglevel,
|
// loglevel = configOld.loglevel,
|
||||||
muxEnabled = configOld.muxEnabled,
|
// muxEnabled = configOld.muxEnabled,
|
||||||
};
|
// };
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (config.routingBasicItem == null)
|
// if (config.routingBasicItem == null)
|
||||||
{
|
// {
|
||||||
config.routingBasicItem = new()
|
// config.routingBasicItem = new()
|
||||||
{
|
// {
|
||||||
enableRoutingAdvanced = configOld.enableRoutingAdvanced,
|
// enableRoutingAdvanced = configOld.enableRoutingAdvanced,
|
||||||
domainStrategy = configOld.domainStrategy
|
// domainStrategy = configOld.domainStrategy
|
||||||
};
|
// };
|
||||||
}
|
// }
|
||||||
|
|
||||||
if (config.guiItem == null)
|
// if (config.guiItem == null)
|
||||||
{
|
// {
|
||||||
config.guiItem = new()
|
// config.guiItem = new()
|
||||||
{
|
// {
|
||||||
enableStatistics = configOld.enableStatistics,
|
// enableStatistics = configOld.enableStatistics,
|
||||||
keepOlderDedupl = configOld.keepOlderDedupl,
|
// keepOlderDedupl = configOld.keepOlderDedupl,
|
||||||
ignoreGeoUpdateCore = configOld.ignoreGeoUpdateCore,
|
// ignoreGeoUpdateCore = configOld.ignoreGeoUpdateCore,
|
||||||
autoUpdateInterval = configOld.autoUpdateInterval,
|
// autoUpdateInterval = configOld.autoUpdateInterval,
|
||||||
checkPreReleaseUpdate = configOld.checkPreReleaseUpdate,
|
// checkPreReleaseUpdate = configOld.checkPreReleaseUpdate,
|
||||||
enableSecurityProtocolTls13 = configOld.enableSecurityProtocolTls13,
|
// enableSecurityProtocolTls13 = configOld.enableSecurityProtocolTls13,
|
||||||
trayMenuServersLimit = configOld.trayMenuServersLimit,
|
// trayMenuServersLimit = configOld.trayMenuServersLimit,
|
||||||
};
|
// };
|
||||||
}
|
// }
|
||||||
|
|
||||||
GetDefaultServer(config);
|
// GetDefaultServer(config);
|
||||||
GetDefaultRouting(config);
|
// GetDefaultRouting(config);
|
||||||
SaveConfig(config);
|
// SaveConfig(config);
|
||||||
LoadConfig(ref config);
|
// LoadConfig(ref config);
|
||||||
|
|
||||||
return 0;
|
// return 0;
|
||||||
}
|
//}
|
||||||
|
|
||||||
#endregion ConfigHandler
|
#endregion ConfigHandler
|
||||||
|
|
||||||
@@ -664,6 +663,23 @@ namespace v2rayN.Handler
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Add or edit server
|
||||||
|
/// </summary>
|
||||||
|
/// <param name="config"></param>
|
||||||
|
/// <param name="profileItem"></param>
|
||||||
|
/// <returns></returns>
|
||||||
|
public static int AddHttpServer(Config config, ProfileItem profileItem, bool toFile = true)
|
||||||
|
{
|
||||||
|
profileItem.configType = EConfigType.Http;
|
||||||
|
|
||||||
|
profileItem.address = profileItem.address.TrimEx();
|
||||||
|
|
||||||
|
AddServerCommon(config, profileItem, toFile);
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Add or edit server
|
/// Add or edit server
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -1657,14 +1673,15 @@ namespace v2rayN.Handler
|
|||||||
|
|
||||||
public static int InitBuiltinRouting(Config config, bool blImportAdvancedRules = false)
|
public static int InitBuiltinRouting(Config config, bool blImportAdvancedRules = false)
|
||||||
{
|
{
|
||||||
|
var ver = "V2-";
|
||||||
var items = LazyConfig.Instance.RoutingItems();
|
var items = LazyConfig.Instance.RoutingItems();
|
||||||
if (blImportAdvancedRules || items.Count <= 0)
|
if (blImportAdvancedRules || items.Where(t => t.remarks.StartsWith(ver)).ToList().Count <= 0)
|
||||||
{
|
{
|
||||||
var maxSort = items.Count;
|
var maxSort = items.Count;
|
||||||
//Bypass the mainland
|
//Bypass the mainland
|
||||||
var item2 = new RoutingItem()
|
var item2 = new RoutingItem()
|
||||||
{
|
{
|
||||||
remarks = "绕过大陆(Whitelist)",
|
remarks = $"{ver}绕过大陆(Whitelist)",
|
||||||
url = string.Empty,
|
url = string.Empty,
|
||||||
sort = maxSort + 1,
|
sort = maxSort + 1,
|
||||||
};
|
};
|
||||||
@@ -1673,7 +1690,7 @@ namespace v2rayN.Handler
|
|||||||
//Blacklist
|
//Blacklist
|
||||||
var item3 = new RoutingItem()
|
var item3 = new RoutingItem()
|
||||||
{
|
{
|
||||||
remarks = "黑名单(Blacklist)",
|
remarks = $"{ver}黑名单(Blacklist)",
|
||||||
url = string.Empty,
|
url = string.Empty,
|
||||||
sort = maxSort + 2,
|
sort = maxSort + 2,
|
||||||
};
|
};
|
||||||
@@ -1682,7 +1699,7 @@ namespace v2rayN.Handler
|
|||||||
//Global
|
//Global
|
||||||
var item1 = new RoutingItem()
|
var item1 = new RoutingItem()
|
||||||
{
|
{
|
||||||
remarks = "全局(Global)",
|
remarks = $"{ver}全局(Global)",
|
||||||
url = string.Empty,
|
url = string.Empty,
|
||||||
sort = maxSort + 3,
|
sort = maxSort + 3,
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -54,7 +54,9 @@ namespace v2rayN.Handler
|
|||||||
|
|
||||||
GenDns(node, singboxConfig);
|
GenDns(node, singboxConfig);
|
||||||
|
|
||||||
GenStatistic(singboxConfig);
|
GenExperimental(singboxConfig);
|
||||||
|
|
||||||
|
ConvertGeo2Ruleset(singboxConfig);
|
||||||
|
|
||||||
msg = string.Format(ResUI.SuccessfulConfiguration, "");
|
msg = string.Format(ResUI.SuccessfulConfiguration, "");
|
||||||
}
|
}
|
||||||
@@ -109,7 +111,8 @@ namespace v2rayN.Handler
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
singboxConfig.inbounds.Clear();
|
var listen = "::";
|
||||||
|
singboxConfig.inbounds = [];
|
||||||
|
|
||||||
if (!_config.tunModeItem.enableTun || (_config.tunModeItem.enableTun && _config.tunModeItem.enableExInbound))
|
if (!_config.tunModeItem.enableTun || (_config.tunModeItem.enableTun && _config.tunModeItem.enableExInbound))
|
||||||
{
|
{
|
||||||
@@ -144,11 +147,11 @@ namespace v2rayN.Handler
|
|||||||
if (_config.inbound[0].newPort4LAN)
|
if (_config.inbound[0].newPort4LAN)
|
||||||
{
|
{
|
||||||
var inbound3 = GetInbound(inbound, EInboundProtocol.socks2, true);
|
var inbound3 = GetInbound(inbound, EInboundProtocol.socks2, true);
|
||||||
inbound3.listen = "::";
|
inbound3.listen = listen;
|
||||||
singboxConfig.inbounds.Add(inbound3);
|
singboxConfig.inbounds.Add(inbound3);
|
||||||
|
|
||||||
var inbound4 = GetInbound(inbound, EInboundProtocol.http2, false);
|
var inbound4 = GetInbound(inbound, EInboundProtocol.http2, false);
|
||||||
inbound4.listen = "::";
|
inbound4.listen = listen;
|
||||||
singboxConfig.inbounds.Add(inbound4);
|
singboxConfig.inbounds.Add(inbound4);
|
||||||
|
|
||||||
//auth
|
//auth
|
||||||
@@ -160,8 +163,8 @@ namespace v2rayN.Handler
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
inbound.listen = "::";
|
inbound.listen = listen;
|
||||||
inbound2.listen = "::";
|
inbound2.listen = listen;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -213,11 +216,12 @@ namespace v2rayN.Handler
|
|||||||
{
|
{
|
||||||
outbound.server = node.address;
|
outbound.server = node.address;
|
||||||
outbound.server_port = node.port;
|
outbound.server_port = node.port;
|
||||||
|
outbound.type = Global.ProtocolTypes[node.configType];
|
||||||
|
|
||||||
if (node.configType == EConfigType.VMess)
|
switch (node.configType)
|
||||||
|
{
|
||||||
|
case EConfigType.VMess:
|
||||||
{
|
{
|
||||||
outbound.type = Global.ProtocolTypes[EConfigType.VMess];
|
|
||||||
|
|
||||||
outbound.uuid = node.id;
|
outbound.uuid = node.id;
|
||||||
outbound.alter_id = node.alterId;
|
outbound.alter_id = node.alterId;
|
||||||
if (Global.VmessSecurities.Contains(node.security))
|
if (Global.VmessSecurities.Contains(node.security))
|
||||||
@@ -230,20 +234,18 @@ namespace v2rayN.Handler
|
|||||||
}
|
}
|
||||||
|
|
||||||
GenOutboundMux(node, outbound);
|
GenOutboundMux(node, outbound);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else if (node.configType == EConfigType.Shadowsocks)
|
case EConfigType.Shadowsocks:
|
||||||
{
|
{
|
||||||
outbound.type = Global.ProtocolTypes[EConfigType.Shadowsocks];
|
|
||||||
|
|
||||||
outbound.method = LazyConfig.Instance.GetShadowsocksSecurities(node).Contains(node.security) ? node.security : Global.None;
|
outbound.method = LazyConfig.Instance.GetShadowsocksSecurities(node).Contains(node.security) ? node.security : Global.None;
|
||||||
outbound.password = node.id;
|
outbound.password = node.id;
|
||||||
|
|
||||||
GenOutboundMux(node, outbound);
|
GenOutboundMux(node, outbound);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else if (node.configType == EConfigType.Socks)
|
case EConfigType.Socks:
|
||||||
{
|
{
|
||||||
outbound.type = Global.ProtocolTypes[EConfigType.Socks];
|
|
||||||
|
|
||||||
outbound.version = "5";
|
outbound.version = "5";
|
||||||
if (!Utils.IsNullOrEmpty(node.security)
|
if (!Utils.IsNullOrEmpty(node.security)
|
||||||
&& !Utils.IsNullOrEmpty(node.id))
|
&& !Utils.IsNullOrEmpty(node.id))
|
||||||
@@ -251,11 +253,20 @@ namespace v2rayN.Handler
|
|||||||
outbound.username = node.security;
|
outbound.username = node.security;
|
||||||
outbound.password = node.id;
|
outbound.password = node.id;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else if (node.configType == EConfigType.VLESS)
|
case EConfigType.Http:
|
||||||
|
{
|
||||||
|
if (!Utils.IsNullOrEmpty(node.security)
|
||||||
|
&& !Utils.IsNullOrEmpty(node.id))
|
||||||
|
{
|
||||||
|
outbound.username = node.security;
|
||||||
|
outbound.password = node.id;
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case EConfigType.VLESS:
|
||||||
{
|
{
|
||||||
outbound.type = Global.ProtocolTypes[EConfigType.VLESS];
|
|
||||||
|
|
||||||
outbound.uuid = node.id;
|
outbound.uuid = node.id;
|
||||||
|
|
||||||
outbound.packet_encoding = "xudp";
|
outbound.packet_encoding = "xudp";
|
||||||
@@ -268,19 +279,17 @@ namespace v2rayN.Handler
|
|||||||
{
|
{
|
||||||
outbound.flow = node.flow;
|
outbound.flow = node.flow;
|
||||||
}
|
}
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else if (node.configType == EConfigType.Trojan)
|
case EConfigType.Trojan:
|
||||||
{
|
{
|
||||||
outbound.type = Global.ProtocolTypes[EConfigType.Trojan];
|
|
||||||
|
|
||||||
outbound.password = node.id;
|
outbound.password = node.id;
|
||||||
|
|
||||||
GenOutboundMux(node, outbound);
|
GenOutboundMux(node, outbound);
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else if (node.configType == EConfigType.Hysteria2)
|
case EConfigType.Hysteria2:
|
||||||
{
|
{
|
||||||
outbound.type = Global.ProtocolTypes[EConfigType.Hysteria2];
|
|
||||||
|
|
||||||
outbound.password = node.id;
|
outbound.password = node.id;
|
||||||
|
|
||||||
if (!Utils.IsNullOrEmpty(node.path))
|
if (!Utils.IsNullOrEmpty(node.path))
|
||||||
@@ -294,24 +303,24 @@ namespace v2rayN.Handler
|
|||||||
|
|
||||||
outbound.up_mbps = _config.hysteriaItem.up_mbps > 0 ? _config.hysteriaItem.up_mbps : null;
|
outbound.up_mbps = _config.hysteriaItem.up_mbps > 0 ? _config.hysteriaItem.up_mbps : null;
|
||||||
outbound.down_mbps = _config.hysteriaItem.down_mbps > 0 ? _config.hysteriaItem.down_mbps : null;
|
outbound.down_mbps = _config.hysteriaItem.down_mbps > 0 ? _config.hysteriaItem.down_mbps : null;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else if (node.configType == EConfigType.Tuic)
|
case EConfigType.Tuic:
|
||||||
{
|
{
|
||||||
outbound.type = Global.ProtocolTypes[EConfigType.Tuic];
|
|
||||||
|
|
||||||
outbound.uuid = node.id;
|
outbound.uuid = node.id;
|
||||||
outbound.password = node.security;
|
outbound.password = node.security;
|
||||||
outbound.congestion_control = node.headerType;
|
outbound.congestion_control = node.headerType;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else if (node.configType == EConfigType.Wireguard)
|
case EConfigType.Wireguard:
|
||||||
{
|
{
|
||||||
outbound.type = Global.ProtocolTypes[EConfigType.Wireguard];
|
|
||||||
|
|
||||||
outbound.private_key = node.id;
|
outbound.private_key = node.id;
|
||||||
outbound.peer_public_key = node.publicKey;
|
outbound.peer_public_key = node.publicKey;
|
||||||
outbound.reserved = Utils.String2List(node.path).Select(int.Parse).ToArray();
|
outbound.reserved = Utils.String2List(node.path).Select(int.Parse).ToArray();
|
||||||
outbound.local_address = [.. Utils.String2List(node.requestHost)];
|
outbound.local_address = [.. Utils.String2List(node.requestHost)];
|
||||||
outbound.mtu = Utils.ToInt(node.shortId.IsNullOrEmpty() ? Global.TunMtus.FirstOrDefault() : node.shortId);
|
outbound.mtu = Utils.ToInt(node.shortId.IsNullOrEmpty() ? Global.TunMtus.FirstOrDefault() : node.shortId);
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
GenOutboundTls(node, outbound);
|
GenOutboundTls(node, outbound);
|
||||||
@@ -329,16 +338,16 @@ namespace v2rayN.Handler
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//if (_config.coreBasicItem.muxEnabled)
|
if (_config.coreBasicItem.muxEnabled && !Utils.IsNullOrEmpty(_config.mux4SboxItem.protocol))
|
||||||
//{
|
{
|
||||||
// var mux = new Multiplex4Sbox()
|
var mux = new Multiplex4Sbox()
|
||||||
// {
|
{
|
||||||
// enabled = true,
|
enabled = true,
|
||||||
// protocol = _config.mux4SboxItem.protocol,
|
protocol = _config.mux4SboxItem.protocol,
|
||||||
// max_connections = _config.mux4SboxItem.max_connections,
|
max_connections = _config.mux4SboxItem.max_connections,
|
||||||
// };
|
};
|
||||||
// outbound.multiplex = mux;
|
outbound.multiplex = mux;
|
||||||
//}
|
}
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -531,24 +540,38 @@ namespace v2rayN.Handler
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
var dnsOutbound = "dns_out";
|
||||||
|
if (!_config.inbound[0].sniffingEnabled)
|
||||||
|
{
|
||||||
|
singboxConfig.route.rules.Add(new()
|
||||||
|
{
|
||||||
|
port = [53],
|
||||||
|
network = "udp",
|
||||||
|
outbound = dnsOutbound
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
if (_config.tunModeItem.enableTun)
|
if (_config.tunModeItem.enableTun)
|
||||||
{
|
{
|
||||||
singboxConfig.route.auto_detect_interface = true;
|
singboxConfig.route.auto_detect_interface = true;
|
||||||
|
|
||||||
var tunRules = JsonUtils.Deserialize<List<Rule4Sbox>>(Utils.GetEmbedText(Global.TunSingboxRulesFileName));
|
var tunRules = JsonUtils.Deserialize<List<Rule4Sbox>>(Utils.GetEmbedText(Global.TunSingboxRulesFileName));
|
||||||
|
if (tunRules != null)
|
||||||
|
{
|
||||||
singboxConfig.route.rules.AddRange(tunRules);
|
singboxConfig.route.rules.AddRange(tunRules);
|
||||||
|
}
|
||||||
|
|
||||||
GenRoutingDirectExe(out List<string> lstDnsExe, out List<string> lstDirectExe);
|
GenRoutingDirectExe(out List<string> lstDnsExe, out List<string> lstDirectExe);
|
||||||
singboxConfig.route.rules.Add(new()
|
singboxConfig.route.rules.Add(new()
|
||||||
{
|
{
|
||||||
port = new() { 53 },
|
port = new() { 53 },
|
||||||
outbound = "dns_out",
|
outbound = dnsOutbound,
|
||||||
process_name = lstDnsExe
|
process_name = lstDnsExe
|
||||||
});
|
});
|
||||||
|
|
||||||
singboxConfig.route.rules.Add(new()
|
singboxConfig.route.rules.Add(new()
|
||||||
{
|
{
|
||||||
outbound = "direct",
|
outbound = Global.DirectTag,
|
||||||
process_name = lstDirectExe
|
process_name = lstDirectExe
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@@ -647,29 +670,38 @@ namespace v2rayN.Handler
|
|||||||
{
|
{
|
||||||
rule.inbound = item.inboundTag;
|
rule.inbound = item.inboundTag;
|
||||||
}
|
}
|
||||||
|
var rule1 = JsonUtils.DeepCopy(rule);
|
||||||
var rule2 = JsonUtils.DeepCopy(rule);
|
var rule2 = JsonUtils.DeepCopy(rule);
|
||||||
var rule3 = JsonUtils.DeepCopy(rule);
|
var rule3 = JsonUtils.DeepCopy(rule);
|
||||||
|
|
||||||
var hasDomainIp = false;
|
var hasDomainIp = false;
|
||||||
if (item.domain?.Count > 0)
|
if (item.domain?.Count > 0)
|
||||||
{
|
{
|
||||||
|
var countDomain = 0;
|
||||||
foreach (var it in item.domain)
|
foreach (var it in item.domain)
|
||||||
{
|
{
|
||||||
ParseV2Domain(it, rule);
|
if (ParseV2Domain(it, rule1)) countDomain++;
|
||||||
}
|
}
|
||||||
rules.Add(rule);
|
if (countDomain > 0)
|
||||||
|
{
|
||||||
|
rules.Add(rule1);
|
||||||
hasDomainIp = true;
|
hasDomainIp = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (item.ip?.Count > 0)
|
if (item.ip?.Count > 0)
|
||||||
{
|
{
|
||||||
|
var countIp = 0;
|
||||||
foreach (var it in item.ip)
|
foreach (var it in item.ip)
|
||||||
{
|
{
|
||||||
ParseV2Address(it, rule2);
|
if (ParseV2Address(it, rule2)) countIp++;
|
||||||
}
|
}
|
||||||
|
if (countIp > 0)
|
||||||
|
{
|
||||||
rules.Add(rule2);
|
rules.Add(rule2);
|
||||||
hasDomainIp = true;
|
hasDomainIp = true;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (_config.tunModeItem.enableTun && item.process?.Count > 0)
|
if (_config.tunModeItem.enableTun && item.process?.Count > 0)
|
||||||
{
|
{
|
||||||
@@ -678,7 +710,8 @@ namespace v2rayN.Handler
|
|||||||
hasDomainIp = true;
|
hasDomainIp = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!hasDomainIp)
|
if (!hasDomainIp
|
||||||
|
&& (rule.port != null || rule.port_range != null || rule.protocol != null || rule.inbound != null))
|
||||||
{
|
{
|
||||||
rules.Add(rule);
|
rules.Add(rule);
|
||||||
}
|
}
|
||||||
@@ -690,11 +723,11 @@ namespace v2rayN.Handler
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ParseV2Domain(string domain, Rule4Sbox rule)
|
private bool ParseV2Domain(string domain, Rule4Sbox rule)
|
||||||
{
|
{
|
||||||
if (domain.StartsWith("#") || domain.StartsWith("ext:") || domain.StartsWith("ext-domain:"))
|
if (domain.StartsWith("#") || domain.StartsWith("ext:") || domain.StartsWith("ext-domain:"))
|
||||||
{
|
{
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
else if (domain.StartsWith("geosite:"))
|
else if (domain.StartsWith("geosite:"))
|
||||||
{
|
{
|
||||||
@@ -728,17 +761,22 @@ namespace v2rayN.Handler
|
|||||||
rule.domain_keyword ??= [];
|
rule.domain_keyword ??= [];
|
||||||
rule.domain_keyword?.Add(domain);
|
rule.domain_keyword?.Add(domain);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ParseV2Address(string address, Rule4Sbox rule)
|
private bool ParseV2Address(string address, Rule4Sbox rule)
|
||||||
{
|
{
|
||||||
if (address.StartsWith("ext:") || address.StartsWith("ext-ip:"))
|
if (address.StartsWith("ext:") || address.StartsWith("ext-ip:"))
|
||||||
{
|
{
|
||||||
return;
|
return false;
|
||||||
}
|
}
|
||||||
else if (address.StartsWith("geoip:!"))
|
else if (address.StartsWith("geoip:!"))
|
||||||
{
|
{
|
||||||
return;
|
return false;
|
||||||
|
}
|
||||||
|
else if (address.Equals("geoip:private"))
|
||||||
|
{
|
||||||
|
rule.ip_is_private = true;
|
||||||
}
|
}
|
||||||
else if (address.StartsWith("geoip:"))
|
else if (address.StartsWith("geoip:"))
|
||||||
{
|
{
|
||||||
@@ -750,56 +788,32 @@ namespace v2rayN.Handler
|
|||||||
if (rule.ip_cidr is null) { rule.ip_cidr = new(); }
|
if (rule.ip_cidr is null) { rule.ip_cidr = new(); }
|
||||||
rule.ip_cidr?.Add(address);
|
rule.ip_cidr?.Add(address);
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int GenDns(ProfileItem node, SingboxConfig singboxConfig)
|
private int GenDns(ProfileItem node, SingboxConfig singboxConfig)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Dns4Sbox? dns4Sbox;
|
var item = LazyConfig.Instance.GetDNSItem(ECoreType.sing_box);
|
||||||
|
var strDNS = string.Empty;
|
||||||
if (_config.tunModeItem.enableTun)
|
if (_config.tunModeItem.enableTun)
|
||||||
{
|
{
|
||||||
var item = LazyConfig.Instance.GetDNSItem(ECoreType.sing_box);
|
strDNS = Utils.IsNullOrEmpty(item?.tunDNS) ? Utils.GetEmbedText(Global.TunSingboxDNSFileName) : item?.tunDNS;
|
||||||
var tunDNS = item?.tunDNS;
|
|
||||||
if (Utils.IsNullOrEmpty(tunDNS))
|
|
||||||
{
|
|
||||||
tunDNS = Utils.GetEmbedText(Global.TunSingboxDNSFileName);
|
|
||||||
}
|
|
||||||
dns4Sbox = JsonUtils.Deserialize<Dns4Sbox>(tunDNS);
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var item = LazyConfig.Instance.GetDNSItem(ECoreType.sing_box);
|
strDNS = Utils.IsNullOrEmpty(item?.normalDNS) ? Utils.GetEmbedText(Global.DNSSingboxNormalFileName) : item?.normalDNS;
|
||||||
var normalDNS = item?.normalDNS;
|
|
||||||
if (Utils.IsNullOrEmpty(normalDNS))
|
|
||||||
{
|
|
||||||
normalDNS = "{\"servers\":[{\"address\":\"tcp://8.8.8.8\"}]}";
|
|
||||||
}
|
}
|
||||||
|
|
||||||
dns4Sbox = JsonUtils.Deserialize<Dns4Sbox>(normalDNS);
|
var dns4Sbox = JsonUtils.Deserialize<Dns4Sbox>(strDNS);
|
||||||
}
|
|
||||||
if (dns4Sbox is null)
|
if (dns4Sbox is null)
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
//Add the dns of the remote server domain
|
|
||||||
if (dns4Sbox.rules is null)
|
|
||||||
{
|
|
||||||
dns4Sbox.rules = new();
|
|
||||||
}
|
|
||||||
dns4Sbox.servers.Add(new()
|
|
||||||
{
|
|
||||||
tag = "local_local",
|
|
||||||
address = "223.5.5.5",
|
|
||||||
detour = "direct"
|
|
||||||
});
|
|
||||||
dns4Sbox.rules.Add(new()
|
|
||||||
{
|
|
||||||
server = "local_local",
|
|
||||||
outbound = "any"
|
|
||||||
});
|
|
||||||
|
|
||||||
singboxConfig.dns = dns4Sbox;
|
singboxConfig.dns = dns4Sbox;
|
||||||
|
|
||||||
|
GenDnsDomains(singboxConfig);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
@@ -808,30 +822,135 @@ namespace v2rayN.Handler
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private int GenStatistic(SingboxConfig singboxConfig)
|
private int GenDnsDomains(SingboxConfig singboxConfig)
|
||||||
|
{
|
||||||
|
var dns4Sbox = singboxConfig.dns ?? new();
|
||||||
|
dns4Sbox.servers ??= [];
|
||||||
|
dns4Sbox.rules ??= [];
|
||||||
|
|
||||||
|
var lstDomain = singboxConfig.outbounds
|
||||||
|
.Where(t => !Utils.IsNullOrEmpty(t.server) && Utils.IsDomain(t.server))
|
||||||
|
.Select(t => t.server)
|
||||||
|
.ToList();
|
||||||
|
if (lstDomain != null && lstDomain.Count > 0)
|
||||||
|
{
|
||||||
|
var tag = "local_local";
|
||||||
|
dns4Sbox.servers.Insert(0, new()
|
||||||
|
{
|
||||||
|
tag = tag,
|
||||||
|
address = "223.5.5.5",
|
||||||
|
detour = Global.DirectTag,
|
||||||
|
});
|
||||||
|
dns4Sbox.rules.Insert(0, new()
|
||||||
|
{
|
||||||
|
server = tag,
|
||||||
|
domain = lstDomain
|
||||||
|
});
|
||||||
|
}
|
||||||
|
singboxConfig.dns = dns4Sbox;
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int GenExperimental(SingboxConfig singboxConfig)
|
||||||
{
|
{
|
||||||
if (_config.guiItem.enableStatistics)
|
if (_config.guiItem.enableStatistics)
|
||||||
{
|
{
|
||||||
singboxConfig.experimental = new Experimental4Sbox()
|
singboxConfig.experimental ??= new Experimental4Sbox();
|
||||||
{
|
singboxConfig.experimental.clash_api = new Clash_Api4Sbox()
|
||||||
//cache_file = new CacheFile4Sbox()
|
|
||||||
//{
|
|
||||||
// enabled = true
|
|
||||||
//},
|
|
||||||
//v2ray_api = new V2ray_Api4Sbox()
|
|
||||||
//{
|
|
||||||
// listen = $"{Global.Loopback}:{Global.StatePort}",
|
|
||||||
// stats = new Stats4Sbox()
|
|
||||||
// {
|
|
||||||
// enabled = true,
|
|
||||||
// }
|
|
||||||
//},
|
|
||||||
clash_api = new Clash_Api4Sbox()
|
|
||||||
{
|
{
|
||||||
external_controller = $"{Global.Loopback}:{LazyConfig.Instance.StatePort}",
|
external_controller = $"{Global.Loopback}:{LazyConfig.Instance.StatePort}",
|
||||||
}
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (_config.coreBasicItem.enableCacheFile4Sbox)
|
||||||
|
{
|
||||||
|
singboxConfig.experimental ??= new Experimental4Sbox();
|
||||||
|
singboxConfig.experimental.cache_file = new CacheFile4Sbox()
|
||||||
|
{
|
||||||
|
enabled = true
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
private int ConvertGeo2Ruleset(SingboxConfig singboxConfig)
|
||||||
|
{
|
||||||
|
var geosite = "geosite";
|
||||||
|
var geoip = "geoip";
|
||||||
|
var ruleSets = new List<string>();
|
||||||
|
|
||||||
|
//convert route geosite & geoip to ruleset
|
||||||
|
foreach (var rule in singboxConfig.route.rules.Where(t => t.geosite?.Count > 0).ToList() ?? [])
|
||||||
|
{
|
||||||
|
rule.rule_set = rule?.geosite?.Select(t => $"{geosite}-{t}").ToList();
|
||||||
|
rule.geosite = null;
|
||||||
|
ruleSets.AddRange(rule.rule_set);
|
||||||
|
}
|
||||||
|
foreach (var rule in singboxConfig.route.rules.Where(t => t.geoip?.Count > 0).ToList() ?? [])
|
||||||
|
{
|
||||||
|
rule.rule_set = rule?.geoip?.Select(t => $"{geoip}-{t}").ToList();
|
||||||
|
rule.geoip = null;
|
||||||
|
ruleSets.AddRange(rule.rule_set);
|
||||||
|
}
|
||||||
|
|
||||||
|
//convert dns geosite & geoip to ruleset
|
||||||
|
foreach (var rule in singboxConfig.dns?.rules.Where(t => t.geosite?.Count > 0).ToList() ?? [])
|
||||||
|
{
|
||||||
|
rule.rule_set = rule?.geosite?.Select(t => $"{geosite}-{t}").ToList();
|
||||||
|
rule.geosite = null;
|
||||||
|
}
|
||||||
|
foreach (var rule in singboxConfig.dns?.rules.Where(t => t.geoip?.Count > 0).ToList() ?? [])
|
||||||
|
{
|
||||||
|
rule.rule_set = rule?.geoip?.Select(t => $"{geoip}-{t}").ToList();
|
||||||
|
rule.geoip = null;
|
||||||
|
}
|
||||||
|
foreach (var dnsRule in singboxConfig.dns?.rules.Where(t => t.rule_set?.Count > 0).ToList() ?? [])
|
||||||
|
{
|
||||||
|
ruleSets.AddRange(dnsRule.rule_set);
|
||||||
|
}
|
||||||
|
|
||||||
|
//load custom ruleset file
|
||||||
|
List<Ruleset4Sbox> customRulesets = [];
|
||||||
|
if (_config.routingBasicItem.enableRoutingAdvanced)
|
||||||
|
{
|
||||||
|
var routing = ConfigHandler.GetDefaultRouting(_config);
|
||||||
|
if (!Utils.IsNullOrEmpty(routing.customRulesetPath4Singbox))
|
||||||
|
{
|
||||||
|
var result = Utils.LoadResource(routing.customRulesetPath4Singbox);
|
||||||
|
if (!Utils.IsNullOrEmpty(result))
|
||||||
|
{
|
||||||
|
customRulesets = (JsonUtils.Deserialize<List<Ruleset4Sbox>>(result) ?? [])
|
||||||
|
.Where(t => t.tag != null)
|
||||||
|
.Where(t => t.type != null)
|
||||||
|
.Where(t => t.format != null)
|
||||||
|
.ToList();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
//Add ruleset srs
|
||||||
|
singboxConfig.route.rule_set = [];
|
||||||
|
foreach (var item in new HashSet<string>(ruleSets))
|
||||||
|
{
|
||||||
|
var customRuleset = customRulesets.FirstOrDefault(t => t.tag != null && t.tag.Equals(item));
|
||||||
|
if (customRuleset != null)
|
||||||
|
{
|
||||||
|
singboxConfig.route.rule_set.Add(customRuleset);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
singboxConfig.route.rule_set.Add(new()
|
||||||
|
{
|
||||||
|
type = "remote",
|
||||||
|
format = "binary",
|
||||||
|
tag = item,
|
||||||
|
url = string.Format(Global.SingboxRulesetUrl, item.StartsWith(geosite) ? geosite : geoip, item),
|
||||||
|
download_detour = Global.ProxyTag
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -972,12 +1091,18 @@ namespace v2rayN.Handler
|
|||||||
singboxConfig.route.rules.Add(rule);
|
singboxConfig.route.rules.Add(rule);
|
||||||
}
|
}
|
||||||
|
|
||||||
GenDns(new(), singboxConfig);
|
GenDnsDomains(singboxConfig);
|
||||||
var dnsServer = singboxConfig.dns?.servers.FirstOrDefault();
|
//var dnsServer = singboxConfig.dns?.servers.FirstOrDefault();
|
||||||
if (dnsServer != null)
|
//if (dnsServer != null)
|
||||||
{
|
//{
|
||||||
dnsServer.detour = singboxConfig.route.rules.LastOrDefault()?.outbound;
|
// dnsServer.detour = singboxConfig.route.rules.LastOrDefault()?.outbound;
|
||||||
}
|
//}
|
||||||
|
//var dnsRule = singboxConfig.dns?.rules.Where(t => t.outbound != null).FirstOrDefault();
|
||||||
|
//if (dnsRule != null)
|
||||||
|
//{
|
||||||
|
// singboxConfig.dns.rules = [];
|
||||||
|
// singboxConfig.dns.rules.Add(dnsRule);
|
||||||
|
//}
|
||||||
|
|
||||||
//msg = string.Format(ResUI.SuccessfulConfiguration"), node.getSummary());
|
//msg = string.Format(ResUI.SuccessfulConfiguration"), node.getSummary());
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -98,7 +98,8 @@ namespace v2rayN.Handler
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
v2rayConfig.inbounds = new List<Inbounds4Ray>();
|
var listen = "0.0.0.0";
|
||||||
|
v2rayConfig.inbounds = [];
|
||||||
|
|
||||||
Inbounds4Ray? inbound = GetInbound(_config.inbound[0], EInboundProtocol.socks, true);
|
Inbounds4Ray? inbound = GetInbound(_config.inbound[0], EInboundProtocol.socks, true);
|
||||||
v2rayConfig.inbounds.Add(inbound);
|
v2rayConfig.inbounds.Add(inbound);
|
||||||
@@ -112,11 +113,11 @@ namespace v2rayN.Handler
|
|||||||
if (_config.inbound[0].newPort4LAN)
|
if (_config.inbound[0].newPort4LAN)
|
||||||
{
|
{
|
||||||
var inbound3 = GetInbound(_config.inbound[0], EInboundProtocol.socks2, true);
|
var inbound3 = GetInbound(_config.inbound[0], EInboundProtocol.socks2, true);
|
||||||
inbound3.listen = "0.0.0.0";
|
inbound3.listen = listen;
|
||||||
v2rayConfig.inbounds.Add(inbound3);
|
v2rayConfig.inbounds.Add(inbound3);
|
||||||
|
|
||||||
var inbound4 = GetInbound(_config.inbound[0], EInboundProtocol.http2, false);
|
var inbound4 = GetInbound(_config.inbound[0], EInboundProtocol.http2, false);
|
||||||
inbound4.listen = "0.0.0.0";
|
inbound4.listen = listen;
|
||||||
v2rayConfig.inbounds.Add(inbound4);
|
v2rayConfig.inbounds.Add(inbound4);
|
||||||
|
|
||||||
//auth
|
//auth
|
||||||
@@ -131,8 +132,8 @@ namespace v2rayN.Handler
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
inbound.listen = "0.0.0.0";
|
inbound.listen = listen;
|
||||||
inbound2.listen = "0.0.0.0";
|
inbound2.listen = listen;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -143,24 +144,25 @@ namespace v2rayN.Handler
|
|||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private Inbounds4Ray? GetInbound(InItem inItem, EInboundProtocol protocol, bool bSocks)
|
private Inbounds4Ray GetInbound(InItem inItem, EInboundProtocol protocol, bool bSocks)
|
||||||
{
|
{
|
||||||
string result = Utils.GetEmbedText(Global.V2raySampleInbound);
|
string result = Utils.GetEmbedText(Global.V2raySampleInbound);
|
||||||
if (Utils.IsNullOrEmpty(result))
|
if (Utils.IsNullOrEmpty(result))
|
||||||
{
|
{
|
||||||
return null;
|
return new();
|
||||||
}
|
}
|
||||||
|
|
||||||
var inbound = JsonUtils.Deserialize<Inbounds4Ray>(result);
|
var inbound = JsonUtils.Deserialize<Inbounds4Ray>(result);
|
||||||
if (inbound == null)
|
if (inbound == null)
|
||||||
{
|
{
|
||||||
return null;
|
return new();
|
||||||
}
|
}
|
||||||
inbound.tag = protocol.ToString();
|
inbound.tag = protocol.ToString();
|
||||||
inbound.port = inItem.localPort + (int)protocol;
|
inbound.port = inItem.localPort + (int)protocol;
|
||||||
inbound.protocol = bSocks ? EInboundProtocol.socks.ToString() : EInboundProtocol.http.ToString();
|
inbound.protocol = bSocks ? EInboundProtocol.socks.ToString() : EInboundProtocol.http.ToString();
|
||||||
inbound.settings.udp = inItem.udpEnabled;
|
inbound.settings.udp = inItem.udpEnabled;
|
||||||
inbound.sniffing.enabled = inItem.sniffingEnabled;
|
inbound.sniffing.enabled = inItem.sniffingEnabled;
|
||||||
|
inbound.sniffing.destOverride = inItem.destOverride;
|
||||||
inbound.sniffing.routeOnly = inItem.routeOnly;
|
inbound.sniffing.routeOnly = inItem.routeOnly;
|
||||||
|
|
||||||
return inbound;
|
return inbound;
|
||||||
@@ -295,7 +297,9 @@ namespace v2rayN.Handler
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (node.configType == EConfigType.VMess)
|
switch (node.configType)
|
||||||
|
{
|
||||||
|
case EConfigType.VMess:
|
||||||
{
|
{
|
||||||
VnextItem4Ray vnextItem;
|
VnextItem4Ray vnextItem;
|
||||||
if (outbound.settings.vnext.Count <= 0)
|
if (outbound.settings.vnext.Count <= 0)
|
||||||
@@ -335,10 +339,10 @@ namespace v2rayN.Handler
|
|||||||
|
|
||||||
GenOutboundMux(node, outbound, _config.coreBasicItem.muxEnabled);
|
GenOutboundMux(node, outbound, _config.coreBasicItem.muxEnabled);
|
||||||
|
|
||||||
outbound.protocol = Global.ProtocolTypes[EConfigType.VMess];
|
|
||||||
outbound.settings.servers = null;
|
outbound.settings.servers = null;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else if (node.configType == EConfigType.Shadowsocks)
|
case EConfigType.Shadowsocks:
|
||||||
{
|
{
|
||||||
ServersItem4Ray serversItem;
|
ServersItem4Ray serversItem;
|
||||||
if (outbound.settings.servers.Count <= 0)
|
if (outbound.settings.servers.Count <= 0)
|
||||||
@@ -360,10 +364,11 @@ namespace v2rayN.Handler
|
|||||||
|
|
||||||
GenOutboundMux(node, outbound, false);
|
GenOutboundMux(node, outbound, false);
|
||||||
|
|
||||||
outbound.protocol = Global.ProtocolTypes[EConfigType.Shadowsocks];
|
|
||||||
outbound.settings.vnext = null;
|
outbound.settings.vnext = null;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else if (node.configType == EConfigType.Socks)
|
case EConfigType.Socks:
|
||||||
|
case EConfigType.Http:
|
||||||
{
|
{
|
||||||
ServersItem4Ray serversItem;
|
ServersItem4Ray serversItem;
|
||||||
if (outbound.settings.servers.Count <= 0)
|
if (outbound.settings.servers.Count <= 0)
|
||||||
@@ -395,13 +400,13 @@ namespace v2rayN.Handler
|
|||||||
|
|
||||||
GenOutboundMux(node, outbound, false);
|
GenOutboundMux(node, outbound, false);
|
||||||
|
|
||||||
outbound.protocol = Global.ProtocolTypes[EConfigType.Socks];
|
|
||||||
outbound.settings.vnext = null;
|
outbound.settings.vnext = null;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else if (node.configType == EConfigType.VLESS)
|
case EConfigType.VLESS:
|
||||||
{
|
{
|
||||||
VnextItem4Ray vnextItem;
|
VnextItem4Ray vnextItem;
|
||||||
if (outbound.settings.vnext.Count <= 0)
|
if (outbound.settings.vnext?.Count <= 0)
|
||||||
{
|
{
|
||||||
vnextItem = new VnextItem4Ray();
|
vnextItem = new VnextItem4Ray();
|
||||||
outbound.settings.vnext.Add(vnextItem);
|
outbound.settings.vnext.Add(vnextItem);
|
||||||
@@ -444,10 +449,10 @@ namespace v2rayN.Handler
|
|||||||
GenOutboundMux(node, outbound, _config.coreBasicItem.muxEnabled);
|
GenOutboundMux(node, outbound, _config.coreBasicItem.muxEnabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
outbound.protocol = Global.ProtocolTypes[EConfigType.VLESS];
|
|
||||||
outbound.settings.servers = null;
|
outbound.settings.servers = null;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
else if (node.configType == EConfigType.Trojan)
|
case EConfigType.Trojan:
|
||||||
{
|
{
|
||||||
ServersItem4Ray serversItem;
|
ServersItem4Ray serversItem;
|
||||||
if (outbound.settings.servers.Count <= 0)
|
if (outbound.settings.servers.Count <= 0)
|
||||||
@@ -468,9 +473,12 @@ namespace v2rayN.Handler
|
|||||||
|
|
||||||
GenOutboundMux(node, outbound, false);
|
GenOutboundMux(node, outbound, false);
|
||||||
|
|
||||||
outbound.protocol = Global.ProtocolTypes[EConfigType.Trojan];
|
|
||||||
outbound.settings.vnext = null;
|
outbound.settings.vnext = null;
|
||||||
|
break;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
outbound.protocol = Global.ProtocolTypes[node.configType];
|
||||||
GenBoundStreamSettings(node, outbound.streamSettings);
|
GenBoundStreamSettings(node, outbound.streamSettings);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
@@ -724,7 +732,7 @@ namespace v2rayN.Handler
|
|||||||
var domainStrategy4Freedom = item?.domainStrategy4Freedom;
|
var domainStrategy4Freedom = item?.domainStrategy4Freedom;
|
||||||
if (Utils.IsNullOrEmpty(normalDNS))
|
if (Utils.IsNullOrEmpty(normalDNS))
|
||||||
{
|
{
|
||||||
normalDNS = "1.1.1.1,8.8.8.8";
|
normalDNS = Utils.GetEmbedText(Global.DNSV2rayNormalFileName);
|
||||||
}
|
}
|
||||||
|
|
||||||
//Outbound Freedom domainStrategy
|
//Outbound Freedom domainStrategy
|
||||||
@@ -828,6 +836,33 @@ namespace v2rayN.Handler
|
|||||||
|
|
||||||
private int GenMoreOutbounds(ProfileItem node, V2rayConfig v2rayConfig)
|
private int GenMoreOutbounds(ProfileItem node, V2rayConfig v2rayConfig)
|
||||||
{
|
{
|
||||||
|
//fragment proxy
|
||||||
|
if (_config.coreBasicItem.enableFragment
|
||||||
|
&& !Utils.IsNullOrEmpty(v2rayConfig.outbounds[0].streamSettings?.security))
|
||||||
|
{
|
||||||
|
var fragmentOutbound = new Outbounds4Ray
|
||||||
|
{
|
||||||
|
protocol = "freedom",
|
||||||
|
tag = $"{Global.ProxyTag}3",
|
||||||
|
settings = new()
|
||||||
|
{
|
||||||
|
fragment = new()
|
||||||
|
{
|
||||||
|
packets = "tlshello",
|
||||||
|
length = "100-200",
|
||||||
|
interval = "10-20"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
|
v2rayConfig.outbounds.Add(fragmentOutbound);
|
||||||
|
v2rayConfig.outbounds[0].streamSettings.sockopt = new()
|
||||||
|
{
|
||||||
|
dialerProxy = fragmentOutbound.tag
|
||||||
|
};
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
if (node.subid.IsNullOrEmpty())
|
if (node.subid.IsNullOrEmpty())
|
||||||
{
|
{
|
||||||
return 0;
|
return 0;
|
||||||
|
|||||||
@@ -208,18 +208,19 @@ namespace v2rayN.Handler
|
|||||||
{
|
{
|
||||||
if ((node.configType == EConfigType.Custom && node.preSocksPort > 0))
|
if ((node.configType == EConfigType.Custom && node.preSocksPort > 0))
|
||||||
{
|
{
|
||||||
|
var preCoreType = _config.tunModeItem.enableTun ? ECoreType.sing_box : ECoreType.Xray;
|
||||||
var itemSocks = new ProfileItem()
|
var itemSocks = new ProfileItem()
|
||||||
{
|
{
|
||||||
coreType = ECoreType.sing_box,
|
coreType = preCoreType,
|
||||||
configType = EConfigType.Socks,
|
configType = EConfigType.Socks,
|
||||||
address = Global.Loopback,
|
address = Global.Loopback,
|
||||||
port = node.preSocksPort
|
port = node.preSocksPort
|
||||||
};
|
};
|
||||||
_config.runningCoreType = ECoreType.sing_box;
|
_config.runningCoreType = preCoreType;
|
||||||
string fileName2 = Utils.GetConfigPath(Global.CorePreConfigFileName);
|
string fileName2 = Utils.GetConfigPath(Global.CorePreConfigFileName);
|
||||||
if (CoreConfigHandler.GenerateClientConfig(itemSocks, fileName2, out string msg2, out string configStr) == 0)
|
if (CoreConfigHandler.GenerateClientConfig(itemSocks, fileName2, out string msg2, out string configStr) == 0)
|
||||||
{
|
{
|
||||||
var coreInfo2 = LazyConfig.Instance.GetCoreInfo(ECoreType.sing_box);
|
var coreInfo2 = LazyConfig.Instance.GetCoreInfo(preCoreType);
|
||||||
var proc2 = RunProcess(node, coreInfo2, $" -c {Global.CorePreConfigFileName}", true);
|
var proc2 = RunProcess(node, coreInfo2, $" -c {Global.CorePreConfigFileName}", true);
|
||||||
if (proc2 is not null)
|
if (proc2 is not null)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ namespace v2rayN.Handler
|
|||||||
internal class ProfileExHandler
|
internal class ProfileExHandler
|
||||||
{
|
{
|
||||||
private static readonly Lazy<ProfileExHandler> _instance = new(() => new());
|
private static readonly Lazy<ProfileExHandler> _instance = new(() => new());
|
||||||
private ConcurrentBag<ProfileExItem> _lstProfileEx;
|
private ConcurrentBag<ProfileExItem> _lstProfileEx = [];
|
||||||
private Queue<string> _queIndexIds = new();
|
private Queue<string> _queIndexIds = new();
|
||||||
public ConcurrentBag<ProfileExItem> ProfileExs => _lstProfileEx;
|
public ConcurrentBag<ProfileExItem> ProfileExs => _lstProfileEx;
|
||||||
public static ProfileExHandler Instance => _instance.Value;
|
public static ProfileExHandler Instance => _instance.Value;
|
||||||
@@ -15,6 +15,15 @@ namespace v2rayN.Handler
|
|||||||
public ProfileExHandler()
|
public ProfileExHandler()
|
||||||
{
|
{
|
||||||
Init();
|
Init();
|
||||||
|
|
||||||
|
Task.Run(async () =>
|
||||||
|
{
|
||||||
|
while (true)
|
||||||
|
{
|
||||||
|
SaveQueueIndexIds();
|
||||||
|
await Task.Delay(1000 * 600);
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Init()
|
private void Init()
|
||||||
@@ -22,24 +31,6 @@ namespace v2rayN.Handler
|
|||||||
SQLiteHelper.Instance.Execute($"delete from ProfileExItem where indexId not in ( select indexId from ProfileItem )");
|
SQLiteHelper.Instance.Execute($"delete from ProfileExItem where indexId not in ( select indexId from ProfileItem )");
|
||||||
|
|
||||||
_lstProfileEx = new(SQLiteHelper.Instance.Table<ProfileExItem>());
|
_lstProfileEx = new(SQLiteHelper.Instance.Table<ProfileExItem>());
|
||||||
|
|
||||||
Task.Run(async () =>
|
|
||||||
{
|
|
||||||
while (true)
|
|
||||||
{
|
|
||||||
var cnt = _queIndexIds.Count;
|
|
||||||
for (int i = 0; i < cnt; i++)
|
|
||||||
{
|
|
||||||
var id = _queIndexIds.Dequeue();
|
|
||||||
var item = _lstProfileEx.FirstOrDefault(t => t.indexId == id);
|
|
||||||
if (item is not null)
|
|
||||||
{
|
|
||||||
SQLiteHelper.Instance.Replace(item);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
await Task.Delay(1000 * 60);
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void IndexIdEnqueue(string indexId)
|
private void IndexIdEnqueue(string indexId)
|
||||||
@@ -50,6 +41,49 @@ namespace v2rayN.Handler
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void SaveQueueIndexIds()
|
||||||
|
{
|
||||||
|
var cnt = _queIndexIds.Count;
|
||||||
|
if (cnt > 0)
|
||||||
|
{
|
||||||
|
var lstExists = SQLiteHelper.Instance.Table<ProfileExItem>();
|
||||||
|
List<ProfileExItem> lstInserts = [];
|
||||||
|
List<ProfileExItem> lstUpdates = [];
|
||||||
|
|
||||||
|
for (int i = 0; i < cnt; i++)
|
||||||
|
{
|
||||||
|
var id = _queIndexIds.Dequeue();
|
||||||
|
var item = lstExists.FirstOrDefault(t => t.indexId == id);
|
||||||
|
var itemNew = _lstProfileEx?.FirstOrDefault(t => t.indexId == id);
|
||||||
|
if (itemNew is null)
|
||||||
|
{
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (item is not null)
|
||||||
|
{
|
||||||
|
lstUpdates.Add(itemNew);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
lstInserts.Add(itemNew);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try
|
||||||
|
{
|
||||||
|
if (lstInserts.Count() > 0)
|
||||||
|
SQLiteHelper.Instance.InsertAll(lstInserts);
|
||||||
|
|
||||||
|
if (lstUpdates.Count() > 0)
|
||||||
|
SQLiteHelper.Instance.UpdateAll(lstUpdates);
|
||||||
|
}
|
||||||
|
catch (Exception ex)
|
||||||
|
{
|
||||||
|
Logging.SaveLog("ProfileExHandler", ex);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void AddProfileEx(string indexId, ref ProfileExItem? profileEx)
|
private void AddProfileEx(string indexId, ref ProfileExItem? profileEx)
|
||||||
{
|
{
|
||||||
profileEx = new()
|
profileEx = new()
|
||||||
@@ -73,11 +107,7 @@ namespace v2rayN.Handler
|
|||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//foreach (var item in _lstProfileEx)
|
SaveQueueIndexIds();
|
||||||
//{
|
|
||||||
// SQLiteHelper.Instance.Replace(item);
|
|
||||||
//}
|
|
||||||
SQLiteHelper.Instance.UpdateAll(_lstProfileEx);
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -264,7 +264,12 @@ namespace v2rayN.Handler
|
|||||||
|
|
||||||
private static string GetIpv6(string address)
|
private static string GetIpv6(string address)
|
||||||
{
|
{
|
||||||
return Utils.IsIpv6(address) ? $"[{address}]" : address;
|
if (Utils.IsIpv6(address))
|
||||||
|
{
|
||||||
|
// 检查地址是否已经被方括号包围,如果没有,则添加方括号
|
||||||
|
return address.StartsWith('[') && address.EndsWith(']') ? address : $"[{address}]";
|
||||||
|
}
|
||||||
|
return address; // 如果不是IPv6地址,直接返回原地址
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int GetStdTransport(ProfileItem item, string? securityDef, ref Dictionary<string, string> dicQuery)
|
private static int GetStdTransport(ProfileItem item, string? securityDef, ref Dictionary<string, string> dicQuery)
|
||||||
|
|||||||
@@ -61,6 +61,7 @@ namespace v2rayN.Handler
|
|||||||
|
|
||||||
while (!_exitFlag)
|
while (!_exitFlag)
|
||||||
{
|
{
|
||||||
|
await Task.Delay(1000);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!(_config.runningCoreType is ECoreType.sing_box or ECoreType.clash or ECoreType.clash_meta or ECoreType.mihomo))
|
if (!(_config.runningCoreType is ECoreType.sing_box or ECoreType.clash or ECoreType.clash_meta or ECoreType.mihomo))
|
||||||
@@ -105,10 +106,6 @@ namespace v2rayN.Handler
|
|||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
finally
|
|
||||||
{
|
|
||||||
await Task.Delay(1000);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -49,6 +49,7 @@ namespace v2rayN.Handler
|
|||||||
{
|
{
|
||||||
while (!_exitFlag)
|
while (!_exitFlag)
|
||||||
{
|
{
|
||||||
|
await Task.Delay(1000);
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
if (!(_config.runningCoreType is ECoreType.Xray or ECoreType.v2fly or ECoreType.v2fly_v5 or ECoreType.SagerNet))
|
if (!(_config.runningCoreType is ECoreType.Xray or ECoreType.v2fly or ECoreType.v2fly_v5 or ECoreType.SagerNet))
|
||||||
@@ -60,6 +61,7 @@ namespace v2rayN.Handler
|
|||||||
QueryStatsResponse? res = null;
|
QueryStatsResponse? res = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
if (_client != null)
|
||||||
res = await _client.QueryStatsAsync(new QueryStatsRequest() { Pattern = "", Reset = true });
|
res = await _client.QueryStatsAsync(new QueryStatsRequest() { Pattern = "", Reset = true });
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
@@ -72,8 +74,8 @@ namespace v2rayN.Handler
|
|||||||
_updateFunc(server);
|
_updateFunc(server);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
await Task.Delay(1000);
|
if (_channel != null)
|
||||||
if (_channel != null) await _channel.ConnectAsync();
|
await _channel.ConnectAsync();
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -31,6 +31,10 @@ namespace v2rayN.Models
|
|||||||
/// 默认用户代理
|
/// 默认用户代理
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string defUserAgent { get; set; }
|
public string defUserAgent { get; set; }
|
||||||
|
|
||||||
|
public bool enableFragment { get; set; }
|
||||||
|
|
||||||
|
public bool enableCacheFile4Sbox { get; set; } = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
@@ -43,8 +47,8 @@ namespace v2rayN.Models
|
|||||||
public bool udpEnabled { get; set; }
|
public bool udpEnabled { get; set; }
|
||||||
|
|
||||||
public bool sniffingEnabled { get; set; } = true;
|
public bool sniffingEnabled { get; set; } = true;
|
||||||
|
public List<string>? destOverride { get; set; } = ["http", "tls"];
|
||||||
public bool routeOnly { get; set; }
|
public bool routeOnly { get; set; }
|
||||||
|
|
||||||
public bool allowLANConn { get; set; }
|
public bool allowLANConn { get; set; }
|
||||||
|
|
||||||
public bool newPort4LAN { get; set; }
|
public bool newPort4LAN { get; set; }
|
||||||
@@ -122,7 +126,7 @@ namespace v2rayN.Models
|
|||||||
public int currentFontSize { get; set; }
|
public int currentFontSize { get; set; }
|
||||||
public bool enableDragDropSort { get; set; }
|
public bool enableDragDropSort { get; set; }
|
||||||
public bool doubleClick2Activate { get; set; }
|
public bool doubleClick2Activate { get; set; }
|
||||||
public bool autoHideStartup { get; set; } = true;
|
public bool autoHideStartup { get; set; }
|
||||||
public string mainMsgFilter { get; set; }
|
public string mainMsgFilter { get; set; }
|
||||||
public List<ColumnItem> mainColumnItem { get; set; }
|
public List<ColumnItem> mainColumnItem { get; set; }
|
||||||
}
|
}
|
||||||
@@ -178,13 +182,8 @@ namespace v2rayN.Models
|
|||||||
[Serializable]
|
[Serializable]
|
||||||
public class RoutingBasicItem
|
public class RoutingBasicItem
|
||||||
{
|
{
|
||||||
/// <summary>
|
|
||||||
/// 域名解析策略
|
|
||||||
/// </summary>
|
|
||||||
public string domainStrategy { get; set; }
|
public string domainStrategy { get; set; }
|
||||||
|
|
||||||
public string domainStrategy4Singbox { get; set; }
|
public string domainStrategy4Singbox { get; set; }
|
||||||
|
|
||||||
public string domainMatcher { get; set; }
|
public string domainMatcher { get; set; }
|
||||||
public string routingIndexId { get; set; }
|
public string routingIndexId { get; set; }
|
||||||
public bool enableRoutingAdvanced { get; set; }
|
public bool enableRoutingAdvanced { get; set; }
|
||||||
|
|||||||
@@ -10,6 +10,7 @@
|
|||||||
Trojan = 6,
|
Trojan = 6,
|
||||||
Hysteria2 = 7,
|
Hysteria2 = 7,
|
||||||
Tuic = 8,
|
Tuic = 8,
|
||||||
Wireguard = 9
|
Wireguard = 9,
|
||||||
|
Http = 10
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -15,6 +15,7 @@ namespace v2rayN.Models
|
|||||||
public bool enabled { get; set; } = true;
|
public bool enabled { get; set; } = true;
|
||||||
public bool locked { get; set; }
|
public bool locked { get; set; }
|
||||||
public string customIcon { get; set; }
|
public string customIcon { get; set; }
|
||||||
|
public string customRulesetPath4Singbox { get; set; }
|
||||||
public string domainStrategy { get; set; }
|
public string domainStrategy { get; set; }
|
||||||
public string domainStrategy4Singbox { get; set; }
|
public string domainStrategy4Singbox { get; set; }
|
||||||
public int sort { get; set; }
|
public int sort { get; set; }
|
||||||
|
|||||||
@@ -7,7 +7,7 @@
|
|||||||
public List<Inbound4Sbox> inbounds { get; set; }
|
public List<Inbound4Sbox> inbounds { get; set; }
|
||||||
public List<Outbound4Sbox> outbounds { get; set; }
|
public List<Outbound4Sbox> outbounds { get; set; }
|
||||||
public Route4Sbox route { get; set; }
|
public Route4Sbox route { get; set; }
|
||||||
public Experimental4Sbox experimental { get; set; }
|
public Experimental4Sbox? experimental { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Log4Sbox
|
public class Log4Sbox
|
||||||
@@ -35,19 +35,21 @@
|
|||||||
{
|
{
|
||||||
public bool? auto_detect_interface { get; set; }
|
public bool? auto_detect_interface { get; set; }
|
||||||
public List<Rule4Sbox> rules { get; set; }
|
public List<Rule4Sbox> rules { get; set; }
|
||||||
|
public List<Ruleset4Sbox>? rule_set { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
public class Rule4Sbox
|
public class Rule4Sbox
|
||||||
{
|
{
|
||||||
public string outbound { get; set; }
|
public string? outbound { get; set; }
|
||||||
public string server { get; set; }
|
public string? server { get; set; }
|
||||||
public bool? disable_cache { get; set; }
|
public bool? disable_cache { get; set; }
|
||||||
public List<string>? inbound { get; set; }
|
public List<string>? inbound { get; set; }
|
||||||
public List<string>? protocol { get; set; }
|
public List<string>? protocol { get; set; }
|
||||||
public string type { get; set; }
|
public string? type { get; set; }
|
||||||
public string mode { get; set; }
|
public string? mode { get; set; }
|
||||||
public string network { get; set; }
|
public string? network { get; set; }
|
||||||
|
public bool? ip_is_private { get; set; }
|
||||||
public List<int>? port { get; set; }
|
public List<int>? port { get; set; }
|
||||||
public List<string>? port_range { get; set; }
|
public List<string>? port_range { get; set; }
|
||||||
public List<string>? geosite { get; set; }
|
public List<string>? geosite { get; set; }
|
||||||
@@ -58,8 +60,8 @@
|
|||||||
public List<string>? geoip { get; set; }
|
public List<string>? geoip { get; set; }
|
||||||
public List<string>? ip_cidr { get; set; }
|
public List<string>? ip_cidr { get; set; }
|
||||||
public List<string>? source_ip_cidr { get; set; }
|
public List<string>? source_ip_cidr { get; set; }
|
||||||
|
|
||||||
public List<string>? process_name { get; set; }
|
public List<string>? process_name { get; set; }
|
||||||
|
public List<string>? rule_set { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
@@ -93,7 +95,7 @@
|
|||||||
{
|
{
|
||||||
public string type { get; set; }
|
public string type { get; set; }
|
||||||
public string tag { get; set; }
|
public string tag { get; set; }
|
||||||
public string server { get; set; }
|
public string? server { get; set; }
|
||||||
public int? server_port { get; set; }
|
public int? server_port { get; set; }
|
||||||
public string uuid { get; set; }
|
public string uuid { get; set; }
|
||||||
public string security { get; set; }
|
public string security { get; set; }
|
||||||
@@ -230,4 +232,15 @@
|
|||||||
public string? cache_id { get; set; }
|
public string? cache_id { get; set; }
|
||||||
public bool? store_fakeip { get; set; }
|
public bool? store_fakeip { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class Ruleset4Sbox
|
||||||
|
{
|
||||||
|
public string? tag { get; set; }
|
||||||
|
public string? type { get; set; }
|
||||||
|
public string? format { get; set; }
|
||||||
|
public string? path { get; set; }
|
||||||
|
public string? url { get; set; }
|
||||||
|
public string? download_detour { get; set; }
|
||||||
|
public string? update_interval { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
@@ -195,7 +195,7 @@ namespace v2rayN.Models
|
|||||||
public class Sniffing4Ray
|
public class Sniffing4Ray
|
||||||
{
|
{
|
||||||
public bool enabled { get; set; }
|
public bool enabled { get; set; }
|
||||||
public List<string> destOverride { get; set; }
|
public List<string>? destOverride { get; set; }
|
||||||
public bool routeOnly { get; set; }
|
public bool routeOnly { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -232,7 +232,7 @@ namespace v2rayN.Models
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<VnextItem4Ray> vnext { get; set; }
|
public List<VnextItem4Ray>? vnext { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
@@ -253,6 +253,8 @@ namespace v2rayN.Models
|
|||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int? userLevel { get; set; }
|
public int? userLevel { get; set; }
|
||||||
|
|
||||||
|
public FragmentItem4Ray? fragment { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class VnextItem4Ray
|
public class VnextItem4Ray
|
||||||
@@ -288,17 +290,17 @@ namespace v2rayN.Models
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string method { get; set; }
|
public string? method { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool ota { get; set; }
|
public bool? ota { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string password { get; set; }
|
public string? password { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
@@ -308,7 +310,7 @@ namespace v2rayN.Models
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int level { get; set; }
|
public int? level { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// trojan
|
/// trojan
|
||||||
@@ -336,7 +338,7 @@ namespace v2rayN.Models
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int level { get; set; }
|
public int? level { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Mux4Ray
|
public class Mux4Ray
|
||||||
@@ -389,19 +391,19 @@ namespace v2rayN.Models
|
|||||||
[Serializable]
|
[Serializable]
|
||||||
public class RulesItem4Ray
|
public class RulesItem4Ray
|
||||||
{
|
{
|
||||||
public string type { get; set; }
|
public string? type { get; set; }
|
||||||
|
|
||||||
public string port { get; set; }
|
public string? port { get; set; }
|
||||||
|
|
||||||
public List<string> inboundTag { get; set; }
|
public List<string>? inboundTag { get; set; }
|
||||||
|
|
||||||
public string outboundTag { get; set; }
|
public string? outboundTag { get; set; }
|
||||||
|
|
||||||
public List<string> ip { get; set; }
|
public List<string>? ip { get; set; }
|
||||||
|
|
||||||
public List<string> domain { get; set; }
|
public List<string>? domain { get; set; }
|
||||||
|
|
||||||
public List<string> protocol { get; set; }
|
public List<string>? protocol { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class StreamSettings4Ray
|
public class StreamSettings4Ray
|
||||||
@@ -665,4 +667,11 @@ namespace v2rayN.Models
|
|||||||
{
|
{
|
||||||
public string? dialerProxy { get; set; }
|
public string? dialerProxy { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public class FragmentItem4Ray
|
||||||
|
{
|
||||||
|
public string? packets { get; set; }
|
||||||
|
public string? length { get; set; }
|
||||||
|
public string? interval { get; set; }
|
||||||
|
}
|
||||||
}
|
}
|
||||||
65
v2rayN/v2rayN/Resx/ResUI.Designer.cs
generated
65
v2rayN/v2rayN/Resx/ResUI.Designer.cs
generated
@@ -411,6 +411,15 @@ namespace v2rayN.Resx {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Custom the rule-set of sing-box 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string LvCustomRulesetPath4Singbox {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("LvCustomRulesetPath4Singbox", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 Enabled Update 的本地化字符串。
|
/// 查找类似 Enabled Update 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -618,6 +627,15 @@ namespace v2rayN.Resx {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Add [Http] server 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string menuAddHttpServer {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("menuAddHttpServer", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 Add [Hysteria2] server 的本地化字符串。
|
/// 查找类似 Add [Hysteria2] server 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -960,6 +978,15 @@ namespace v2rayN.Resx {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Open the storage location 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string menuOpenTheFileLocation {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("menuOpenTheFileLocation", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 Option Setting 的本地化字符串。
|
/// 查找类似 Option Setting 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -1563,6 +1590,15 @@ namespace v2rayN.Resx {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Successful operation. Click the settings menu to reboot the app. 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string NeedRebootTips {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("NeedRebootTips", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 Non-VMess or ss protocol 的本地化字符串。
|
/// 查找类似 Non-VMess or ss protocol 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -2599,6 +2635,15 @@ namespace v2rayN.Resx {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Enable cache file for sing-box (ruleset files) 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string TbSettingsEnableCacheFile4Sbox {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("TbSettingsEnableCacheFile4Sbox", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 Check for pre-release updates 的本地化字符串。
|
/// 查找类似 Check for pre-release updates 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -2626,6 +2671,24 @@ namespace v2rayN.Resx {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Enable fragment 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string TbSettingsEnableFragment {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("TbSettingsEnableFragment", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// 查找类似 Use Xray and enable non-Tun mode, which conflicts with the group previous proxy 的本地化字符串。
|
||||||
|
/// </summary>
|
||||||
|
public static string TbSettingsEnableFragmentTips {
|
||||||
|
get {
|
||||||
|
return ResourceManager.GetString("TbSettingsEnableFragmentTips", resourceCulture);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 Enable hardware acceleration(Require restart) 的本地化字符串。
|
/// 查找类似 Enable hardware acceleration(Require restart) 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@@ -3149,7 +3212,7 @@ namespace v2rayN.Resx {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 查找类似 * After setting this value, an socks service will be started using sing-box to provide functions such as speed display 的本地化字符串。
|
/// 查找类似 * After setting this value, an socks service will be started using Xray/sing-box(Tun) to provide functions such as speed display 的本地化字符串。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public static string TipPreSocksPort {
|
public static string TipPreSocksPort {
|
||||||
get {
|
get {
|
||||||
|
|||||||
@@ -698,7 +698,7 @@
|
|||||||
<value>txtPreSocksPort</value>
|
<value>txtPreSocksPort</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TipPreSocksPort" xml:space="preserve">
|
<data name="TipPreSocksPort" xml:space="preserve">
|
||||||
<value>* After setting this value, an socks service will be started using sing-box to provide functions such as speed display</value>
|
<value>* After setting this value, an socks service will be started using Xray/sing-box(Tun) to provide functions such as speed display</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbBrowse" xml:space="preserve">
|
<data name="TbBrowse" xml:space="preserve">
|
||||||
<value>Browse</value>
|
<value>Browse</value>
|
||||||
@@ -1003,4 +1003,7 @@
|
|||||||
<data name="TbSettingsEnableHWA" xml:space="preserve">
|
<data name="TbSettingsEnableHWA" xml:space="preserve">
|
||||||
<value>فعالسازی شتابدهنده سختافزاری (نیاز به راهاندازی مجدد)</value>
|
<value>فعالسازی شتابدهنده سختافزاری (نیاز به راهاندازی مجدد)</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="TbSettingsEnableCacheFile4Sbox" xml:space="preserve">
|
||||||
|
<value>فعال کردن کش فایل مجموعه قوانین برای sing-box</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -701,7 +701,7 @@
|
|||||||
<value>txtPreSocksPort</value>
|
<value>txtPreSocksPort</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TipPreSocksPort" xml:space="preserve">
|
<data name="TipPreSocksPort" xml:space="preserve">
|
||||||
<value>* After setting this value, an socks service will be started using sing-box to provide functions such as speed display</value>
|
<value>* After setting this value, an socks service will be started using Xray/sing-box(Tun) to provide functions such as speed display</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbBrowse" xml:space="preserve">
|
<data name="TbBrowse" xml:space="preserve">
|
||||||
<value>Browse</value>
|
<value>Browse</value>
|
||||||
@@ -1198,4 +1198,25 @@
|
|||||||
<data name="TransportRequestHostTip5" xml:space="preserve">
|
<data name="TransportRequestHostTip5" xml:space="preserve">
|
||||||
<value>*grpc Authority</value>
|
<value>*grpc Authority</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="menuAddHttpServer" xml:space="preserve">
|
||||||
|
<value>Add [Http] server</value>
|
||||||
|
</data>
|
||||||
|
<data name="TbSettingsEnableFragmentTips" xml:space="preserve">
|
||||||
|
<value>Use Xray and enable non-Tun mode, which conflicts with the group previous proxy</value>
|
||||||
|
</data>
|
||||||
|
<data name="TbSettingsEnableFragment" xml:space="preserve">
|
||||||
|
<value>Enable fragment</value>
|
||||||
|
</data>
|
||||||
|
<data name="TbSettingsEnableCacheFile4Sbox" xml:space="preserve">
|
||||||
|
<value>Enable cache file for sing-box (ruleset files)</value>
|
||||||
|
</data>
|
||||||
|
<data name="LvCustomRulesetPath4Singbox" xml:space="preserve">
|
||||||
|
<value>Custom the rule-set of sing-box</value>
|
||||||
|
</data>
|
||||||
|
<data name="NeedRebootTips" xml:space="preserve">
|
||||||
|
<value>Successful operation. Click the settings menu to reboot the app.</value>
|
||||||
|
</data>
|
||||||
|
<data name="menuOpenTheFileLocation" xml:space="preserve">
|
||||||
|
<value>Open the storage location</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -701,7 +701,7 @@
|
|||||||
<value>txtPreSocksPort</value>
|
<value>txtPreSocksPort</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TipPreSocksPort" xml:space="preserve">
|
<data name="TipPreSocksPort" xml:space="preserve">
|
||||||
<value>* После установки этого значения служба socks будет запущена с использованием sing-box для обеспечения таких функций, как отображение скорости</value>
|
<value>* После установки этого значения служба socks будет запущена с использованием Xray/sing-box(Tun) для обеспечения таких функций, как отображение скорости</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbBrowse" xml:space="preserve">
|
<data name="TbBrowse" xml:space="preserve">
|
||||||
<value>Просмотр</value>
|
<value>Просмотр</value>
|
||||||
|
|||||||
@@ -701,7 +701,7 @@
|
|||||||
<value>Socks端口</value>
|
<value>Socks端口</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TipPreSocksPort" xml:space="preserve">
|
<data name="TipPreSocksPort" xml:space="preserve">
|
||||||
<value>* 自定义配置的Socks端口值,可不设置;当设置此值后,将使用sing-box额外启动一个前置Socks服务,提供分流和速度显示等功能</value>
|
<value>* 自定义配置的Socks端口值,可不设置;当设置此值后,将使用Xray/sing-box(Tun)额外启动一个前置Socks服务,提供分流和速度显示等功能</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TbBrowse" xml:space="preserve">
|
<data name="TbBrowse" xml:space="preserve">
|
||||||
<value>浏览</value>
|
<value>浏览</value>
|
||||||
@@ -1195,4 +1195,25 @@
|
|||||||
<data name="TransportRequestHostTip5" xml:space="preserve">
|
<data name="TransportRequestHostTip5" xml:space="preserve">
|
||||||
<value>*grpc Authority</value>
|
<value>*grpc Authority</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="menuAddHttpServer" xml:space="preserve">
|
||||||
|
<value>添加[Http]服务器</value>
|
||||||
|
</data>
|
||||||
|
<data name="TbSettingsEnableFragment" xml:space="preserve">
|
||||||
|
<value>启用分片(Fragment)</value>
|
||||||
|
</data>
|
||||||
|
<data name="TbSettingsEnableFragmentTips" xml:space="preserve">
|
||||||
|
<value>使用Xray且非Tun模式启用,和分组前置代理冲突</value>
|
||||||
|
</data>
|
||||||
|
<data name="TbSettingsEnableCacheFile4Sbox" xml:space="preserve">
|
||||||
|
<value>启用sing-box(规则集文件)的缓存文件</value>
|
||||||
|
</data>
|
||||||
|
<data name="LvCustomRulesetPath4Singbox" xml:space="preserve">
|
||||||
|
<value>自定义sing-box rule-set</value>
|
||||||
|
</data>
|
||||||
|
<data name="NeedRebootTips" xml:space="preserve">
|
||||||
|
<value>操作成功。请点击设置菜单重启应用。</value>
|
||||||
|
</data>
|
||||||
|
<data name="menuOpenTheFileLocation" xml:space="preserve">
|
||||||
|
<value>打开存储所在的位置</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -700,7 +700,7 @@
|
|||||||
<value>SOCKS埠</value>
|
<value>SOCKS埠</value>
|
||||||
</data>
|
</data>
|
||||||
<data name="TipPreSocksPort" xml:space="preserve">
|
<data name="TipPreSocksPort" xml:space="preserve">
|
||||||
<value>* 自訂配置的Socks埠值,可不設定;當設定此值後,將使用sing-box額外啟動一個前置Socks服務,提供分流和速度顯示等功能</value>
|
<value>* 自訂配置的Socks埠值,可不設定;當設定此值後,將使用Xray/sing-box(Tun)額外啟動一個前置Socks服務,提供分流和速度顯示等功能</value>
|
||||||
</data>
|
</data>
|
||||||
<!--********************************************-->
|
<!--********************************************-->
|
||||||
<data name="TbBrowse" xml:space="preserve">
|
<data name="TbBrowse" xml:space="preserve">
|
||||||
@@ -1168,4 +1168,25 @@
|
|||||||
<data name="TransportRequestHostTip5" xml:space="preserve">
|
<data name="TransportRequestHostTip5" xml:space="preserve">
|
||||||
<value>*grpc Authority</value>
|
<value>*grpc Authority</value>
|
||||||
</data>
|
</data>
|
||||||
|
<data name="menuAddHttpServer" xml:space="preserve">
|
||||||
|
<value>新增[Http]伺服器</value>
|
||||||
|
</data>
|
||||||
|
<data name="TbSettingsEnableFragment" xml:space="preserve">
|
||||||
|
<value>啟用分片(Fragment)</value>
|
||||||
|
</data>
|
||||||
|
<data name="TbSettingsEnableFragmentTips" xml:space="preserve">
|
||||||
|
<value>使用Xray且非Tun模式啟用,和分組前置代理衝突</value>
|
||||||
|
</data>
|
||||||
|
<data name="TbSettingsEnableCacheFile4Sbox" xml:space="preserve">
|
||||||
|
<value>啟用sing-box(規則集文件)的緩存文件</value>
|
||||||
|
</data>
|
||||||
|
<data name="LvCustomRulesetPath4Singbox" xml:space="preserve">
|
||||||
|
<value>自訂sing-box rule-set</value>
|
||||||
|
</data>
|
||||||
|
<data name="NeedRebootTips" xml:space="preserve">
|
||||||
|
<value>操作成功。 請點選設定選單重啟應用程式。</value>
|
||||||
|
</data>
|
||||||
|
<data name="menuOpenTheFileLocation" xml:space="preserve">
|
||||||
|
<value>打開儲存所在的位置</value>
|
||||||
|
</data>
|
||||||
</root>
|
</root>
|
||||||
@@ -4,56 +4,7 @@
|
|||||||
"error": "Verror.log",
|
"error": "Verror.log",
|
||||||
"loglevel": "warning"
|
"loglevel": "warning"
|
||||||
},
|
},
|
||||||
"inbounds": [{
|
"inbounds": [],
|
||||||
"tag": "tag1",
|
|
||||||
"port": 10808,
|
|
||||||
"protocol": "socks",
|
|
||||||
"listen": "127.0.0.1",
|
|
||||||
"settings": {
|
|
||||||
"auth": "noauth",
|
|
||||||
"udp": true
|
|
||||||
},
|
|
||||||
"sniffing": {
|
|
||||||
"enabled": true,
|
|
||||||
"destOverride": [
|
|
||||||
"http",
|
|
||||||
"tls"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"tag": "tag2",
|
|
||||||
"port": 10809,
|
|
||||||
"protocol": "http",
|
|
||||||
"listen": "127.0.0.1",
|
|
||||||
"settings": {
|
|
||||||
"allowTransparent": false
|
|
||||||
},
|
|
||||||
"sniffing": {
|
|
||||||
"enabled": true,
|
|
||||||
"destOverride": [
|
|
||||||
"http",
|
|
||||||
"tls"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"tag": "tag3",
|
|
||||||
"port": 10809,
|
|
||||||
"protocol": "http",
|
|
||||||
"listen": "127.0.0.1",
|
|
||||||
"settings": {
|
|
||||||
"allowTransparent": false
|
|
||||||
},
|
|
||||||
"sniffing": {
|
|
||||||
"enabled": true,
|
|
||||||
"destOverride": [
|
|
||||||
"http",
|
|
||||||
"tls"
|
|
||||||
]
|
|
||||||
}
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"outbounds": [{
|
"outbounds": [{
|
||||||
"tag": "proxy",
|
"tag": "proxy",
|
||||||
"protocol": "vmess",
|
"protocol": "vmess",
|
||||||
|
|||||||
@@ -3,14 +3,7 @@
|
|||||||
"level": "debug",
|
"level": "debug",
|
||||||
"timestamp": true
|
"timestamp": true
|
||||||
},
|
},
|
||||||
"inbounds": [
|
"inbounds": [],
|
||||||
{
|
|
||||||
"type": "socks",
|
|
||||||
"tag": "socks",
|
|
||||||
"listen": "127.0.0.1",
|
|
||||||
"listen_port": 10000
|
|
||||||
}
|
|
||||||
],
|
|
||||||
"outbounds": [
|
"outbounds": [
|
||||||
{
|
{
|
||||||
"type": "vless",
|
"type": "vless",
|
||||||
|
|||||||
@@ -13,20 +13,10 @@
|
|||||||
},
|
},
|
||||||
{
|
{
|
||||||
"outboundTag": "proxy",
|
"outboundTag": "proxy",
|
||||||
"ip": [
|
|
||||||
"geoip:cloudflare",
|
|
||||||
"geoip:cloudfront",
|
|
||||||
"geoip:facebook",
|
|
||||||
"geoip:fastly",
|
|
||||||
"geoip:google",
|
|
||||||
"geoip:netflix",
|
|
||||||
"geoip:telegram",
|
|
||||||
"geoip:twitter"
|
|
||||||
],
|
|
||||||
"domain": [
|
"domain": [
|
||||||
"geosite:gfw",
|
"geosite:geolocation-!cn",
|
||||||
"geosite:greatfire",
|
"geosite:greatfire"
|
||||||
"geosite:tld-!cn"
|
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -15,7 +15,8 @@
|
|||||||
{
|
{
|
||||||
"outboundTag": "direct",
|
"outboundTag": "direct",
|
||||||
"domain": [
|
"domain": [
|
||||||
"geosite:cn"
|
"geosite:cn",
|
||||||
|
"geosite:geolocation-cn"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@@ -3,11 +3,13 @@
|
|||||||
{
|
{
|
||||||
"tag": "remote",
|
"tag": "remote",
|
||||||
"address": "tcp://8.8.8.8",
|
"address": "tcp://8.8.8.8",
|
||||||
|
"strategy": "ipv4_only",
|
||||||
"detour": "proxy"
|
"detour": "proxy"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"tag": "local",
|
"tag": "local",
|
||||||
"address": "223.5.5.5",
|
"address": "223.5.5.5",
|
||||||
|
"strategy": "ipv4_only",
|
||||||
"detour": "direct"
|
"detour": "direct"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -17,16 +19,17 @@
|
|||||||
],
|
],
|
||||||
"rules": [
|
"rules": [
|
||||||
{
|
{
|
||||||
"geosite": [
|
"rule_set": [
|
||||||
"cn"
|
"geosite-geolocation-!cn"
|
||||||
],
|
],
|
||||||
"server": "local"
|
"server": "remote"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"geosite": [
|
"rule_set": [
|
||||||
"category-ads-all"
|
"geosite-category-ads-all"
|
||||||
],
|
],
|
||||||
"server": "block"
|
"server": "block"
|
||||||
}
|
}
|
||||||
]
|
],
|
||||||
|
"final": "local"
|
||||||
}
|
}
|
||||||
@@ -7,7 +7,8 @@
|
|||||||
{
|
{
|
||||||
"address": "223.5.5.5",
|
"address": "223.5.5.5",
|
||||||
"domains": [
|
"domains": [
|
||||||
"geosite:cn"
|
"geosite:cn",
|
||||||
|
"geosite:geolocation-cn"
|
||||||
],
|
],
|
||||||
"expectIPs": [
|
"expectIPs": [
|
||||||
"geoip:cn"
|
"geoip:cn"
|
||||||
|
|||||||
@@ -3,11 +3,13 @@
|
|||||||
{
|
{
|
||||||
"tag": "remote",
|
"tag": "remote",
|
||||||
"address": "tcp://8.8.8.8",
|
"address": "tcp://8.8.8.8",
|
||||||
|
"strategy": "ipv4_only",
|
||||||
"detour": "proxy"
|
"detour": "proxy"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"tag": "local",
|
"tag": "local",
|
||||||
"address": "223.5.5.5",
|
"address": "223.5.5.5",
|
||||||
|
"strategy": "ipv4_only",
|
||||||
"detour": "direct"
|
"detour": "direct"
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@@ -17,19 +19,17 @@
|
|||||||
],
|
],
|
||||||
"rules": [
|
"rules": [
|
||||||
{
|
{
|
||||||
"geosite": [
|
"rule_set": [
|
||||||
"cn"
|
"geosite-geolocation-!cn"
|
||||||
],
|
],
|
||||||
"server": "local",
|
"server": "remote"
|
||||||
"disable_cache": true
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
"geosite": [
|
"rule_set": [
|
||||||
"category-ads-all"
|
"geosite-category-ads-all"
|
||||||
],
|
],
|
||||||
"server": "block",
|
"server": "block"
|
||||||
"disable_cache": true
|
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"strategy": "ipv4_only"
|
"final": "local"
|
||||||
}
|
}
|
||||||
@@ -56,7 +56,7 @@ namespace v2rayN.ViewModels
|
|||||||
SaveServer();
|
SaveServer();
|
||||||
});
|
});
|
||||||
|
|
||||||
Utils.SetDarkBorder(view, _config.uiItem.colorModeDark);
|
Utils.SetDarkBorder(view, _config.uiItem.followSystemTheme ? !Utils.IsLightTheme() : _config.uiItem.colorModeDark);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveServer()
|
private void SaveServer()
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ namespace v2rayN.ViewModels
|
|||||||
SaveServer();
|
SaveServer();
|
||||||
});
|
});
|
||||||
|
|
||||||
Utils.SetDarkBorder(view, _config.uiItem.colorModeDark);
|
Utils.SetDarkBorder(view, _config.uiItem.followSystemTheme ? !Utils.IsLightTheme() : _config.uiItem.colorModeDark);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveServer()
|
private void SaveServer()
|
||||||
@@ -80,7 +80,8 @@ namespace v2rayN.ViewModels
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (SelectedSource.configType != EConfigType.Socks)
|
if (SelectedSource.configType != EConfigType.Socks
|
||||||
|
&& SelectedSource.configType != EConfigType.Http)
|
||||||
{
|
{
|
||||||
if (Utils.IsNullOrEmpty(SelectedSource.id))
|
if (Utils.IsNullOrEmpty(SelectedSource.id))
|
||||||
{
|
{
|
||||||
@@ -127,6 +128,7 @@ namespace v2rayN.ViewModels
|
|||||||
EConfigType.VMess => ConfigHandler.AddServer(_config, item),
|
EConfigType.VMess => ConfigHandler.AddServer(_config, item),
|
||||||
EConfigType.Shadowsocks => ConfigHandler.AddShadowsocksServer(_config, item),
|
EConfigType.Shadowsocks => ConfigHandler.AddShadowsocksServer(_config, item),
|
||||||
EConfigType.Socks => ConfigHandler.AddSocksServer(_config, item),
|
EConfigType.Socks => ConfigHandler.AddSocksServer(_config, item),
|
||||||
|
EConfigType.Http => ConfigHandler.AddHttpServer(_config, item),
|
||||||
EConfigType.Trojan => ConfigHandler.AddTrojanServer(_config, item),
|
EConfigType.Trojan => ConfigHandler.AddTrojanServer(_config, item),
|
||||||
EConfigType.VLESS => ConfigHandler.AddVlessServer(_config, item),
|
EConfigType.VLESS => ConfigHandler.AddVlessServer(_config, item),
|
||||||
EConfigType.Hysteria2 => ConfigHandler.AddHysteria2Server(_config, item),
|
EConfigType.Hysteria2 => ConfigHandler.AddHysteria2Server(_config, item),
|
||||||
|
|||||||
@@ -56,7 +56,7 @@ namespace v2rayN.ViewModels
|
|||||||
tunDNS2 = Utils.GetEmbedText(Global.TunSingboxDNSFileName);
|
tunDNS2 = Utils.GetEmbedText(Global.TunSingboxDNSFileName);
|
||||||
});
|
});
|
||||||
|
|
||||||
Utils.SetDarkBorder(view, _config.uiItem.colorModeDark);
|
Utils.SetDarkBorder(view, _config.uiItem.followSystemTheme ? !Utils.IsLightTheme() : _config.uiItem.colorModeDark);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveSetting()
|
private void SaveSetting()
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ namespace v2rayN.ViewModels
|
|||||||
public ReactiveCommand<Unit, Unit> AddVlessServerCmd { get; }
|
public ReactiveCommand<Unit, Unit> AddVlessServerCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> AddShadowsocksServerCmd { get; }
|
public ReactiveCommand<Unit, Unit> AddShadowsocksServerCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> AddSocksServerCmd { get; }
|
public ReactiveCommand<Unit, Unit> AddSocksServerCmd { get; }
|
||||||
|
public ReactiveCommand<Unit, Unit> AddHttpServerCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> AddTrojanServerCmd { get; }
|
public ReactiveCommand<Unit, Unit> AddTrojanServerCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> AddHysteria2ServerCmd { get; }
|
public ReactiveCommand<Unit, Unit> AddHysteria2ServerCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> AddTuicServerCmd { get; }
|
public ReactiveCommand<Unit, Unit> AddTuicServerCmd { get; }
|
||||||
@@ -142,7 +143,8 @@ namespace v2rayN.ViewModels
|
|||||||
public ReactiveCommand<Unit, Unit> GlobalHotkeySettingCmd { get; }
|
public ReactiveCommand<Unit, Unit> GlobalHotkeySettingCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> RebootAsAdminCmd { get; }
|
public ReactiveCommand<Unit, Unit> RebootAsAdminCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> ClearServerStatisticsCmd { get; }
|
public ReactiveCommand<Unit, Unit> ClearServerStatisticsCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> ImportOldGuiConfigCmd { get; }
|
public ReactiveCommand<Unit, Unit> OpenTheFileLocationCmd { get; }
|
||||||
|
//public ReactiveCommand<Unit, Unit> ImportOldGuiConfigCmd { get; }
|
||||||
|
|
||||||
//CheckUpdate
|
//CheckUpdate
|
||||||
public ReactiveCommand<Unit, Unit> CheckUpdateNCmd { get; }
|
public ReactiveCommand<Unit, Unit> CheckUpdateNCmd { get; }
|
||||||
@@ -333,6 +335,10 @@ namespace v2rayN.ViewModels
|
|||||||
{
|
{
|
||||||
EditServer(true, EConfigType.Socks);
|
EditServer(true, EConfigType.Socks);
|
||||||
});
|
});
|
||||||
|
AddHttpServerCmd = ReactiveCommand.Create(() =>
|
||||||
|
{
|
||||||
|
EditServer(true, EConfigType.Http);
|
||||||
|
});
|
||||||
AddTrojanServerCmd = ReactiveCommand.Create(() =>
|
AddTrojanServerCmd = ReactiveCommand.Create(() =>
|
||||||
{
|
{
|
||||||
EditServer(true, EConfigType.Trojan);
|
EditServer(true, EConfigType.Trojan);
|
||||||
@@ -498,10 +504,14 @@ namespace v2rayN.ViewModels
|
|||||||
_statistics?.ClearAllServerStatistics();
|
_statistics?.ClearAllServerStatistics();
|
||||||
RefreshServers();
|
RefreshServers();
|
||||||
});
|
});
|
||||||
ImportOldGuiConfigCmd = ReactiveCommand.Create(() =>
|
OpenTheFileLocationCmd = ReactiveCommand.Create(() =>
|
||||||
{
|
{
|
||||||
ImportOldGuiConfig();
|
Utils.ProcessStart("Explorer", $"/select,{Utils.GetConfigPath()}");
|
||||||
});
|
});
|
||||||
|
//ImportOldGuiConfigCmd = ReactiveCommand.Create(() =>
|
||||||
|
//{
|
||||||
|
// ImportOldGuiConfig();
|
||||||
|
//});
|
||||||
|
|
||||||
//CheckUpdate
|
//CheckUpdate
|
||||||
CheckUpdateNCmd = ReactiveCommand.Create(() =>
|
CheckUpdateNCmd = ReactiveCommand.Create(() =>
|
||||||
@@ -1016,10 +1026,10 @@ namespace v2rayN.ViewModels
|
|||||||
{
|
{
|
||||||
ShowHideWindow(false);
|
ShowHideWindow(false);
|
||||||
|
|
||||||
var dpiXY = Utils.GetDpiXY(Application.Current.MainWindow);
|
var dpiXY = QRCodeHelper.GetDpiXY(Application.Current.MainWindow);
|
||||||
string result = await Task.Run(() =>
|
string result = await Task.Run(() =>
|
||||||
{
|
{
|
||||||
return Utils.ScanScreen(dpiXY.Item1, dpiXY.Item2);
|
return QRCodeHelper.ScanScreen(dpiXY.Item1, dpiXY.Item2);
|
||||||
});
|
});
|
||||||
|
|
||||||
ShowHideWindow(true);
|
ShowHideWindow(true);
|
||||||
@@ -1417,32 +1427,32 @@ namespace v2rayN.ViewModels
|
|||||||
catch { }
|
catch { }
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ImportOldGuiConfig()
|
//private void ImportOldGuiConfig()
|
||||||
{
|
//{
|
||||||
if (UI.OpenFileDialog(out string fileName,
|
// if (UI.OpenFileDialog(out string fileName,
|
||||||
"guiNConfig|*.json|All|*.*") != true)
|
// "guiNConfig|*.json|All|*.*") != true)
|
||||||
{
|
// {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
if (Utils.IsNullOrEmpty(fileName))
|
// if (Utils.IsNullOrEmpty(fileName))
|
||||||
{
|
// {
|
||||||
return;
|
// return;
|
||||||
}
|
// }
|
||||||
|
|
||||||
var ret = ConfigHandler.ImportOldGuiConfig(_config, fileName);
|
// var ret = ConfigHandler.ImportOldGuiConfig(_config, fileName);
|
||||||
if (ret == 0)
|
// if (ret == 0)
|
||||||
{
|
// {
|
||||||
RefreshRoutingsMenu();
|
// RefreshRoutingsMenu();
|
||||||
InitSubscriptionView();
|
// InitSubscriptionView();
|
||||||
RefreshServers();
|
// RefreshServers();
|
||||||
Reload();
|
// Reload();
|
||||||
_noticeHandler?.Enqueue(ResUI.OperationSuccess);
|
// _noticeHandler?.Enqueue(ResUI.OperationSuccess);
|
||||||
}
|
// }
|
||||||
else
|
// else
|
||||||
{
|
// {
|
||||||
_noticeHandler?.Enqueue(ResUI.OperationFailed);
|
// _noticeHandler?.Enqueue(ResUI.OperationFailed);
|
||||||
}
|
// }
|
||||||
}
|
//}
|
||||||
|
|
||||||
#endregion Setting
|
#endregion Setting
|
||||||
|
|
||||||
@@ -1842,7 +1852,7 @@ namespace v2rayN.ViewModels
|
|||||||
{
|
{
|
||||||
var theme = _paletteHelper.GetTheme();
|
var theme = _paletteHelper.GetTheme();
|
||||||
|
|
||||||
theme.SetBaseTheme(isDarkTheme ? Theme.Dark : Theme.Light);
|
theme.SetBaseTheme(isDarkTheme ? BaseTheme.Dark : BaseTheme.Light);
|
||||||
_paletteHelper.SetTheme(theme);
|
_paletteHelper.SetTheme(theme);
|
||||||
|
|
||||||
Utils.SetDarkBorder(Application.Current.MainWindow, isDarkTheme);
|
Utils.SetDarkBorder(Application.Current.MainWindow, isDarkTheme);
|
||||||
|
|||||||
@@ -20,6 +20,7 @@ namespace v2rayN.ViewModels
|
|||||||
[Reactive] public int localPort { get; set; }
|
[Reactive] public int localPort { get; set; }
|
||||||
[Reactive] public bool udpEnabled { get; set; }
|
[Reactive] public bool udpEnabled { get; set; }
|
||||||
[Reactive] public bool sniffingEnabled { get; set; }
|
[Reactive] public bool sniffingEnabled { get; set; }
|
||||||
|
public IList<string> destOverride { get; set; }
|
||||||
[Reactive] public bool routeOnly { get; set; }
|
[Reactive] public bool routeOnly { get; set; }
|
||||||
[Reactive] public bool allowLANConn { get; set; }
|
[Reactive] public bool allowLANConn { get; set; }
|
||||||
[Reactive] public bool newPort4LAN { get; set; }
|
[Reactive] public bool newPort4LAN { get; set; }
|
||||||
@@ -32,8 +33,10 @@ namespace v2rayN.ViewModels
|
|||||||
[Reactive] public string defFingerprint { get; set; }
|
[Reactive] public string defFingerprint { get; set; }
|
||||||
[Reactive] public string defUserAgent { get; set; }
|
[Reactive] public string defUserAgent { get; set; }
|
||||||
[Reactive] public string mux4SboxProtocol { get; set; }
|
[Reactive] public string mux4SboxProtocol { get; set; }
|
||||||
|
[Reactive] public bool enableCacheFile4Sbox { get; set; }
|
||||||
[Reactive] public int hyUpMbps { get; set; }
|
[Reactive] public int hyUpMbps { get; set; }
|
||||||
[Reactive] public int hyDownMbps { get; set; }
|
[Reactive] public int hyDownMbps { get; set; }
|
||||||
|
[Reactive] public bool enableFragment { get; set; }
|
||||||
|
|
||||||
#endregion Core
|
#endregion Core
|
||||||
|
|
||||||
@@ -62,9 +65,9 @@ namespace v2rayN.ViewModels
|
|||||||
[Reactive] public bool EnableCheckPreReleaseUpdate { get; set; }
|
[Reactive] public bool EnableCheckPreReleaseUpdate { get; set; }
|
||||||
[Reactive] public bool EnableDragDropSort { get; set; }
|
[Reactive] public bool EnableDragDropSort { get; set; }
|
||||||
[Reactive] public bool DoubleClick2Activate { get; set; }
|
[Reactive] public bool DoubleClick2Activate { get; set; }
|
||||||
[Reactive] public int autoUpdateInterval { get; set; }
|
[Reactive] public int AutoUpdateInterval { get; set; }
|
||||||
[Reactive] public int trayMenuServersLimit { get; set; }
|
[Reactive] public int TrayMenuServersLimit { get; set; }
|
||||||
[Reactive] public string currentFontFamily { get; set; }
|
[Reactive] public string CurrentFontFamily { get; set; }
|
||||||
[Reactive] public int SpeedTestTimeout { get; set; }
|
[Reactive] public int SpeedTestTimeout { get; set; }
|
||||||
[Reactive] public string SpeedTestUrl { get; set; }
|
[Reactive] public string SpeedTestUrl { get; set; }
|
||||||
[Reactive] public string SpeedPingTestUrl { get; set; }
|
[Reactive] public string SpeedPingTestUrl { get; set; }
|
||||||
@@ -127,8 +130,10 @@ namespace v2rayN.ViewModels
|
|||||||
defFingerprint = _config.coreBasicItem.defFingerprint;
|
defFingerprint = _config.coreBasicItem.defFingerprint;
|
||||||
defUserAgent = _config.coreBasicItem.defUserAgent;
|
defUserAgent = _config.coreBasicItem.defUserAgent;
|
||||||
mux4SboxProtocol = _config.mux4SboxItem.protocol;
|
mux4SboxProtocol = _config.mux4SboxItem.protocol;
|
||||||
|
enableCacheFile4Sbox = _config.coreBasicItem.enableCacheFile4Sbox;
|
||||||
hyUpMbps = _config.hysteriaItem.up_mbps;
|
hyUpMbps = _config.hysteriaItem.up_mbps;
|
||||||
hyDownMbps = _config.hysteriaItem.down_mbps;
|
hyDownMbps = _config.hysteriaItem.down_mbps;
|
||||||
|
enableFragment = _config.coreBasicItem.enableFragment;
|
||||||
|
|
||||||
#endregion Core
|
#endregion Core
|
||||||
|
|
||||||
@@ -157,9 +162,9 @@ namespace v2rayN.ViewModels
|
|||||||
EnableCheckPreReleaseUpdate = _config.guiItem.checkPreReleaseUpdate;
|
EnableCheckPreReleaseUpdate = _config.guiItem.checkPreReleaseUpdate;
|
||||||
EnableDragDropSort = _config.uiItem.enableDragDropSort;
|
EnableDragDropSort = _config.uiItem.enableDragDropSort;
|
||||||
DoubleClick2Activate = _config.uiItem.doubleClick2Activate;
|
DoubleClick2Activate = _config.uiItem.doubleClick2Activate;
|
||||||
autoUpdateInterval = _config.guiItem.autoUpdateInterval;
|
AutoUpdateInterval = _config.guiItem.autoUpdateInterval;
|
||||||
trayMenuServersLimit = _config.guiItem.trayMenuServersLimit;
|
TrayMenuServersLimit = _config.guiItem.trayMenuServersLimit;
|
||||||
currentFontFamily = _config.uiItem.currentFontFamily;
|
CurrentFontFamily = _config.uiItem.currentFontFamily;
|
||||||
SpeedTestTimeout = _config.speedTestItem.speedTestTimeout;
|
SpeedTestTimeout = _config.speedTestItem.speedTestTimeout;
|
||||||
SpeedTestUrl = _config.speedTestItem.speedTestUrl;
|
SpeedTestUrl = _config.speedTestItem.speedTestUrl;
|
||||||
SpeedPingTestUrl = _config.speedTestItem.speedPingTestUrl;
|
SpeedPingTestUrl = _config.speedTestItem.speedPingTestUrl;
|
||||||
@@ -192,7 +197,7 @@ namespace v2rayN.ViewModels
|
|||||||
SaveSetting();
|
SaveSetting();
|
||||||
});
|
});
|
||||||
|
|
||||||
Utils.SetDarkBorder(view, _config.uiItem.colorModeDark);
|
Utils.SetDarkBorder(view, _config.uiItem.followSystemTheme ? !Utils.IsLightTheme() : _config.uiItem.colorModeDark);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void InitCoreType()
|
private void InitCoreType()
|
||||||
@@ -255,6 +260,10 @@ namespace v2rayN.ViewModels
|
|||||||
_noticeHandler?.Enqueue(ResUI.FillLocalListeningPort);
|
_noticeHandler?.Enqueue(ResUI.FillLocalListeningPort);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
var needReboot = (EnableStatistics != _config.guiItem.enableStatistics
|
||||||
|
|| EnableDragDropSort != _config.uiItem.enableDragDropSort
|
||||||
|
|| EnableHWA != _config.guiItem.enableHWA
|
||||||
|
|| CurrentFontFamily != _config.uiItem.currentFontFamily);
|
||||||
|
|
||||||
//if (Utile.IsNullOrEmpty(Kcpmtu.ToString()) || !Utile.IsNumeric(Kcpmtu.ToString())
|
//if (Utile.IsNullOrEmpty(Kcpmtu.ToString()) || !Utile.IsNumeric(Kcpmtu.ToString())
|
||||||
// || Utile.IsNullOrEmpty(Kcptti.ToString()) || !Utile.IsNumeric(Kcptti.ToString())
|
// || Utile.IsNullOrEmpty(Kcptti.ToString()) || !Utile.IsNumeric(Kcptti.ToString())
|
||||||
@@ -271,6 +280,7 @@ namespace v2rayN.ViewModels
|
|||||||
_config.inbound[0].localPort = localPort;
|
_config.inbound[0].localPort = localPort;
|
||||||
_config.inbound[0].udpEnabled = udpEnabled;
|
_config.inbound[0].udpEnabled = udpEnabled;
|
||||||
_config.inbound[0].sniffingEnabled = sniffingEnabled;
|
_config.inbound[0].sniffingEnabled = sniffingEnabled;
|
||||||
|
_config.inbound[0].destOverride = destOverride?.ToList();
|
||||||
_config.inbound[0].routeOnly = routeOnly;
|
_config.inbound[0].routeOnly = routeOnly;
|
||||||
_config.inbound[0].allowLANConn = allowLANConn;
|
_config.inbound[0].allowLANConn = allowLANConn;
|
||||||
_config.inbound[0].newPort4LAN = newPort4LAN;
|
_config.inbound[0].newPort4LAN = newPort4LAN;
|
||||||
@@ -287,8 +297,10 @@ namespace v2rayN.ViewModels
|
|||||||
_config.coreBasicItem.defFingerprint = defFingerprint;
|
_config.coreBasicItem.defFingerprint = defFingerprint;
|
||||||
_config.coreBasicItem.defUserAgent = defUserAgent;
|
_config.coreBasicItem.defUserAgent = defUserAgent;
|
||||||
_config.mux4SboxItem.protocol = mux4SboxProtocol;
|
_config.mux4SboxItem.protocol = mux4SboxProtocol;
|
||||||
|
_config.coreBasicItem.enableCacheFile4Sbox = enableCacheFile4Sbox;
|
||||||
_config.hysteriaItem.up_mbps = hyUpMbps;
|
_config.hysteriaItem.up_mbps = hyUpMbps;
|
||||||
_config.hysteriaItem.down_mbps = hyDownMbps;
|
_config.hysteriaItem.down_mbps = hyDownMbps;
|
||||||
|
_config.coreBasicItem.enableFragment = enableFragment;
|
||||||
|
|
||||||
//Kcp
|
//Kcp
|
||||||
//_config.kcpItem.mtu = Kcpmtu;
|
//_config.kcpItem.mtu = Kcpmtu;
|
||||||
@@ -309,12 +321,12 @@ namespace v2rayN.ViewModels
|
|||||||
_config.uiItem.enableUpdateSubOnlyRemarksExist = EnableUpdateSubOnlyRemarksExist;
|
_config.uiItem.enableUpdateSubOnlyRemarksExist = EnableUpdateSubOnlyRemarksExist;
|
||||||
_config.guiItem.enableSecurityProtocolTls13 = EnableSecurityProtocolTls13;
|
_config.guiItem.enableSecurityProtocolTls13 = EnableSecurityProtocolTls13;
|
||||||
_config.uiItem.autoHideStartup = AutoHideStartup;
|
_config.uiItem.autoHideStartup = AutoHideStartup;
|
||||||
_config.guiItem.autoUpdateInterval = autoUpdateInterval;
|
_config.guiItem.autoUpdateInterval = AutoUpdateInterval;
|
||||||
_config.guiItem.checkPreReleaseUpdate = EnableCheckPreReleaseUpdate;
|
_config.guiItem.checkPreReleaseUpdate = EnableCheckPreReleaseUpdate;
|
||||||
_config.uiItem.enableDragDropSort = EnableDragDropSort;
|
_config.uiItem.enableDragDropSort = EnableDragDropSort;
|
||||||
_config.uiItem.doubleClick2Activate = DoubleClick2Activate;
|
_config.uiItem.doubleClick2Activate = DoubleClick2Activate;
|
||||||
_config.guiItem.trayMenuServersLimit = trayMenuServersLimit;
|
_config.guiItem.trayMenuServersLimit = TrayMenuServersLimit;
|
||||||
_config.uiItem.currentFontFamily = currentFontFamily;
|
_config.uiItem.currentFontFamily = CurrentFontFamily;
|
||||||
_config.speedTestItem.speedTestTimeout = SpeedTestTimeout;
|
_config.speedTestItem.speedTestTimeout = SpeedTestTimeout;
|
||||||
_config.speedTestItem.speedTestUrl = SpeedTestUrl;
|
_config.speedTestItem.speedTestUrl = SpeedTestUrl;
|
||||||
_config.speedTestItem.speedPingTestUrl = SpeedPingTestUrl;
|
_config.speedTestItem.speedPingTestUrl = SpeedPingTestUrl;
|
||||||
@@ -336,8 +348,15 @@ namespace v2rayN.ViewModels
|
|||||||
SaveCoreType();
|
SaveCoreType();
|
||||||
|
|
||||||
if (ConfigHandler.SaveConfig(_config) == 0)
|
if (ConfigHandler.SaveConfig(_config) == 0)
|
||||||
|
{
|
||||||
|
if (needReboot)
|
||||||
|
{
|
||||||
|
_noticeHandler?.Enqueue(ResUI.NeedRebootTips);
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
_noticeHandler?.Enqueue(ResUI.OperationSuccess);
|
_noticeHandler?.Enqueue(ResUI.OperationSuccess);
|
||||||
|
}
|
||||||
_view.DialogResult = true;
|
_view.DialogResult = true;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ namespace v2rayN.ViewModels
|
|||||||
SaveRules();
|
SaveRules();
|
||||||
});
|
});
|
||||||
|
|
||||||
Utils.SetDarkBorder(view, _config.uiItem.colorModeDark);
|
Utils.SetDarkBorder(view, _config.uiItem.followSystemTheme ? !Utils.IsLightTheme() : _config.uiItem.colorModeDark);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveRules()
|
private void SaveRules()
|
||||||
|
|||||||
@@ -115,7 +115,7 @@ namespace v2rayN.ViewModels
|
|||||||
SaveRouting();
|
SaveRouting();
|
||||||
});
|
});
|
||||||
|
|
||||||
Utils.SetDarkBorder(view, _config.uiItem.colorModeDark);
|
Utils.SetDarkBorder(view, _config.uiItem.followSystemTheme ? !Utils.IsLightTheme() : _config.uiItem.colorModeDark);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RefreshRulesItems()
|
public void RefreshRulesItems()
|
||||||
@@ -196,13 +196,14 @@ namespace v2rayN.ViewModels
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
var lst = new List<RulesItem>();
|
var lst = new List<RulesItem4Ray>();
|
||||||
foreach (var it in SelectedSources)
|
foreach (var it in SelectedSources)
|
||||||
{
|
{
|
||||||
var item = _rules.FirstOrDefault(t => t.id == it?.id);
|
var item = _rules.FirstOrDefault(t => t.id == it?.id);
|
||||||
if (item != null)
|
if (item != null)
|
||||||
{
|
{
|
||||||
lst.Add(item);
|
var item2 = JsonUtils.Deserialize<RulesItem4Ray>(JsonUtils.Serialize(item));
|
||||||
|
lst.Add(item2 ?? new());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (lst.Count > 0)
|
if (lst.Count > 0)
|
||||||
|
|||||||
@@ -126,7 +126,7 @@ namespace v2rayN.ViewModels
|
|||||||
SaveRouting();
|
SaveRouting();
|
||||||
});
|
});
|
||||||
|
|
||||||
Utils.SetDarkBorder(view, _config.uiItem.colorModeDark);
|
Utils.SetDarkBorder(view, _config.uiItem.followSystemTheme ? !Utils.IsLightTheme() : _config.uiItem.colorModeDark);
|
||||||
}
|
}
|
||||||
|
|
||||||
#region locked
|
#region locked
|
||||||
@@ -192,6 +192,7 @@ namespace v2rayN.ViewModels
|
|||||||
remarks = item.remarks,
|
remarks = item.remarks,
|
||||||
url = item.url,
|
url = item.url,
|
||||||
customIcon = item.customIcon,
|
customIcon = item.customIcon,
|
||||||
|
customRulesetPath4Singbox = item.customRulesetPath4Singbox,
|
||||||
sort = item.sort,
|
sort = item.sort,
|
||||||
};
|
};
|
||||||
_routingItems.Add(it);
|
_routingItems.Add(it);
|
||||||
|
|||||||
@@ -40,7 +40,7 @@ namespace v2rayN.ViewModels
|
|||||||
SaveSub();
|
SaveSub();
|
||||||
});
|
});
|
||||||
|
|
||||||
Utils.SetDarkBorder(view, _config.uiItem.colorModeDark);
|
Utils.SetDarkBorder(view, _config.uiItem.followSystemTheme ? !Utils.IsLightTheme() : _config.uiItem.colorModeDark);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveSub()
|
private void SaveSub()
|
||||||
|
|||||||
@@ -62,7 +62,7 @@ namespace v2rayN.ViewModels
|
|||||||
SubShare();
|
SubShare();
|
||||||
}, canEditRemove);
|
}, canEditRemove);
|
||||||
|
|
||||||
Utils.SetDarkBorder(view, _config.uiItem.colorModeDark);
|
Utils.SetDarkBorder(view, _config.uiItem.followSystemTheme ? !Utils.IsLightTheme() : _config.uiItem.colorModeDark);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RefreshSubItems()
|
public void RefreshSubItems()
|
||||||
|
|||||||
@@ -92,6 +92,7 @@ namespace v2rayN.Views
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case EConfigType.Socks:
|
case EConfigType.Socks:
|
||||||
|
case EConfigType.Http:
|
||||||
gridSocks.Visibility = Visibility.Visible;
|
gridSocks.Visibility = Visibility.Visible;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@@ -174,6 +175,7 @@ namespace v2rayN.Views
|
|||||||
break;
|
break;
|
||||||
|
|
||||||
case EConfigType.Socks:
|
case EConfigType.Socks:
|
||||||
|
case EConfigType.Http:
|
||||||
this.Bind(ViewModel, vm => vm.SelectedSource.id, v => v.txtId4.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SelectedSource.id, v => v.txtId4.Text).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.SelectedSource.security, v => v.txtSecurity4.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SelectedSource.security, v => v.txtSecurity4.Text).DisposeWith(disposables);
|
||||||
break;
|
break;
|
||||||
|
|||||||
@@ -88,6 +88,7 @@
|
|||||||
Style="{StaticResource ToolbarTextBlock}">
|
Style="{StaticResource ToolbarTextBlock}">
|
||||||
<Hyperlink Click="linkDnsObjectDoc_Click">
|
<Hyperlink Click="linkDnsObjectDoc_Click">
|
||||||
<TextBlock Text="{x:Static resx:ResUI.TbDnsObjectDoc}" />
|
<TextBlock Text="{x:Static resx:ResUI.TbDnsObjectDoc}" />
|
||||||
|
<materialDesign:PackIcon Kind="Link" />
|
||||||
</Hyperlink>
|
</Hyperlink>
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
<Button
|
<Button
|
||||||
@@ -120,6 +121,7 @@
|
|||||||
Style="{StaticResource ToolbarTextBlock}">
|
Style="{StaticResource ToolbarTextBlock}">
|
||||||
<Hyperlink Click="linkDnsSingboxObjectDoc_Click">
|
<Hyperlink Click="linkDnsSingboxObjectDoc_Click">
|
||||||
<TextBlock Text="{x:Static resx:ResUI.TbDnsSingboxObjectDoc}" />
|
<TextBlock Text="{x:Static resx:ResUI.TbDnsSingboxObjectDoc}" />
|
||||||
|
<materialDesign:PackIcon Kind="Link" />
|
||||||
</Hyperlink>
|
</Hyperlink>
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
<Button
|
<Button
|
||||||
|
|||||||
@@ -51,7 +51,7 @@ namespace v2rayN.Views
|
|||||||
|
|
||||||
private void linkDnsObjectDoc_Click(object sender, RoutedEventArgs e)
|
private void linkDnsObjectDoc_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
Utils.ProcessStart("https://www.v2fly.org/config/dns.html#dnsobject");
|
Utils.ProcessStart("https://xtls.github.io/config/dns.html#dnsobject");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void linkDnsSingboxObjectDoc_Click(object sender, RoutedEventArgs e)
|
private void linkDnsSingboxObjectDoc_Click(object sender, RoutedEventArgs e)
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ namespace v2rayN.Views
|
|||||||
|
|
||||||
HotkeyHandler.Instance.IsPause = true;
|
HotkeyHandler.Instance.IsPause = true;
|
||||||
this.Closing += (s, e) => HotkeyHandler.Instance.IsPause = false;
|
this.Closing += (s, e) => HotkeyHandler.Instance.IsPause = false;
|
||||||
Utils.SetDarkBorder(this, _config.uiItem.colorModeDark);
|
Utils.SetDarkBorder(this, _config.uiItem.followSystemTheme ? !Utils.IsLightTheme() : _config.uiItem.colorModeDark);
|
||||||
InitData();
|
InitData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -1,20 +1,21 @@
|
|||||||
<reactiveui:ReactiveWindow
|
<reactiveui:ReactiveWindow
|
||||||
x:Class="v2rayN.Views.MainWindow"
|
x:Class="v2rayN.Views.MainWindow"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
|
||||||
xmlns:reactiveui="http://reactiveui.net"
|
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
||||||
xmlns:tb="clr-namespace:H.NotifyIcon;assembly=H.NotifyIcon.Wpf"
|
|
||||||
xmlns:base="clr-namespace:v2rayN.Base"
|
xmlns:base="clr-namespace:v2rayN.Base"
|
||||||
xmlns:conv="clr-namespace:v2rayN.Converters"
|
xmlns:conv="clr-namespace:v2rayN.Converters"
|
||||||
xmlns:resx="clr-namespace:v2rayN.Resx"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:vms="clr-namespace:v2rayN.ViewModels"
|
|
||||||
xmlns:local="clr-namespace:v2rayN.Views"
|
xmlns:local="clr-namespace:v2rayN.Views"
|
||||||
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
|
xmlns:reactiveui="http://reactiveui.net"
|
||||||
|
xmlns:resx="clr-namespace:v2rayN.Resx"
|
||||||
|
xmlns:tb="clr-namespace:H.NotifyIcon;assembly=H.NotifyIcon.Wpf"
|
||||||
|
xmlns:vms="clr-namespace:v2rayN.ViewModels"
|
||||||
Title="v2rayN"
|
Title="v2rayN"
|
||||||
Width="900"
|
Width="900"
|
||||||
Height="700"
|
Height="700"
|
||||||
|
MinWidth="900"
|
||||||
x:TypeArguments="vms:MainWindowViewModel"
|
x:TypeArguments="vms:MainWindowViewModel"
|
||||||
Background="{DynamicResource MaterialDesignPaper}"
|
Background="{DynamicResource MaterialDesignPaper}"
|
||||||
FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}"
|
FontFamily="{x:Static conv:MaterialDesignFonts.MyFont}"
|
||||||
@@ -37,6 +38,7 @@
|
|||||||
|
|
||||||
<materialDesign:DialogHost
|
<materialDesign:DialogHost
|
||||||
Identifier="RootDialog"
|
Identifier="RootDialog"
|
||||||
|
materialDesign:TransitionAssist.DisableTransitions="True"
|
||||||
SnackbarMessageQueue="{Binding ElementName=MainSnackbar, Path=MessageQueue}"
|
SnackbarMessageQueue="{Binding ElementName=MainSnackbar, Path=MessageQueue}"
|
||||||
Style="{StaticResource MaterialDesignEmbeddedDialogHost}">
|
Style="{StaticResource MaterialDesignEmbeddedDialogHost}">
|
||||||
<Grid>
|
<Grid>
|
||||||
@@ -79,6 +81,10 @@
|
|||||||
x:Name="menuAddSocksServer"
|
x:Name="menuAddSocksServer"
|
||||||
Height="{StaticResource MenuItemHeight}"
|
Height="{StaticResource MenuItemHeight}"
|
||||||
Header="{x:Static resx:ResUI.menuAddSocksServer}" />
|
Header="{x:Static resx:ResUI.menuAddSocksServer}" />
|
||||||
|
<MenuItem
|
||||||
|
x:Name="menuAddHttpServer"
|
||||||
|
Height="{StaticResource MenuItemHeight}"
|
||||||
|
Header="{x:Static resx:ResUI.menuAddHttpServer}" />
|
||||||
<MenuItem
|
<MenuItem
|
||||||
x:Name="menuAddTrojanServer"
|
x:Name="menuAddTrojanServer"
|
||||||
Height="{StaticResource MenuItemHeight}"
|
Height="{StaticResource MenuItemHeight}"
|
||||||
@@ -186,9 +192,13 @@
|
|||||||
Header="{x:Static resx:ResUI.menuClearServerStatistics}" />
|
Header="{x:Static resx:ResUI.menuClearServerStatistics}" />
|
||||||
<Separator Margin="-40,5" />
|
<Separator Margin="-40,5" />
|
||||||
<MenuItem
|
<MenuItem
|
||||||
|
x:Name="menuOpenTheFileLocation"
|
||||||
|
Height="{StaticResource MenuItemHeight}"
|
||||||
|
Header="{x:Static resx:ResUI.menuOpenTheFileLocation}" />
|
||||||
|
<!--<MenuItem
|
||||||
x:Name="menuImportOldGuiConfig"
|
x:Name="menuImportOldGuiConfig"
|
||||||
Height="{StaticResource MenuItemHeight}"
|
Height="{StaticResource MenuItemHeight}"
|
||||||
Header="{x:Static resx:ResUI.menuImportOldGuiConfig}" />
|
Header="{x:Static resx:ResUI.menuImportOldGuiConfig}" />-->
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
</Menu>
|
</Menu>
|
||||||
<Separator />
|
<Separator />
|
||||||
@@ -665,9 +675,9 @@
|
|||||||
<Style BasedOn="{StaticResource MaterialDesignDataGridCell}" TargetType="DataGridCell">
|
<Style BasedOn="{StaticResource MaterialDesignDataGridCell}" TargetType="DataGridCell">
|
||||||
<Style.Triggers>
|
<Style.Triggers>
|
||||||
<DataTrigger Binding="{Binding isActive}" Value="True">
|
<DataTrigger Binding="{Binding isActive}" Value="True">
|
||||||
<Setter Property="Background" Value="{DynamicResource PrimaryHueLightBrush}" />
|
<Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Primary.Light}" />
|
||||||
<Setter Property="Foreground" Value="Black" />
|
<Setter Property="Foreground" Value="Black" />
|
||||||
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryHueLightBrush}" />
|
<Setter Property="BorderBrush" Value="{DynamicResource MaterialDesign.Brush.Primary.Light}" />
|
||||||
</DataTrigger>
|
</DataTrigger>
|
||||||
</Style.Triggers>
|
</Style.Triggers>
|
||||||
</Style>
|
</Style>
|
||||||
|
|||||||
@@ -86,6 +86,7 @@ namespace v2rayN.Views
|
|||||||
this.BindCommand(ViewModel, vm => vm.AddVlessServerCmd, v => v.menuAddVlessServer).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.AddVlessServerCmd, v => v.menuAddVlessServer).DisposeWith(disposables);
|
||||||
this.BindCommand(ViewModel, vm => vm.AddShadowsocksServerCmd, v => v.menuAddShadowsocksServer).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.AddShadowsocksServerCmd, v => v.menuAddShadowsocksServer).DisposeWith(disposables);
|
||||||
this.BindCommand(ViewModel, vm => vm.AddSocksServerCmd, v => v.menuAddSocksServer).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.AddSocksServerCmd, v => v.menuAddSocksServer).DisposeWith(disposables);
|
||||||
|
this.BindCommand(ViewModel, vm => vm.AddHttpServerCmd, v => v.menuAddHttpServer).DisposeWith(disposables);
|
||||||
this.BindCommand(ViewModel, vm => vm.AddTrojanServerCmd, v => v.menuAddTrojanServer).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.AddTrojanServerCmd, v => v.menuAddTrojanServer).DisposeWith(disposables);
|
||||||
this.BindCommand(ViewModel, vm => vm.AddHysteria2ServerCmd, v => v.menuAddHysteria2Server).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.AddHysteria2ServerCmd, v => v.menuAddHysteria2Server).DisposeWith(disposables);
|
||||||
this.BindCommand(ViewModel, vm => vm.AddTuicServerCmd, v => v.menuAddTuicServer).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.AddTuicServerCmd, v => v.menuAddTuicServer).DisposeWith(disposables);
|
||||||
@@ -137,7 +138,8 @@ namespace v2rayN.Views
|
|||||||
this.BindCommand(ViewModel, vm => vm.GlobalHotkeySettingCmd, v => v.menuGlobalHotkeySetting).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.GlobalHotkeySettingCmd, v => v.menuGlobalHotkeySetting).DisposeWith(disposables);
|
||||||
this.BindCommand(ViewModel, vm => vm.RebootAsAdminCmd, v => v.menuRebootAsAdmin).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.RebootAsAdminCmd, v => v.menuRebootAsAdmin).DisposeWith(disposables);
|
||||||
this.BindCommand(ViewModel, vm => vm.ClearServerStatisticsCmd, v => v.menuClearServerStatistics).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.ClearServerStatisticsCmd, v => v.menuClearServerStatistics).DisposeWith(disposables);
|
||||||
this.BindCommand(ViewModel, vm => vm.ImportOldGuiConfigCmd, v => v.menuImportOldGuiConfig).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.OpenTheFileLocationCmd, v => v.menuOpenTheFileLocation).DisposeWith(disposables);
|
||||||
|
//this.BindCommand(ViewModel, vm => vm.ImportOldGuiConfigCmd, v => v.menuImportOldGuiConfig).DisposeWith(disposables);
|
||||||
|
|
||||||
//check update
|
//check update
|
||||||
this.BindCommand(ViewModel, vm => vm.CheckUpdateNCmd, v => v.menuCheckUpdateN).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.CheckUpdateNCmd, v => v.menuCheckUpdateN).DisposeWith(disposables);
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
<TextBlock
|
<TextBlock
|
||||||
Margin="8,0"
|
Margin="8,0"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Foreground="{DynamicResource PrimaryHueLightBrush}"
|
|
||||||
Style="{StaticResource ToolbarTextBlock}"
|
Style="{StaticResource ToolbarTextBlock}"
|
||||||
Text="{x:Static resx:ResUI.MsgInformationTitle}" />
|
Text="{x:Static resx:ResUI.MsgInformationTitle}" />
|
||||||
<ComboBox
|
<ComboBox
|
||||||
|
|||||||
@@ -67,6 +67,8 @@
|
|||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
|
<RowDefinition Height="Auto" />
|
||||||
</Grid.RowDefinitions>
|
</Grid.RowDefinitions>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition Width="Auto" />
|
||||||
@@ -117,12 +119,22 @@
|
|||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Style="{StaticResource ToolbarTextBlock}"
|
Style="{StaticResource ToolbarTextBlock}"
|
||||||
Text="{x:Static resx:ResUI.TbSettingsSniffingEnabled}" />
|
Text="{x:Static resx:ResUI.TbSettingsSniffingEnabled}" />
|
||||||
<ToggleButton
|
<StackPanel
|
||||||
x:Name="togsniffingEnabled"
|
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
|
Grid.ColumnSpan="2"
|
||||||
|
Orientation="Horizontal">
|
||||||
|
<ToggleButton
|
||||||
|
x:Name="togsniffingEnabled"
|
||||||
Margin="{StaticResource SettingItemMargin}"
|
Margin="{StaticResource SettingItemMargin}"
|
||||||
HorizontalAlignment="Left" />
|
HorizontalAlignment="Left" />
|
||||||
|
<ListBox
|
||||||
|
x:Name="clbdestOverride"
|
||||||
|
Margin="4"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
FontSize="{DynamicResource StdFontSize}"
|
||||||
|
Style="{StaticResource MaterialDesignFilterChipPrimaryListBox}" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Row="3"
|
Grid.Row="3"
|
||||||
@@ -313,10 +325,24 @@
|
|||||||
Margin="{StaticResource SettingItemMargin}"
|
Margin="{StaticResource SettingItemMargin}"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Style="{StaticResource ToolbarTextBlock}"
|
Style="{StaticResource ToolbarTextBlock}"
|
||||||
|
Text="{x:Static resx:ResUI.TbSettingsEnableCacheFile4Sbox}" />
|
||||||
|
<ToggleButton
|
||||||
|
x:Name="togenableCacheFile4Sbox"
|
||||||
|
Grid.Row="15"
|
||||||
|
Grid.Column="1"
|
||||||
|
Margin="{StaticResource SettingItemMargin}"
|
||||||
|
HorizontalAlignment="Left" />
|
||||||
|
|
||||||
|
<TextBlock
|
||||||
|
Grid.Row="16"
|
||||||
|
Grid.Column="0"
|
||||||
|
Margin="{StaticResource SettingItemMargin}"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Style="{StaticResource ToolbarTextBlock}"
|
||||||
Text="{x:Static resx:ResUI.TbSettingsHysteriaBandwidth}" />
|
Text="{x:Static resx:ResUI.TbSettingsHysteriaBandwidth}" />
|
||||||
|
|
||||||
<StackPanel
|
<StackPanel
|
||||||
Grid.Row="15"
|
Grid.Row="16"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Orientation="Horizontal">
|
Orientation="Horizontal">
|
||||||
|
|
||||||
@@ -333,6 +359,26 @@
|
|||||||
materialDesign:HintAssist.Hint="Down"
|
materialDesign:HintAssist.Hint="Down"
|
||||||
Style="{StaticResource DefTextBox}" />
|
Style="{StaticResource DefTextBox}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
|
<TextBlock
|
||||||
|
Grid.Row="17"
|
||||||
|
Grid.Column="0"
|
||||||
|
Margin="{StaticResource SettingItemMargin}"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Style="{StaticResource ToolbarTextBlock}"
|
||||||
|
Text="{x:Static resx:ResUI.TbSettingsEnableFragment}" />
|
||||||
|
<ToggleButton
|
||||||
|
x:Name="togenableFragment"
|
||||||
|
Grid.Row="17"
|
||||||
|
Grid.Column="1"
|
||||||
|
Margin="{StaticResource SettingItemMargin}"
|
||||||
|
HorizontalAlignment="Left" />
|
||||||
|
<TextBlock
|
||||||
|
Grid.Row="17"
|
||||||
|
Grid.Column="3"
|
||||||
|
Margin="{StaticResource SettingItemMargin}"
|
||||||
|
Style="{StaticResource ToolbarTextBlock}"
|
||||||
|
Text="{x:Static resx:ResUI.TbSettingsEnableFragmentTips}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
|||||||
@@ -30,9 +30,19 @@ namespace v2rayN.Views
|
|||||||
|
|
||||||
this.Owner = Application.Current.MainWindow;
|
this.Owner = Application.Current.MainWindow;
|
||||||
_config = LazyConfig.Instance.GetConfig();
|
_config = LazyConfig.Instance.GetConfig();
|
||||||
|
var lstFonts = GetFonts(Utils.GetFontsPath());
|
||||||
|
|
||||||
ViewModel = new OptionSettingViewModel(this);
|
ViewModel = new OptionSettingViewModel(this);
|
||||||
|
|
||||||
|
clbdestOverride.SelectionChanged += ClbdestOverride_SelectionChanged;
|
||||||
|
Global.destOverrideProtocols.ForEach(it =>
|
||||||
|
{
|
||||||
|
clbdestOverride.Items.Add(it);
|
||||||
|
});
|
||||||
|
_config.inbound[0].destOverride?.ForEach(it =>
|
||||||
|
{
|
||||||
|
clbdestOverride.SelectedItems.Add(it);
|
||||||
|
});
|
||||||
Global.IEProxyProtocols.ForEach(it =>
|
Global.IEProxyProtocols.ForEach(it =>
|
||||||
{
|
{
|
||||||
cmbsystemProxyAdvancedProtocol.Items.Add(it);
|
cmbsystemProxyAdvancedProtocol.Items.Add(it);
|
||||||
@@ -89,14 +99,91 @@ namespace v2rayN.Views
|
|||||||
cmbSubConvertUrl.Items.Add(it);
|
cmbSubConvertUrl.Items.Add(it);
|
||||||
});
|
});
|
||||||
|
|
||||||
//fill fonts
|
lstFonts.ForEach(it => { cmbcurrentFontFamily.Items.Add(it); });
|
||||||
|
cmbcurrentFontFamily.Items.Add(string.Empty);
|
||||||
|
|
||||||
|
this.WhenActivated(disposables =>
|
||||||
|
{
|
||||||
|
this.Bind(ViewModel, vm => vm.localPort, v => v.txtlocalPort.Text).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.udpEnabled, v => v.togudpEnabled.IsChecked).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.sniffingEnabled, v => v.togsniffingEnabled.IsChecked).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.routeOnly, v => v.togrouteOnly.IsChecked).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.allowLANConn, v => v.togAllowLANConn.IsChecked).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.newPort4LAN, v => v.togNewPort4LAN.IsChecked).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.newPort4LAN, v => v.txtuser.IsEnabled).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.newPort4LAN, v => v.txtpass.IsEnabled).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.user, v => v.txtuser.Text).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.pass, v => v.txtpass.Text).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.muxEnabled, v => v.togmuxEnabled.IsChecked).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.logEnabled, v => v.toglogEnabled.IsChecked).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.loglevel, v => v.cmbloglevel.Text).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.defAllowInsecure, v => v.togdefAllowInsecure.IsChecked).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.defFingerprint, v => v.cmbdefFingerprint.Text).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.defUserAgent, v => v.cmbdefUserAgent.Text).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.mux4SboxProtocol, v => v.cmbmux4SboxProtocol.Text).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.enableCacheFile4Sbox, v => v.togenableCacheFile4Sbox.IsChecked).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.hyUpMbps, v => v.txtUpMbps.Text).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.hyDownMbps, v => v.txtDownMbps.Text).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.enableFragment, v => v.togenableFragment.IsChecked).DisposeWith(disposables);
|
||||||
|
|
||||||
|
//this.Bind(ViewModel, vm => vm.Kcpmtu, v => v.txtKcpmtu.Text).DisposeWith(disposables);
|
||||||
|
//this.Bind(ViewModel, vm => vm.Kcptti, v => v.txtKcptti.Text).DisposeWith(disposables);
|
||||||
|
//this.Bind(ViewModel, vm => vm.KcpuplinkCapacity, v => v.txtKcpuplinkCapacity.Text).DisposeWith(disposables);
|
||||||
|
//this.Bind(ViewModel, vm => vm.KcpdownlinkCapacity, v => v.txtKcpdownlinkCapacity.Text).DisposeWith(disposables);
|
||||||
|
//this.Bind(ViewModel, vm => vm.KcpreadBufferSize, v => v.txtKcpreadBufferSize.Text).DisposeWith(disposables);
|
||||||
|
//this.Bind(ViewModel, vm => vm.KcpwriteBufferSize, v => v.txtKcpwriteBufferSize.Text).DisposeWith(disposables);
|
||||||
|
//this.Bind(ViewModel, vm => vm.Kcpcongestion, v => v.togKcpcongestion.IsChecked).DisposeWith(disposables);
|
||||||
|
|
||||||
|
this.Bind(ViewModel, vm => vm.AutoRun, v => v.togAutoRun.IsChecked).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.EnableStatistics, v => v.togEnableStatistics.IsChecked).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.KeepOlderDedupl, v => v.togKeepOlderDedupl.IsChecked).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.IgnoreGeoUpdateCore, v => v.togIgnoreGeoUpdateCore.IsChecked).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.EnableAutoAdjustMainLvColWidth, v => v.togEnableAutoAdjustMainLvColWidth.IsChecked).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.EnableUpdateSubOnlyRemarksExist, v => v.togEnableUpdateSubOnlyRemarksExist.IsChecked).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.EnableSecurityProtocolTls13, v => v.togEnableSecurityProtocolTls13.IsChecked).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.AutoHideStartup, v => v.togAutoHideStartup.IsChecked).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.EnableCheckPreReleaseUpdate, v => v.togEnableCheckPreReleaseUpdate.IsChecked).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.EnableDragDropSort, v => v.togEnableDragDropSort.IsChecked).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.DoubleClick2Activate, v => v.togDoubleClick2Activate.IsChecked).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.AutoUpdateInterval, v => v.txtautoUpdateInterval.Text).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.TrayMenuServersLimit, v => v.txttrayMenuServersLimit.Text).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.CurrentFontFamily, v => v.cmbcurrentFontFamily.Text).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.SpeedTestTimeout, v => v.cmbSpeedTestTimeout.Text).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.SpeedTestUrl, v => v.cmbSpeedTestUrl.Text).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.SpeedPingTestUrl, v => v.cmbSpeedPingTestUrl.Text).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.EnableHWA, v => v.togEnableHWA.IsChecked).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.SubConvertUrl, v => v.cmbSubConvertUrl.Text).DisposeWith(disposables);
|
||||||
|
|
||||||
|
this.Bind(ViewModel, vm => vm.systemProxyAdvancedProtocol, v => v.cmbsystemProxyAdvancedProtocol.Text).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.systemProxyExceptions, v => v.txtsystemProxyExceptions.Text).DisposeWith(disposables);
|
||||||
|
|
||||||
|
this.Bind(ViewModel, vm => vm.TunStrictRoute, v => v.togStrictRoute.IsChecked).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.TunStack, v => v.cmbStack.Text).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.TunMtu, v => v.cmbMtu.Text).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.TunEnableExInbound, v => v.togEnableExInbound.IsChecked).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.TunEnableIPv6Address, v => v.togEnableIPv6Address.IsChecked).DisposeWith(disposables);
|
||||||
|
|
||||||
|
this.Bind(ViewModel, vm => vm.CoreType1, v => v.cmbCoreType1.Text).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.CoreType2, v => v.cmbCoreType2.Text).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.CoreType3, v => v.cmbCoreType3.Text).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.CoreType4, v => v.cmbCoreType4.Text).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.CoreType5, v => v.cmbCoreType5.Text).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.CoreType6, v => v.cmbCoreType6.Text).DisposeWith(disposables);
|
||||||
|
|
||||||
|
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables);
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
private List<string> GetFonts(string path)
|
||||||
|
{
|
||||||
|
var lstFonts = new List<string>();
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
string[] searchPatterns = { "*.ttf", "*.ttc" };
|
string[] searchPatterns = { "*.ttf", "*.ttc" };
|
||||||
var files = new List<string>();
|
var files = new List<string>();
|
||||||
foreach (var pattern in searchPatterns)
|
foreach (var pattern in searchPatterns)
|
||||||
{
|
{
|
||||||
files.AddRange(Directory.GetFiles(Utils.GetFontsPath(), pattern));
|
files.AddRange(Directory.GetFiles(path, pattern));
|
||||||
}
|
}
|
||||||
var culture = _config.uiItem.currentLanguage == Global.Languages[0] ? "zh-cn" : "en-us";
|
var culture = _config.uiItem.currentLanguage == Global.Languages[0] ? "zh-cn" : "en-us";
|
||||||
var culture2 = "en-us";
|
var culture2 = "en-us";
|
||||||
@@ -123,7 +210,7 @@ namespace v2rayN.Views
|
|||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
cmbcurrentFontFamily.Items.Add(fontFamily);
|
lstFonts.Add(fontFamily);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -133,76 +220,12 @@ namespace v2rayN.Views
|
|||||||
{
|
{
|
||||||
Logging.SaveLog("fill fonts error", ex);
|
Logging.SaveLog("fill fonts error", ex);
|
||||||
}
|
}
|
||||||
cmbcurrentFontFamily.Items.Add(string.Empty);
|
return lstFonts;
|
||||||
|
}
|
||||||
|
|
||||||
this.WhenActivated(disposables =>
|
private void ClbdestOverride_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
this.Bind(ViewModel, vm => vm.localPort, v => v.txtlocalPort.Text).DisposeWith(disposables);
|
ViewModel.destOverride = clbdestOverride.SelectedItems.Cast<string>().ToList();
|
||||||
this.Bind(ViewModel, vm => vm.udpEnabled, v => v.togudpEnabled.IsChecked).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.sniffingEnabled, v => v.togsniffingEnabled.IsChecked).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.routeOnly, v => v.togrouteOnly.IsChecked).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.allowLANConn, v => v.togAllowLANConn.IsChecked).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.newPort4LAN, v => v.togNewPort4LAN.IsChecked).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.newPort4LAN, v => v.txtuser.IsEnabled).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.newPort4LAN, v => v.txtpass.IsEnabled).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.user, v => v.txtuser.Text).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.pass, v => v.txtpass.Text).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.muxEnabled, v => v.togmuxEnabled.IsChecked).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.logEnabled, v => v.toglogEnabled.IsChecked).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.loglevel, v => v.cmbloglevel.Text).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.defAllowInsecure, v => v.togdefAllowInsecure.IsChecked).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.defFingerprint, v => v.cmbdefFingerprint.Text).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.defUserAgent, v => v.cmbdefUserAgent.Text).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.mux4SboxProtocol, v => v.cmbmux4SboxProtocol.Text).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.hyUpMbps, v => v.txtUpMbps.Text).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.hyDownMbps, v => v.txtDownMbps.Text).DisposeWith(disposables);
|
|
||||||
|
|
||||||
//this.Bind(ViewModel, vm => vm.Kcpmtu, v => v.txtKcpmtu.Text).DisposeWith(disposables);
|
|
||||||
//this.Bind(ViewModel, vm => vm.Kcptti, v => v.txtKcptti.Text).DisposeWith(disposables);
|
|
||||||
//this.Bind(ViewModel, vm => vm.KcpuplinkCapacity, v => v.txtKcpuplinkCapacity.Text).DisposeWith(disposables);
|
|
||||||
//this.Bind(ViewModel, vm => vm.KcpdownlinkCapacity, v => v.txtKcpdownlinkCapacity.Text).DisposeWith(disposables);
|
|
||||||
//this.Bind(ViewModel, vm => vm.KcpreadBufferSize, v => v.txtKcpreadBufferSize.Text).DisposeWith(disposables);
|
|
||||||
//this.Bind(ViewModel, vm => vm.KcpwriteBufferSize, v => v.txtKcpwriteBufferSize.Text).DisposeWith(disposables);
|
|
||||||
//this.Bind(ViewModel, vm => vm.Kcpcongestion, v => v.togKcpcongestion.IsChecked).DisposeWith(disposables);
|
|
||||||
|
|
||||||
this.Bind(ViewModel, vm => vm.AutoRun, v => v.togAutoRun.IsChecked).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.EnableStatistics, v => v.togEnableStatistics.IsChecked).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.KeepOlderDedupl, v => v.togKeepOlderDedupl.IsChecked).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.IgnoreGeoUpdateCore, v => v.togIgnoreGeoUpdateCore.IsChecked).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.EnableAutoAdjustMainLvColWidth, v => v.togEnableAutoAdjustMainLvColWidth.IsChecked).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.EnableUpdateSubOnlyRemarksExist, v => v.togEnableUpdateSubOnlyRemarksExist.IsChecked).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.EnableSecurityProtocolTls13, v => v.togEnableSecurityProtocolTls13.IsChecked).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.AutoHideStartup, v => v.togAutoHideStartup.IsChecked).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.EnableCheckPreReleaseUpdate, v => v.togEnableCheckPreReleaseUpdate.IsChecked).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.EnableDragDropSort, v => v.togEnableDragDropSort.IsChecked).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.DoubleClick2Activate, v => v.togDoubleClick2Activate.IsChecked).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.autoUpdateInterval, v => v.txtautoUpdateInterval.Text).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.trayMenuServersLimit, v => v.txttrayMenuServersLimit.Text).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.currentFontFamily, v => v.cmbcurrentFontFamily.Text).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.SpeedTestTimeout, v => v.cmbSpeedTestTimeout.Text).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.SpeedTestUrl, v => v.cmbSpeedTestUrl.Text).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.SpeedPingTestUrl, v => v.cmbSpeedPingTestUrl.Text).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.EnableHWA, v => v.togEnableHWA.IsChecked).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.SubConvertUrl, v => v.cmbSubConvertUrl.Text).DisposeWith(disposables);
|
|
||||||
|
|
||||||
this.Bind(ViewModel, vm => vm.systemProxyAdvancedProtocol, v => v.cmbsystemProxyAdvancedProtocol.Text).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.systemProxyExceptions, v => v.txtsystemProxyExceptions.Text).DisposeWith(disposables);
|
|
||||||
|
|
||||||
this.Bind(ViewModel, vm => vm.TunStrictRoute, v => v.togStrictRoute.IsChecked).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.TunStack, v => v.cmbStack.Text).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.TunMtu, v => v.cmbMtu.Text).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.TunEnableExInbound, v => v.togEnableExInbound.IsChecked).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.TunEnableIPv6Address, v => v.togEnableIPv6Address.IsChecked).DisposeWith(disposables);
|
|
||||||
|
|
||||||
this.Bind(ViewModel, vm => vm.CoreType1, v => v.cmbCoreType1.Text).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.CoreType2, v => v.cmbCoreType2.Text).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.CoreType3, v => v.cmbCoreType3.Text).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.CoreType4, v => v.cmbCoreType4.Text).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.CoreType5, v => v.cmbCoreType5.Text).DisposeWith(disposables);
|
|
||||||
this.Bind(ViewModel, vm => vm.CoreType6, v => v.cmbCoreType6.Text).DisposeWith(disposables);
|
|
||||||
|
|
||||||
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables);
|
|
||||||
});
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -4,6 +4,7 @@
|
|||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:conv="clr-namespace:v2rayN.Converters"
|
xmlns:conv="clr-namespace:v2rayN.Converters"
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
|
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
xmlns:reactiveui="http://reactiveui.net"
|
xmlns:reactiveui="http://reactiveui.net"
|
||||||
xmlns:resx="clr-namespace:v2rayN.Resx"
|
xmlns:resx="clr-namespace:v2rayN.Resx"
|
||||||
@@ -83,6 +84,7 @@
|
|||||||
Style="{StaticResource ToolbarTextBlock}">
|
Style="{StaticResource ToolbarTextBlock}">
|
||||||
<Hyperlink Click="linkRuleobjectDoc_Click">
|
<Hyperlink Click="linkRuleobjectDoc_Click">
|
||||||
<TextBlock Text="{x:Static resx:ResUI.TbRuleobjectDoc}" />
|
<TextBlock Text="{x:Static resx:ResUI.TbRuleobjectDoc}" />
|
||||||
|
<materialDesign:PackIcon Kind="Link" />
|
||||||
</Hyperlink>
|
</Hyperlink>
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
|
|
||||||
|
|||||||
@@ -83,7 +83,7 @@ namespace v2rayN.Views
|
|||||||
|
|
||||||
private void linkRuleobjectDoc_Click(object sender, RoutedEventArgs e)
|
private void linkRuleobjectDoc_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
Utils.ProcessStart("https://www.v2fly.org/config/routing.html#ruleobject");
|
Utils.ProcessStart("https://xtls.github.io/config/routing.html#ruleobject");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -114,11 +114,16 @@
|
|||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Style="{StaticResource ToolbarTextBlock}"
|
Style="{StaticResource ToolbarTextBlock}"
|
||||||
Text="{x:Static resx:ResUI.LvRemarks}" />
|
Text="{x:Static resx:ResUI.LvRemarks}" />
|
||||||
|
<StackPanel
|
||||||
|
Grid.Row="0"
|
||||||
|
Grid.Column="1"
|
||||||
|
Orientation="Horizontal">
|
||||||
|
|
||||||
<TextBox
|
<TextBox
|
||||||
x:Name="txtRemarks"
|
x:Name="txtRemarks"
|
||||||
Grid.Row="0"
|
Grid.Row="0"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Width="400"
|
Width="300"
|
||||||
Margin="4"
|
Margin="4"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
VerticalAlignment="Top"
|
VerticalAlignment="Top"
|
||||||
@@ -126,6 +131,20 @@
|
|||||||
Style="{StaticResource DefTextBox}"
|
Style="{StaticResource DefTextBox}"
|
||||||
TextWrapping="Wrap" />
|
TextWrapping="Wrap" />
|
||||||
|
|
||||||
|
<TextBlock
|
||||||
|
Margin="4"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Style="{StaticResource ToolbarTextBlock}"
|
||||||
|
Text="{x:Static resx:ResUI.LvSort}" />
|
||||||
|
<TextBox
|
||||||
|
x:Name="txtSort"
|
||||||
|
Width="100"
|
||||||
|
Margin="4"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
AcceptsReturn="True"
|
||||||
|
Style="{StaticResource DefTextBox}" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
@@ -190,11 +209,11 @@
|
|||||||
Style="{StaticResource DefTextBox}"
|
Style="{StaticResource DefTextBox}"
|
||||||
TextWrapping="Wrap" />
|
TextWrapping="Wrap" />
|
||||||
<Button
|
<Button
|
||||||
x:Name="btnBrowse"
|
x:Name="btnBrowseCustomIcon"
|
||||||
Grid.Row="3"
|
Grid.Row="3"
|
||||||
Grid.Column="2"
|
Grid.Column="2"
|
||||||
Margin="2,0,8,0"
|
Margin="2,0,8,0"
|
||||||
Click="btnBrowse_Click"
|
Click="btnBrowseCustomIcon_Click"
|
||||||
Content="{x:Static resx:ResUI.TbBrowse}"
|
Content="{x:Static resx:ResUI.TbBrowse}"
|
||||||
Style="{StaticResource DefButton}" />
|
Style="{StaticResource DefButton}" />
|
||||||
|
|
||||||
@@ -203,17 +222,30 @@
|
|||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
Margin="4"
|
Margin="4"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Style="{StaticResource ToolbarTextBlock}"
|
Style="{StaticResource ToolbarTextBlock}">
|
||||||
Text="{x:Static resx:ResUI.LvSort}" />
|
<Hyperlink Click="linkCustomRulesetPath4Singbox">
|
||||||
|
<TextBlock Text="{x:Static resx:ResUI.LvCustomRulesetPath4Singbox}" />
|
||||||
|
<materialDesign:PackIcon Kind="Link" />
|
||||||
|
</Hyperlink>
|
||||||
|
</TextBlock>
|
||||||
<TextBox
|
<TextBox
|
||||||
x:Name="txtSort"
|
x:Name="txtCustomRulesetPath4Singbox"
|
||||||
Grid.Row="4"
|
Grid.Row="4"
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Width="200"
|
Width="600"
|
||||||
Margin="4"
|
Margin="4"
|
||||||
HorizontalAlignment="Left"
|
VerticalAlignment="Top"
|
||||||
AcceptsReturn="True"
|
AcceptsReturn="True"
|
||||||
Style="{StaticResource DefTextBox}" />
|
Style="{StaticResource DefTextBox}"
|
||||||
|
TextWrapping="Wrap" />
|
||||||
|
<Button
|
||||||
|
x:Name="btnBrowseCustomRulesetPath4Singbox"
|
||||||
|
Grid.Row="4"
|
||||||
|
Grid.Column="2"
|
||||||
|
Margin="2,0,8,0"
|
||||||
|
Click="btnBrowseCustomRulesetPath4Singbox_Click"
|
||||||
|
Content="{x:Static resx:ResUI.TbBrowse}"
|
||||||
|
Style="{StaticResource DefButton}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<TabControl x:Name="tabAdvanced">
|
<TabControl x:Name="tabAdvanced">
|
||||||
|
|||||||
@@ -51,6 +51,7 @@ namespace v2rayN.Views
|
|||||||
|
|
||||||
this.Bind(ViewModel, vm => vm.SelectedRouting.url, v => v.txtUrl.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SelectedRouting.url, v => v.txtUrl.Text).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.SelectedRouting.customIcon, v => v.txtCustomIcon.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SelectedRouting.customIcon, v => v.txtCustomIcon.Text).DisposeWith(disposables);
|
||||||
|
this.Bind(ViewModel, vm => vm.SelectedRouting.customRulesetPath4Singbox, v => v.txtCustomRulesetPath4Singbox.Text).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.SelectedRouting.sort, v => v.txtSort.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SelectedRouting.sort, v => v.txtSort.Text).DisposeWith(disposables);
|
||||||
|
|
||||||
this.BindCommand(ViewModel, vm => vm.RuleAddCmd, v => v.menuRuleAdd).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.RuleAddCmd, v => v.menuRuleAdd).DisposeWith(disposables);
|
||||||
@@ -128,7 +129,7 @@ namespace v2rayN.Views
|
|||||||
lstRules.SelectAll();
|
lstRules.SelectAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnBrowse_Click(object sender, System.Windows.RoutedEventArgs e)
|
private void btnBrowseCustomIcon_Click(object sender, System.Windows.RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (UI.OpenFileDialog(out string fileName,
|
if (UI.OpenFileDialog(out string fileName,
|
||||||
"PNG,ICO|*.png;*.ico") != true)
|
"PNG,ICO|*.png;*.ico") != true)
|
||||||
@@ -138,5 +139,21 @@ namespace v2rayN.Views
|
|||||||
|
|
||||||
txtCustomIcon.Text = fileName;
|
txtCustomIcon.Text = fileName;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void btnBrowseCustomRulesetPath4Singbox_Click(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
if (UI.OpenFileDialog(out string fileName,
|
||||||
|
"Config|*.json|All|*.*") != true)
|
||||||
|
{
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
txtCustomRulesetPath4Singbox.Text = fileName;
|
||||||
|
}
|
||||||
|
|
||||||
|
private void linkCustomRulesetPath4Singbox(object sender, RoutedEventArgs e)
|
||||||
|
{
|
||||||
|
Utils.ProcessStart("https://github.com/2dust/v2rayCustomRoutingList/blob/master/singbox_custom_ruleset_example.json");
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -90,6 +90,7 @@
|
|||||||
Style="{StaticResource ToolbarTextBlock}">
|
Style="{StaticResource ToolbarTextBlock}">
|
||||||
<Hyperlink Click="linkdomainStrategy_Click">
|
<Hyperlink Click="linkdomainStrategy_Click">
|
||||||
<TextBlock Text="{x:Static resx:ResUI.TbdomainStrategy}" />
|
<TextBlock Text="{x:Static resx:ResUI.TbdomainStrategy}" />
|
||||||
|
<materialDesign:PackIcon Kind="Link" />
|
||||||
</Hyperlink>
|
</Hyperlink>
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
<ComboBox
|
<ComboBox
|
||||||
@@ -115,6 +116,7 @@
|
|||||||
Style="{StaticResource ToolbarTextBlock}">
|
Style="{StaticResource ToolbarTextBlock}">
|
||||||
<Hyperlink Click="linkdomainStrategy4Singbox_Click">
|
<Hyperlink Click="linkdomainStrategy4Singbox_Click">
|
||||||
<TextBlock Text="{x:Static resx:ResUI.TbdomainStrategy4Singbox}" />
|
<TextBlock Text="{x:Static resx:ResUI.TbdomainStrategy4Singbox}" />
|
||||||
|
<materialDesign:PackIcon Kind="Link" />
|
||||||
</Hyperlink>
|
</Hyperlink>
|
||||||
</TextBlock>
|
</TextBlock>
|
||||||
<ComboBox
|
<ComboBox
|
||||||
@@ -199,9 +201,9 @@
|
|||||||
<Style BasedOn="{StaticResource MaterialDesignDataGridCell}" TargetType="DataGridCell">
|
<Style BasedOn="{StaticResource MaterialDesignDataGridCell}" TargetType="DataGridCell">
|
||||||
<Style.Triggers>
|
<Style.Triggers>
|
||||||
<DataTrigger Binding="{Binding isActive}" Value="True">
|
<DataTrigger Binding="{Binding isActive}" Value="True">
|
||||||
<Setter Property="Background" Value="{DynamicResource PrimaryHueLightBrush}" />
|
<Setter Property="Background" Value="{DynamicResource MaterialDesign.Brush.Primary.Light}" />
|
||||||
<Setter Property="Foreground" Value="Black" />
|
<Setter Property="Foreground" Value="Black" />
|
||||||
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryHueLightBrush}" />
|
<Setter Property="BorderBrush" Value="{DynamicResource MaterialDesign.Brush.Primary.Light}" />
|
||||||
</DataTrigger>
|
</DataTrigger>
|
||||||
</Style.Triggers>
|
</Style.Triggers>
|
||||||
</Style>
|
</Style>
|
||||||
|
|||||||
@@ -127,7 +127,7 @@ namespace v2rayN.Views
|
|||||||
|
|
||||||
private void linkdomainStrategy_Click(object sender, System.Windows.RoutedEventArgs e)
|
private void linkdomainStrategy_Click(object sender, System.Windows.RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
Utils.ProcessStart("https://www.v2fly.org/config/routing.html");
|
Utils.ProcessStart("https://xtls.github.io/config/routing.html");
|
||||||
}
|
}
|
||||||
|
|
||||||
private void linkdomainStrategy4Singbox_Click(object sender, RoutedEventArgs e)
|
private void linkdomainStrategy4Singbox_Click(object sender, RoutedEventArgs e)
|
||||||
|
|||||||
@@ -23,7 +23,10 @@
|
|||||||
TextOptions.TextRenderingMode="Auto"
|
TextOptions.TextRenderingMode="Auto"
|
||||||
WindowStartupLocation="CenterScreen"
|
WindowStartupLocation="CenterScreen"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<materialDesign:DialogHost Identifier="SubDialog" Style="{StaticResource MaterialDesignEmbeddedDialogHost}">
|
<materialDesign:DialogHost
|
||||||
|
materialDesign:TransitionAssist.DisableTransitions="True"
|
||||||
|
Identifier="SubDialog"
|
||||||
|
Style="{StaticResource MaterialDesignEmbeddedDialogHost}">
|
||||||
<DockPanel>
|
<DockPanel>
|
||||||
<ToolBarTray DockPanel.Dock="Top">
|
<ToolBarTray DockPanel.Dock="Top">
|
||||||
<ToolBar
|
<ToolBar
|
||||||
|
|||||||
@@ -10,22 +10,22 @@
|
|||||||
<ImplicitUsings>enable</ImplicitUsings>
|
<ImplicitUsings>enable</ImplicitUsings>
|
||||||
<ApplicationIcon>v2rayN.ico</ApplicationIcon>
|
<ApplicationIcon>v2rayN.ico</ApplicationIcon>
|
||||||
<Copyright>Copyright © 2017-2024 (GPLv3)</Copyright>
|
<Copyright>Copyright © 2017-2024 (GPLv3)</Copyright>
|
||||||
<FileVersion>6.41</FileVersion>
|
<FileVersion>6.45</FileVersion>
|
||||||
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
|
<SupportedOSPlatformVersion>7.0</SupportedOSPlatformVersion>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="Downloader" Version="3.0.6" />
|
<PackageReference Include="Downloader" Version="3.0.6" />
|
||||||
<PackageReference Include="MaterialDesignThemes" Version="4.9.0" />
|
<PackageReference Include="MaterialDesignThemes" Version="5.0.0" />
|
||||||
<PackageReference Include="H.NotifyIcon.Wpf" Version="2.0.124" />
|
<PackageReference Include="H.NotifyIcon.Wpf" Version="2.0.131" />
|
||||||
<PackageReference Include="QRCoder.Xaml" Version="1.4.3" />
|
<PackageReference Include="QRCoder.Xaml" Version="1.5.1" />
|
||||||
<PackageReference Include="sqlite-net-pcl" Version="1.9.172" />
|
<PackageReference Include="sqlite-net-pcl" Version="1.9.172" />
|
||||||
<PackageReference Include="TaskScheduler" Version="2.10.1" />
|
<PackageReference Include="TaskScheduler" Version="2.11.0" />
|
||||||
<PackageReference Include="ZXing.Net.Bindings.Windows.Compatibility" Version="0.16.12" />
|
<PackageReference Include="ZXing.Net.Bindings.Windows.Compatibility" Version="0.16.12" />
|
||||||
<PackageReference Include="ReactiveUI.Fody" Version="19.5.41" />
|
<PackageReference Include="ReactiveUI.Fody" Version="19.5.41" />
|
||||||
<PackageReference Include="ReactiveUI.Validation" Version="3.1.7" />
|
<PackageReference Include="ReactiveUI.Validation" Version="4.0.9" />
|
||||||
<PackageReference Include="ReactiveUI.WPF" Version="19.6.1" />
|
<PackageReference Include="ReactiveUI.WPF" Version="20.0.1" />
|
||||||
<PackageReference Include="Splat.NLog" Version="14.8.12" />
|
<PackageReference Include="Splat.NLog" Version="15.1.1" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
|||||||
Reference in New Issue
Block a user