mirror of
https://github.com/2dust/v2rayN.git
synced 2025-07-01 20:42:10 +00:00
Code clean
This commit is contained in:
parent
165454dc57
commit
bf6dcdf2bd
98 changed files with 715 additions and 538 deletions
|
@ -17,11 +17,10 @@ public class PacHandler
|
||||||
private static bool _isRunning;
|
private static bool _isRunning;
|
||||||
private static bool _needRestart = true;
|
private static bool _needRestart = true;
|
||||||
|
|
||||||
|
|
||||||
public static void Start(string configPath, int httpPort, int pacPort)
|
public static void Start(string configPath, int httpPort, int pacPort)
|
||||||
{
|
{
|
||||||
_needRestart = (configPath != _configPath || httpPort != _httpPort || pacPort != _pacPort || !_isRunning);
|
_needRestart = (configPath != _configPath || httpPort != _httpPort || pacPort != _pacPort || !_isRunning);
|
||||||
|
|
||||||
_configPath = configPath;
|
_configPath = configPath;
|
||||||
_httpPort = httpPort;
|
_httpPort = httpPort;
|
||||||
_pacPort = pacPort;
|
_pacPort = pacPort;
|
||||||
|
@ -83,9 +82,7 @@ public class PacHandler
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}, TaskCreationOptions.LongRunning);
|
}, TaskCreationOptions.LongRunning);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void Stop()
|
public static void Stop()
|
||||||
|
|
|
@ -8,8 +8,6 @@ namespace ProtosLib
|
||||||
|
|
||||||
public Tests()
|
public Tests()
|
||||||
{
|
{
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,10 +1,9 @@
|
||||||
<Application
|
<Application
|
||||||
x:Class="v2rayN.App"
|
x:Class="v2rayN.App"
|
||||||
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: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:local="clr-namespace:v2rayN"
|
|
||||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
|
||||||
ShutdownMode="OnExplicitShutdown"
|
ShutdownMode="OnExplicitShutdown"
|
||||||
StartupUri="Views/MainWindow.xaml">
|
StartupUri="Views/MainWindow.xaml">
|
||||||
<Application.Resources>
|
<Application.Resources>
|
||||||
|
@ -141,10 +140,6 @@
|
||||||
TargetType="{x:Type ListBoxItem}">
|
TargetType="{x:Type ListBoxItem}">
|
||||||
<Setter Property="Margin" Value="-2,0" />
|
<Setter Property="Margin" Value="-2,0" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
|
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
|
|
||||||
</Application.Resources>
|
</Application.Resources>
|
||||||
|
</Application>
|
||||||
</Application>
|
|
|
@ -1,5 +1,4 @@
|
||||||
using System.Runtime.InteropServices;
|
using System.Windows;
|
||||||
using System.Windows;
|
|
||||||
using System.Windows.Threading;
|
using System.Windows.Threading;
|
||||||
using v2rayN.Handler;
|
using v2rayN.Handler;
|
||||||
using v2rayN.Mode;
|
using v2rayN.Mode;
|
||||||
|
@ -49,13 +48,11 @@ namespace v2rayN
|
||||||
Utils.SaveLog($"v2rayN start up | {Utils.GetVersion()} | {Utils.GetExePath()}");
|
Utils.SaveLog($"v2rayN start up | {Utils.GetVersion()} | {Utils.GetExePath()}");
|
||||||
Logging.ClearLogs();
|
Logging.ClearLogs();
|
||||||
|
|
||||||
|
|
||||||
Thread.CurrentThread.CurrentUICulture = new(_config.uiItem.currentLanguage);
|
Thread.CurrentThread.CurrentUICulture = new(_config.uiItem.currentLanguage);
|
||||||
|
|
||||||
base.OnStartup(e);
|
base.OnStartup(e);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void Init()
|
private void Init()
|
||||||
{
|
{
|
||||||
if (ConfigHandler.LoadConfig(ref _config) != 0)
|
if (ConfigHandler.LoadConfig(ref _config) != 0)
|
||||||
|
@ -70,6 +67,7 @@ namespace v2rayN
|
||||||
// _config.guiItem.enableStatistics = false;
|
// _config.guiItem.enableStatistics = false;
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
|
private void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
|
||||||
{
|
{
|
||||||
Utils.SaveLog("App_DispatcherUnhandledException", e.Exception);
|
Utils.SaveLog("App_DispatcherUnhandledException", e.Exception);
|
||||||
|
@ -89,4 +87,4 @@ namespace v2rayN
|
||||||
Utils.SaveLog("TaskScheduler_UnobservedTaskException", e.Exception);
|
Utils.SaveLog("TaskScheduler_UnobservedTaskException", e.Exception);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,4 +7,4 @@ using System.Windows;
|
||||||
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
|
||||||
//(used if a resource is not found in the page,
|
//(used if a resource is not found in the page,
|
||||||
// app, or any theme specific resource dictionaries)
|
// app, or any theme specific resource dictionaries)
|
||||||
)]
|
)]
|
|
@ -56,7 +56,6 @@ namespace v2rayN.Base
|
||||||
return reader.ReadToEnd();
|
return reader.ReadToEnd();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public async Task DownloadDataAsync4Speed(IWebProxy webProxy, string url, IProgress<string> progress, int timeout)
|
public async Task DownloadDataAsync4Speed(IWebProxy webProxy, string url, IProgress<string> progress, int timeout)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(url))
|
if (string.IsNullOrEmpty(url))
|
||||||
|
|
|
@ -9,12 +9,13 @@ namespace v2rayN.Base
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public class HttpClientHelper
|
public class HttpClientHelper
|
||||||
{
|
{
|
||||||
private readonly static Lazy<HttpClientHelper> _instance = new(() =>
|
private static readonly Lazy<HttpClientHelper> _instance = new(() =>
|
||||||
{
|
{
|
||||||
HttpClientHandler handler = new() { UseCookies = false };
|
HttpClientHandler handler = new() { UseCookies = false };
|
||||||
HttpClientHelper helper = new(new HttpClient(handler));
|
HttpClientHelper helper = new(new HttpClient(handler));
|
||||||
return helper;
|
return helper;
|
||||||
});
|
});
|
||||||
|
|
||||||
public static HttpClientHelper Instance => _instance.Value;
|
public static HttpClientHelper Instance => _instance.Value;
|
||||||
private readonly HttpClient httpClient;
|
private readonly HttpClient httpClient;
|
||||||
|
|
||||||
|
@ -82,7 +83,6 @@ namespace v2rayN.Base
|
||||||
if (canReportProgress)
|
if (canReportProgress)
|
||||||
{
|
{
|
||||||
progress!.Report(101);
|
progress!.Report(101);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -136,7 +136,7 @@ namespace v2rayN.Base
|
||||||
var data = new byte[read];
|
var data = new byte[read];
|
||||||
buffer.ToList().CopyTo(0, data, 0, read);
|
buffer.ToList().CopyTo(0, data, 0, read);
|
||||||
|
|
||||||
// TODO:
|
// TODO:
|
||||||
totalRead += read;
|
totalRead += read;
|
||||||
|
|
||||||
TimeSpan ts = (DateTime.Now - totalDatetime);
|
TimeSpan ts = (DateTime.Now - totalDatetime);
|
||||||
|
@ -153,6 +153,5 @@ namespace v2rayN.Base
|
||||||
}
|
}
|
||||||
} while (isMoreToRead);
|
} while (isMoreToRead);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -5,6 +5,5 @@ namespace v2rayN.Base
|
||||||
internal class MyDGTextColumn : DataGridTextColumn
|
internal class MyDGTextColumn : DataGridTextColumn
|
||||||
{
|
{
|
||||||
public string ExName { get; set; }
|
public string ExName { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,4 @@
|
||||||
|
using SQLite;
|
||||||
using SQLite;
|
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
|
||||||
namespace v2rayN.Base
|
namespace v2rayN.Base
|
||||||
|
@ -29,6 +28,7 @@ namespace v2rayN.Base
|
||||||
{
|
{
|
||||||
return _db.Insert(model);
|
return _db.Insert(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int InsertAll(IEnumerable models)
|
public int InsertAll(IEnumerable models)
|
||||||
{
|
{
|
||||||
lock (objLock)
|
lock (objLock)
|
||||||
|
@ -36,10 +36,12 @@ namespace v2rayN.Base
|
||||||
return _db.InsertAll(models);
|
return _db.InsertAll(models);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<int> InsertAsync(object model)
|
public async Task<int> InsertAsync(object model)
|
||||||
{
|
{
|
||||||
return await _dbAsync.InsertAsync(model);
|
return await _dbAsync.InsertAsync(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Replace(object model)
|
public int Replace(object model)
|
||||||
{
|
{
|
||||||
lock (objLock)
|
lock (objLock)
|
||||||
|
@ -47,6 +49,7 @@ namespace v2rayN.Base
|
||||||
return _db.InsertOrReplace(model);
|
return _db.InsertOrReplace(model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<int> Replacesync(object model)
|
public async Task<int> Replacesync(object model)
|
||||||
{
|
{
|
||||||
return await _dbAsync.InsertOrReplaceAsync(model);
|
return await _dbAsync.InsertOrReplaceAsync(model);
|
||||||
|
@ -59,10 +62,12 @@ namespace v2rayN.Base
|
||||||
return _db.Update(model);
|
return _db.Update(model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<int> UpdateAsync(object model)
|
public async Task<int> UpdateAsync(object model)
|
||||||
{
|
{
|
||||||
return await _dbAsync.UpdateAsync(model);
|
return await _dbAsync.UpdateAsync(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int UpdateAll(IEnumerable models)
|
public int UpdateAll(IEnumerable models)
|
||||||
{
|
{
|
||||||
lock (objLock)
|
lock (objLock)
|
||||||
|
@ -78,22 +83,27 @@ namespace v2rayN.Base
|
||||||
return _db.Delete(model);
|
return _db.Delete(model);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<int> DeleteAsync(object model)
|
public async Task<int> DeleteAsync(object model)
|
||||||
{
|
{
|
||||||
return await _dbAsync.DeleteAsync(model);
|
return await _dbAsync.DeleteAsync(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<T> Query<T>(string sql) where T : new()
|
public List<T> Query<T>(string sql) where T : new()
|
||||||
{
|
{
|
||||||
return _db.Query<T>(sql);
|
return _db.Query<T>(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<List<T>> QueryAsync<T>(string sql) where T : new()
|
public async Task<List<T>> QueryAsync<T>(string sql) where T : new()
|
||||||
{
|
{
|
||||||
return await _dbAsync.QueryAsync<T>(sql);
|
return await _dbAsync.QueryAsync<T>(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
public int Execute(string sql)
|
public int Execute(string sql)
|
||||||
{
|
{
|
||||||
return _db.Execute(sql);
|
return _db.Execute(sql);
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task<int> ExecuteAsync(string sql)
|
public async Task<int> ExecuteAsync(string sql)
|
||||||
{
|
{
|
||||||
return await _dbAsync.ExecuteAsync(sql);
|
return await _dbAsync.ExecuteAsync(sql);
|
||||||
|
@ -103,6 +113,7 @@ namespace v2rayN.Base
|
||||||
{
|
{
|
||||||
return _db.Table<T>();
|
return _db.Table<T>();
|
||||||
}
|
}
|
||||||
|
|
||||||
public AsyncTableQuery<T> TableAsync<T>() where T : new()
|
public AsyncTableQuery<T> TableAsync<T>() where T : new()
|
||||||
{
|
{
|
||||||
return _dbAsync.Table<T>();
|
return _dbAsync.Table<T>();
|
||||||
|
|
|
@ -3,7 +3,7 @@ using System.IO;
|
||||||
|
|
||||||
namespace v2rayN.Base
|
namespace v2rayN.Base
|
||||||
{
|
{
|
||||||
static class StringEx
|
internal static class StringEx
|
||||||
{
|
{
|
||||||
public static bool IsNullOrEmpty([NotNullWhen(false)] this string? value)
|
public static bool IsNullOrEmpty([NotNullWhen(false)] this string? value)
|
||||||
{
|
{
|
||||||
|
@ -32,7 +32,6 @@ namespace v2rayN.Base
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static IEnumerable<string> NonWhiteSpaceLines(this TextReader reader)
|
public static IEnumerable<string> NonWhiteSpaceLines(this TextReader reader)
|
||||||
{
|
{
|
||||||
string? line;
|
string? line;
|
||||||
|
@ -48,4 +47,4 @@ namespace v2rayN.Base
|
||||||
return value == null ? string.Empty : value.Trim();
|
return value == null ? string.Empty : value.Trim();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -22,4 +22,4 @@ namespace v2rayN.Converters
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,8 +1,9 @@
|
||||||
namespace v2rayN
|
namespace v2rayN
|
||||||
{
|
{
|
||||||
class Global
|
internal class Global
|
||||||
{
|
{
|
||||||
#region const
|
#region const
|
||||||
|
|
||||||
public const string githubUrl = "https://github.com";
|
public const string githubUrl = "https://github.com";
|
||||||
public const string githubApiUrl = "https://api.github.com/repos";
|
public const string githubApiUrl = "https://api.github.com/repos";
|
||||||
public const string v2rayWebsiteUrl = @"https://www.v2fly.org/";
|
public const string v2rayWebsiteUrl = @"https://www.v2fly.org/";
|
||||||
|
@ -89,6 +90,7 @@
|
||||||
"http=http://{ip}:{http_port};https=http://{ip}:{http_port}",
|
"http=http://{ip}:{http_port};https=http://{ip}:{http_port}",
|
||||||
""
|
""
|
||||||
};
|
};
|
||||||
|
|
||||||
public static readonly List<string> vmessSecuritys = new() { "aes-128-gcm", "chacha20-poly1305", "auto", "none", "zero" };
|
public static readonly List<string> vmessSecuritys = new() { "aes-128-gcm", "chacha20-poly1305", "auto", "none", "zero" };
|
||||||
public static readonly List<string> ssSecuritys = new() { "aes-256-gcm", "aes-128-gcm", "chacha20-poly1305", "chacha20-ietf-poly1305", "none", "plain" };
|
public static readonly List<string> ssSecuritys = new() { "aes-256-gcm", "aes-128-gcm", "chacha20-poly1305", "chacha20-ietf-poly1305", "none", "plain" };
|
||||||
public static readonly List<string> ssSecuritysInSagerNet = new() { "none", "2022-blake3-aes-128-gcm", "2022-blake3-aes-256-gcm", "2022-blake3-chacha20-poly1305", "aes-128-gcm", "aes-192-gcm", "aes-256-gcm", "chacha20-ietf-poly1305", "xchacha20-ietf-poly1305", "rc4", "rc4-md5", "aes-128-ctr", "aes-192-ctr", "aes-256-ctr", "aes-128-cfb", "aes-192-cfb", "aes-256-cfb", "aes-128-cfb8", "aes-192-cfb8", "aes-256-cfb8", "aes-128-ofb", "aes-192-ofb", "aes-256-ofb", "bf-cfb", "cast5-cfb", "des-cfb", "idea-cfb", "rc2-cfb", "seed-cfb", "camellia-128-cfb", "camellia-192-cfb", "camellia-256-cfb", "camellia-128-cfb8", "camellia-192-cfb8", "camellia-256-cfb8", "salsa20", "chacha20", "chacha20-ietf", "xchacha20" };
|
public static readonly List<string> ssSecuritysInSagerNet = new() { "none", "2022-blake3-aes-128-gcm", "2022-blake3-aes-256-gcm", "2022-blake3-chacha20-poly1305", "aes-128-gcm", "aes-192-gcm", "aes-256-gcm", "chacha20-ietf-poly1305", "xchacha20-ietf-poly1305", "rc4", "rc4-md5", "aes-128-ctr", "aes-192-ctr", "aes-256-ctr", "aes-128-cfb", "aes-192-cfb", "aes-256-cfb", "aes-128-cfb8", "aes-192-cfb8", "aes-256-cfb8", "aes-128-ofb", "aes-192-ofb", "aes-256-ofb", "bf-cfb", "cast5-cfb", "des-cfb", "idea-cfb", "rc2-cfb", "seed-cfb", "camellia-128-cfb", "camellia-192-cfb", "camellia-256-cfb", "camellia-128-cfb8", "camellia-192-cfb8", "camellia-256-cfb8", "salsa20", "chacha20", "chacha20-ietf", "xchacha20" };
|
||||||
|
@ -101,6 +103,7 @@
|
||||||
public static readonly List<string> domainMatchers = new() { "linear", "mph", "" };
|
public static readonly List<string> domainMatchers = new() { "linear", "mph", "" };
|
||||||
public static readonly List<string> fingerprints = new() { "chrome", "firefox", "safari", "ios", "android", "edge", "360", "qq", "random", "randomized", "" };
|
public static readonly List<string> fingerprints = new() { "chrome", "firefox", "safari", "ios", "android", "edge", "360", "qq", "random", "randomized", "" };
|
||||||
public static readonly List<string> userAgent = new() { "chrome", "firefox", "safari", "edge", "none" };
|
public static readonly List<string> userAgent = new() { "chrome", "firefox", "safari", "edge", "none" };
|
||||||
|
|
||||||
public static readonly Dictionary<string, string> userAgentTxt = new()
|
public static readonly Dictionary<string, string> userAgentTxt = new()
|
||||||
{
|
{
|
||||||
{"chrome","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36" },
|
{"chrome","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/92.0.4515.131 Safari/537.36" },
|
||||||
|
@ -109,6 +112,7 @@
|
||||||
{"edge","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36 Edg/91.0.864.70" },
|
{"edge","Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/91.0.4472.124 Safari/537.36 Edg/91.0.864.70" },
|
||||||
{"none",""}
|
{"none",""}
|
||||||
};
|
};
|
||||||
|
|
||||||
public static readonly List<string> allowInsecures = new() { "true", "false", "" };
|
public static readonly List<string> allowInsecures = new() { "true", "false", "" };
|
||||||
public static readonly List<string> domainStrategy4Freedoms = new() { "AsIs", "UseIP", "UseIPv4", "UseIPv6", "" };
|
public static readonly List<string> domainStrategy4Freedoms = new() { "AsIs", "UseIP", "UseIPv4", "UseIPv6", "" };
|
||||||
public static readonly List<string> Languages = new() { "zh-Hans", "en", "fa-Ir", "ru" };
|
public static readonly List<string> Languages = new() { "zh-Hans", "en", "fa-Ir", "ru" };
|
||||||
|
@ -121,7 +125,7 @@
|
||||||
public static readonly List<string> PresetMsgFilters = new() { "proxy", "direct", "block", "" };
|
public static readonly List<string> PresetMsgFilters = new() { "proxy", "direct", "block", "" };
|
||||||
public static readonly List<string> SpeedTestUrls = new() { @"http://cachefly.cachefly.net/100mb.test", @"http://cachefly.cachefly.net/10mb.test" };
|
public static readonly List<string> SpeedTestUrls = new() { @"http://cachefly.cachefly.net/100mb.test", @"http://cachefly.cachefly.net/10mb.test" };
|
||||||
|
|
||||||
#endregion
|
#endregion const
|
||||||
|
|
||||||
#region global variable
|
#region global variable
|
||||||
|
|
||||||
|
@ -130,7 +134,6 @@
|
||||||
public static bool ShowInTaskbar { get; set; }
|
public static bool ShowInTaskbar { get; set; }
|
||||||
public static string ExePathKey { get; set; }
|
public static string ExePathKey { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion global variable
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -10,7 +10,7 @@ namespace v2rayN.Handler
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 本软件配置文件处理类
|
/// 本软件配置文件处理类
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class ConfigHandler
|
internal class ConfigHandler
|
||||||
{
|
{
|
||||||
private static string configRes = Global.ConfigFileName;
|
private static string configRes = Global.ConfigFileName;
|
||||||
private static readonly object objLock = new();
|
private static readonly object objLock = new();
|
||||||
|
@ -24,7 +24,7 @@ namespace v2rayN.Handler
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static int LoadConfig(ref Config config)
|
public static int LoadConfig(ref Config config)
|
||||||
{
|
{
|
||||||
//载入配置文件
|
//载入配置文件
|
||||||
string result = Utils.LoadResource(Utils.GetConfigPath(configRes));
|
string result = Utils.LoadResource(Utils.GetConfigPath(configRes));
|
||||||
if (!Utils.IsNullOrEmpty(result))
|
if (!Utils.IsNullOrEmpty(result))
|
||||||
{
|
{
|
||||||
|
@ -198,6 +198,7 @@ namespace v2rayN.Handler
|
||||||
LazyConfig.Instance.SetConfig(config);
|
LazyConfig.Instance.SetConfig(config);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 保参数
|
/// 保参数
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -205,7 +206,6 @@ namespace v2rayN.Handler
|
||||||
/// <returns></returns>
|
/// <returns></returns>
|
||||||
public static int SaveConfig(ref Config config, bool reload = true)
|
public static int SaveConfig(ref Config config, bool reload = true)
|
||||||
{
|
{
|
||||||
|
|
||||||
ToJsonFile(config);
|
ToJsonFile(config);
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
@ -221,7 +221,6 @@ namespace v2rayN.Handler
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
//save temp file
|
//save temp file
|
||||||
var resPath = Utils.GetConfigPath(configRes);
|
var resPath = Utils.GetConfigPath(configRes);
|
||||||
var tempPath = $"{resPath}_temp";
|
var tempPath = $"{resPath}_temp";
|
||||||
|
@ -342,7 +341,8 @@ namespace v2rayN.Handler
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
#endregion ConfigHandler
|
||||||
|
|
||||||
#region Server
|
#region Server
|
||||||
|
|
||||||
|
@ -467,6 +467,7 @@ namespace v2rayN.Handler
|
||||||
}
|
}
|
||||||
return SetDefaultServerIndex(ref config, SqliteHelper.Instance.Table<ProfileItem>().Where(t => t.port > 0).Select(t => t.indexId).FirstOrDefault());
|
return SetDefaultServerIndex(ref config, SqliteHelper.Instance.Table<ProfileItem>().Where(t => t.port > 0).Select(t => t.indexId).FirstOrDefault());
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ProfileItem? GetDefaultServer(ref Config config)
|
public static ProfileItem? GetDefaultServer(ref Config config)
|
||||||
{
|
{
|
||||||
var item = LazyConfig.Instance.GetProfileItem(config.indexId);
|
var item = LazyConfig.Instance.GetProfileItem(config.indexId);
|
||||||
|
@ -592,10 +593,8 @@ namespace v2rayN.Handler
|
||||||
profileItem.remarks = $"import custom@{DateTime.Now.ToShortDateString()}";
|
profileItem.remarks = $"import custom@{DateTime.Now.ToShortDateString()}";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
AddServerCommon(ref config, profileItem, true);
|
AddServerCommon(ref config, profileItem, true);
|
||||||
|
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -682,7 +681,6 @@ namespace v2rayN.Handler
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static int SortServers(ref Config config, string subId, string colName, bool asc)
|
public static int SortServers(ref Config config, string subId, string colName, bool asc)
|
||||||
{
|
{
|
||||||
var lstModel = LazyConfig.Instance.ProfileItems(subId, "");
|
var lstModel = LazyConfig.Instance.ProfileItems(subId, "");
|
||||||
|
@ -709,7 +707,6 @@ namespace v2rayN.Handler
|
||||||
sort = t33 == null ? 0 : t33.sort
|
sort = t33 == null ? 0 : t33.sort
|
||||||
}).ToList();
|
}).ToList();
|
||||||
|
|
||||||
|
|
||||||
Enum.TryParse(colName, true, out EServerColName name);
|
Enum.TryParse(colName, true, out EServerColName name);
|
||||||
var propertyName = string.Empty;
|
var propertyName = string.Empty;
|
||||||
switch (name)
|
switch (name)
|
||||||
|
@ -723,15 +720,19 @@ namespace v2rayN.Handler
|
||||||
case EServerColName.streamSecurity:
|
case EServerColName.streamSecurity:
|
||||||
propertyName = name.ToString();
|
propertyName = name.ToString();
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EServerColName.delayVal:
|
case EServerColName.delayVal:
|
||||||
propertyName = "delay";
|
propertyName = "delay";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EServerColName.speedVal:
|
case EServerColName.speedVal:
|
||||||
propertyName = "speed";
|
propertyName = "speed";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EServerColName.subRemarks:
|
case EServerColName.subRemarks:
|
||||||
propertyName = "subid";
|
propertyName = "subid";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
@ -910,7 +911,8 @@ namespace v2rayN.Handler
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
#endregion Server
|
||||||
|
|
||||||
#region Batch add servers
|
#region Batch add servers
|
||||||
|
|
||||||
|
@ -1123,7 +1125,6 @@ namespace v2rayN.Handler
|
||||||
if (AddCustomServer(ref config, profileItem, true) == 0)
|
if (AddCustomServer(ref config, profileItem, true) == 0)
|
||||||
{
|
{
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -1209,7 +1210,7 @@ namespace v2rayN.Handler
|
||||||
counter = AddBatchServers4SsSIP008(ref config, clipboardData, subid, isSub, lstOriSub);
|
counter = AddBatchServers4SsSIP008(ref config, clipboardData, subid, isSub, lstOriSub);
|
||||||
}
|
}
|
||||||
|
|
||||||
//maybe other sub
|
//maybe other sub
|
||||||
if (counter < 1)
|
if (counter < 1)
|
||||||
{
|
{
|
||||||
counter = AddBatchServers4Custom(ref config, clipboardData, subid, isSub, lstOriSub);
|
counter = AddBatchServers4Custom(ref config, clipboardData, subid, isSub, lstOriSub);
|
||||||
|
@ -1218,8 +1219,7 @@ namespace v2rayN.Handler
|
||||||
return counter;
|
return counter;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion Batch add servers
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Sub & Group
|
#region Sub & Group
|
||||||
|
|
||||||
|
@ -1273,7 +1273,6 @@ namespace v2rayN.Handler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 移除服务器
|
/// 移除服务器
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -1326,9 +1325,10 @@ namespace v2rayN.Handler
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region Routing
|
#endregion Sub & Group
|
||||||
|
|
||||||
|
#region Routing
|
||||||
|
|
||||||
public static int SaveRoutingItem(ref Config config, RoutingItem item)
|
public static int SaveRoutingItem(ref Config config, RoutingItem item)
|
||||||
{
|
{
|
||||||
|
@ -1461,7 +1461,6 @@ namespace v2rayN.Handler
|
||||||
rules.Remove(removeItem);
|
rules.Remove(removeItem);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
@ -1477,6 +1476,7 @@ namespace v2rayN.Handler
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static RoutingItem GetDefaultRouting(ref Config config)
|
public static RoutingItem GetDefaultRouting(ref Config config)
|
||||||
{
|
{
|
||||||
var item = LazyConfig.Instance.GetRoutingItem(config.routingBasicItem.routingIndexId);
|
var item = LazyConfig.Instance.GetRoutingItem(config.routingBasicItem.routingIndexId);
|
||||||
|
@ -1551,6 +1551,7 @@ namespace v2rayN.Handler
|
||||||
{
|
{
|
||||||
SqliteHelper.Instance.Delete(routingItem);
|
SqliteHelper.Instance.Delete(routingItem);
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
#endregion Routing
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -10,7 +10,7 @@ namespace v2rayN.Handler
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Core configuration file processing class
|
/// Core configuration file processing class
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class CoreConfigHandler
|
internal class CoreConfigHandler
|
||||||
{
|
{
|
||||||
private static string SampleClient = Global.v2raySampleClient;
|
private static string SampleClient = Global.v2raySampleClient;
|
||||||
private static string SampleServer = Global.v2raySampleServer;
|
private static string SampleServer = Global.v2raySampleServer;
|
||||||
|
@ -228,6 +228,7 @@ namespace v2rayN.Handler
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static int routingUserRule(RulesItem rules, ref V2rayConfig v2rayConfig)
|
private static int routingUserRule(RulesItem rules, ref V2rayConfig v2rayConfig)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -372,7 +373,6 @@ namespace v2rayN.Handler
|
||||||
serversItem.password = node.id;
|
serversItem.password = node.id;
|
||||||
serversItem.method = LazyConfig.Instance.GetShadowsocksSecuritys(node).Contains(node.security) ? node.security : "none";
|
serversItem.method = LazyConfig.Instance.GetShadowsocksSecuritys(node).Contains(node.security) ? node.security : "none";
|
||||||
|
|
||||||
|
|
||||||
serversItem.ota = false;
|
serversItem.ota = false;
|
||||||
serversItem.level = 1;
|
serversItem.level = 1;
|
||||||
|
|
||||||
|
@ -663,6 +663,7 @@ namespace v2rayN.Handler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "grpc":
|
case "grpc":
|
||||||
GrpcSettings grpcSettings = new()
|
GrpcSettings grpcSettings = new()
|
||||||
{
|
{
|
||||||
|
@ -675,6 +676,7 @@ namespace v2rayN.Handler
|
||||||
};
|
};
|
||||||
streamSettings.grpcSettings = grpcSettings;
|
streamSettings.grpcSettings = grpcSettings;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
//tcp
|
//tcp
|
||||||
if (node.headerType == Global.TcpHeaderHttp)
|
if (node.headerType == Global.TcpHeaderHttp)
|
||||||
|
@ -874,9 +876,10 @@ namespace v2rayN.Handler
|
||||||
case ECoreType.Xray:
|
case ECoreType.Xray:
|
||||||
case ECoreType.v2fly_v5:
|
case ECoreType.v2fly_v5:
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ECoreType.clash:
|
case ECoreType.clash:
|
||||||
case ECoreType.clash_meta:
|
case ECoreType.clash_meta:
|
||||||
//remove the original
|
//remove the original
|
||||||
var indexPort = fileContent.FindIndex(t => t.Contains("port:"));
|
var indexPort = fileContent.FindIndex(t => t.Contains("port:"));
|
||||||
if (indexPort >= 0)
|
if (indexPort >= 0)
|
||||||
{
|
{
|
||||||
|
@ -961,7 +964,7 @@ namespace v2rayN.Handler
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion Generate client configuration
|
||||||
|
|
||||||
#region Generate server-side configuration
|
#region Generate server-side configuration
|
||||||
|
|
||||||
|
@ -1036,7 +1039,6 @@ namespace v2rayN.Handler
|
||||||
{
|
{
|
||||||
inbound.protocol = Global.vmessProtocolLite;
|
inbound.protocol = Global.vmessProtocolLite;
|
||||||
usersItem.alterId = node.alterId;
|
usersItem.alterId = node.alterId;
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (node.configType == EConfigType.VLESS)
|
else if (node.configType == EConfigType.VLESS)
|
||||||
{
|
{
|
||||||
|
@ -1069,7 +1071,8 @@ namespace v2rayN.Handler
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
#endregion Generate server-side configuration
|
||||||
|
|
||||||
#region Import (export) client/server configuration
|
#region Import (export) client/server configuration
|
||||||
|
|
||||||
|
@ -1340,11 +1343,10 @@ namespace v2rayN.Handler
|
||||||
return GenerateServerConfig(node, fileName, out msg);
|
return GenerateServerConfig(node, fileName, out msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion Import (export) client/server configuration
|
||||||
|
|
||||||
#region Gen speedtest config
|
#region Gen speedtest config
|
||||||
|
|
||||||
|
|
||||||
public static string GenerateClientSpeedtestConfigString(Config config, List<ServerTestItem> selecteds, out string msg)
|
public static string GenerateClientSpeedtestConfigString(Config config, List<ServerTestItem> selecteds, out string msg)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -1491,7 +1493,6 @@ namespace v2rayN.Handler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion Gen speedtest config
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -9,13 +9,13 @@ namespace v2rayN.Handler
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Core process processing class
|
/// Core process processing class
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class CoreHandler
|
internal class CoreHandler
|
||||||
{
|
{
|
||||||
private static string _coreCConfigRes = Global.coreConfigFileName;
|
private static string _coreCConfigRes = Global.coreConfigFileName;
|
||||||
private CoreInfo? _coreInfo;
|
private CoreInfo? _coreInfo;
|
||||||
private int _processId = 0;
|
private int _processId = 0;
|
||||||
private Process? _process;
|
private Process? _process;
|
||||||
Action<bool, string> _updateFunc;
|
private Action<bool, string> _updateFunc;
|
||||||
|
|
||||||
public CoreHandler(Action<bool, string> update)
|
public CoreHandler(Action<bool, string> update)
|
||||||
{
|
{
|
||||||
|
@ -119,7 +119,6 @@ namespace v2rayN.Handler
|
||||||
CoreStopPid(_processId);
|
CoreStopPid(_processId);
|
||||||
_processId = 0;
|
_processId = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
|
@ -318,4 +317,4 @@ namespace v2rayN.Handler
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -12,13 +12,12 @@ namespace v2rayN.Handler
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///Download
|
///Download
|
||||||
/// </summary>
|
/// </summary>
|
||||||
class DownloadHandle
|
internal class DownloadHandle
|
||||||
{
|
{
|
||||||
public event EventHandler<ResultEventArgs>? UpdateCompleted;
|
public event EventHandler<ResultEventArgs>? UpdateCompleted;
|
||||||
|
|
||||||
public event ErrorEventHandler? Error;
|
public event ErrorEventHandler? Error;
|
||||||
|
|
||||||
|
|
||||||
public class ResultEventArgs : EventArgs
|
public class ResultEventArgs : EventArgs
|
||||||
{
|
{
|
||||||
public bool Success;
|
public bool Success;
|
||||||
|
@ -175,13 +174,12 @@ namespace v2rayN.Handler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// DownloadString
|
/// DownloadString
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="url"></param>
|
/// <param name="url"></param>
|
||||||
public async Task<string?> DownloadStringAsync(string url, bool blProxy, string userAgent)
|
public async Task<string?> DownloadStringAsync(string url, bool blProxy, string userAgent)
|
||||||
{
|
{
|
||||||
|
@ -228,7 +226,7 @@ namespace v2rayN.Handler
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// DownloadString
|
/// DownloadString
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="url"></param>
|
/// <param name="url"></param>
|
||||||
public async Task<string?> DownloadStringViaDownloader(string url, bool blProxy, string userAgent)
|
public async Task<string?> DownloadStringViaDownloader(string url, bool blProxy, string userAgent)
|
||||||
{
|
{
|
||||||
|
@ -257,7 +255,6 @@ namespace v2rayN.Handler
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public int RunAvailabilityCheck(IWebProxy? webProxy)
|
public int RunAvailabilityCheck(IWebProxy? webProxy)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -345,4 +342,4 @@ namespace v2rayN.Handler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -15,15 +15,20 @@ namespace v2rayN.Handler
|
||||||
public static HotkeyHandler Instance = _instance.Value;
|
public static HotkeyHandler Instance = _instance.Value;
|
||||||
|
|
||||||
private const int WmHotkey = 0x0312;
|
private const int WmHotkey = 0x0312;
|
||||||
|
|
||||||
private Config _config
|
private Config _config
|
||||||
{
|
{
|
||||||
get => LazyConfig.Instance.GetConfig();
|
get => LazyConfig.Instance.GetConfig();
|
||||||
}
|
}
|
||||||
|
|
||||||
private Dictionary<int, List<EGlobalHotkey>> _hotkeyTriggerDic;
|
private Dictionary<int, List<EGlobalHotkey>> _hotkeyTriggerDic;
|
||||||
|
|
||||||
public bool IsPause { get; set; } = false;
|
public bool IsPause { get; set; } = false;
|
||||||
|
|
||||||
public event Action<bool, string>? UpdateViewEvent;
|
public event Action<bool, string>? UpdateViewEvent;
|
||||||
|
|
||||||
public event Action<EGlobalHotkey>? HotkeyTriggerEvent;
|
public event Action<EGlobalHotkey>? HotkeyTriggerEvent;
|
||||||
|
|
||||||
public HotkeyHandler()
|
public HotkeyHandler()
|
||||||
{
|
{
|
||||||
_hotkeyTriggerDic = new();
|
_hotkeyTriggerDic = new();
|
||||||
|
@ -57,6 +62,7 @@ namespace v2rayN.Handler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Load()
|
public void Load()
|
||||||
{
|
{
|
||||||
foreach (var _hotkeyCode in _hotkeyTriggerDic.Keys)
|
foreach (var _hotkeyCode in _hotkeyTriggerDic.Keys)
|
||||||
|
@ -82,7 +88,6 @@ namespace v2rayN.Handler
|
||||||
}
|
}
|
||||||
UpdateViewEvent?.Invoke(false, msg);
|
UpdateViewEvent?.Invoke(false, msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -98,6 +103,7 @@ namespace v2rayN.Handler
|
||||||
Init();
|
Init();
|
||||||
Load();
|
Load();
|
||||||
}
|
}
|
||||||
|
|
||||||
private (int fsModifiers, int vKey, string hotkeyStr, List<string> Names) GetHotkeyInfo(int hotkeycode)
|
private (int fsModifiers, int vKey, string hotkeyStr, List<string> Names) GetHotkeyInfo(int hotkeycode)
|
||||||
{
|
{
|
||||||
var _fsModifiers = hotkeycode & 0xffff;
|
var _fsModifiers = hotkeycode & 0xffff;
|
||||||
|
@ -117,9 +123,9 @@ namespace v2rayN.Handler
|
||||||
_names.Add(name.ToString());
|
_names.Add(name.ToString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
return (_fsModifiers, _vkey, _hotkeyStr.ToString(), _names);
|
return (_fsModifiers, _vkey, _hotkeyStr.ToString(), _names);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnThreadPreProcessMessage(ref MSG msg, ref bool handled)
|
private void OnThreadPreProcessMessage(ref MSG msg, ref bool handled)
|
||||||
{
|
{
|
||||||
if (msg.message != WmHotkey || !_hotkeyTriggerDic.ContainsKey((int)msg.lParam))
|
if (msg.message != WmHotkey || !_hotkeyTriggerDic.ContainsKey((int)msg.lParam))
|
||||||
|
@ -153,11 +159,13 @@ namespace v2rayN.Handler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
[DllImport("user32.dll", SetLastError = true)]
|
[DllImport("user32.dll", SetLastError = true)]
|
||||||
private static extern bool RegisterHotKey(IntPtr hWnd, int id, int fsModifiers, int vlc);
|
private static extern bool RegisterHotKey(IntPtr hWnd, int id, int fsModifiers, int vlc);
|
||||||
|
|
||||||
[DllImport("user32.dll", SetLastError = true)]
|
[DllImport("user32.dll", SetLastError = true)]
|
||||||
private static extern bool UnregisterHotKey(IntPtr hWnd, int id);
|
private static extern bool UnregisterHotKey(IntPtr hWnd, int id);
|
||||||
|
|
||||||
[Flags]
|
[Flags]
|
||||||
private enum KeyModifiers
|
private enum KeyModifiers
|
||||||
{
|
{
|
||||||
|
@ -169,4 +177,4 @@ namespace v2rayN.Handler
|
||||||
NoRepeat = 0x4000
|
NoRepeat = 0x4000
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -26,6 +26,7 @@ namespace v2rayN.Handler
|
||||||
{
|
{
|
||||||
_config = config;
|
_config = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
public Config GetConfig()
|
public Config GetConfig()
|
||||||
{
|
{
|
||||||
return _config;
|
return _config;
|
||||||
|
@ -65,6 +66,7 @@ namespace v2rayN.Handler
|
||||||
{
|
{
|
||||||
return SqliteHelper.Instance.Table<SubItem>().ToList();
|
return SqliteHelper.Instance.Table<SubItem>().ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public SubItem GetSubItem(string subid)
|
public SubItem GetSubItem(string subid)
|
||||||
{
|
{
|
||||||
return SqliteHelper.Instance.Table<SubItem>().FirstOrDefault(t => t.id == subid);
|
return SqliteHelper.Instance.Table<SubItem>().FirstOrDefault(t => t.id == subid);
|
||||||
|
@ -75,19 +77,18 @@ namespace v2rayN.Handler
|
||||||
if (Utils.IsNullOrEmpty(subid))
|
if (Utils.IsNullOrEmpty(subid))
|
||||||
{
|
{
|
||||||
return SqliteHelper.Instance.Table<ProfileItem>().ToList();
|
return SqliteHelper.Instance.Table<ProfileItem>().ToList();
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
return SqliteHelper.Instance.Table<ProfileItem>().Where(t => t.subid == subid).ToList();
|
return SqliteHelper.Instance.Table<ProfileItem>().Where(t => t.subid == subid).ToList();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<string> ProfileItemIndexs(string subid)
|
public List<string> ProfileItemIndexs(string subid)
|
||||||
{
|
{
|
||||||
if (Utils.IsNullOrEmpty(subid))
|
if (Utils.IsNullOrEmpty(subid))
|
||||||
{
|
{
|
||||||
return SqliteHelper.Instance.Table<ProfileItem>().Select(t => t.indexId).ToList();
|
return SqliteHelper.Instance.Table<ProfileItem>().Select(t => t.indexId).ToList();
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -97,10 +98,10 @@ namespace v2rayN.Handler
|
||||||
|
|
||||||
public List<ProfileItemModel> ProfileItems(string subid, string filter)
|
public List<ProfileItemModel> ProfileItems(string subid, string filter)
|
||||||
{
|
{
|
||||||
var sql = @$"select a.*
|
var sql = @$"select a.*
|
||||||
,b.remarks subRemarks
|
,b.remarks subRemarks
|
||||||
from ProfileItem a
|
from ProfileItem a
|
||||||
left join SubItem b on a.subid = b.id
|
left join SubItem b on a.subid = b.id
|
||||||
where 1=1 ";
|
where 1=1 ";
|
||||||
if (!Utils.IsNullOrEmpty(subid))
|
if (!Utils.IsNullOrEmpty(subid))
|
||||||
{
|
{
|
||||||
|
@ -131,12 +132,13 @@ namespace v2rayN.Handler
|
||||||
{
|
{
|
||||||
return SqliteHelper.Instance.Table<RoutingItem>().Where(it => it.locked == false).OrderBy(t => t.sort).ToList();
|
return SqliteHelper.Instance.Table<RoutingItem>().Where(it => it.locked == false).OrderBy(t => t.sort).ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
public RoutingItem GetRoutingItem(string id)
|
public RoutingItem GetRoutingItem(string id)
|
||||||
{
|
{
|
||||||
return SqliteHelper.Instance.Table<RoutingItem>().FirstOrDefault(it => it.locked == false && it.id == id);
|
return SqliteHelper.Instance.Table<RoutingItem>().FirstOrDefault(it => it.locked == false && it.id == id);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion Config
|
||||||
|
|
||||||
#region Core Type
|
#region Core Type
|
||||||
|
|
||||||
|
@ -332,7 +334,7 @@ namespace v2rayN.Handler
|
||||||
coreExes = new List<string> { "sing-box-client", "sing-box" },
|
coreExes = new List<string> { "sing-box-client", "sing-box" },
|
||||||
arguments = "run",
|
arguments = "run",
|
||||||
coreUrl = Global.singboxCoreUrl,
|
coreUrl = Global.singboxCoreUrl,
|
||||||
redirectInfo = true,
|
redirectInfo = true,
|
||||||
coreReleaseApiUrl = Global.singboxCoreUrl.Replace(Global.githubUrl, Global.githubApiUrl),
|
coreReleaseApiUrl = Global.singboxCoreUrl.Replace(Global.githubUrl, Global.githubApiUrl),
|
||||||
coreDownloadUrl32 = Global.singboxCoreUrl + "/download/{0}/sing-box-{1}-windows-386.zip",
|
coreDownloadUrl32 = Global.singboxCoreUrl + "/download/{0}/sing-box-{1}-windows-386.zip",
|
||||||
coreDownloadUrl64 = Global.singboxCoreUrl + "/download/{0}/sing-box-{1}-windows-amd64.zip",
|
coreDownloadUrl64 = Global.singboxCoreUrl + "/download/{0}/sing-box-{1}-windows-amd64.zip",
|
||||||
|
@ -342,6 +344,6 @@ namespace v2rayN.Handler
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion Core Type
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,4 @@
|
||||||
|
using Microsoft.Win32;
|
||||||
using Microsoft.Win32;
|
|
||||||
using System.Drawing;
|
using System.Drawing;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Windows.Media.Imaging;
|
using System.Windows.Media.Imaging;
|
||||||
|
@ -56,10 +55,12 @@ namespace v2rayN.Handler
|
||||||
case 0:
|
case 0:
|
||||||
index = 1;
|
index = 1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 1:
|
case 1:
|
||||||
case 3:
|
case 3:
|
||||||
index = 2;
|
index = 2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
index = 3;
|
index = 3;
|
||||||
break;
|
break;
|
||||||
|
@ -97,7 +98,7 @@ namespace v2rayN.Handler
|
||||||
SolidBrush drawBrush = new(color);
|
SolidBrush drawBrush = new(color);
|
||||||
|
|
||||||
graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
|
graphics.SmoothingMode = System.Drawing.Drawing2D.SmoothingMode.AntiAlias;
|
||||||
//graphics.FillRectangle(drawBrush, new Rectangle(0, 0, width, height));
|
//graphics.FillRectangle(drawBrush, new Rectangle(0, 0, width, height));
|
||||||
graphics.DrawImage(new Bitmap(item.customIcon), 0, 0, width, height);
|
graphics.DrawImage(new Bitmap(item.customIcon), 0, 0, width, height);
|
||||||
graphics.FillEllipse(drawBrush, width / 2, width / 2, width / 2, width / 2);
|
graphics.FillEllipse(drawBrush, width / 2, width / 2, width / 2, width / 2);
|
||||||
|
|
||||||
|
@ -225,7 +226,6 @@ namespace v2rayN.Handler
|
||||||
{
|
{
|
||||||
if (ret == 0)
|
if (ret == 0)
|
||||||
{
|
{
|
||||||
|
|
||||||
UI.Show(ResUI.OperationSuccess);
|
UI.Show(ResUI.OperationSuccess);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -354,6 +354,5 @@ namespace v2rayN.Handler
|
||||||
HotkeyHandler.Instance.HotkeyTriggerEvent += handler;
|
HotkeyHandler.Instance.HotkeyTriggerEvent += handler;
|
||||||
HotkeyHandler.Instance.Load();
|
HotkeyHandler.Instance.Load();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -18,16 +18,16 @@ namespace v2rayN.Handler
|
||||||
{
|
{
|
||||||
_snackbarMessageQueue?.Enqueue(content);
|
_snackbarMessageQueue?.Enqueue(content);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendMessage(string msg)
|
public void SendMessage(string msg)
|
||||||
{
|
{
|
||||||
MessageBus.Current.SendMessage(msg, "MsgView");
|
MessageBus.Current.SendMessage(msg, "MsgView");
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SendMessage(string msg, bool time)
|
public void SendMessage(string msg, bool time)
|
||||||
{
|
{
|
||||||
msg = $"{DateTime.Now} {msg}";
|
msg = $"{DateTime.Now} {msg}";
|
||||||
MessageBus.Current.SendMessage(msg, "MsgView");
|
MessageBus.Current.SendMessage(msg, "MsgView");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -5,7 +5,7 @@ using v2rayN.Mode;
|
||||||
|
|
||||||
namespace v2rayN.Handler
|
namespace v2rayN.Handler
|
||||||
{
|
{
|
||||||
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;
|
||||||
|
@ -132,6 +132,7 @@ namespace v2rayN.Handler
|
||||||
}
|
}
|
||||||
return profileEx.sort;
|
return profileEx.sort;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int GetMaxSort()
|
public int GetMaxSort()
|
||||||
{
|
{
|
||||||
if (_lstProfileEx.Count <= 0)
|
if (_lstProfileEx.Count <= 0)
|
||||||
|
@ -141,4 +142,4 @@ namespace v2rayN.Handler
|
||||||
return _lstProfileEx.Max(t => t == null ? 0 : t.sort);
|
return _lstProfileEx.Max(t => t == null ? 0 : t.sort);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -3,7 +3,7 @@ using System.Runtime.InteropServices;
|
||||||
|
|
||||||
namespace v2rayN.Handler
|
namespace v2rayN.Handler
|
||||||
{
|
{
|
||||||
class ProxySetting
|
internal class ProxySetting
|
||||||
{
|
{
|
||||||
public static bool UnsetProxy()
|
public static bool UnsetProxy()
|
||||||
{
|
{
|
||||||
|
@ -62,7 +62,6 @@ namespace v2rayN.Handler
|
||||||
list.dwOptionCount = options.Length;
|
list.dwOptionCount = options.Length;
|
||||||
list.dwOptionError = 0;
|
list.dwOptionError = 0;
|
||||||
|
|
||||||
|
|
||||||
int optSize = Marshal.SizeOf(typeof(InternetConnectionOption));
|
int optSize = Marshal.SizeOf(typeof(InternetConnectionOption));
|
||||||
// make a pointer out of all that ...
|
// make a pointer out of all that ...
|
||||||
IntPtr optionsPtr = Marshal.AllocCoTaskMem(optSize * options.Length);
|
IntPtr optionsPtr = Marshal.AllocCoTaskMem(optSize * options.Length);
|
||||||
|
@ -106,8 +105,8 @@ namespace v2rayN.Handler
|
||||||
return (returnvalue < 0);
|
return (returnvalue < 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
#region WinInet structures
|
#region WinInet structures
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
|
||||||
public struct InternetPerConnOptionList
|
public struct InternetPerConnOptionList
|
||||||
{
|
{
|
||||||
|
@ -115,6 +114,7 @@ namespace v2rayN.Handler
|
||||||
public IntPtr szConnection; // connection name to set/query options
|
public IntPtr szConnection; // connection name to set/query options
|
||||||
public int dwOptionCount; // number of options to set/query
|
public int dwOptionCount; // number of options to set/query
|
||||||
public int dwOptionError; // on error, which option failed
|
public int dwOptionError; // on error, which option failed
|
||||||
|
|
||||||
//[MarshalAs(UnmanagedType.)]
|
//[MarshalAs(UnmanagedType.)]
|
||||||
public IntPtr options;
|
public IntPtr options;
|
||||||
};
|
};
|
||||||
|
@ -122,9 +122,10 @@ namespace v2rayN.Handler
|
||||||
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
|
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
|
||||||
public struct InternetConnectionOption
|
public struct InternetConnectionOption
|
||||||
{
|
{
|
||||||
static readonly int Size;
|
private static readonly int Size;
|
||||||
public PerConnOption m_Option;
|
public PerConnOption m_Option;
|
||||||
public InternetConnectionOptionValue m_Value;
|
public InternetConnectionOptionValue m_Value;
|
||||||
|
|
||||||
static InternetConnectionOption()
|
static InternetConnectionOption()
|
||||||
{
|
{
|
||||||
Size = Marshal.SizeOf(typeof(InternetConnectionOption));
|
Size = Marshal.SizeOf(typeof(InternetConnectionOption));
|
||||||
|
@ -137,15 +138,19 @@ namespace v2rayN.Handler
|
||||||
// Fields
|
// Fields
|
||||||
[FieldOffset(0)]
|
[FieldOffset(0)]
|
||||||
public System.Runtime.InteropServices.ComTypes.FILETIME m_FileTime;
|
public System.Runtime.InteropServices.ComTypes.FILETIME m_FileTime;
|
||||||
|
|
||||||
[FieldOffset(0)]
|
[FieldOffset(0)]
|
||||||
public int m_Int;
|
public int m_Int;
|
||||||
|
|
||||||
[FieldOffset(0)]
|
[FieldOffset(0)]
|
||||||
public IntPtr m_StringPtr;
|
public IntPtr m_StringPtr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
#endregion WinInet structures
|
||||||
|
|
||||||
#region WinInet enums
|
#region WinInet enums
|
||||||
|
|
||||||
//
|
//
|
||||||
// options manifests for Internet{Query|Set}Option
|
// options manifests for Internet{Query|Set}Option
|
||||||
//
|
//
|
||||||
|
@ -159,11 +164,10 @@ namespace v2rayN.Handler
|
||||||
//
|
//
|
||||||
public enum PerConnOption
|
public enum PerConnOption
|
||||||
{
|
{
|
||||||
INTERNET_PER_CONN_FLAGS = 1, // Sets or retrieves the connection type. The Value member will contain one or more of the values from PerConnFlags
|
INTERNET_PER_CONN_FLAGS = 1, // Sets or retrieves the connection type. The Value member will contain one or more of the values from PerConnFlags
|
||||||
INTERNET_PER_CONN_PROXY_SERVER = 2, // Sets or retrieves a string containing the proxy servers.
|
INTERNET_PER_CONN_PROXY_SERVER = 2, // Sets or retrieves a string containing the proxy servers.
|
||||||
INTERNET_PER_CONN_PROXY_BYPASS = 3, // Sets or retrieves a string containing the URLs that do not use the proxy server.
|
INTERNET_PER_CONN_PROXY_BYPASS = 3, // Sets or retrieves a string containing the URLs that do not use the proxy server.
|
||||||
INTERNET_PER_CONN_AUTOCONFIG_URL = 4//, // Sets or retrieves a string containing the URL to the automatic configuration script.
|
INTERNET_PER_CONN_AUTOCONFIG_URL = 4//, // Sets or retrieves a string containing the URL to the automatic configuration script.
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
//
|
//
|
||||||
|
@ -177,7 +181,8 @@ namespace v2rayN.Handler
|
||||||
PROXY_TYPE_AUTO_PROXY_URL = 0x00000004, // autoproxy URL
|
PROXY_TYPE_AUTO_PROXY_URL = 0x00000004, // autoproxy URL
|
||||||
PROXY_TYPE_AUTO_DETECT = 0x00000008 // use autoproxy detection
|
PROXY_TYPE_AUTO_DETECT = 0x00000008 // use autoproxy detection
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
#endregion WinInet enums
|
||||||
|
|
||||||
internal static class NativeMethods
|
internal static class NativeMethods
|
||||||
{
|
{
|
||||||
|
@ -199,13 +204,13 @@ namespace v2rayN.Handler
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
//获得代理的IP和端口
|
//获得代理的IP和端口
|
||||||
public static string? GetProxyProxyServer()
|
public static string? GetProxyProxyServer()
|
||||||
{
|
{
|
||||||
using RegistryKey? rk = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Internet Settings", true);
|
using RegistryKey? rk = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Internet Settings", true);
|
||||||
string ProxyServer = rk.GetValue("ProxyServer").ToString();
|
string ProxyServer = rk.GetValue("ProxyServer").ToString();
|
||||||
return ProxyServer;
|
return ProxyServer;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -24,7 +24,5 @@ namespace v2rayN.Handler
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,9 +7,8 @@ using v2rayN.Resx;
|
||||||
|
|
||||||
namespace v2rayN.Handler
|
namespace v2rayN.Handler
|
||||||
{
|
{
|
||||||
class ShareHandler
|
internal class ShareHandler
|
||||||
{
|
{
|
||||||
|
|
||||||
#region GetShareUrl
|
#region GetShareUrl
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -162,6 +161,7 @@ namespace v2rayN.Handler
|
||||||
url = $"{Global.vlessProtocol}{url}{query}{remark}";
|
url = $"{Global.vlessProtocol}{url}{query}{remark}";
|
||||||
return url;
|
return url;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static string GetIpv6(string address)
|
private static string GetIpv6(string address)
|
||||||
{
|
{
|
||||||
return Utils.IsIpv6(address) ? $"[{address}]" : address;
|
return Utils.IsIpv6(address) ? $"[{address}]" : address;
|
||||||
|
@ -221,6 +221,7 @@ namespace v2rayN.Handler
|
||||||
dicQuery.Add("host", Utils.UrlEncode(item.requestHost));
|
dicQuery.Add("host", Utils.UrlEncode(item.requestHost));
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "kcp":
|
case "kcp":
|
||||||
dicQuery.Add("headerType", !Utils.IsNullOrEmpty(item.headerType) ? item.headerType : "none");
|
dicQuery.Add("headerType", !Utils.IsNullOrEmpty(item.headerType) ? item.headerType : "none");
|
||||||
if (!Utils.IsNullOrEmpty(item.path))
|
if (!Utils.IsNullOrEmpty(item.path))
|
||||||
|
@ -258,6 +259,7 @@ namespace v2rayN.Handler
|
||||||
dicQuery.Add("quicSecurity", Utils.UrlEncode(item.requestHost));
|
dicQuery.Add("quicSecurity", Utils.UrlEncode(item.requestHost));
|
||||||
dicQuery.Add("key", Utils.UrlEncode(item.path));
|
dicQuery.Add("key", Utils.UrlEncode(item.path));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "grpc":
|
case "grpc":
|
||||||
if (!Utils.IsNullOrEmpty(item.path))
|
if (!Utils.IsNullOrEmpty(item.path))
|
||||||
{
|
{
|
||||||
|
@ -272,10 +274,9 @@ namespace v2rayN.Handler
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion GetShareUrl
|
||||||
|
|
||||||
#region ImportShareUrl
|
|
||||||
|
|
||||||
|
#region ImportShareUrl
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 从剪贴板导入URL
|
/// 从剪贴板导入URL
|
||||||
|
@ -290,7 +291,7 @@ namespace v2rayN.Handler
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//载入配置文件
|
//载入配置文件
|
||||||
string result = clipboardData.TrimEx();// Utils.GetClipboardData();
|
string result = clipboardData.TrimEx();// Utils.GetClipboardData();
|
||||||
if (Utils.IsNullOrEmpty(result))
|
if (Utils.IsNullOrEmpty(result))
|
||||||
{
|
{
|
||||||
|
@ -309,7 +310,6 @@ namespace v2rayN.Handler
|
||||||
{
|
{
|
||||||
profileItem = ResolveVmess(result, out msg);
|
profileItem = ResolveVmess(result, out msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
else if (result.StartsWith(Global.ssProtocol))
|
else if (result.StartsWith(Global.ssProtocol))
|
||||||
{
|
{
|
||||||
|
@ -352,7 +352,6 @@ namespace v2rayN.Handler
|
||||||
else if (result.StartsWith(Global.vlessProtocol))
|
else if (result.StartsWith(Global.vlessProtocol))
|
||||||
{
|
{
|
||||||
profileItem = ResolveStdVLESS(result);
|
profileItem = ResolveStdVLESS(result);
|
||||||
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -487,6 +486,7 @@ namespace v2rayN.Handler
|
||||||
case "tls":
|
case "tls":
|
||||||
// TODO tls config
|
// TODO tls config
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
if (!string.IsNullOrWhiteSpace(i.streamSecurity))
|
if (!string.IsNullOrWhiteSpace(i.streamSecurity))
|
||||||
return null;
|
return null;
|
||||||
|
@ -502,6 +502,7 @@ namespace v2rayN.Handler
|
||||||
// TODO http option
|
// TODO http option
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "kcp":
|
case "kcp":
|
||||||
i.headerType = q["type"] ?? "none";
|
i.headerType = q["type"] ?? "none";
|
||||||
// TODO kcp seed
|
// TODO kcp seed
|
||||||
|
@ -636,7 +637,6 @@ namespace v2rayN.Handler
|
||||||
return server;
|
return server;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private static readonly Regex StdVmessUserInfo = new(
|
private static readonly Regex StdVmessUserInfo = new(
|
||||||
@"^(?<network>[a-z]+)(\+(?<streamSecurity>[a-z]+))?:(?<id>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$", RegexOptions.Compiled);
|
@"^(?<network>[a-z]+)(\+(?<streamSecurity>[a-z]+))?:(?<id>[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$", RegexOptions.Compiled);
|
||||||
|
|
||||||
|
@ -738,6 +738,7 @@ namespace v2rayN.Handler
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static ProfileItem ResolveStdVLESS(string result)
|
private static ProfileItem ResolveStdVLESS(string result)
|
||||||
{
|
{
|
||||||
ProfileItem item = new()
|
ProfileItem item = new()
|
||||||
|
@ -780,6 +781,7 @@ namespace v2rayN.Handler
|
||||||
item.requestHost = Utils.UrlDecode(query["host"] ?? "");
|
item.requestHost = Utils.UrlDecode(query["host"] ?? "");
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "kcp":
|
case "kcp":
|
||||||
item.headerType = query["headerType"] ?? "none";
|
item.headerType = query["headerType"] ?? "none";
|
||||||
item.path = Utils.UrlDecode(query["seed"] ?? "");
|
item.path = Utils.UrlDecode(query["seed"] ?? "");
|
||||||
|
@ -802,16 +804,18 @@ namespace v2rayN.Handler
|
||||||
item.requestHost = query["quicSecurity"] ?? "none";
|
item.requestHost = query["quicSecurity"] ?? "none";
|
||||||
item.path = Utils.UrlDecode(query["key"] ?? "");
|
item.path = Utils.UrlDecode(query["key"] ?? "");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "grpc":
|
case "grpc":
|
||||||
item.path = Utils.UrlDecode(query["serviceName"] ?? "");
|
item.path = Utils.UrlDecode(query["serviceName"] ?? "");
|
||||||
item.headerType = Utils.UrlDecode(query["mode"] ?? Global.GrpcgunMode);
|
item.headerType = Utils.UrlDecode(query["mode"] ?? Global.GrpcgunMode);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion ImportShareUrl
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,13 +7,13 @@ using v2rayN.Resx;
|
||||||
|
|
||||||
namespace v2rayN.Handler
|
namespace v2rayN.Handler
|
||||||
{
|
{
|
||||||
class SpeedtestHandler
|
internal class SpeedtestHandler
|
||||||
{
|
{
|
||||||
private Config _config;
|
private Config _config;
|
||||||
private CoreHandler _coreHandler;
|
private CoreHandler _coreHandler;
|
||||||
private List<ServerTestItem> _selecteds;
|
private List<ServerTestItem> _selecteds;
|
||||||
private ESpeedActionType _actionType;
|
private ESpeedActionType _actionType;
|
||||||
Action<string, string, string> _updateFunc;
|
private Action<string, string, string> _updateFunc;
|
||||||
|
|
||||||
public SpeedtestHandler(Config config)
|
public SpeedtestHandler(Config config)
|
||||||
{
|
{
|
||||||
|
@ -57,10 +57,12 @@ namespace v2rayN.Handler
|
||||||
UpdateFunc(it.indexId, ResUI.Speedtesting, "");
|
UpdateFunc(it.indexId, ResUI.Speedtesting, "");
|
||||||
ProfileExHandler.Instance.SetTestDelay(it.indexId, "0");
|
ProfileExHandler.Instance.SetTestDelay(it.indexId, "0");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ESpeedActionType.Speedtest:
|
case ESpeedActionType.Speedtest:
|
||||||
UpdateFunc(it.indexId, "", ResUI.SpeedtestingWait);
|
UpdateFunc(it.indexId, "", ResUI.SpeedtestingWait);
|
||||||
ProfileExHandler.Instance.SetTestSpeed(it.indexId, "0");
|
ProfileExHandler.Instance.SetTestSpeed(it.indexId, "0");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ESpeedActionType.Mixedtest:
|
case ESpeedActionType.Mixedtest:
|
||||||
UpdateFunc(it.indexId, ResUI.Speedtesting, ResUI.SpeedtestingWait);
|
UpdateFunc(it.indexId, ResUI.Speedtesting, ResUI.SpeedtestingWait);
|
||||||
ProfileExHandler.Instance.SetTestDelay(it.indexId, "0");
|
ProfileExHandler.Instance.SetTestDelay(it.indexId, "0");
|
||||||
|
@ -74,15 +76,19 @@ namespace v2rayN.Handler
|
||||||
case ESpeedActionType.Ping:
|
case ESpeedActionType.Ping:
|
||||||
Task.Run(RunPing);
|
Task.Run(RunPing);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ESpeedActionType.Tcping:
|
case ESpeedActionType.Tcping:
|
||||||
Task.Run(RunTcping);
|
Task.Run(RunTcping);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ESpeedActionType.Realping:
|
case ESpeedActionType.Realping:
|
||||||
Task.Run(RunRealPing);
|
Task.Run(RunRealPing);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ESpeedActionType.Speedtest:
|
case ESpeedActionType.Speedtest:
|
||||||
Task.Run(RunSpeedTestAsync);
|
Task.Run(RunSpeedTestAsync);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ESpeedActionType.Mixedtest:
|
case ESpeedActionType.Mixedtest:
|
||||||
Task.Run(RunMixedtestAsync);
|
Task.Run(RunMixedtestAsync);
|
||||||
break;
|
break;
|
||||||
|
@ -113,7 +119,6 @@ namespace v2rayN.Handler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void RunPing()
|
private void RunPing()
|
||||||
{
|
{
|
||||||
RunPingSub((ServerTestItem it) =>
|
RunPingSub((ServerTestItem it) =>
|
||||||
|
@ -169,7 +174,6 @@ namespace v2rayN.Handler
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
WebProxy webProxy = new(Global.Loopback, it.port);
|
WebProxy webProxy = new(Global.Loopback, it.port);
|
||||||
string output = GetRealPingTime(downloadHandle, webProxy);
|
string output = GetRealPingTime(downloadHandle, webProxy);
|
||||||
|
|
||||||
|
@ -365,7 +369,6 @@ namespace v2rayN.Handler
|
||||||
return responseTime;
|
return responseTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Ping
|
/// Ping
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -417,4 +420,4 @@ namespace v2rayN.Handler
|
||||||
_updateFunc(indexId, delay, speed);
|
_updateFunc(indexId, delay, speed);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -22,7 +22,7 @@ namespace v2rayN.Handler
|
||||||
// <pac-url>
|
// <pac-url>
|
||||||
private static SysproxyConfig? _userSettings = null;
|
private static SysproxyConfig? _userSettings = null;
|
||||||
|
|
||||||
enum RET_ERRORS : int
|
private enum RET_ERRORS : int
|
||||||
{
|
{
|
||||||
RET_NO_ERROR = 0,
|
RET_NO_ERROR = 0,
|
||||||
INVALID_FORMAT = 1,
|
INVALID_FORMAT = 1,
|
||||||
|
@ -45,7 +45,6 @@ namespace v2rayN.Handler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static bool UpdateSysProxy(Config config, bool forceDisable)
|
public static bool UpdateSysProxy(Config config, bool forceDisable)
|
||||||
{
|
{
|
||||||
var type = config.sysProxyType;
|
var type = config.sysProxyType;
|
||||||
|
@ -120,7 +119,6 @@ namespace v2rayN.Handler
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static void SetIEProxy(bool global, string strProxy, string strExceptions)
|
public static void SetIEProxy(bool global, string strProxy, string strExceptions)
|
||||||
{
|
{
|
||||||
string arguments = global
|
string arguments = global
|
||||||
|
@ -209,7 +207,6 @@ namespace v2rayN.Handler
|
||||||
}
|
}
|
||||||
catch (System.ComponentModel.Win32Exception e)
|
catch (System.ComponentModel.Win32Exception e)
|
||||||
{
|
{
|
||||||
|
|
||||||
// log the arguments
|
// log the arguments
|
||||||
throw new Exception(process.StartInfo.Arguments);
|
throw new Exception(process.StartInfo.Arguments);
|
||||||
}
|
}
|
||||||
|
@ -231,7 +228,5 @@ namespace v2rayN.Handler
|
||||||
// _queryStr = stdout;
|
// _queryStr = stdout;
|
||||||
//}
|
//}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -204,7 +204,6 @@ namespace v2rayN.Base
|
||||||
configStr = configStr.Replace("$ruleProxyProcess$", "");
|
configStr = configStr.Replace("$ruleProxyProcess$", "");
|
||||||
configStr = configStr.Replace("$ruleFinally$", "");
|
configStr = configStr.Replace("$ruleFinally$", "");
|
||||||
|
|
||||||
|
|
||||||
File.WriteAllText(Utils.GetConfigPath(_tunConfigName), configStr);
|
File.WriteAllText(Utils.GetConfigPath(_tunConfigName), configStr);
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -12,9 +12,9 @@ using v2rayN.Resx;
|
||||||
|
|
||||||
namespace v2rayN.Handler
|
namespace v2rayN.Handler
|
||||||
{
|
{
|
||||||
class UpdateHandle
|
internal class UpdateHandle
|
||||||
{
|
{
|
||||||
Action<bool, string> _updateFunc;
|
private Action<bool, string> _updateFunc;
|
||||||
private Config _config;
|
private Config _config;
|
||||||
|
|
||||||
public event EventHandler<ResultEventArgs> AbsoluteCompleted;
|
public event EventHandler<ResultEventArgs> AbsoluteCompleted;
|
||||||
|
@ -96,7 +96,6 @@ namespace v2rayN.Handler
|
||||||
CheckUpdateAsync(ECoreType.v2rayN, preRelease);
|
CheckUpdateAsync(ECoreType.v2rayN, preRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void CheckUpdateCore(ECoreType type, Config config, Action<bool, string> update, bool preRelease)
|
public void CheckUpdateCore(ECoreType type, Config config, Action<bool, string> update, bool preRelease)
|
||||||
{
|
{
|
||||||
_config = config;
|
_config = config;
|
||||||
|
@ -148,7 +147,6 @@ namespace v2rayN.Handler
|
||||||
CheckUpdateAsync(type, preRelease);
|
CheckUpdateAsync(type, preRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public void UpdateSubscriptionProcess(Config config, string subId, bool blProxy, Action<bool, string> update)
|
public void UpdateSubscriptionProcess(Config config, string subId, bool blProxy, Action<bool, string> update)
|
||||||
{
|
{
|
||||||
_config = config;
|
_config = config;
|
||||||
|
@ -264,7 +262,6 @@ namespace v2rayN.Handler
|
||||||
}
|
}
|
||||||
|
|
||||||
_updateFunc(true, $"{ResUI.MsgUpdateSubscriptionEnd}");
|
_updateFunc(true, $"{ResUI.MsgUpdateSubscriptionEnd}");
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -313,7 +310,6 @@ namespace v2rayN.Handler
|
||||||
_updateFunc(false, args.GetException().Message);
|
_updateFunc(false, args.GetException().Message);
|
||||||
};
|
};
|
||||||
askToDownload(downloadHandle, url, false);
|
askToDownload(downloadHandle, url, false);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RunAvailabilityCheck(Action<bool, string> update)
|
public void RunAvailabilityCheck(Action<bool, string> update)
|
||||||
|
@ -360,7 +356,6 @@ namespace v2rayN.Handler
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
|
|
||||||
var coreInfo = LazyConfig.Instance.GetCoreInfo(type);
|
var coreInfo = LazyConfig.Instance.GetCoreInfo(type);
|
||||||
string filePath = string.Empty;
|
string filePath = string.Empty;
|
||||||
foreach (string name in coreInfo.coreExes)
|
foreach (string name in coreInfo.coreExes)
|
||||||
|
@ -401,10 +396,12 @@ namespace v2rayN.Handler
|
||||||
case ECoreType.v2fly_v5:
|
case ECoreType.v2fly_v5:
|
||||||
version = Regex.Match(echo, $"{coreInfo.match} ([0-9.]+) \\(").Groups[1].Value;
|
version = Regex.Match(echo, $"{coreInfo.match} ([0-9.]+) \\(").Groups[1].Value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ECoreType.clash:
|
case ECoreType.clash:
|
||||||
case ECoreType.clash_meta:
|
case ECoreType.clash_meta:
|
||||||
version = Regex.Match(echo, $"v[0-9.]+").Groups[0].Value;
|
version = Regex.Match(echo, $"v[0-9.]+").Groups[0].Value;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case ECoreType.sing_box:
|
case ECoreType.sing_box:
|
||||||
version = Regex.Match(echo, $"([0-9.]+)").Groups[1].Value;
|
version = Regex.Match(echo, $"([0-9.]+)").Groups[1].Value;
|
||||||
break;
|
break;
|
||||||
|
@ -418,6 +415,7 @@ namespace v2rayN.Handler
|
||||||
return "";
|
return "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void responseHandler(ECoreType type, string gitHubReleaseApi, bool preRelease)
|
private void responseHandler(ECoreType type, string gitHubReleaseApi, bool preRelease)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -452,9 +450,11 @@ namespace v2rayN.Handler
|
||||||
case Architecture.Arm64:
|
case Architecture.Arm64:
|
||||||
osBit = "arm64-v8a";
|
osBit = "arm64-v8a";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Architecture.X86:
|
case Architecture.X86:
|
||||||
osBit = "32";
|
osBit = "32";
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
osBit = "64";
|
osBit = "64";
|
||||||
break;
|
break;
|
||||||
|
@ -473,9 +473,11 @@ namespace v2rayN.Handler
|
||||||
case Architecture.Arm64:
|
case Architecture.Arm64:
|
||||||
url = coreInfo.coreDownloadUrlArm64;
|
url = coreInfo.coreDownloadUrlArm64;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Architecture.X86:
|
case Architecture.X86:
|
||||||
url = coreInfo.coreDownloadUrl32;
|
url = coreInfo.coreDownloadUrl32;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
url = coreInfo.coreDownloadUrl64;
|
url = coreInfo.coreDownloadUrl64;
|
||||||
break;
|
break;
|
||||||
|
@ -492,9 +494,11 @@ namespace v2rayN.Handler
|
||||||
case Architecture.Arm64:
|
case Architecture.Arm64:
|
||||||
url = coreInfo.coreDownloadUrlArm64;
|
url = coreInfo.coreDownloadUrlArm64;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Architecture.X86:
|
case Architecture.X86:
|
||||||
url = coreInfo.coreDownloadUrl32;
|
url = coreInfo.coreDownloadUrl32;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
url = coreInfo.coreDownloadUrl64;
|
url = coreInfo.coreDownloadUrl64;
|
||||||
break;
|
break;
|
||||||
|
@ -511,9 +515,11 @@ namespace v2rayN.Handler
|
||||||
case Architecture.Arm64:
|
case Architecture.Arm64:
|
||||||
url = string.Format(coreInfo.coreDownloadUrlArm64, version);
|
url = string.Format(coreInfo.coreDownloadUrlArm64, version);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case Architecture.X86:
|
case Architecture.X86:
|
||||||
url = string.Format(coreInfo.coreDownloadUrl32, version);
|
url = string.Format(coreInfo.coreDownloadUrl32, version);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
url = string.Format(coreInfo.coreDownloadUrl64, version);
|
url = string.Format(coreInfo.coreDownloadUrl64, version);
|
||||||
break;
|
break;
|
||||||
|
@ -569,6 +575,7 @@ namespace v2rayN.Handler
|
||||||
downloadHandle.DownloadFileAsync(url, true, 600);
|
downloadHandle.DownloadFileAsync(url, true, 600);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
#endregion private
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,9 +6,10 @@
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string Text
|
public string Text
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -12,6 +12,7 @@
|
||||||
public string subIndexId { get; set; }
|
public string subIndexId { get; set; }
|
||||||
|
|
||||||
public string remoteDNS { get; set; }
|
public string remoteDNS { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Outbound Freedom domainStrategy
|
/// Outbound Freedom domainStrategy
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -21,7 +22,7 @@
|
||||||
public string systemProxyExceptions { get; set; }
|
public string systemProxyExceptions { get; set; }
|
||||||
public string systemProxyAdvancedProtocol { get; set; }
|
public string systemProxyAdvancedProtocol { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion property
|
||||||
|
|
||||||
#region other entities
|
#region other entities
|
||||||
|
|
||||||
|
@ -38,7 +39,6 @@
|
||||||
public List<KeyEventItem> globalHotkeys { get; set; }
|
public List<KeyEventItem> globalHotkeys { get; set; }
|
||||||
public List<CoreTypeItem> coreTypeItem { get; set; }
|
public List<CoreTypeItem> coreTypeItem { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion other entities
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,4 +1,5 @@
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
|
||||||
namespace v2rayN.Mode
|
namespace v2rayN.Mode
|
||||||
{
|
{
|
||||||
[Serializable]
|
[Serializable]
|
||||||
|
@ -51,7 +52,6 @@ namespace v2rayN.Mode
|
||||||
public string user { get; set; }
|
public string user { get; set; }
|
||||||
|
|
||||||
public string pass { get; set; }
|
public string pass { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
|
@ -127,7 +127,6 @@ namespace v2rayN.Mode
|
||||||
public bool autoHideStartup { get; set; } = true;
|
public bool autoHideStartup { get; set; } = true;
|
||||||
public string mainMsgFilter { get; set; }
|
public string mainMsgFilter { get; set; }
|
||||||
public List<ColumnItem> mainColumnItem { get; set; }
|
public List<ColumnItem> mainColumnItem { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
|
@ -148,7 +147,6 @@ namespace v2rayN.Mode
|
||||||
public bool Shift { get; set; }
|
public bool Shift { get; set; }
|
||||||
|
|
||||||
public Key? KeyCode { get; set; }
|
public Key? KeyCode { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
|
@ -176,7 +174,6 @@ namespace v2rayN.Mode
|
||||||
public List<string> proxyIP { get; set; }
|
public List<string> proxyIP { get; set; }
|
||||||
public List<string> proxyProcess { get; set; }
|
public List<string> proxyProcess { get; set; }
|
||||||
public string proxyDNS { get; set; }
|
public string proxyDNS { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
|
@ -185,7 +182,6 @@ namespace v2rayN.Mode
|
||||||
public int speedTestTimeout { get; set; }
|
public int speedTestTimeout { get; set; }
|
||||||
public string speedTestUrl { get; set; }
|
public string speedTestUrl { get; set; }
|
||||||
public string speedPingTestUrl { get; set; }
|
public string speedPingTestUrl { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
|
@ -195,6 +191,7 @@ namespace v2rayN.Mode
|
||||||
/// 域名解析策略
|
/// 域名解析策略
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string domainStrategy { get; set; }
|
public string domainStrategy { 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; }
|
||||||
|
@ -207,4 +204,4 @@ namespace v2rayN.Mode
|
||||||
public int Width { get; set; }
|
public int Width { get; set; }
|
||||||
public int Index { get; set; }
|
public int Index { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -35,7 +35,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public ESysProxyType sysProxyType
|
public ESysProxyType sysProxyType
|
||||||
{
|
{
|
||||||
|
@ -97,14 +97,17 @@
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string domainMatcher
|
public string domainMatcher
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int routingIndex
|
public int routingIndex
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool enableRoutingAdvanced
|
public bool enableRoutingAdvanced
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
|
@ -122,6 +125,7 @@
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string systemProxyAdvancedProtocol { get; set; }
|
public string systemProxyAdvancedProtocol { get; set; }
|
||||||
|
|
||||||
public int autoUpdateInterval { get; set; } = 0;
|
public int autoUpdateInterval { get; set; } = 0;
|
||||||
|
@ -137,7 +141,7 @@
|
||||||
|
|
||||||
public int trayMenuServersLimit { get; set; }
|
public int trayMenuServersLimit { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion property
|
||||||
|
|
||||||
#region other entities
|
#region other entities
|
||||||
|
|
||||||
|
@ -172,6 +176,7 @@
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// UI
|
/// UI
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -179,6 +184,7 @@
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<RoutingItemOld> routings
|
public List<RoutingItemOld> routings
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
|
@ -194,14 +200,12 @@
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public List<CoreTypeItem> coreTypeItem
|
public List<CoreTypeItem> coreTypeItem
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion other entities
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
[Serializable]
|
[Serializable]
|
||||||
|
@ -231,7 +235,6 @@
|
||||||
groupId = string.Empty;
|
groupId = string.Empty;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public string indexId
|
public string indexId
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
|
@ -265,6 +268,7 @@
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 远程服务器端口
|
/// 远程服务器端口
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -272,6 +276,7 @@
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 远程服务器ID
|
/// 远程服务器ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -279,6 +284,7 @@
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 远程服务器额外ID
|
/// 远程服务器额外ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -286,6 +292,7 @@
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 本地安全策略
|
/// 本地安全策略
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -293,6 +300,7 @@
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// tcp,kcp,ws,h2,quic
|
/// tcp,kcp,ws,h2,quic
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -300,8 +308,9 @@
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string remarks
|
public string remarks
|
||||||
{
|
{
|
||||||
|
@ -349,7 +358,7 @@
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string testResult
|
public string testResult
|
||||||
{
|
{
|
||||||
|
@ -371,6 +380,7 @@
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// tls sni
|
/// tls sni
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -404,23 +414,27 @@
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string url
|
public string url
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<RulesItem> rules
|
public List<RulesItem> rules
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool enabled { get; set; } = true;
|
public bool enabled { get; set; } = true;
|
||||||
|
|
||||||
public bool locked
|
public bool locked
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public string customIcon
|
public string customIcon
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -23,6 +23,5 @@
|
||||||
public string versionArg { get; set; }
|
public string versionArg { get; set; }
|
||||||
|
|
||||||
public bool redirectInfo { get; set; }
|
public bool redirectInfo { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,4 @@
|
||||||
|
namespace v2rayN.Mode
|
||||||
namespace v2rayN.Mode
|
|
||||||
{
|
{
|
||||||
public enum EConfigType
|
public enum EConfigType
|
||||||
{
|
{
|
||||||
|
@ -10,4 +9,4 @@ namespace v2rayN.Mode
|
||||||
VLESS = 5,
|
VLESS = 5,
|
||||||
Trojan = 6
|
Trojan = 6
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,4 @@
|
||||||
|
namespace v2rayN.Mode
|
||||||
namespace v2rayN.Mode
|
|
||||||
{
|
{
|
||||||
public enum ECoreType
|
public enum ECoreType
|
||||||
{
|
{
|
||||||
|
@ -15,4 +14,4 @@ namespace v2rayN.Mode
|
||||||
sing_box = 24,
|
sing_box = 24,
|
||||||
v2rayN = 99
|
v2rayN = 99
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,4 @@
|
||||||
|
namespace v2rayN.Mode
|
||||||
namespace v2rayN.Mode
|
|
||||||
{
|
{
|
||||||
public enum EGlobalHotkey
|
public enum EGlobalHotkey
|
||||||
{
|
{
|
||||||
|
@ -9,4 +8,4 @@ namespace v2rayN.Mode
|
||||||
SystemProxyUnchanged = 3,
|
SystemProxyUnchanged = 3,
|
||||||
SystemProxyPac = 4,
|
SystemProxyPac = 4,
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,4 @@
|
||||||
|
namespace v2rayN.Mode
|
||||||
namespace v2rayN.Mode
|
|
||||||
{
|
{
|
||||||
public enum EMove
|
public enum EMove
|
||||||
{
|
{
|
||||||
|
@ -9,4 +8,4 @@ namespace v2rayN.Mode
|
||||||
Bottom = 4,
|
Bottom = 4,
|
||||||
Position = 5
|
Position = 5
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,4 @@
|
||||||
|
namespace v2rayN.Mode
|
||||||
namespace v2rayN.Mode
|
|
||||||
{
|
{
|
||||||
public enum EServerColName
|
public enum EServerColName
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,5 +1,4 @@
|
||||||
|
namespace v2rayN.Mode
|
||||||
namespace v2rayN.Mode
|
|
||||||
{
|
{
|
||||||
public enum ESpeedActionType
|
public enum ESpeedActionType
|
||||||
{
|
{
|
||||||
|
@ -9,4 +8,4 @@ namespace v2rayN.Mode
|
||||||
Speedtest,
|
Speedtest,
|
||||||
Mixedtest
|
Mixedtest
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,5 +1,4 @@
|
||||||
|
namespace v2rayN.Mode
|
||||||
namespace v2rayN.Mode
|
|
||||||
{
|
{
|
||||||
public enum ESysProxyType
|
public enum ESysProxyType
|
||||||
{
|
{
|
||||||
|
@ -8,4 +7,4 @@ namespace v2rayN.Mode
|
||||||
Unchanged = 2,
|
Unchanged = 2,
|
||||||
Pac = 3
|
Pac = 3
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -4,6 +4,5 @@
|
||||||
{
|
{
|
||||||
AdjustMainLvColWidth,
|
AdjustMainLvColWidth,
|
||||||
ProfilesFocus
|
ProfilesFocus
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,8 +7,9 @@ namespace v2rayN.Mode
|
||||||
{
|
{
|
||||||
[PrimaryKey]
|
[PrimaryKey]
|
||||||
public string indexId { get; set; }
|
public string indexId { get; set; }
|
||||||
|
|
||||||
public int delay { get; set; }
|
public int delay { get; set; }
|
||||||
public decimal speed { get; set; }
|
public decimal speed { get; set; }
|
||||||
public int sort { get; set; }
|
public int sort { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -28,6 +28,7 @@ namespace v2rayN.Mode
|
||||||
}
|
}
|
||||||
|
|
||||||
#region function
|
#region function
|
||||||
|
|
||||||
public string GetSummary()
|
public string GetSummary()
|
||||||
{
|
{
|
||||||
string summary = string.Format("[{0}] ", (configType).ToString());
|
string summary = string.Format("[{0}] ", (configType).ToString());
|
||||||
|
@ -54,6 +55,7 @@ namespace v2rayN.Mode
|
||||||
case EConfigType.Trojan:
|
case EConfigType.Trojan:
|
||||||
summary += string.Format("{0}({1}:{2})", remarks, addr, port);
|
summary += string.Format("{0}({1}:{2})", remarks, addr, port);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
summary += string.Format("{0}", remarks);
|
summary += string.Format("{0}", remarks);
|
||||||
break;
|
break;
|
||||||
|
@ -82,7 +84,7 @@ namespace v2rayN.Mode
|
||||||
return network.TrimEx();
|
return network.TrimEx();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion function
|
||||||
|
|
||||||
[PrimaryKey]
|
[PrimaryKey]
|
||||||
public string indexId { get; set; }
|
public string indexId { get; set; }
|
||||||
|
@ -91,6 +93,7 @@ namespace v2rayN.Mode
|
||||||
/// config type(1=normal,2=custom)
|
/// config type(1=normal,2=custom)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public EConfigType configType { get; set; }
|
public EConfigType configType { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 版本(现在=2)
|
/// 版本(现在=2)
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -100,28 +103,34 @@ namespace v2rayN.Mode
|
||||||
/// 远程服务器地址
|
/// 远程服务器地址
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string address { get; set; }
|
public string address { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 远程服务器端口
|
/// 远程服务器端口
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int port { get; set; }
|
public int port { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 远程服务器ID
|
/// 远程服务器ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string id { get; set; }
|
public string id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 远程服务器额外ID
|
/// 远程服务器额外ID
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int alterId { get; set; }
|
public int alterId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 本地安全策略
|
/// 本地安全策略
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string security { get; set; }
|
public string security { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// tcp,kcp,ws,h2,quic
|
/// tcp,kcp,ws,h2,quic
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string network { get; set; }
|
public string network { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string remarks { get; set; }
|
public string remarks { get; set; }
|
||||||
|
|
||||||
|
@ -154,22 +163,24 @@ namespace v2rayN.Mode
|
||||||
/// SubItem id
|
/// SubItem id
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string subid { get; set; }
|
public string subid { get; set; }
|
||||||
|
|
||||||
public bool isSub { get; set; } = true;
|
public bool isSub { get; set; } = true;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// VLESS flow
|
/// VLESS flow
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string flow { get; set; }
|
public string flow { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// tls sni
|
/// tls sni
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string sni { get; set; }
|
public string sni { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// tls alpn
|
/// tls alpn
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string alpn { get; set; } = string.Empty;
|
public string alpn { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
|
||||||
public ECoreType? coreType { get; set; }
|
public ECoreType? coreType { get; set; }
|
||||||
|
|
||||||
public int preSocksPort { get; set; }
|
public int preSocksPort { get; set; }
|
||||||
|
@ -181,4 +192,4 @@ namespace v2rayN.Mode
|
||||||
public string shortId { get; set; }
|
public string shortId { get; set; }
|
||||||
public string spiderX { get; set; }
|
public string spiderX { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -14,6 +14,5 @@
|
||||||
public string todayDown { get; set; }
|
public string todayDown { get; set; }
|
||||||
public string totalUp { get; set; }
|
public string totalUp { get; set; }
|
||||||
public string totalDown { get; set; }
|
public string totalDown { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -7,6 +7,7 @@ namespace v2rayN.Mode
|
||||||
{
|
{
|
||||||
[PrimaryKey]
|
[PrimaryKey]
|
||||||
public string id { get; set; }
|
public string id { get; set; }
|
||||||
|
|
||||||
public string remarks { get; set; }
|
public string remarks { get; set; }
|
||||||
public string url { get; set; }
|
public string url { get; set; }
|
||||||
public string ruleSet { get; set; }
|
public string ruleSet { get; set; }
|
||||||
|
@ -16,6 +17,5 @@ namespace v2rayN.Mode
|
||||||
public string customIcon { get; set; }
|
public string customIcon { get; set; }
|
||||||
public string domainStrategy { get; set; }
|
public string domainStrategy { get; set; }
|
||||||
public int sort { get; set; }
|
public int sort { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -4,6 +4,5 @@
|
||||||
public class RoutingItemModel : RoutingItem
|
public class RoutingItemModel : RoutingItem
|
||||||
{
|
{
|
||||||
public bool isActive { get; set; }
|
public bool isActive { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -19,7 +19,5 @@
|
||||||
public List<string> protocol { get; set; }
|
public List<string> protocol { get; set; }
|
||||||
|
|
||||||
public bool enabled { get; set; } = true;
|
public bool enabled { get; set; } = true;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
|
@ -10,6 +10,5 @@
|
||||||
public string domains { get; set; }
|
public string domains { get; set; }
|
||||||
|
|
||||||
public string protocols { get; set; }
|
public string protocols { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,23 +1,26 @@
|
||||||
namespace v2rayN.Mode
|
namespace v2rayN.Mode
|
||||||
{
|
{
|
||||||
[Serializable]
|
[Serializable]
|
||||||
class ServerSpeedItem : ServerStatItem
|
internal class ServerSpeedItem : ServerStatItem
|
||||||
{
|
{
|
||||||
public long proxyUp
|
public long proxyUp
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long proxyDown
|
public long proxyDown
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long directUp
|
public long directUp
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long directDown
|
public long directDown
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -10,25 +10,30 @@ namespace v2rayN.Mode
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long totalUp
|
public long totalUp
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long totalDown
|
public long totalDown
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long todayUp
|
public long todayUp
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long todayDown
|
public long todayDown
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
|
|
||||||
public long dateNow
|
public long dateNow
|
||||||
{
|
{
|
||||||
get; set;
|
get; set;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,7 @@
|
||||||
namespace v2rayN.Mode
|
namespace v2rayN.Mode
|
||||||
{
|
{
|
||||||
[Serializable]
|
[Serializable]
|
||||||
class ServerTestItem
|
internal class ServerTestItem
|
||||||
{
|
{
|
||||||
public string indexId { get; set; }
|
public string indexId { get; set; }
|
||||||
public string address { get; set; }
|
public string address { get; set; }
|
||||||
|
@ -10,4 +10,4 @@
|
||||||
public bool allowTest { get; set; }
|
public bool allowTest { get; set; }
|
||||||
public int delay { get; set; }
|
public int delay { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -15,5 +15,4 @@
|
||||||
public string password { get; set; }
|
public string password { get; set; }
|
||||||
public string plugin { get; set; }
|
public string plugin { get; set; }
|
||||||
}
|
}
|
||||||
|
}
|
||||||
}
|
|
|
@ -26,4 +26,4 @@ namespace v2rayN.Mode
|
||||||
|
|
||||||
public long updateTime { get; set; }
|
public long updateTime { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,7 +1,6 @@
|
||||||
|
namespace v2rayN.Mode
|
||||||
namespace v2rayN.Mode
|
|
||||||
{
|
{
|
||||||
class SysproxyConfig
|
internal class SysproxyConfig
|
||||||
{
|
{
|
||||||
public bool UserSettingsRecorded;
|
public bool UserSettingsRecorded;
|
||||||
public string Flags;
|
public string Flags;
|
||||||
|
@ -18,4 +17,4 @@ namespace v2rayN.Mode
|
||||||
PacUrl = "";
|
PacUrl = "";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -12,10 +12,12 @@ namespace v2rayN.Mode
|
||||||
/// 日志配置
|
/// 日志配置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Log log { get; set; }
|
public Log log { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 传入连接配置
|
/// 传入连接配置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<Inbounds> inbounds { get; set; }
|
public List<Inbounds> inbounds { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 传出连接配置
|
/// 传出连接配置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -36,13 +38,15 @@ namespace v2rayN.Mode
|
||||||
/// DNS 配置
|
/// DNS 配置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public object dns { get; set; }
|
public object dns { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 路由配置
|
/// 路由配置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Routing routing { get; set; }
|
public Routing routing { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Stats { };
|
public class Stats
|
||||||
|
{ };
|
||||||
|
|
||||||
public class API
|
public class API
|
||||||
{
|
{
|
||||||
|
@ -64,15 +68,17 @@ namespace v2rayN.Mode
|
||||||
public class Log
|
public class Log
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string access { get; set; }
|
public string access { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string error { get; set; }
|
public string error { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string loglevel { get; set; }
|
public string loglevel { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -80,46 +86,52 @@ namespace v2rayN.Mode
|
||||||
public class Inbounds
|
public class Inbounds
|
||||||
{
|
{
|
||||||
public string tag { get; set; }
|
public string tag { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int port { get; set; }
|
public int port { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string listen { get; set; }
|
public string listen { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string protocol { get; set; }
|
public string protocol { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Sniffing sniffing { get; set; }
|
public Sniffing sniffing { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Inboundsettings settings { get; set; }
|
public Inboundsettings settings { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public StreamSettings streamSettings { get; set; }
|
public StreamSettings streamSettings { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Inboundsettings
|
public class Inboundsettings
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string auth { get; set; }
|
public string auth { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool udp { get; set; }
|
public bool udp { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ip { get; set; }
|
public string ip { get; set; }
|
||||||
|
|
||||||
|
@ -129,11 +141,10 @@ namespace v2rayN.Mode
|
||||||
public string address { get; set; }
|
public string address { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<UsersItem> clients { get; set; }
|
public List<UsersItem> clients { get; set; }
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// VLESS
|
/// VLESS
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -147,19 +158,22 @@ namespace v2rayN.Mode
|
||||||
public class UsersItem
|
public class UsersItem
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string id { get; set; }
|
public string id { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int alterId { get; set; }
|
public int alterId { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string email { get; set; }
|
public string email { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string security { get; set; }
|
public string security { get; set; }
|
||||||
|
|
||||||
|
@ -173,6 +187,7 @@ namespace v2rayN.Mode
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string flow { get; set; }
|
public string flow { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Sniffing
|
public class Sniffing
|
||||||
{
|
{
|
||||||
public bool enabled { get; set; }
|
public bool enabled { get; set; }
|
||||||
|
@ -186,20 +201,24 @@ namespace v2rayN.Mode
|
||||||
/// 默认值agentout
|
/// 默认值agentout
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string tag { get; set; }
|
public string tag { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string protocol { get; set; }
|
public string protocol { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Outboundsettings settings { get; set; }
|
public Outboundsettings settings { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public StreamSettings streamSettings { get; set; }
|
public StreamSettings streamSettings { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Mux mux { get; set; }
|
public Mux mux { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -207,26 +226,27 @@ namespace v2rayN.Mode
|
||||||
public class Outboundsettings
|
public class Outboundsettings
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<VnextItem> vnext { get; set; }
|
public List<VnextItem> vnext { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<ServersItem> servers { get; set; }
|
public List<ServersItem> servers { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Response response { get; set; }
|
public Response response { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string domainStrategy { get; set; }
|
public string domainStrategy { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int? userLevel { get; set; }
|
public int? userLevel { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -234,46 +254,55 @@ namespace v2rayN.Mode
|
||||||
public class VnextItem
|
public class VnextItem
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string address { get; set; }
|
public string address { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int port { get; set; }
|
public int port { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<UsersItem> users { get; set; }
|
public List<UsersItem> users { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class ServersItem
|
public class ServersItem
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string email { get; set; }
|
public string email { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string address { get; set; }
|
public string address { get; set; }
|
||||||
|
|
||||||
/// <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>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int port { get; set; }
|
public int port { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int level { get; set; }
|
public int level { get; set; }
|
||||||
|
|
||||||
|
@ -283,7 +312,7 @@ namespace v2rayN.Mode
|
||||||
public string flow { get; set; }
|
public string flow { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<SocksUsersItem> users { get; set; }
|
public List<SocksUsersItem> users { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -291,29 +320,30 @@ namespace v2rayN.Mode
|
||||||
public class SocksUsersItem
|
public class SocksUsersItem
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string user { get; set; }
|
public string user { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string pass { get; set; }
|
public string pass { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int level { get; set; }
|
public int level { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public class Mux
|
public class Mux
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool enabled { get; set; }
|
public bool enabled { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int concurrency { get; set; }
|
public int concurrency { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -321,7 +351,7 @@ namespace v2rayN.Mode
|
||||||
public class Response
|
public class Response
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string type { get; set; }
|
public string type { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -329,7 +359,7 @@ namespace v2rayN.Mode
|
||||||
public class Dns
|
public class Dns
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<string> servers { get; set; }
|
public List<string> servers { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -337,15 +367,17 @@ namespace v2rayN.Mode
|
||||||
public class Routing
|
public class Routing
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string domainStrategy { get; set; }
|
public string domainStrategy { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string domainMatcher { get; set; }
|
public string domainMatcher { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<RulesItem> rules { get; set; }
|
public List<RulesItem> rules { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -353,16 +385,17 @@ namespace v2rayN.Mode
|
||||||
public class StreamSettings
|
public class StreamSettings
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string network { get; set; }
|
public string network { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string security { get; set; }
|
public string security { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public TlsSettings tlsSettings { get; set; }
|
public TlsSettings tlsSettings { get; set; }
|
||||||
|
|
||||||
|
@ -370,14 +403,17 @@ namespace v2rayN.Mode
|
||||||
/// Tcp传输额外设置
|
/// Tcp传输额外设置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public TcpSettings tcpSettings { get; set; }
|
public TcpSettings tcpSettings { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Kcp传输额外设置
|
/// Kcp传输额外设置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public KcpSettings kcpSettings { get; set; }
|
public KcpSettings kcpSettings { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// ws传输额外设置
|
/// ws传输额外设置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public WsSettings wsSettings { get; set; }
|
public WsSettings wsSettings { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// h2传输额外设置
|
/// h2传输额外设置
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -392,11 +428,11 @@ namespace v2rayN.Mode
|
||||||
/// VLESS only
|
/// VLESS only
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public TlsSettings realitySettings { get; set; }
|
public TlsSettings realitySettings { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// grpc
|
/// grpc
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public GrpcSettings grpcSettings { get; set; }
|
public GrpcSettings grpcSettings { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TlsSettings
|
public class TlsSettings
|
||||||
|
@ -407,11 +443,12 @@ namespace v2rayN.Mode
|
||||||
public bool? allowInsecure { get; set; }
|
public bool? allowInsecure { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string? serverName { get; set; }
|
public string? serverName { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<string>? alpn { get; set; }
|
public List<string>? alpn { get; set; }
|
||||||
|
|
||||||
|
@ -421,7 +458,6 @@ namespace v2rayN.Mode
|
||||||
public string? publicKey { get; set; }
|
public string? publicKey { get; set; }
|
||||||
public string? shortId { get; set; }
|
public string? shortId { get; set; }
|
||||||
public string? spiderX { get; set; }
|
public string? spiderX { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class TcpSettings
|
public class TcpSettings
|
||||||
|
@ -438,10 +474,12 @@ namespace v2rayN.Mode
|
||||||
/// 伪装
|
/// 伪装
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string type { get; set; }
|
public string type { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 结构复杂,直接存起来
|
/// 结构复杂,直接存起来
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public object request { get; set; }
|
public object request { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 结构复杂,直接存起来
|
/// 结构复杂,直接存起来
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -451,39 +489,47 @@ namespace v2rayN.Mode
|
||||||
public class KcpSettings
|
public class KcpSettings
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int mtu { get; set; }
|
public int mtu { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int tti { get; set; }
|
public int tti { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int uplinkCapacity { get; set; }
|
public int uplinkCapacity { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int downlinkCapacity { get; set; }
|
public int downlinkCapacity { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public bool congestion { get; set; }
|
public bool congestion { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int readBufferSize { get; set; }
|
public int readBufferSize { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int writeBufferSize { get; set; }
|
public int writeBufferSize { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Header header { get; set; }
|
public Header header { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string seed { get; set; }
|
public string seed { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -491,19 +537,20 @@ namespace v2rayN.Mode
|
||||||
public class WsSettings
|
public class WsSettings
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string path { get; set; }
|
public string path { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Headers headers { get; set; }
|
public Headers headers { get; set; }
|
||||||
}
|
}
|
||||||
|
|
||||||
public class Headers
|
public class Headers
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string Host { get; set; }
|
public string Host { get; set; }
|
||||||
|
|
||||||
|
@ -517,30 +564,30 @@ namespace v2rayN.Mode
|
||||||
public class HttpSettings
|
public class HttpSettings
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string path { get; set; }
|
public string path { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<string> host { get; set; }
|
public List<string> host { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public class QuicSettings
|
public class QuicSettings
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string security { get; set; }
|
public string security { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string key { get; set; }
|
public string key { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public Header header { get; set; }
|
public Header header { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -558,12 +605,13 @@ namespace v2rayN.Mode
|
||||||
public class AccountsItem
|
public class AccountsItem
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string user { get; set; }
|
public string user { get; set; }
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string pass { get; set; }
|
public string pass { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -6,7 +6,7 @@
|
||||||
public class V2rayTcpRequest
|
public class V2rayTcpRequest
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public RequestHeaders headers { get; set; }
|
public RequestHeaders headers { get; set; }
|
||||||
}
|
}
|
||||||
|
@ -14,10 +14,8 @@
|
||||||
public class RequestHeaders
|
public class RequestHeaders
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public List<string> Host { get; set; }
|
public List<string> Host { get; set; }
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
|
|
@ -4,69 +4,81 @@
|
||||||
/// https://github.com/2dust/v2rayN/wiki/
|
/// https://github.com/2dust/v2rayN/wiki/
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[Serializable]
|
[Serializable]
|
||||||
class VmessQRCode
|
internal class VmessQRCode
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string v { get; set; } = string.Empty;
|
public string v { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string ps { get; set; } = string.Empty;
|
public string ps { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string add { get; set; } = string.Empty;
|
public string add { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string port { get; set; } = string.Empty;
|
public string port { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string id { get; set; } = string.Empty;
|
public string id { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string aid { get; set; } = string.Empty;
|
public string aid { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string scy { get; set; } = string.Empty;
|
public string scy { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string net { get; set; } = string.Empty;
|
public string net { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string type { get; set; } = string.Empty;
|
public string type { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string host { get; set; } = string.Empty;
|
public string host { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
///
|
///
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string path { get; set; } = string.Empty;
|
public string path { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// TLS
|
/// TLS
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string tls { get; set; } = string.Empty;
|
public string tls { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// TLS SNI
|
/// TLS SNI
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string sni { get; set; } = string.Empty;
|
public string sni { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// TLS alpn
|
/// TLS alpn
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string alpn { get; set; } = string.Empty;
|
public string alpn { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// TLS fingerprint
|
/// TLS fingerprint
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string fp { get; set; } = string.Empty;
|
public string fp { get; set; } = string.Empty;
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -53,6 +53,7 @@ namespace v2rayN.Tool
|
||||||
throw;
|
throw;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool ZipExtractToFile(string fileName, string toPath, string ignoredName)
|
public static bool ZipExtractToFile(string fileName, string toPath, string ignoredName)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -86,4 +87,4 @@ namespace v2rayN.Tool
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -1,13 +1,13 @@
|
||||||
using System.Diagnostics;
|
using System.Diagnostics;
|
||||||
using System.Runtime.InteropServices;
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
|
||||||
namespace v2rayN
|
namespace v2rayN
|
||||||
{
|
{
|
||||||
/*
|
/*
|
||||||
* See:
|
* See:
|
||||||
* http://stackoverflow.com/questions/6266820/working-example-of-createjobobject-setinformationjobobject-pinvoke-in-net
|
* http://stackoverflow.com/questions/6266820/working-example-of-createjobobject-setinformationjobobject-pinvoke-in-net
|
||||||
*/
|
*/
|
||||||
|
|
||||||
public class Job : IDisposable
|
public class Job : IDisposable
|
||||||
{
|
{
|
||||||
private IntPtr handle = IntPtr.Zero;
|
private IntPtr handle = IntPtr.Zero;
|
||||||
|
@ -95,7 +95,7 @@ namespace v2rayN
|
||||||
Dispose(false);
|
Dispose(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion IDisposable
|
||||||
|
|
||||||
#region Interop
|
#region Interop
|
||||||
|
|
||||||
|
@ -112,13 +112,13 @@ namespace v2rayN
|
||||||
[return: MarshalAs(UnmanagedType.Bool)]
|
[return: MarshalAs(UnmanagedType.Bool)]
|
||||||
private static extern bool CloseHandle(IntPtr hObject);
|
private static extern bool CloseHandle(IntPtr hObject);
|
||||||
|
|
||||||
#endregion
|
#endregion Interop
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Helper classes
|
#region Helper classes
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
struct IO_COUNTERS
|
internal struct IO_COUNTERS
|
||||||
{
|
{
|
||||||
public UInt64 ReadOperationCount;
|
public UInt64 ReadOperationCount;
|
||||||
public UInt64 WriteOperationCount;
|
public UInt64 WriteOperationCount;
|
||||||
|
@ -128,9 +128,8 @@ namespace v2rayN
|
||||||
public UInt64 OtherTransferCount;
|
public UInt64 OtherTransferCount;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
struct JOBOBJECT_BASIC_LIMIT_INFORMATION
|
internal struct JOBOBJECT_BASIC_LIMIT_INFORMATION
|
||||||
{
|
{
|
||||||
public Int64 PerProcessUserTimeLimit;
|
public Int64 PerProcessUserTimeLimit;
|
||||||
public Int64 PerJobUserTimeLimit;
|
public Int64 PerJobUserTimeLimit;
|
||||||
|
@ -152,7 +151,7 @@ namespace v2rayN
|
||||||
}
|
}
|
||||||
|
|
||||||
[StructLayout(LayoutKind.Sequential)]
|
[StructLayout(LayoutKind.Sequential)]
|
||||||
struct JOBOBJECT_EXTENDED_LIMIT_INFORMATION
|
internal struct JOBOBJECT_EXTENDED_LIMIT_INFORMATION
|
||||||
{
|
{
|
||||||
public JOBOBJECT_BASIC_LIMIT_INFORMATION BasicLimitInformation;
|
public JOBOBJECT_BASIC_LIMIT_INFORMATION BasicLimitInformation;
|
||||||
public IO_COUNTERS IoInfo;
|
public IO_COUNTERS IoInfo;
|
||||||
|
@ -173,5 +172,5 @@ namespace v2rayN
|
||||||
GroupInformation = 11
|
GroupInformation = 11
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion Helper classes
|
||||||
}
|
}
|
|
@ -17,6 +17,7 @@ namespace v2rayN.Tool
|
||||||
config.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, fileTarget));
|
config.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, fileTarget));
|
||||||
LogManager.Configuration = config;
|
LogManager.Configuration = config;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void LoggingEnabled(bool enable)
|
public static void LoggingEnabled(bool enable)
|
||||||
{
|
{
|
||||||
if (!enable)
|
if (!enable)
|
||||||
|
@ -51,4 +52,4 @@ namespace v2rayN.Tool
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -9,12 +9,13 @@ namespace v2rayN.Tool
|
||||||
{
|
{
|
||||||
return _OrderBy<T>(query, propertyName, false);
|
return _OrderBy<T>(query, propertyName, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IOrderedQueryable<T> OrderByDescending<T>(this IQueryable<T> query, string propertyName)
|
public static IOrderedQueryable<T> OrderByDescending<T>(this IQueryable<T> query, string propertyName)
|
||||||
{
|
{
|
||||||
return _OrderBy<T>(query, propertyName, true);
|
return _OrderBy<T>(query, propertyName, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
static IOrderedQueryable<T> _OrderBy<T>(IQueryable<T> query, string propertyName, bool isDesc)
|
private static IOrderedQueryable<T> _OrderBy<T>(IQueryable<T> query, string propertyName, bool isDesc)
|
||||||
{
|
{
|
||||||
string methodname = (isDesc) ? "OrderByDescendingInternal" : "OrderByInternal";
|
string methodname = (isDesc) ? "OrderByDescendingInternal" : "OrderByInternal";
|
||||||
|
|
||||||
|
@ -25,15 +26,18 @@ namespace v2rayN.Tool
|
||||||
|
|
||||||
return (IOrderedQueryable<T>)method.Invoke(null, new object[] { query, memberProp });
|
return (IOrderedQueryable<T>)method.Invoke(null, new object[] { query, memberProp });
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IOrderedQueryable<T> OrderByInternal<T, TProp>(IQueryable<T> query, PropertyInfo memberProperty)
|
public static IOrderedQueryable<T> OrderByInternal<T, TProp>(IQueryable<T> query, PropertyInfo memberProperty)
|
||||||
{//public
|
{//public
|
||||||
return query.OrderBy(_GetLamba<T, TProp>(memberProperty));
|
return query.OrderBy(_GetLamba<T, TProp>(memberProperty));
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IOrderedQueryable<T> OrderByDescendingInternal<T, TProp>(IQueryable<T> query, PropertyInfo memberProperty)
|
public static IOrderedQueryable<T> OrderByDescendingInternal<T, TProp>(IQueryable<T> query, PropertyInfo memberProperty)
|
||||||
{//public
|
{//public
|
||||||
return query.OrderByDescending(_GetLamba<T, TProp>(memberProperty));
|
return query.OrderByDescending(_GetLamba<T, TProp>(memberProperty));
|
||||||
}
|
}
|
||||||
static Expression<Func<T, TProp>> _GetLamba<T, TProp>(PropertyInfo memberProperty)
|
|
||||||
|
private static Expression<Func<T, TProp>> _GetLamba<T, TProp>(PropertyInfo memberProperty)
|
||||||
{
|
{
|
||||||
if (memberProperty.PropertyType != typeof(TProp)) throw new Exception();
|
if (memberProperty.PropertyType != typeof(TProp)) throw new Exception();
|
||||||
|
|
||||||
|
@ -43,4 +47,4 @@ namespace v2rayN.Tool
|
||||||
return lamba;
|
return lamba;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -2,21 +2,23 @@
|
||||||
|
|
||||||
namespace v2rayN
|
namespace v2rayN
|
||||||
{
|
{
|
||||||
class UI
|
internal class UI
|
||||||
{
|
{
|
||||||
private readonly static string caption = "v2rayN";
|
private static readonly string caption = "v2rayN";
|
||||||
|
|
||||||
public static void Show(string msg)
|
public static void Show(string msg)
|
||||||
{
|
{
|
||||||
MessageBox.Show(msg, caption, MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK);
|
MessageBox.Show(msg, caption, MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void ShowWarning(string msg)
|
public static void ShowWarning(string msg)
|
||||||
{
|
{
|
||||||
MessageBox.Show(msg, caption, MessageBoxButton.OK, MessageBoxImage.Warning, MessageBoxResult.OK);
|
MessageBox.Show(msg, caption, MessageBoxButton.OK, MessageBoxImage.Warning, MessageBoxResult.OK);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MessageBoxResult ShowYesNo(string msg)
|
public static MessageBoxResult ShowYesNo(string msg)
|
||||||
{
|
{
|
||||||
return MessageBox.Show(msg, caption, MessageBoxButton.YesNo, MessageBoxImage.Question);
|
return MessageBox.Show(msg, caption, MessageBoxButton.YesNo, MessageBoxImage.Question);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -31,9 +31,8 @@ using ZXing.Windows.Compatibility;
|
||||||
|
|
||||||
namespace v2rayN
|
namespace v2rayN
|
||||||
{
|
{
|
||||||
class Utils
|
internal class Utils
|
||||||
{
|
{
|
||||||
|
|
||||||
#region 资源Json操作
|
#region 资源Json操作
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -60,7 +59,6 @@ namespace v2rayN
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 取得存储资源
|
/// 取得存储资源
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -178,7 +176,8 @@ namespace v2rayN
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
#endregion 资源Json操作
|
||||||
|
|
||||||
#region 转换函数
|
#region 转换函数
|
||||||
|
|
||||||
|
@ -210,6 +209,7 @@ namespace v2rayN
|
||||||
return string.Empty;
|
return string.Empty;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 逗号分隔的字符串,转List<string>
|
/// 逗号分隔的字符串,转List<string>
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -318,6 +318,7 @@ namespace v2rayN
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static bool ToBool(object obj)
|
public static bool ToBool(object obj)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -404,6 +405,7 @@ namespace v2rayN
|
||||||
return Uri.EscapeDataString(url);
|
return Uri.EscapeDataString(url);
|
||||||
//return HttpUtility.UrlEncode(url);
|
//return HttpUtility.UrlEncode(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string UrlDecode(string url)
|
public static string UrlDecode(string url)
|
||||||
{
|
{
|
||||||
return HttpUtility.UrlDecode(url);
|
return HttpUtility.UrlDecode(url);
|
||||||
|
@ -420,6 +422,7 @@ namespace v2rayN
|
||||||
}
|
}
|
||||||
return sb.ToString();
|
return sb.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ImageSource IconToImageSource(Icon icon)
|
public static ImageSource IconToImageSource(Icon icon)
|
||||||
{
|
{
|
||||||
return Imaging.CreateBitmapSourceFromHIcon(
|
return Imaging.CreateBitmapSourceFromHIcon(
|
||||||
|
@ -463,8 +466,7 @@ namespace v2rayN
|
||||||
return Convert.TryFromBase64String(plainText, buffer, out int _);
|
return Convert.TryFromBase64String(plainText, buffer, out int _);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion 转换函数
|
||||||
|
|
||||||
|
|
||||||
#region 数据检查
|
#region 数据检查
|
||||||
|
|
||||||
|
@ -508,7 +510,7 @@ namespace v2rayN
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 验证IP地址是否合法
|
/// 验证IP地址是否合法
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="ip"></param>
|
/// <param name="ip"></param>
|
||||||
public static bool IsIP(string ip)
|
public static bool IsIP(string ip)
|
||||||
{
|
{
|
||||||
//如果为空
|
//如果为空
|
||||||
|
@ -533,7 +535,6 @@ namespace v2rayN
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
//模式字符串
|
//模式字符串
|
||||||
string pattern = @"^((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)$";
|
string pattern = @"^((2[0-4]\d|25[0-5]|[01]?\d\d?)\.){3}(2[0-4]\d|25[0-5]|[01]?\d\d?)$";
|
||||||
|
|
||||||
|
@ -544,7 +545,7 @@ namespace v2rayN
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 验证Domain地址是否合法
|
/// 验证Domain地址是否合法
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="domain"></param>
|
/// <param name="domain"></param>
|
||||||
public static bool IsDomain(string domain)
|
public static bool IsDomain(string domain)
|
||||||
{
|
{
|
||||||
//如果为空
|
//如果为空
|
||||||
|
@ -567,7 +568,7 @@ namespace v2rayN
|
||||||
/// 验证输入字符串是否与模式字符串匹配,匹配返回true
|
/// 验证输入字符串是否与模式字符串匹配,匹配返回true
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="input">输入字符串</param>
|
/// <param name="input">输入字符串</param>
|
||||||
/// <param name="pattern">模式字符串</param>
|
/// <param name="pattern">模式字符串</param>
|
||||||
public static bool IsMatch(string input, string pattern)
|
public static bool IsMatch(string input, string pattern)
|
||||||
{
|
{
|
||||||
return Regex.IsMatch(input, pattern, RegexOptions.IgnoreCase);
|
return Regex.IsMatch(input, pattern, RegexOptions.IgnoreCase);
|
||||||
|
@ -587,11 +588,10 @@ namespace v2rayN
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion 数据检查
|
||||||
|
|
||||||
#region 开机自动启动
|
#region 开机自动启动
|
||||||
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 开机自动启动
|
/// 开机自动启动
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
@ -797,7 +797,7 @@ namespace v2rayN
|
||||||
taskService.RootFolder.RegisterTaskDefinition(TaskName, task);
|
taskService.RootFolder.RegisterTaskDefinition(TaskName, task);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion 开机自动启动
|
||||||
|
|
||||||
#region 测速
|
#region 测速
|
||||||
|
|
||||||
|
@ -862,7 +862,8 @@ namespace v2rayN
|
||||||
}
|
}
|
||||||
return inUse;
|
return inUse;
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
#endregion 测速
|
||||||
|
|
||||||
#region 杂项
|
#region 杂项
|
||||||
|
|
||||||
|
@ -995,7 +996,6 @@ namespace v2rayN
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static string GetDownloadFileName(string url)
|
public static string GetDownloadFileName(string url)
|
||||||
{
|
{
|
||||||
var fileName = Path.GetFileName(url);
|
var fileName = Path.GetFileName(url);
|
||||||
|
@ -1022,6 +1022,7 @@ 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)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -1043,7 +1044,8 @@ namespace v2rayN
|
||||||
DwmSetWindowAttribute(hWnd, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1, ref attribute, attributeSize);
|
DwmSetWindowAttribute(hWnd, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE_BEFORE_20H1, ref attribute, attributeSize);
|
||||||
DwmSetWindowAttribute(hWnd, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE, ref attribute, attributeSize);
|
DwmSetWindowAttribute(hWnd, DWMWINDOWATTRIBUTE.DWMWA_USE_IMMERSIVE_DARK_MODE, ref attribute, attributeSize);
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
#endregion 杂项
|
||||||
|
|
||||||
#region TempPath
|
#region TempPath
|
||||||
|
|
||||||
|
@ -1083,6 +1085,7 @@ namespace v2rayN
|
||||||
}
|
}
|
||||||
return Path.Combine(_tempPath, filename);
|
return Path.Combine(_tempPath, filename);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetConfigPath(string filename = "")
|
public static string GetConfigPath(string filename = "")
|
||||||
{
|
{
|
||||||
string _tempPath = Path.Combine(StartupPath(), "guiConfigs");
|
string _tempPath = Path.Combine(StartupPath(), "guiConfigs");
|
||||||
|
@ -1099,6 +1102,7 @@ namespace v2rayN
|
||||||
return Path.Combine(_tempPath, filename);
|
return Path.Combine(_tempPath, filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetBinPath(string filename, ECoreType? coreType = null)
|
public static string GetBinPath(string filename, ECoreType? coreType = null)
|
||||||
{
|
{
|
||||||
string _tempPath = Path.Combine(StartupPath(), "bin");
|
string _tempPath = Path.Combine(StartupPath(), "bin");
|
||||||
|
@ -1123,6 +1127,7 @@ namespace v2rayN
|
||||||
return Path.Combine(_tempPath, filename);
|
return Path.Combine(_tempPath, filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetLogPath(string filename = "")
|
public static string GetLogPath(string filename = "")
|
||||||
{
|
{
|
||||||
string _tempPath = Path.Combine(StartupPath(), "guiLogs");
|
string _tempPath = Path.Combine(StartupPath(), "guiLogs");
|
||||||
|
@ -1139,6 +1144,7 @@ namespace v2rayN
|
||||||
return Path.Combine(_tempPath, filename);
|
return Path.Combine(_tempPath, filename);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetFontsPath(string filename = "")
|
public static string GetFontsPath(string filename = "")
|
||||||
{
|
{
|
||||||
string _tempPath = Path.Combine(StartupPath(), "guiFonts");
|
string _tempPath = Path.Combine(StartupPath(), "guiFonts");
|
||||||
|
@ -1156,7 +1162,7 @@ namespace v2rayN
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion TempPath
|
||||||
|
|
||||||
#region Log
|
#region Log
|
||||||
|
|
||||||
|
@ -1168,6 +1174,7 @@ namespace v2rayN
|
||||||
logger.Info(strContent);
|
logger.Info(strContent);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void SaveLog(string strTitle, Exception ex)
|
public static void SaveLog(string strTitle, Exception ex)
|
||||||
{
|
{
|
||||||
if (LogManager.IsLoggingEnabled())
|
if (LogManager.IsLoggingEnabled())
|
||||||
|
@ -1182,8 +1189,7 @@ namespace v2rayN
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion Log
|
||||||
|
|
||||||
|
|
||||||
#region scan screen
|
#region scan screen
|
||||||
|
|
||||||
|
@ -1243,12 +1249,10 @@ namespace v2rayN
|
||||||
return new(96 / g.DpiX, 96 / g.DpiY);
|
return new(96 / g.DpiX, 96 / g.DpiY);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion scan screen
|
||||||
|
|
||||||
|
|
||||||
#region Windows API
|
#region Windows API
|
||||||
|
|
||||||
|
|
||||||
[Flags]
|
[Flags]
|
||||||
public enum DWMWINDOWATTRIBUTE : uint
|
public enum DWMWINDOWATTRIBUTE : uint
|
||||||
{
|
{
|
||||||
|
@ -1259,6 +1263,6 @@ namespace v2rayN
|
||||||
[DllImport("dwmapi.dll")]
|
[DllImport("dwmapi.dll")]
|
||||||
public static extern int DwmSetWindowAttribute(IntPtr hwnd, DWMWINDOWATTRIBUTE attribute, ref int attributeValue, uint attributeSize);
|
public static extern int DwmSetWindowAttribute(IntPtr hwnd, DWMWINDOWATTRIBUTE attribute, ref int attributeValue, uint attributeSize);
|
||||||
|
|
||||||
#endregion
|
#endregion Windows API
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -22,7 +22,6 @@ namespace v2rayN.ViewModels
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public ProfileItem SelectedSource { get; set; }
|
public ProfileItem SelectedSource { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public ReactiveCommand<Unit, Unit> BrowseServerCmd { get; }
|
public ReactiveCommand<Unit, Unit> BrowseServerCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> EditServerCmd { get; }
|
public ReactiveCommand<Unit, Unit> EditServerCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> SaveServerCmd { get; }
|
public ReactiveCommand<Unit, Unit> SaveServerCmd { get; }
|
||||||
|
@ -158,4 +157,4 @@ namespace v2rayN.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -21,7 +21,6 @@ namespace v2rayN.ViewModels
|
||||||
|
|
||||||
public ReactiveCommand<Unit, Unit> SaveCmd { get; }
|
public ReactiveCommand<Unit, Unit> SaveCmd { get; }
|
||||||
|
|
||||||
|
|
||||||
public AddServerViewModel(ProfileItem profileItem, Window view)
|
public AddServerViewModel(ProfileItem profileItem, Window view)
|
||||||
{
|
{
|
||||||
_config = LazyConfig.Instance.GetConfig();
|
_config = LazyConfig.Instance.GetConfig();
|
||||||
|
@ -130,15 +129,19 @@ namespace v2rayN.ViewModels
|
||||||
case EConfigType.VMess:
|
case EConfigType.VMess:
|
||||||
ret = ConfigHandler.AddServer(ref _config, item);
|
ret = ConfigHandler.AddServer(ref _config, item);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EConfigType.Shadowsocks:
|
case EConfigType.Shadowsocks:
|
||||||
ret = ConfigHandler.AddShadowsocksServer(ref _config, item);
|
ret = ConfigHandler.AddShadowsocksServer(ref _config, item);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EConfigType.Socks:
|
case EConfigType.Socks:
|
||||||
ret = ConfigHandler.AddSocksServer(ref _config, item);
|
ret = ConfigHandler.AddSocksServer(ref _config, item);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EConfigType.VLESS:
|
case EConfigType.VLESS:
|
||||||
ret = ConfigHandler.AddVlessServer(ref _config, item);
|
ret = ConfigHandler.AddVlessServer(ref _config, item);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EConfigType.Trojan:
|
case EConfigType.Trojan:
|
||||||
ret = ConfigHandler.AddTrojanServer(ref _config, item);
|
ret = ConfigHandler.AddTrojanServer(ref _config, item);
|
||||||
break;
|
break;
|
||||||
|
@ -156,4 +159,4 @@ namespace v2rayN.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -22,7 +22,6 @@ using v2rayN.Resx;
|
||||||
using v2rayN.Tool;
|
using v2rayN.Tool;
|
||||||
using v2rayN.Views;
|
using v2rayN.Views;
|
||||||
|
|
||||||
|
|
||||||
namespace v2rayN.ViewModels
|
namespace v2rayN.ViewModels
|
||||||
{
|
{
|
||||||
public class MainWindowViewModel : ReactiveObject
|
public class MainWindowViewModel : ReactiveObject
|
||||||
|
@ -40,7 +39,7 @@ namespace v2rayN.ViewModels
|
||||||
private Dictionary<string, bool> _dicHeaderSort = new();
|
private Dictionary<string, bool> _dicHeaderSort = new();
|
||||||
private Action<EViewAction> _updateView;
|
private Action<EViewAction> _updateView;
|
||||||
|
|
||||||
#endregion
|
#endregion private prop
|
||||||
|
|
||||||
#region ObservableCollection
|
#region ObservableCollection
|
||||||
|
|
||||||
|
@ -58,25 +57,34 @@ namespace v2rayN.ViewModels
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public ProfileItemModel SelectedProfile { get; set; }
|
public ProfileItemModel SelectedProfile { get; set; }
|
||||||
|
|
||||||
public IList<ProfileItemModel> SelectedProfiles { get; set; }
|
public IList<ProfileItemModel> SelectedProfiles { get; set; }
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public SubItem SelectedSub { get; set; }
|
public SubItem SelectedSub { get; set; }
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public SubItem SelectedMoveToGroup { get; set; }
|
public SubItem SelectedMoveToGroup { get; set; }
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public RoutingItem SelectedRouting { get; set; }
|
public RoutingItem SelectedRouting { get; set; }
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public ComboItem SelectedServer { get; set; }
|
public ComboItem SelectedServer { get; set; }
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public string ServerFilter { get; set; }
|
public string ServerFilter { get; set; }
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public bool BlServers { get; set; }
|
public bool BlServers { get; set; }
|
||||||
#endregion
|
|
||||||
|
#endregion ObservableCollection
|
||||||
|
|
||||||
#region Menu
|
#region Menu
|
||||||
|
|
||||||
//servers
|
//servers
|
||||||
public ReactiveCommand<Unit, Unit> AddVmessServerCmd { get; }
|
public ReactiveCommand<Unit, Unit> AddVmessServerCmd { get; }
|
||||||
|
|
||||||
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; }
|
||||||
|
@ -84,34 +92,42 @@ namespace v2rayN.ViewModels
|
||||||
public ReactiveCommand<Unit, Unit> AddCustomServerCmd { get; }
|
public ReactiveCommand<Unit, Unit> AddCustomServerCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> AddServerViaClipboardCmd { get; }
|
public ReactiveCommand<Unit, Unit> AddServerViaClipboardCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> AddServerViaScanCmd { get; }
|
public ReactiveCommand<Unit, Unit> AddServerViaScanCmd { get; }
|
||||||
|
|
||||||
//servers delete
|
//servers delete
|
||||||
public ReactiveCommand<Unit, Unit> EditServerCmd { get; }
|
public ReactiveCommand<Unit, Unit> EditServerCmd { get; }
|
||||||
|
|
||||||
public ReactiveCommand<Unit, Unit> RemoveServerCmd { get; }
|
public ReactiveCommand<Unit, Unit> RemoveServerCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> RemoveDuplicateServerCmd { get; }
|
public ReactiveCommand<Unit, Unit> RemoveDuplicateServerCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> CopyServerCmd { get; }
|
public ReactiveCommand<Unit, Unit> CopyServerCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> SetDefaultServerCmd { get; }
|
public ReactiveCommand<Unit, Unit> SetDefaultServerCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> ShareServerCmd { get; }
|
public ReactiveCommand<Unit, Unit> ShareServerCmd { get; }
|
||||||
//servers move
|
|
||||||
|
//servers move
|
||||||
public ReactiveCommand<Unit, Unit> MoveTopCmd { get; }
|
public ReactiveCommand<Unit, Unit> MoveTopCmd { get; }
|
||||||
|
|
||||||
public ReactiveCommand<Unit, Unit> MoveUpCmd { get; }
|
public ReactiveCommand<Unit, Unit> MoveUpCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> MoveDownCmd { get; }
|
public ReactiveCommand<Unit, Unit> MoveDownCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> MoveBottomCmd { get; }
|
public ReactiveCommand<Unit, Unit> MoveBottomCmd { get; }
|
||||||
|
|
||||||
//servers ping
|
//servers ping
|
||||||
public ReactiveCommand<Unit, Unit> MixedTestServerCmd { get; }
|
public ReactiveCommand<Unit, Unit> MixedTestServerCmd { get; }
|
||||||
|
|
||||||
public ReactiveCommand<Unit, Unit> PingServerCmd { get; }
|
public ReactiveCommand<Unit, Unit> PingServerCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> TcpingServerCmd { get; }
|
public ReactiveCommand<Unit, Unit> TcpingServerCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> RealPingServerCmd { get; }
|
public ReactiveCommand<Unit, Unit> RealPingServerCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> SpeedServerCmd { get; }
|
public ReactiveCommand<Unit, Unit> SpeedServerCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> SortServerResultCmd { get; }
|
public ReactiveCommand<Unit, Unit> SortServerResultCmd { get; }
|
||||||
|
|
||||||
//servers export
|
//servers export
|
||||||
public ReactiveCommand<Unit, Unit> Export2ClientConfigCmd { get; }
|
public ReactiveCommand<Unit, Unit> Export2ClientConfigCmd { get; }
|
||||||
|
|
||||||
public ReactiveCommand<Unit, Unit> Export2ServerConfigCmd { get; }
|
public ReactiveCommand<Unit, Unit> Export2ServerConfigCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> Export2ShareUrlCmd { get; }
|
public ReactiveCommand<Unit, Unit> Export2ShareUrlCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> Export2SubContentCmd { get; }
|
public ReactiveCommand<Unit, Unit> Export2SubContentCmd { get; }
|
||||||
|
|
||||||
//Subscription
|
//Subscription
|
||||||
public ReactiveCommand<Unit, Unit> SubSettingCmd { get; }
|
public ReactiveCommand<Unit, Unit> SubSettingCmd { get; }
|
||||||
|
|
||||||
public ReactiveCommand<Unit, Unit> AddSubCmd { get; }
|
public ReactiveCommand<Unit, Unit> AddSubCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> SubUpdateCmd { get; }
|
public ReactiveCommand<Unit, Unit> SubUpdateCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> SubUpdateViaProxyCmd { get; }
|
public ReactiveCommand<Unit, Unit> SubUpdateViaProxyCmd { get; }
|
||||||
|
@ -120,6 +136,7 @@ namespace v2rayN.ViewModels
|
||||||
|
|
||||||
//Setting
|
//Setting
|
||||||
public ReactiveCommand<Unit, Unit> OptionSettingCmd { get; }
|
public ReactiveCommand<Unit, Unit> OptionSettingCmd { get; }
|
||||||
|
|
||||||
public ReactiveCommand<Unit, Unit> RoutingSettingCmd { get; }
|
public ReactiveCommand<Unit, Unit> RoutingSettingCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> GlobalHotkeySettingCmd { get; }
|
public ReactiveCommand<Unit, Unit> GlobalHotkeySettingCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> RebootAsAdminCmd { get; }
|
public ReactiveCommand<Unit, Unit> RebootAsAdminCmd { get; }
|
||||||
|
@ -128,36 +145,44 @@ namespace v2rayN.ViewModels
|
||||||
|
|
||||||
//CheckUpdate
|
//CheckUpdate
|
||||||
public ReactiveCommand<Unit, Unit> CheckUpdateNCmd { get; }
|
public ReactiveCommand<Unit, Unit> CheckUpdateNCmd { get; }
|
||||||
|
|
||||||
public ReactiveCommand<Unit, Unit> CheckUpdateV2flyCoreCmd { get; }
|
public ReactiveCommand<Unit, Unit> CheckUpdateV2flyCoreCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> CheckUpdateSagerNetCoreCmd { get; }
|
public ReactiveCommand<Unit, Unit> CheckUpdateSagerNetCoreCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> CheckUpdateXrayCoreCmd { get; }
|
public ReactiveCommand<Unit, Unit> CheckUpdateXrayCoreCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> CheckUpdateClashCoreCmd { get; }
|
public ReactiveCommand<Unit, Unit> CheckUpdateClashCoreCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> CheckUpdateClashMetaCoreCmd { get; }
|
public ReactiveCommand<Unit, Unit> CheckUpdateClashMetaCoreCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> CheckUpdateSingBoxCoreCmd { get; }
|
public ReactiveCommand<Unit, Unit> CheckUpdateSingBoxCoreCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> CheckUpdateGeoCmd { get; }
|
public ReactiveCommand<Unit, Unit> CheckUpdateGeoCmd { get; }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
public ReactiveCommand<Unit, Unit> ReloadCmd { get; }
|
public ReactiveCommand<Unit, Unit> ReloadCmd { get; }
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public bool BlReloadEnabled { get; set; }
|
public bool BlReloadEnabled { get; set; }
|
||||||
|
|
||||||
public ReactiveCommand<Unit, Unit> NotifyLeftClickCmd { get; }
|
public ReactiveCommand<Unit, Unit> NotifyLeftClickCmd { get; }
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public Icon NotifyIcon { get; set; }
|
public Icon NotifyIcon { get; set; }
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public ImageSource AppIcon { get; set; }
|
public ImageSource AppIcon { get; set; }
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region System Proxy
|
#endregion Menu
|
||||||
|
|
||||||
|
#region System Proxy
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public bool BlSystemProxyClear { get; set; }
|
public bool BlSystemProxyClear { get; set; }
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public bool BlSystemProxySet { get; set; }
|
public bool BlSystemProxySet { get; set; }
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public bool BlSystemProxyNothing { get; set; }
|
public bool BlSystemProxyNothing { get; set; }
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public bool BlSystemProxyPac { get; set; }
|
public bool BlSystemProxyPac { get; set; }
|
||||||
|
|
||||||
public ReactiveCommand<Unit, Unit> SystemProxyClearCmd { get; }
|
public ReactiveCommand<Unit, Unit> SystemProxyClearCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> SystemProxySetCmd { get; }
|
public ReactiveCommand<Unit, Unit> SystemProxySetCmd { get; }
|
||||||
public ReactiveCommand<Unit, Unit> SystemProxyNothingCmd { get; }
|
public ReactiveCommand<Unit, Unit> SystemProxyNothingCmd { get; }
|
||||||
|
@ -165,41 +190,54 @@ namespace v2rayN.ViewModels
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public bool BlRouting { get; set; }
|
public bool BlRouting { get; set; }
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public int SystemProxySelected { get; set; }
|
public int SystemProxySelected { get; set; }
|
||||||
#endregion
|
|
||||||
|
#endregion System Proxy
|
||||||
|
|
||||||
#region UI
|
#region UI
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public string InboundDisplay { get; set; }
|
public string InboundDisplay { get; set; }
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public string InboundLanDisplay { get; set; }
|
public string InboundLanDisplay { get; set; }
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public string RunningServerDisplay { get; set; }
|
public string RunningServerDisplay { get; set; }
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public string RunningServerToolTipText { get; set; }
|
public string RunningServerToolTipText { get; set; }
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public string RunningInfoDisplay { get; set; }
|
public string RunningInfoDisplay { get; set; }
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public string SpeedProxyDisplay { get; set; }
|
public string SpeedProxyDisplay { get; set; }
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public string SpeedDirectDisplay { get; set; }
|
public string SpeedDirectDisplay { get; set; }
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public bool EnableTun { get; set; }
|
public bool EnableTun { get; set; }
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public bool ColorModeDark { get; set; }
|
public bool ColorModeDark { get; set; }
|
||||||
|
|
||||||
private IObservableCollection<Swatch> _swatches = new ObservableCollectionExtended<Swatch>();
|
private IObservableCollection<Swatch> _swatches = new ObservableCollectionExtended<Swatch>();
|
||||||
public IObservableCollection<Swatch> Swatches => _swatches;
|
public IObservableCollection<Swatch> Swatches => _swatches;
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public Swatch SelectedSwatch { get; set; }
|
public Swatch SelectedSwatch { get; set; }
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public int CurrentFontSize { get; set; }
|
public int CurrentFontSize { get; set; }
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public string CurrentLanguage { get; set; }
|
public string CurrentLanguage { get; set; }
|
||||||
#endregion
|
|
||||||
|
#endregion UI
|
||||||
|
|
||||||
#region Init
|
#region Init
|
||||||
|
|
||||||
|
@ -330,7 +368,7 @@ namespace v2rayN.ViewModels
|
||||||
{
|
{
|
||||||
ShareServer();
|
ShareServer();
|
||||||
}, canEditRemove);
|
}, canEditRemove);
|
||||||
//servers move
|
//servers move
|
||||||
MoveTopCmd = ReactiveCommand.Create(() =>
|
MoveTopCmd = ReactiveCommand.Create(() =>
|
||||||
{
|
{
|
||||||
MoveServer(EMove.Top);
|
MoveServer(EMove.Top);
|
||||||
|
@ -391,7 +429,6 @@ namespace v2rayN.ViewModels
|
||||||
Export2SubContent();
|
Export2SubContent();
|
||||||
}, canEditRemove);
|
}, canEditRemove);
|
||||||
|
|
||||||
|
|
||||||
//Subscription
|
//Subscription
|
||||||
SubSettingCmd = ReactiveCommand.Create(() =>
|
SubSettingCmd = ReactiveCommand.Create(() =>
|
||||||
{
|
{
|
||||||
|
@ -476,7 +513,7 @@ namespace v2rayN.ViewModels
|
||||||
CheckUpdateSingBoxCoreCmd = ReactiveCommand.Create(() =>
|
CheckUpdateSingBoxCoreCmd = ReactiveCommand.Create(() =>
|
||||||
{
|
{
|
||||||
CheckUpdateCore(ECoreType.sing_box);
|
CheckUpdateCore(ECoreType.sing_box);
|
||||||
});
|
});
|
||||||
CheckUpdateGeoCmd = ReactiveCommand.Create(() =>
|
CheckUpdateGeoCmd = ReactiveCommand.Create(() =>
|
||||||
{
|
{
|
||||||
CheckUpdateGeo();
|
CheckUpdateGeo();
|
||||||
|
@ -510,7 +547,6 @@ namespace v2rayN.ViewModels
|
||||||
SetListenerType(ESysProxyType.Pac);
|
SetListenerType(ESysProxyType.Pac);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
Global.ShowInTaskbar = true;
|
Global.ShowInTaskbar = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -531,6 +567,7 @@ namespace v2rayN.ViewModels
|
||||||
Reload();
|
Reload();
|
||||||
ChangeSystemProxyStatus(_config.sysProxyType, true);
|
ChangeSystemProxyStatus(_config.sysProxyType, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void OnProgramStarted(object state, bool timeout)
|
private void OnProgramStarted(object state, bool timeout)
|
||||||
{
|
{
|
||||||
Application.Current.Dispatcher.Invoke((Action)(() =>
|
Application.Current.Dispatcher.Invoke((Action)(() =>
|
||||||
|
@ -539,13 +576,15 @@ namespace v2rayN.ViewModels
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion Init
|
||||||
|
|
||||||
#region Actions
|
#region Actions
|
||||||
|
|
||||||
private void UpdateHandler(bool notify, string msg)
|
private void UpdateHandler(bool notify, string msg)
|
||||||
{
|
{
|
||||||
_noticeHandler?.SendMessage(msg);
|
_noticeHandler?.SendMessage(msg);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateTaskHandler(bool success, string msg)
|
private void UpdateTaskHandler(bool success, string msg)
|
||||||
{
|
{
|
||||||
_noticeHandler?.SendMessage(msg);
|
_noticeHandler?.SendMessage(msg);
|
||||||
|
@ -563,6 +602,7 @@ namespace v2rayN.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateStatisticsHandler(ServerSpeedItem update)
|
private void UpdateStatisticsHandler(ServerSpeedItem update)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -610,6 +650,7 @@ namespace v2rayN.ViewModels
|
||||||
Utils.SaveLog(ex.Message, ex);
|
Utils.SaveLog(ex.Message, ex);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void UpdateSpeedtestHandler(string indexId, string delay, string speed)
|
private void UpdateSpeedtestHandler(string indexId, string delay, string speed)
|
||||||
{
|
{
|
||||||
Application.Current.Dispatcher.Invoke((Action)(() =>
|
Application.Current.Dispatcher.Invoke((Action)(() =>
|
||||||
|
@ -617,6 +658,7 @@ namespace v2rayN.ViewModels
|
||||||
SetTestResult(indexId, delay, speed);
|
SetTestResult(indexId, delay, speed);
|
||||||
}));
|
}));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetTestResult(string indexId, string delay, string speed)
|
private void SetTestResult(string indexId, string delay, string speed)
|
||||||
{
|
{
|
||||||
if (Utils.IsNullOrEmpty(indexId))
|
if (Utils.IsNullOrEmpty(indexId))
|
||||||
|
@ -649,20 +691,25 @@ namespace v2rayN.ViewModels
|
||||||
case EGlobalHotkey.ShowForm:
|
case EGlobalHotkey.ShowForm:
|
||||||
ShowHideWindow(null);
|
ShowHideWindow(null);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EGlobalHotkey.SystemProxyClear:
|
case EGlobalHotkey.SystemProxyClear:
|
||||||
SetListenerType(ESysProxyType.ForcedClear);
|
SetListenerType(ESysProxyType.ForcedClear);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EGlobalHotkey.SystemProxySet:
|
case EGlobalHotkey.SystemProxySet:
|
||||||
SetListenerType(ESysProxyType.ForcedChange);
|
SetListenerType(ESysProxyType.ForcedChange);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EGlobalHotkey.SystemProxyUnchanged:
|
case EGlobalHotkey.SystemProxyUnchanged:
|
||||||
SetListenerType(ESysProxyType.Unchanged);
|
SetListenerType(ESysProxyType.Unchanged);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EGlobalHotkey.SystemProxyPac:
|
case EGlobalHotkey.SystemProxyPac:
|
||||||
SetListenerType(ESysProxyType.Pac);
|
SetListenerType(ESysProxyType.Pac);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MyAppExit(bool blWindowsShutDown)
|
public void MyAppExit(bool blWindowsShutDown)
|
||||||
{
|
{
|
||||||
try
|
try
|
||||||
|
@ -698,7 +745,7 @@ namespace v2rayN.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion Actions
|
||||||
|
|
||||||
#region Servers && Groups
|
#region Servers && Groups
|
||||||
|
|
||||||
|
@ -789,7 +836,7 @@ namespace v2rayN.ViewModels
|
||||||
|
|
||||||
RefreshServersMenu();
|
RefreshServersMenu();
|
||||||
|
|
||||||
//display running server
|
//display running server
|
||||||
var running = ConfigHandler.GetDefaultServer(ref _config);
|
var running = ConfigHandler.GetDefaultServer(ref _config);
|
||||||
if (running != null)
|
if (running != null)
|
||||||
{
|
{
|
||||||
|
@ -848,9 +895,10 @@ namespace v2rayN.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion Servers && Groups
|
||||||
|
|
||||||
#region Add Servers
|
#region Add Servers
|
||||||
|
|
||||||
private int GetProfileItems(out List<ProfileItem> lstSelecteds, bool latest)
|
private int GetProfileItems(out List<ProfileItem> lstSelecteds, bool latest)
|
||||||
{
|
{
|
||||||
lstSelecteds = new List<ProfileItem>();
|
lstSelecteds = new List<ProfileItem>();
|
||||||
|
@ -934,6 +982,7 @@ namespace v2rayN.ViewModels
|
||||||
_noticeHandler?.Enqueue(string.Format(ResUI.SuccessfullyImportedServerViaClipboard, ret));
|
_noticeHandler?.Enqueue(string.Format(ResUI.SuccessfullyImportedServerViaClipboard, ret));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public async Task ScanScreenTaskAsync()
|
public async Task ScanScreenTaskAsync()
|
||||||
{
|
{
|
||||||
ShowHideWindow(false);
|
ShowHideWindow(false);
|
||||||
|
@ -961,6 +1010,7 @@ namespace v2rayN.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveServer()
|
public void RemoveServer()
|
||||||
{
|
{
|
||||||
if (GetProfileItems(out List<ProfileItem> lstSelecteds, false) < 0)
|
if (GetProfileItems(out List<ProfileItem> lstSelecteds, false) < 0)
|
||||||
|
@ -991,6 +1041,7 @@ namespace v2rayN.ViewModels
|
||||||
Reload();
|
Reload();
|
||||||
_noticeHandler?.Enqueue(string.Format(ResUI.RemoveDuplicateServerResult, tuple.Item1, tuple.Item2));
|
_noticeHandler?.Enqueue(string.Format(ResUI.RemoveDuplicateServerResult, tuple.Item1, tuple.Item2));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CopyServer()
|
private void CopyServer()
|
||||||
{
|
{
|
||||||
if (GetProfileItems(out List<ProfileItem> lstSelecteds, false) < 0)
|
if (GetProfileItems(out List<ProfileItem> lstSelecteds, false) < 0)
|
||||||
|
@ -1012,6 +1063,7 @@ namespace v2rayN.ViewModels
|
||||||
}
|
}
|
||||||
SetDefaultServer(SelectedProfile.indexId);
|
SetDefaultServer(SelectedProfile.indexId);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SetDefaultServer(string indexId)
|
private void SetDefaultServer(string indexId)
|
||||||
{
|
{
|
||||||
if (Utils.IsNullOrEmpty(indexId))
|
if (Utils.IsNullOrEmpty(indexId))
|
||||||
|
@ -1035,6 +1087,7 @@ namespace v2rayN.ViewModels
|
||||||
Reload();
|
Reload();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ServerSelectedChanged(bool c)
|
private void ServerSelectedChanged(bool c)
|
||||||
{
|
{
|
||||||
if (!c)
|
if (!c)
|
||||||
|
@ -1052,7 +1105,6 @@ namespace v2rayN.ViewModels
|
||||||
SetDefaultServer(SelectedServer.ID);
|
SetDefaultServer(SelectedServer.ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public async void ShareServer()
|
public async void ShareServer()
|
||||||
{
|
{
|
||||||
var item = LazyConfig.Instance.GetProfileItem(SelectedProfile.indexId);
|
var item = LazyConfig.Instance.GetProfileItem(SelectedProfile.indexId);
|
||||||
|
@ -1253,7 +1305,7 @@ namespace v2rayN.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion Add Servers
|
||||||
|
|
||||||
#region Subscription
|
#region Subscription
|
||||||
|
|
||||||
|
@ -1265,6 +1317,7 @@ namespace v2rayN.ViewModels
|
||||||
SubSelectedChanged(true);
|
SubSelectedChanged(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AddSub()
|
private void AddSub()
|
||||||
{
|
{
|
||||||
SubItem item = new();
|
SubItem item = new();
|
||||||
|
@ -1281,7 +1334,7 @@ namespace v2rayN.ViewModels
|
||||||
(new UpdateHandle()).UpdateSubscriptionProcess(_config, subId, blProxy, UpdateTaskHandler);
|
(new UpdateHandle()).UpdateSubscriptionProcess(_config, subId, blProxy, UpdateTaskHandler);
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion Subscription
|
||||||
|
|
||||||
#region Setting
|
#region Setting
|
||||||
|
|
||||||
|
@ -1295,6 +1348,7 @@ namespace v2rayN.ViewModels
|
||||||
TunModeSwitch();
|
TunModeSwitch();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RoutingSetting()
|
private void RoutingSetting()
|
||||||
{
|
{
|
||||||
var ret = (new RoutingSettingWindow()).ShowDialog();
|
var ret = (new RoutingSettingWindow()).ShowDialog();
|
||||||
|
@ -1357,7 +1411,7 @@ namespace v2rayN.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion Setting
|
||||||
|
|
||||||
#region CheckUpdate
|
#region CheckUpdate
|
||||||
|
|
||||||
|
@ -1413,7 +1467,7 @@ namespace v2rayN.ViewModels
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion CheckUpdate
|
||||||
|
|
||||||
#region v2ray job
|
#region v2ray job
|
||||||
|
|
||||||
|
@ -1422,8 +1476,7 @@ namespace v2rayN.ViewModels
|
||||||
_ = LoadV2ray();
|
_ = LoadV2ray();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private async Task LoadV2ray()
|
||||||
async Task LoadV2ray()
|
|
||||||
{
|
{
|
||||||
Application.Current.Dispatcher.Invoke((Action)(() =>
|
Application.Current.Dispatcher.Invoke((Action)(() =>
|
||||||
{
|
{
|
||||||
|
@ -1460,7 +1513,7 @@ namespace v2rayN.ViewModels
|
||||||
_coreHandler.CoreStop();
|
_coreHandler.CoreStop();
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion v2ray job
|
||||||
|
|
||||||
#region System proxy and Routings
|
#region System proxy and Routings
|
||||||
|
|
||||||
|
@ -1549,7 +1602,7 @@ namespace v2rayN.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoSystemProxySelected(bool c)
|
private void DoSystemProxySelected(bool c)
|
||||||
{
|
{
|
||||||
if (!c)
|
if (!c)
|
||||||
{
|
{
|
||||||
|
@ -1562,7 +1615,7 @@ namespace v2rayN.ViewModels
|
||||||
SetListenerType((ESysProxyType)SystemProxySelected);
|
SetListenerType((ESysProxyType)SystemProxySelected);
|
||||||
}
|
}
|
||||||
|
|
||||||
void DoEnableTun(bool c)
|
private void DoEnableTun(bool c)
|
||||||
{
|
{
|
||||||
if (_config.tunModeItem.enableTun != EnableTun)
|
if (_config.tunModeItem.enableTun != EnableTun)
|
||||||
{
|
{
|
||||||
|
@ -1571,7 +1624,7 @@ namespace v2rayN.ViewModels
|
||||||
TunModeSwitch();
|
TunModeSwitch();
|
||||||
}
|
}
|
||||||
|
|
||||||
void TunModeSwitch()
|
private void TunModeSwitch()
|
||||||
{
|
{
|
||||||
if (EnableTun)
|
if (EnableTun)
|
||||||
{
|
{
|
||||||
|
@ -1583,7 +1636,7 @@ namespace v2rayN.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion System proxy and Routings
|
||||||
|
|
||||||
#region UI
|
#region UI
|
||||||
|
|
||||||
|
@ -1626,6 +1679,7 @@ namespace v2rayN.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void StorageUI()
|
private void StorageUI()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
@ -1751,6 +1805,7 @@ namespace v2rayN.ViewModels
|
||||||
|
|
||||||
Utils.SetDarkBorder(Application.Current.MainWindow, isDarkTheme);
|
Utils.SetDarkBorder(Application.Current.MainWindow, isDarkTheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ChangePrimaryColor(System.Windows.Media.Color color)
|
public void ChangePrimaryColor(System.Windows.Media.Color color)
|
||||||
{
|
{
|
||||||
var theme = _paletteHelper.GetTheme();
|
var theme = _paletteHelper.GetTheme();
|
||||||
|
@ -1778,6 +1833,6 @@ namespace v2rayN.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion UI
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -16,6 +16,7 @@ namespace v2rayN.ViewModels
|
||||||
private Window _view;
|
private Window _view;
|
||||||
|
|
||||||
#region Core
|
#region Core
|
||||||
|
|
||||||
[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; }
|
||||||
|
@ -30,14 +31,18 @@ namespace v2rayN.ViewModels
|
||||||
[Reactive] public bool defAllowInsecure { get; set; }
|
[Reactive] public bool defAllowInsecure { get; set; }
|
||||||
[Reactive] public string defFingerprint { get; set; }
|
[Reactive] public string defFingerprint { get; set; }
|
||||||
[Reactive] public string defUserAgent { get; set; }
|
[Reactive] public string defUserAgent { get; set; }
|
||||||
#endregion
|
|
||||||
|
#endregion Core
|
||||||
|
|
||||||
#region Core DNS
|
#region Core DNS
|
||||||
|
|
||||||
[Reactive] public string domainStrategy4Freedom { get; set; }
|
[Reactive] public string domainStrategy4Freedom { get; set; }
|
||||||
[Reactive] public string remoteDNS { get; set; }
|
[Reactive] public string remoteDNS { get; set; }
|
||||||
#endregion
|
|
||||||
|
#endregion Core DNS
|
||||||
|
|
||||||
#region Core KCP
|
#region Core KCP
|
||||||
|
|
||||||
//[Reactive] public int Kcpmtu { get; set; }
|
//[Reactive] public int Kcpmtu { get; set; }
|
||||||
//[Reactive] public int Kcptti { get; set; }
|
//[Reactive] public int Kcptti { get; set; }
|
||||||
//[Reactive] public int KcpuplinkCapacity { get; set; }
|
//[Reactive] public int KcpuplinkCapacity { get; set; }
|
||||||
|
@ -45,9 +50,11 @@ namespace v2rayN.ViewModels
|
||||||
//[Reactive] public int KcpreadBufferSize { get; set; }
|
//[Reactive] public int KcpreadBufferSize { get; set; }
|
||||||
//[Reactive] public int KcpwriteBufferSize { get; set; }
|
//[Reactive] public int KcpwriteBufferSize { get; set; }
|
||||||
//[Reactive] public bool Kcpcongestion { get; set; }
|
//[Reactive] public bool Kcpcongestion { get; set; }
|
||||||
#endregion
|
|
||||||
|
#endregion Core KCP
|
||||||
|
|
||||||
#region UI
|
#region UI
|
||||||
|
|
||||||
[Reactive] public bool AutoRun { get; set; }
|
[Reactive] public bool AutoRun { get; set; }
|
||||||
[Reactive] public bool EnableStatistics { get; set; }
|
[Reactive] public bool EnableStatistics { get; set; }
|
||||||
[Reactive] public int StatisticsFreshRate { get; set; }
|
[Reactive] public int StatisticsFreshRate { get; set; }
|
||||||
|
@ -66,14 +73,17 @@ namespace v2rayN.ViewModels
|
||||||
[Reactive] public string SpeedTestUrl { get; set; }
|
[Reactive] public string SpeedTestUrl { get; set; }
|
||||||
[Reactive] public bool EnableHWA { get; set; }
|
[Reactive] public bool EnableHWA { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion UI
|
||||||
|
|
||||||
#region System proxy
|
#region System proxy
|
||||||
|
|
||||||
[Reactive] public string systemProxyAdvancedProtocol { get; set; }
|
[Reactive] public string systemProxyAdvancedProtocol { get; set; }
|
||||||
[Reactive] public string systemProxyExceptions { get; set; }
|
[Reactive] public string systemProxyExceptions { get; set; }
|
||||||
#endregion
|
|
||||||
|
#endregion System proxy
|
||||||
|
|
||||||
#region Tun mode
|
#region Tun mode
|
||||||
|
|
||||||
[Reactive] public bool TunShowWindow { get; set; }
|
[Reactive] public bool TunShowWindow { get; set; }
|
||||||
[Reactive] public bool TunEnabledLog { get; set; }
|
[Reactive] public bool TunEnabledLog { get; set; }
|
||||||
[Reactive] public bool TunStrictRoute { get; set; }
|
[Reactive] public bool TunStrictRoute { get; set; }
|
||||||
|
@ -88,9 +98,11 @@ namespace v2rayN.ViewModels
|
||||||
[Reactive] public string TunProxyIP { get; set; }
|
[Reactive] public string TunProxyIP { get; set; }
|
||||||
[Reactive] public string TunProxyProcess { get; set; }
|
[Reactive] public string TunProxyProcess { get; set; }
|
||||||
[Reactive] public string TunProxyDNS { get; set; }
|
[Reactive] public string TunProxyDNS { get; set; }
|
||||||
#endregion
|
|
||||||
|
#endregion Tun mode
|
||||||
|
|
||||||
#region CoreType
|
#region CoreType
|
||||||
|
|
||||||
[Reactive] public string CoreType1 { get; set; }
|
[Reactive] public string CoreType1 { get; set; }
|
||||||
[Reactive] public string CoreType2 { get; set; }
|
[Reactive] public string CoreType2 { get; set; }
|
||||||
[Reactive] public string CoreType3 { get; set; }
|
[Reactive] public string CoreType3 { get; set; }
|
||||||
|
@ -98,11 +110,10 @@ namespace v2rayN.ViewModels
|
||||||
[Reactive] public string CoreType5 { get; set; }
|
[Reactive] public string CoreType5 { get; set; }
|
||||||
[Reactive] public string CoreType6 { get; set; }
|
[Reactive] public string CoreType6 { get; set; }
|
||||||
|
|
||||||
#endregion
|
#endregion CoreType
|
||||||
|
|
||||||
public ReactiveCommand<Unit, Unit> SaveCmd { get; }
|
public ReactiveCommand<Unit, Unit> SaveCmd { get; }
|
||||||
|
|
||||||
|
|
||||||
public OptionSettingViewModel(Window view)
|
public OptionSettingViewModel(Window view)
|
||||||
{
|
{
|
||||||
_config = LazyConfig.Instance.GetConfig();
|
_config = LazyConfig.Instance.GetConfig();
|
||||||
|
@ -110,6 +121,7 @@ namespace v2rayN.ViewModels
|
||||||
_view = view;
|
_view = view;
|
||||||
|
|
||||||
#region Core
|
#region Core
|
||||||
|
|
||||||
var inbound = _config.inbound[0];
|
var inbound = _config.inbound[0];
|
||||||
localPort = inbound.localPort;
|
localPort = inbound.localPort;
|
||||||
udpEnabled = inbound.udpEnabled;
|
udpEnabled = inbound.udpEnabled;
|
||||||
|
@ -125,14 +137,18 @@ namespace v2rayN.ViewModels
|
||||||
defAllowInsecure = _config.coreBasicItem.defAllowInsecure;
|
defAllowInsecure = _config.coreBasicItem.defAllowInsecure;
|
||||||
defFingerprint = _config.coreBasicItem.defFingerprint;
|
defFingerprint = _config.coreBasicItem.defFingerprint;
|
||||||
defUserAgent = _config.coreBasicItem.defUserAgent;
|
defUserAgent = _config.coreBasicItem.defUserAgent;
|
||||||
#endregion
|
|
||||||
|
#endregion Core
|
||||||
|
|
||||||
#region Core DNS
|
#region Core DNS
|
||||||
|
|
||||||
domainStrategy4Freedom = _config.domainStrategy4Freedom;
|
domainStrategy4Freedom = _config.domainStrategy4Freedom;
|
||||||
remoteDNS = _config.remoteDNS;
|
remoteDNS = _config.remoteDNS;
|
||||||
#endregion
|
|
||||||
|
#endregion Core DNS
|
||||||
|
|
||||||
#region Core KCP
|
#region Core KCP
|
||||||
|
|
||||||
//Kcpmtu = _config.kcpItem.mtu;
|
//Kcpmtu = _config.kcpItem.mtu;
|
||||||
//Kcptti = _config.kcpItem.tti;
|
//Kcptti = _config.kcpItem.tti;
|
||||||
//KcpuplinkCapacity = _config.kcpItem.uplinkCapacity;
|
//KcpuplinkCapacity = _config.kcpItem.uplinkCapacity;
|
||||||
|
@ -140,9 +156,11 @@ namespace v2rayN.ViewModels
|
||||||
//KcpreadBufferSize = _config.kcpItem.readBufferSize;
|
//KcpreadBufferSize = _config.kcpItem.readBufferSize;
|
||||||
//KcpwriteBufferSize = _config.kcpItem.writeBufferSize;
|
//KcpwriteBufferSize = _config.kcpItem.writeBufferSize;
|
||||||
//Kcpcongestion = _config.kcpItem.congestion;
|
//Kcpcongestion = _config.kcpItem.congestion;
|
||||||
#endregion
|
|
||||||
|
#endregion Core KCP
|
||||||
|
|
||||||
#region UI
|
#region UI
|
||||||
|
|
||||||
AutoRun = _config.guiItem.autoRun;
|
AutoRun = _config.guiItem.autoRun;
|
||||||
EnableStatistics = _config.guiItem.enableStatistics;
|
EnableStatistics = _config.guiItem.enableStatistics;
|
||||||
StatisticsFreshRate = _config.guiItem.statisticsFreshRate;
|
StatisticsFreshRate = _config.guiItem.statisticsFreshRate;
|
||||||
|
@ -161,12 +179,14 @@ namespace v2rayN.ViewModels
|
||||||
SpeedTestUrl = _config.speedTestItem.speedTestUrl;
|
SpeedTestUrl = _config.speedTestItem.speedTestUrl;
|
||||||
EnableHWA = _config.guiItem.enableHWA;
|
EnableHWA = _config.guiItem.enableHWA;
|
||||||
|
|
||||||
#endregion
|
#endregion UI
|
||||||
|
|
||||||
#region System proxy
|
#region System proxy
|
||||||
|
|
||||||
systemProxyAdvancedProtocol = _config.systemProxyAdvancedProtocol;
|
systemProxyAdvancedProtocol = _config.systemProxyAdvancedProtocol;
|
||||||
systemProxyExceptions = _config.systemProxyExceptions;
|
systemProxyExceptions = _config.systemProxyExceptions;
|
||||||
#endregion
|
|
||||||
|
#endregion System proxy
|
||||||
|
|
||||||
#region Tun mode
|
#region Tun mode
|
||||||
|
|
||||||
|
@ -187,7 +207,7 @@ namespace v2rayN.ViewModels
|
||||||
x => x.TunBypassMode)
|
x => x.TunBypassMode)
|
||||||
.Subscribe(c => TunBypassMode2 = !TunBypassMode);
|
.Subscribe(c => TunBypassMode2 = !TunBypassMode);
|
||||||
|
|
||||||
#endregion
|
#endregion Tun mode
|
||||||
|
|
||||||
InitCoreType();
|
InitCoreType();
|
||||||
|
|
||||||
|
@ -227,18 +247,23 @@ namespace v2rayN.ViewModels
|
||||||
case 1:
|
case 1:
|
||||||
CoreType1 = type;
|
CoreType1 = type;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
CoreType2 = type;
|
CoreType2 = type;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
CoreType3 = type;
|
CoreType3 = type;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
CoreType4 = type;
|
CoreType4 = type;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 5:
|
case 5:
|
||||||
CoreType5 = type;
|
CoreType5 = type;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6:
|
case 6:
|
||||||
CoreType6 = type;
|
CoreType6 = type;
|
||||||
break;
|
break;
|
||||||
|
@ -246,7 +271,6 @@ namespace v2rayN.ViewModels
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void SaveSetting()
|
private void SaveSetting()
|
||||||
{
|
{
|
||||||
if (Utils.IsNullOrEmpty(localPort.ToString()) || !Utils.IsNumberic(localPort.ToString())
|
if (Utils.IsNullOrEmpty(localPort.ToString()) || !Utils.IsNumberic(localPort.ToString())
|
||||||
|
@ -300,12 +324,10 @@ namespace v2rayN.ViewModels
|
||||||
_config.coreBasicItem.defFingerprint = defFingerprint;
|
_config.coreBasicItem.defFingerprint = defFingerprint;
|
||||||
_config.coreBasicItem.defUserAgent = defUserAgent;
|
_config.coreBasicItem.defUserAgent = defUserAgent;
|
||||||
|
|
||||||
|
|
||||||
//DNS
|
//DNS
|
||||||
_config.remoteDNS = remoteDNS;
|
_config.remoteDNS = remoteDNS;
|
||||||
_config.domainStrategy4Freedom = domainStrategy4Freedom;
|
_config.domainStrategy4Freedom = domainStrategy4Freedom;
|
||||||
|
|
||||||
|
|
||||||
//Kcp
|
//Kcp
|
||||||
//_config.kcpItem.mtu = Kcpmtu;
|
//_config.kcpItem.mtu = Kcpmtu;
|
||||||
//_config.kcpItem.tti = Kcptti;
|
//_config.kcpItem.tti = Kcptti;
|
||||||
|
@ -315,7 +337,6 @@ namespace v2rayN.ViewModels
|
||||||
//_config.kcpItem.writeBufferSize = KcpwriteBufferSize;
|
//_config.kcpItem.writeBufferSize = KcpwriteBufferSize;
|
||||||
//_config.kcpItem.congestion = Kcpcongestion;
|
//_config.kcpItem.congestion = Kcpcongestion;
|
||||||
|
|
||||||
|
|
||||||
//UI
|
//UI
|
||||||
Utils.SetAutoRun(AutoRun);
|
Utils.SetAutoRun(AutoRun);
|
||||||
_config.guiItem.autoRun = AutoRun;
|
_config.guiItem.autoRun = AutoRun;
|
||||||
|
@ -359,7 +380,7 @@ namespace v2rayN.ViewModels
|
||||||
_config.tunModeItem.proxyProcess = Utils.String2List(TunProxyProcess);
|
_config.tunModeItem.proxyProcess = Utils.String2List(TunProxyProcess);
|
||||||
_config.tunModeItem.proxyDNS = Utils.ToJson(Utils.ParseJson(TunProxyDNS));
|
_config.tunModeItem.proxyDNS = Utils.ToJson(Utils.ParseJson(TunProxyDNS));
|
||||||
|
|
||||||
//coreType
|
//coreType
|
||||||
SaveCoreType();
|
SaveCoreType();
|
||||||
|
|
||||||
if (ConfigHandler.SaveConfig(ref _config) == 0)
|
if (ConfigHandler.SaveConfig(ref _config) == 0)
|
||||||
|
@ -371,8 +392,8 @@ namespace v2rayN.ViewModels
|
||||||
{
|
{
|
||||||
UI.ShowWarning(ResUI.OperationFailed);
|
UI.ShowWarning(ResUI.OperationFailed);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private int SaveCoreType()
|
private int SaveCoreType()
|
||||||
{
|
{
|
||||||
for (int k = 1; k <= _config.coreTypeItem.Count; k++)
|
for (int k = 1; k <= _config.coreTypeItem.Count; k++)
|
||||||
|
@ -384,18 +405,23 @@ namespace v2rayN.ViewModels
|
||||||
case 1:
|
case 1:
|
||||||
type = CoreType1;
|
type = CoreType1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 2:
|
case 2:
|
||||||
type = CoreType2;
|
type = CoreType2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 3:
|
case 3:
|
||||||
type = CoreType3;
|
type = CoreType3;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 4:
|
case 4:
|
||||||
type = CoreType4;
|
type = CoreType4;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 5:
|
case 5:
|
||||||
type = CoreType5;
|
type = CoreType5;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case 6:
|
case 6:
|
||||||
type = CoreType6;
|
type = CoreType6;
|
||||||
break;
|
break;
|
||||||
|
@ -405,4 +431,4 @@ namespace v2rayN.ViewModels
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -31,10 +31,8 @@ namespace v2rayN.ViewModels
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public bool AutoSort { get; set; }
|
public bool AutoSort { get; set; }
|
||||||
|
|
||||||
|
|
||||||
public ReactiveCommand<Unit, Unit> SaveCmd { get; }
|
public ReactiveCommand<Unit, Unit> SaveCmd { get; }
|
||||||
|
|
||||||
|
|
||||||
public RoutingRuleDetailsViewModel(RulesItem rulesItem, Window view)
|
public RoutingRuleDetailsViewModel(RulesItem rulesItem, Window view)
|
||||||
{
|
{
|
||||||
_config = LazyConfig.Instance.GetConfig();
|
_config = LazyConfig.Instance.GetConfig();
|
||||||
|
@ -63,6 +61,7 @@ namespace v2rayN.ViewModels
|
||||||
|
|
||||||
Utils.SetDarkBorder(view, _config.uiItem.colorModeDark);
|
Utils.SetDarkBorder(view, _config.uiItem.colorModeDark);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveRules()
|
private void SaveRules()
|
||||||
{
|
{
|
||||||
if (AutoSort)
|
if (AutoSort)
|
||||||
|
@ -96,4 +95,4 @@ namespace v2rayN.ViewModels
|
||||||
_view.DialogResult = true;
|
_view.DialogResult = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -26,8 +26,10 @@ namespace v2rayN.ViewModels
|
||||||
|
|
||||||
private IObservableCollection<RulesItemModel> _rulesItems = new ObservableCollectionExtended<RulesItemModel>();
|
private IObservableCollection<RulesItemModel> _rulesItems = new ObservableCollectionExtended<RulesItemModel>();
|
||||||
public IObservableCollection<RulesItemModel> RulesItems => _rulesItems;
|
public IObservableCollection<RulesItemModel> RulesItems => _rulesItems;
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public RulesItemModel SelectedSource { get; set; }
|
public RulesItemModel SelectedSource { get; set; }
|
||||||
|
|
||||||
public IList<RulesItemModel> SelectedSources { get; set; }
|
public IList<RulesItemModel> SelectedSources { get; set; }
|
||||||
|
|
||||||
public ReactiveCommand<Unit, Unit> RuleAddCmd { get; }
|
public ReactiveCommand<Unit, Unit> RuleAddCmd { get; }
|
||||||
|
@ -43,7 +45,6 @@ namespace v2rayN.ViewModels
|
||||||
|
|
||||||
public ReactiveCommand<Unit, Unit> SaveCmd { get; }
|
public ReactiveCommand<Unit, Unit> SaveCmd { get; }
|
||||||
|
|
||||||
|
|
||||||
public RoutingRuleSettingViewModel(RoutingItem routingItem, Window view)
|
public RoutingRuleSettingViewModel(RoutingItem routingItem, Window view)
|
||||||
{
|
{
|
||||||
_config = LazyConfig.Instance.GetConfig();
|
_config = LazyConfig.Instance.GetConfig();
|
||||||
|
@ -188,6 +189,7 @@ namespace v2rayN.ViewModels
|
||||||
|
|
||||||
RefreshRulesItems();
|
RefreshRulesItems();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RuleExportSelected()
|
public void RuleExportSelected()
|
||||||
{
|
{
|
||||||
if (SelectedSource is null || SelectedSource.outboundTag.IsNullOrEmpty())
|
if (SelectedSource is null || SelectedSource.outboundTag.IsNullOrEmpty())
|
||||||
|
@ -299,6 +301,7 @@ namespace v2rayN.ViewModels
|
||||||
UI.Show(ResUI.OperationSuccess);
|
UI.Show(ResUI.OperationSuccess);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private async Task ImportRulesFromUrl()
|
private async Task ImportRulesFromUrl()
|
||||||
{
|
{
|
||||||
var url = SelectedRouting.url;
|
var url = SelectedRouting.url;
|
||||||
|
@ -319,6 +322,7 @@ namespace v2rayN.ViewModels
|
||||||
UI.Show(ResUI.OperationSuccess);
|
UI.Show(ResUI.OperationSuccess);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private int AddBatchRoutingRules(RoutingItem routingItem, string clipboardData)
|
private int AddBatchRoutingRules(RoutingItem routingItem, string clipboardData)
|
||||||
{
|
{
|
||||||
bool blReplace = false;
|
bool blReplace = false;
|
||||||
|
@ -351,6 +355,6 @@ namespace v2rayN.ViewModels
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion Import rules
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -20,34 +20,43 @@ namespace v2rayN.ViewModels
|
||||||
private RoutingItem _lockedItem;
|
private RoutingItem _lockedItem;
|
||||||
private List<RulesItem> _lockedRules;
|
private List<RulesItem> _lockedRules;
|
||||||
|
|
||||||
|
|
||||||
#region Reactive
|
#region Reactive
|
||||||
|
|
||||||
private IObservableCollection<RoutingItemModel> _routingItems = new ObservableCollectionExtended<RoutingItemModel>();
|
private IObservableCollection<RoutingItemModel> _routingItems = new ObservableCollectionExtended<RoutingItemModel>();
|
||||||
public IObservableCollection<RoutingItemModel> RoutingItems => _routingItems;
|
public IObservableCollection<RoutingItemModel> RoutingItems => _routingItems;
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public RoutingItemModel SelectedSource { get; set; }
|
public RoutingItemModel SelectedSource { get; set; }
|
||||||
|
|
||||||
public IList<RoutingItemModel> SelectedSources { get; set; }
|
public IList<RoutingItemModel> SelectedSources { get; set; }
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public bool enableRoutingAdvanced { get; set; }
|
public bool enableRoutingAdvanced { get; set; }
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public bool enableRoutingBasic { get; set; }
|
public bool enableRoutingBasic { get; set; }
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public string domainStrategy { get; set; }
|
public string domainStrategy { get; set; }
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public string domainMatcher { get; set; }
|
public string domainMatcher { get; set; }
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public string ProxyDomain { get; set; }
|
public string ProxyDomain { get; set; }
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public string ProxyIP { get; set; }
|
public string ProxyIP { get; set; }
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public string DirectDomain { get; set; }
|
public string DirectDomain { get; set; }
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public string DirectIP { get; set; }
|
public string DirectIP { get; set; }
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public string BlockDomain { get; set; }
|
public string BlockDomain { get; set; }
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public string BlockIP { get; set; }
|
public string BlockIP { get; set; }
|
||||||
|
|
||||||
|
@ -59,7 +68,8 @@ namespace v2rayN.ViewModels
|
||||||
|
|
||||||
public ReactiveCommand<Unit, Unit> SaveCmd { get; }
|
public ReactiveCommand<Unit, Unit> SaveCmd { get; }
|
||||||
public bool IsModified { get; set; }
|
public bool IsModified { get; set; }
|
||||||
#endregion
|
|
||||||
|
#endregion Reactive
|
||||||
|
|
||||||
public RoutingSettingViewModel(Window view)
|
public RoutingSettingViewModel(Window view)
|
||||||
{
|
{
|
||||||
|
@ -117,6 +127,7 @@ namespace v2rayN.ViewModels
|
||||||
}
|
}
|
||||||
|
|
||||||
#region locked
|
#region locked
|
||||||
|
|
||||||
private void BindingLockedData()
|
private void BindingLockedData()
|
||||||
{
|
{
|
||||||
_lockedItem = ConfigHandler.GetLockedRoutingItem(ref _config);
|
_lockedItem = ConfigHandler.GetLockedRoutingItem(ref _config);
|
||||||
|
@ -133,6 +144,7 @@ namespace v2rayN.ViewModels
|
||||||
BlockIP = Utils.List2String(_lockedRules[2].ip, true);
|
BlockIP = Utils.List2String(_lockedRules[2].ip, true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void EndBindingLockedData()
|
private void EndBindingLockedData()
|
||||||
{
|
{
|
||||||
if (_lockedItem != null)
|
if (_lockedItem != null)
|
||||||
|
@ -151,9 +163,11 @@ namespace v2rayN.ViewModels
|
||||||
ConfigHandler.SaveRoutingItem(ref _config, _lockedItem);
|
ConfigHandler.SaveRoutingItem(ref _config, _lockedItem);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
#endregion locked
|
||||||
|
|
||||||
#region Refresh Save
|
#region Refresh Save
|
||||||
|
|
||||||
public void RefreshRoutingItems()
|
public void RefreshRoutingItems()
|
||||||
{
|
{
|
||||||
_routingItems.Clear();
|
_routingItems.Clear();
|
||||||
|
@ -180,6 +194,7 @@ namespace v2rayN.ViewModels
|
||||||
_routingItems.Add(it);
|
_routingItems.Add(it);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveRouting()
|
private void SaveRouting()
|
||||||
{
|
{
|
||||||
_config.routingBasicItem.domainStrategy = domainStrategy;
|
_config.routingBasicItem.domainStrategy = domainStrategy;
|
||||||
|
@ -199,7 +214,7 @@ namespace v2rayN.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion Refresh Save
|
||||||
|
|
||||||
private void RoutingBasicImportRules()
|
private void RoutingBasicImportRules()
|
||||||
{
|
{
|
||||||
|
@ -275,6 +290,7 @@ namespace v2rayN.ViewModels
|
||||||
IsModified = true;
|
IsModified = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void RoutingAdvancedImportRules()
|
private void RoutingAdvancedImportRules()
|
||||||
{
|
{
|
||||||
if (ConfigHandler.InitBuiltinRouting(ref _config, true) == 0)
|
if (ConfigHandler.InitBuiltinRouting(ref _config, true) == 0)
|
||||||
|
@ -284,4 +300,4 @@ namespace v2rayN.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -21,7 +21,6 @@ namespace v2rayN.ViewModels
|
||||||
|
|
||||||
public ReactiveCommand<Unit, Unit> SaveCmd { get; }
|
public ReactiveCommand<Unit, Unit> SaveCmd { get; }
|
||||||
|
|
||||||
|
|
||||||
public SubEditViewModel(SubItem subItem, Window view)
|
public SubEditViewModel(SubItem subItem, Window view)
|
||||||
{
|
{
|
||||||
_config = LazyConfig.Instance.GetConfig();
|
_config = LazyConfig.Instance.GetConfig();
|
||||||
|
@ -44,6 +43,7 @@ namespace v2rayN.ViewModels
|
||||||
|
|
||||||
Utils.SetDarkBorder(view, _config.uiItem.colorModeDark);
|
Utils.SetDarkBorder(view, _config.uiItem.colorModeDark);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void SaveSub()
|
private void SaveSub()
|
||||||
{
|
{
|
||||||
string remarks = SelectedSource.remarks;
|
string remarks = SelectedSource.remarks;
|
||||||
|
@ -82,4 +82,4 @@ namespace v2rayN.ViewModels
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -21,8 +21,10 @@ namespace v2rayN.ViewModels
|
||||||
|
|
||||||
private IObservableCollection<SubItem> _subItems = new ObservableCollectionExtended<SubItem>();
|
private IObservableCollection<SubItem> _subItems = new ObservableCollectionExtended<SubItem>();
|
||||||
public IObservableCollection<SubItem> SubItems => _subItems;
|
public IObservableCollection<SubItem> SubItems => _subItems;
|
||||||
|
|
||||||
[Reactive]
|
[Reactive]
|
||||||
public SubItem SelectedSource { get; set; }
|
public SubItem SelectedSource { get; set; }
|
||||||
|
|
||||||
public IList<SubItem> SelectedSources { get; set; }
|
public IList<SubItem> SelectedSources { get; set; }
|
||||||
|
|
||||||
public ReactiveCommand<Unit, Unit> SubAddCmd { get; }
|
public ReactiveCommand<Unit, Unit> SubAddCmd { get; }
|
||||||
|
@ -91,7 +93,6 @@ namespace v2rayN.ViewModels
|
||||||
RefreshSubItems();
|
RefreshSubItems();
|
||||||
IsModified = true;
|
IsModified = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void DeleteSub()
|
private void DeleteSub()
|
||||||
|
@ -125,6 +126,5 @@ namespace v2rayN.ViewModels
|
||||||
|
|
||||||
await DialogHost.Show(dialog, "SubDialog");
|
await DialogHost.Show(dialog, "SubDialog");
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -150,7 +150,6 @@
|
||||||
Text="{x:Static resx:ResUI.TipDisplayLog}" />
|
Text="{x:Static resx:ResUI.TipDisplayLog}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
|
|
||||||
<TextBlock
|
<TextBlock
|
||||||
Grid.Row="5"
|
Grid.Row="5"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
|
@ -178,7 +177,6 @@
|
||||||
Text="{x:Static resx:ResUI.TipPreSocksPort}"
|
Text="{x:Static resx:ResUI.TipPreSocksPort}"
|
||||||
TextWrapping="Wrap" />
|
TextWrapping="Wrap" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Grid
|
<Grid
|
||||||
|
@ -204,9 +202,6 @@
|
||||||
IsCancel="true"
|
IsCancel="true"
|
||||||
Style="{StaticResource DefButton}" />
|
Style="{StaticResource DefButton}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
</reactiveui:ReactiveWindow>
|
</reactiveui:ReactiveWindow>
|
|
@ -34,15 +34,14 @@ namespace v2rayN.Views
|
||||||
this.BindCommand(ViewModel, vm => vm.BrowseServerCmd, v => v.btnBrowse).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.BrowseServerCmd, v => v.btnBrowse).DisposeWith(disposables);
|
||||||
this.BindCommand(ViewModel, vm => vm.EditServerCmd, v => v.btnEdit).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.EditServerCmd, v => v.btnEdit).DisposeWith(disposables);
|
||||||
this.BindCommand(ViewModel, vm => vm.SaveServerCmd, v => v.btnSave).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.SaveServerCmd, v => v.btnSave).DisposeWith(disposables);
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
txtRemarks.Focus();
|
txtRemarks.Focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnCancel_Click(object sender, System.Windows.RoutedEventArgs e)
|
private void btnCancel_Click(object sender, System.Windows.RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (ViewModel?.IsModified == true)
|
if (ViewModel?.IsModified == true)
|
||||||
|
@ -54,8 +53,5 @@ namespace v2rayN.Views
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -193,7 +193,6 @@
|
||||||
Width="200"
|
Width="200"
|
||||||
Margin="{StaticResource ServerItemMargin}"
|
Margin="{StaticResource ServerItemMargin}"
|
||||||
Style="{StaticResource DefComboBox}" />
|
Style="{StaticResource DefComboBox}" />
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid
|
<Grid
|
||||||
x:Name="gridSs"
|
x:Name="gridSs"
|
||||||
|
@ -239,7 +238,6 @@
|
||||||
Width="300"
|
Width="300"
|
||||||
Margin="{StaticResource ServerItemMargin}"
|
Margin="{StaticResource ServerItemMargin}"
|
||||||
Style="{StaticResource DefComboBox}" />
|
Style="{StaticResource DefComboBox}" />
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid
|
<Grid
|
||||||
x:Name="gridSocks"
|
x:Name="gridSocks"
|
||||||
|
@ -285,7 +283,6 @@
|
||||||
Width="400"
|
Width="400"
|
||||||
Margin="{StaticResource ServerItemMargin}"
|
Margin="{StaticResource ServerItemMargin}"
|
||||||
Style="{StaticResource DefTextBox}" />
|
Style="{StaticResource DefTextBox}" />
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid
|
<Grid
|
||||||
x:Name="gridVLESS"
|
x:Name="gridVLESS"
|
||||||
|
@ -523,7 +520,6 @@
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Style="{StaticResource ToolbarTextBlock}"
|
Style="{StaticResource ToolbarTextBlock}"
|
||||||
Text="{x:Static resx:ResUI.TbPath}" />
|
Text="{x:Static resx:ResUI.TbPath}" />
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<Separator
|
<Separator
|
||||||
|
@ -732,8 +728,6 @@
|
||||||
Margin="{StaticResource ServerItemMargin}"
|
Margin="{StaticResource ServerItemMargin}"
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
Style="{StaticResource DefTextBox}" />
|
Style="{StaticResource DefTextBox}" />
|
||||||
|
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
<Separator
|
<Separator
|
||||||
Grid.Row="8"
|
Grid.Row="8"
|
||||||
|
@ -765,7 +759,6 @@
|
||||||
IsCancel="true"
|
IsCancel="true"
|
||||||
Style="{StaticResource DefButton}" />
|
Style="{StaticResource DefButton}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
</reactiveui:ReactiveWindow>
|
</reactiveui:ReactiveWindow>
|
|
@ -12,7 +12,6 @@ namespace v2rayN.Views
|
||||||
{
|
{
|
||||||
public partial class AddServerWindow
|
public partial class AddServerWindow
|
||||||
{
|
{
|
||||||
|
|
||||||
public AddServerWindow(ProfileItem profileItem)
|
public AddServerWindow(ProfileItem profileItem)
|
||||||
{
|
{
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
|
@ -63,6 +62,7 @@ namespace v2rayN.Views
|
||||||
profileItem.security = Global.DefaultSecurity;
|
profileItem.security = Global.DefaultSecurity;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EConfigType.Shadowsocks:
|
case EConfigType.Shadowsocks:
|
||||||
gridSs.Visibility = Visibility.Visible;
|
gridSs.Visibility = Visibility.Visible;
|
||||||
LazyConfig.Instance.GetShadowsocksSecuritys(profileItem).ForEach(it =>
|
LazyConfig.Instance.GetShadowsocksSecuritys(profileItem).ForEach(it =>
|
||||||
|
@ -70,9 +70,11 @@ namespace v2rayN.Views
|
||||||
cmbSecurity3.Items.Add(it);
|
cmbSecurity3.Items.Add(it);
|
||||||
});
|
});
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EConfigType.Socks:
|
case EConfigType.Socks:
|
||||||
gridSocks.Visibility = Visibility.Visible;
|
gridSocks.Visibility = Visibility.Visible;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EConfigType.VLESS:
|
case EConfigType.VLESS:
|
||||||
gridVLESS.Visibility = Visibility.Visible;
|
gridVLESS.Visibility = Visibility.Visible;
|
||||||
cmbStreamSecurity.Items.Add(Global.StreamSecurityReality);
|
cmbStreamSecurity.Items.Add(Global.StreamSecurityReality);
|
||||||
|
@ -85,6 +87,7 @@ namespace v2rayN.Views
|
||||||
profileItem.security = Global.None;
|
profileItem.security = Global.None;
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EConfigType.Trojan:
|
case EConfigType.Trojan:
|
||||||
gridTrojan.Visibility = Visibility.Visible;
|
gridTrojan.Visibility = Visibility.Visible;
|
||||||
Global.flows.ForEach(it =>
|
Global.flows.ForEach(it =>
|
||||||
|
@ -110,19 +113,23 @@ namespace v2rayN.Views
|
||||||
this.Bind(ViewModel, vm => vm.SelectedSource.alterId, v => v.txtAlterId.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SelectedSource.alterId, v => v.txtAlterId.Text).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.SelectedSource.security, v => v.cmbSecurity.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SelectedSource.security, v => v.cmbSecurity.Text).DisposeWith(disposables);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EConfigType.Shadowsocks:
|
case EConfigType.Shadowsocks:
|
||||||
this.Bind(ViewModel, vm => vm.SelectedSource.id, v => v.txtId3.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SelectedSource.id, v => v.txtId3.Text).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.SelectedSource.security, v => v.cmbSecurity3.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SelectedSource.security, v => v.cmbSecurity3.Text).DisposeWith(disposables);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EConfigType.Socks:
|
case EConfigType.Socks:
|
||||||
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;
|
||||||
|
|
||||||
case EConfigType.VLESS:
|
case EConfigType.VLESS:
|
||||||
this.Bind(ViewModel, vm => vm.SelectedSource.id, v => v.txtId5.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SelectedSource.id, v => v.txtId5.Text).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.SelectedSource.flow, v => v.cmbFlow5.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SelectedSource.flow, v => v.cmbFlow5.Text).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.SelectedSource.security, v => v.txtSecurity5.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SelectedSource.security, v => v.txtSecurity5.Text).DisposeWith(disposables);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case EConfigType.Trojan:
|
case EConfigType.Trojan:
|
||||||
this.Bind(ViewModel, vm => vm.SelectedSource.id, v => v.txtId6.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SelectedSource.id, v => v.txtId6.Text).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.SelectedSource.flow, v => v.cmbFlow6.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SelectedSource.flow, v => v.cmbFlow6.Text).DisposeWith(disposables);
|
||||||
|
@ -145,9 +152,7 @@ namespace v2rayN.Views
|
||||||
this.Bind(ViewModel, vm => vm.SelectedSource.shortId, v => v.txtShortId.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SelectedSource.shortId, v => v.txtShortId.Text).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.SelectedSource.spiderX, v => v.txtSpiderX.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SelectedSource.spiderX, v => v.txtSpiderX.Text).DisposeWith(disposables);
|
||||||
|
|
||||||
|
|
||||||
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables);
|
||||||
|
|
||||||
});
|
});
|
||||||
|
|
||||||
this.Title = $"{profileItem.configType}";
|
this.Title = $"{profileItem.configType}";
|
||||||
|
@ -163,6 +168,7 @@ namespace v2rayN.Views
|
||||||
SetHeaderType();
|
SetHeaderType();
|
||||||
SetTips();
|
SetTips();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void CmbStreamSecurity_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
private void CmbStreamSecurity_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
var security = cmbStreamSecurity.SelectedItem.ToString();
|
var security = cmbStreamSecurity.SelectedItem.ToString();
|
||||||
|
@ -182,6 +188,7 @@ namespace v2rayN.Views
|
||||||
gridTlsMore.Visibility = Visibility.Hidden;
|
gridTlsMore.Visibility = Visibility.Hidden;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnGUID_Click(object sender, RoutedEventArgs e)
|
private void btnGUID_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
txtId.Text =
|
txtId.Text =
|
||||||
|
@ -242,23 +249,28 @@ namespace v2rayN.Views
|
||||||
tipRequestHost.Text = ResUI.TransportRequestHostTip1;
|
tipRequestHost.Text = ResUI.TransportRequestHostTip1;
|
||||||
tipHeaderType.Text = ResUI.TransportHeaderTypeTip1;
|
tipHeaderType.Text = ResUI.TransportHeaderTypeTip1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "kcp":
|
case "kcp":
|
||||||
tipHeaderType.Text = ResUI.TransportHeaderTypeTip2;
|
tipHeaderType.Text = ResUI.TransportHeaderTypeTip2;
|
||||||
tipPath.Text = ResUI.TransportPathTip5;
|
tipPath.Text = ResUI.TransportPathTip5;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "ws":
|
case "ws":
|
||||||
tipRequestHost.Text = ResUI.TransportRequestHostTip2;
|
tipRequestHost.Text = ResUI.TransportRequestHostTip2;
|
||||||
tipPath.Text = ResUI.TransportPathTip1;
|
tipPath.Text = ResUI.TransportPathTip1;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "h2":
|
case "h2":
|
||||||
tipRequestHost.Text = ResUI.TransportRequestHostTip3;
|
tipRequestHost.Text = ResUI.TransportRequestHostTip3;
|
||||||
tipPath.Text = ResUI.TransportPathTip2;
|
tipPath.Text = ResUI.TransportPathTip2;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "quic":
|
case "quic":
|
||||||
tipRequestHost.Text = ResUI.TransportRequestHostTip4;
|
tipRequestHost.Text = ResUI.TransportRequestHostTip4;
|
||||||
tipPath.Text = ResUI.TransportPathTip3;
|
tipPath.Text = ResUI.TransportPathTip3;
|
||||||
tipHeaderType.Text = ResUI.TransportHeaderTypeTip3;
|
tipHeaderType.Text = ResUI.TransportHeaderTypeTip3;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "grpc":
|
case "grpc":
|
||||||
tipPath.Text = ResUI.TransportPathTip4;
|
tipPath.Text = ResUI.TransportPathTip4;
|
||||||
tipHeaderType.Text = ResUI.TransportHeaderTypeTip4;
|
tipHeaderType.Text = ResUI.TransportHeaderTypeTip4;
|
||||||
|
@ -271,6 +283,5 @@ namespace v2rayN.Views
|
||||||
{
|
{
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -181,4 +181,4 @@
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
</reactiveui:ReactiveWindow>
|
</reactiveui:ReactiveWindow>
|
|
@ -45,7 +45,6 @@ namespace v2rayN.Views
|
||||||
BindingData();
|
BindingData();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void TxtGlobalHotkey_KeyDown(object sender, KeyEventArgs e)
|
private void TxtGlobalHotkey_KeyDown(object sender, KeyEventArgs e)
|
||||||
{
|
{
|
||||||
e.Handled = true;
|
e.Handled = true;
|
||||||
|
@ -68,8 +67,8 @@ namespace v2rayN.Views
|
||||||
Shift = false,
|
Shift = false,
|
||||||
KeyCode = null
|
KeyCode = null
|
||||||
});
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private string KeyEventItemToString(KeyEventItem item)
|
private string KeyEventItemToString(KeyEventItem item)
|
||||||
{
|
{
|
||||||
var res = new StringBuilder();
|
var res = new StringBuilder();
|
||||||
|
@ -82,6 +81,7 @@ namespace v2rayN.Views
|
||||||
|
|
||||||
return res.ToString();
|
return res.ToString();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void BindingData()
|
private void BindingData()
|
||||||
{
|
{
|
||||||
foreach (var item in _TextBoxKeyEventItem)
|
foreach (var item in _TextBoxKeyEventItem)
|
||||||
|
@ -137,4 +137,4 @@ namespace v2rayN.Views
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -94,7 +94,6 @@
|
||||||
x:Name="menuAddServerViaScan"
|
x:Name="menuAddServerViaScan"
|
||||||
Height="{StaticResource MenuItemHeight}"
|
Height="{StaticResource MenuItemHeight}"
|
||||||
Header="{x:Static resx:ResUI.menuAddServerViaScan}" />
|
Header="{x:Static resx:ResUI.menuAddServerViaScan}" />
|
||||||
|
|
||||||
</MenuItem>
|
</MenuItem>
|
||||||
</Menu>
|
</Menu>
|
||||||
<Separator />
|
<Separator />
|
||||||
|
@ -361,7 +360,6 @@
|
||||||
Margin="8"
|
Margin="8"
|
||||||
materialDesign:HintAssist.Hint="Language"
|
materialDesign:HintAssist.Hint="Language"
|
||||||
Style="{StaticResource DefComboBox}" />
|
Style="{StaticResource DefComboBox}" />
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</materialDesign:PopupBox>
|
</materialDesign:PopupBox>
|
||||||
|
@ -627,7 +625,6 @@
|
||||||
<DataGrid.Resources>
|
<DataGrid.Resources>
|
||||||
<Style BasedOn="{StaticResource MaterialDesignDataGridRow}" TargetType="DataGridRow">
|
<Style BasedOn="{StaticResource MaterialDesignDataGridRow}" TargetType="DataGridRow">
|
||||||
<EventSetter Event="MouseDoubleClick" Handler="LstProfiles_MouseDoubleClick" />
|
<EventSetter Event="MouseDoubleClick" Handler="LstProfiles_MouseDoubleClick" />
|
||||||
|
|
||||||
</Style>
|
</Style>
|
||||||
<Style BasedOn="{StaticResource MaterialDesignDataGridColumnHeader}" TargetType="DataGridColumnHeader">
|
<Style BasedOn="{StaticResource MaterialDesignDataGridColumnHeader}" TargetType="DataGridColumnHeader">
|
||||||
<EventSetter Event="Click" Handler="LstProfiles_ColumnHeader_Click" />
|
<EventSetter Event="Click" Handler="LstProfiles_ColumnHeader_Click" />
|
||||||
|
@ -642,7 +639,6 @@
|
||||||
</DataTrigger>
|
</DataTrigger>
|
||||||
</Style.Triggers>
|
</Style.Triggers>
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
</DataGrid.Resources>
|
</DataGrid.Resources>
|
||||||
<DataGrid.Columns>
|
<DataGrid.Columns>
|
||||||
|
|
||||||
|
@ -734,13 +730,11 @@
|
||||||
Binding="{Binding totalDown}"
|
Binding="{Binding totalDown}"
|
||||||
ExName="totalDown"
|
ExName="totalDown"
|
||||||
Header="{x:Static resx:ResUI.LvTotalDownloadDataAmount}" />
|
Header="{x:Static resx:ResUI.LvTotalDownloadDataAmount}" />
|
||||||
|
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
<GridSplitter Grid.Row="1" HorizontalAlignment="Stretch" />
|
<GridSplitter Grid.Row="1" HorizontalAlignment="Stretch" />
|
||||||
<local:MsgView Grid.Row="2" />
|
<local:MsgView Grid.Row="2" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
<tb:TaskbarIcon
|
<tb:TaskbarIcon
|
||||||
x:Name="tbNotify"
|
x:Name="tbNotify"
|
||||||
|
@ -867,6 +861,5 @@
|
||||||
</tb:TaskbarIcon>
|
</tb:TaskbarIcon>
|
||||||
<materialDesign:Snackbar x:Name="MainSnackbar" MessageQueue="{materialDesign:MessageQueue}" />
|
<materialDesign:Snackbar x:Name="MainSnackbar" MessageQueue="{materialDesign:MessageQueue}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
</materialDesign:DialogHost>
|
</materialDesign:DialogHost>
|
||||||
</reactiveui:ReactiveWindow>
|
</reactiveui:ReactiveWindow>
|
|
@ -93,7 +93,7 @@ namespace v2rayN.Views
|
||||||
this.BindCommand(ViewModel, vm => vm.MoveDownCmd, v => v.menuMoveDown).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.MoveDownCmd, v => v.menuMoveDown).DisposeWith(disposables);
|
||||||
this.BindCommand(ViewModel, vm => vm.MoveBottomCmd, v => v.menuMoveBottom).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.MoveBottomCmd, v => v.menuMoveBottom).DisposeWith(disposables);
|
||||||
|
|
||||||
//servers ping
|
//servers ping
|
||||||
this.BindCommand(ViewModel, vm => vm.MixedTestServerCmd, v => v.menuMixedTestServer).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.MixedTestServerCmd, v => v.menuMixedTestServer).DisposeWith(disposables);
|
||||||
this.BindCommand(ViewModel, vm => vm.PingServerCmd, v => v.menuPingServer).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.PingServerCmd, v => v.menuPingServer).DisposeWith(disposables);
|
||||||
this.BindCommand(ViewModel, vm => vm.TcpingServerCmd, v => v.menuTcpingServer).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.TcpingServerCmd, v => v.menuTcpingServer).DisposeWith(disposables);
|
||||||
|
@ -207,7 +207,7 @@ namespace v2rayN.Views
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#region Event
|
#region Event
|
||||||
|
|
||||||
private void UpdateViewHandler(EViewAction action)
|
private void UpdateViewHandler(EViewAction action)
|
||||||
{
|
{
|
||||||
|
@ -248,6 +248,7 @@ namespace v2rayN.Views
|
||||||
{
|
{
|
||||||
ViewModel.SelectedProfiles = lstProfiles.SelectedItems.Cast<ProfileItemModel>().ToList();
|
ViewModel.SelectedProfiles = lstProfiles.SelectedItems.Cast<ProfileItemModel>().ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LstProfiles_LoadingRow(object? sender, DataGridRowEventArgs e)
|
private void LstProfiles_LoadingRow(object? sender, DataGridRowEventArgs e)
|
||||||
{
|
{
|
||||||
//if (e.Row.GetIndex() == 0)
|
//if (e.Row.GetIndex() == 0)
|
||||||
|
@ -379,12 +380,12 @@ namespace v2rayN.Views
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void menuClose_Click(object sender, RoutedEventArgs e)
|
private void menuClose_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
StorageUI();
|
StorageUI();
|
||||||
ViewModel?.ShowHideWindow(false);
|
ViewModel?.ShowHideWindow(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void menuPromotion_Click(object sender, RoutedEventArgs e)
|
private void menuPromotion_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
Utils.ProcessStart($"{Utils.Base64Decode(Global.PromotionUrl)}?t={DateTime.Now.Ticks}");
|
Utils.ProcessStart($"{Utils.Base64Decode(Global.PromotionUrl)}?t={DateTime.Now.Ticks}");
|
||||||
|
@ -394,6 +395,7 @@ namespace v2rayN.Views
|
||||||
{
|
{
|
||||||
ViewModel?.TestServerAvailability();
|
ViewModel?.TestServerAvailability();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void menuSettingsSetUWP_Click(object sender, RoutedEventArgs e)
|
private void menuSettingsSetUWP_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
Utils.ProcessStart(Utils.GetBinPath("EnableLoopback.exe"));
|
Utils.ProcessStart(Utils.GetBinPath("EnableLoopback.exe"));
|
||||||
|
@ -403,6 +405,7 @@ namespace v2rayN.Views
|
||||||
{
|
{
|
||||||
AutofitColumnWidth();
|
AutofitColumnWidth();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AutofitColumnWidth()
|
private void AutofitColumnWidth()
|
||||||
{
|
{
|
||||||
foreach (var it in lstProfiles.Columns)
|
foreach (var it in lstProfiles.Columns)
|
||||||
|
@ -418,9 +421,10 @@ namespace v2rayN.Views
|
||||||
ViewModel?.RefreshServers();
|
ViewModel?.RefreshServers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
#endregion
|
|
||||||
|
|
||||||
#region UI
|
#endregion Event
|
||||||
|
|
||||||
|
#region UI
|
||||||
|
|
||||||
private void RestoreUI()
|
private void RestoreUI()
|
||||||
{
|
{
|
||||||
|
@ -470,6 +474,7 @@ namespace v2rayN.Views
|
||||||
colTotalDown.Visibility = Visibility.Hidden;
|
colTotalDown.Visibility = Visibility.Hidden;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void StorageUI()
|
private void StorageUI()
|
||||||
{
|
{
|
||||||
_config.uiItem.mainWidth = this.Width;
|
_config.uiItem.mainWidth = this.Width;
|
||||||
|
@ -506,6 +511,7 @@ namespace v2rayN.Views
|
||||||
menuHelp.Items.Add(item);
|
menuHelp.Items.Add(item);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void MenuItem_Click(object sender, RoutedEventArgs e)
|
private void MenuItem_Click(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
if (sender is MenuItem item)
|
if (sender is MenuItem item)
|
||||||
|
@ -514,8 +520,8 @@ namespace v2rayN.Views
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
#endregion UI
|
||||||
|
|
||||||
#endregion
|
|
||||||
#region Drag and Drop
|
#region Drag and Drop
|
||||||
|
|
||||||
private Point startPoint = new();
|
private Point startPoint = new();
|
||||||
|
@ -542,12 +548,12 @@ namespace v2rayN.Views
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
private void LstProfiles_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
private void LstProfiles_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
// Get current mouse position
|
// Get current mouse position
|
||||||
startPoint = e.GetPosition(null);
|
startPoint = e.GetPosition(null);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LstProfiles_MouseMove(object sender, MouseEventArgs e)
|
private void LstProfiles_MouseMove(object sender, MouseEventArgs e)
|
||||||
{
|
{
|
||||||
// Get the current mouse position
|
// Get the current mouse position
|
||||||
|
@ -596,7 +602,7 @@ namespace v2rayN.Views
|
||||||
// Find the data behind the Item
|
// Find the data behind the Item
|
||||||
ProfileItemModel item = (ProfileItemModel)listView.ItemContainerGenerator.ItemFromContainer(listViewItem);
|
ProfileItemModel item = (ProfileItemModel)listView.ItemContainerGenerator.ItemFromContainer(listViewItem);
|
||||||
if (item == null) return;
|
if (item == null) return;
|
||||||
// Move item into observable collection
|
// Move item into observable collection
|
||||||
// (this will be automatically reflected to lstView.ItemsSource)
|
// (this will be automatically reflected to lstView.ItemsSource)
|
||||||
e.Effects = DragDropEffects.Move;
|
e.Effects = DragDropEffects.Move;
|
||||||
|
|
||||||
|
@ -606,8 +612,6 @@ namespace v2rayN.Views
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion Drag and Drop
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -74,11 +74,8 @@
|
||||||
Height="{StaticResource MenuItemHeight}"
|
Height="{StaticResource MenuItemHeight}"
|
||||||
Click="menuMsgViewClear_Click"
|
Click="menuMsgViewClear_Click"
|
||||||
Header="{x:Static resx:ResUI.menuMsgViewClear}" />
|
Header="{x:Static resx:ResUI.menuMsgViewClear}" />
|
||||||
|
|
||||||
</ContextMenu>
|
</ContextMenu>
|
||||||
</TextBox.ContextMenu>
|
</TextBox.ContextMenu>
|
||||||
</TextBox>
|
</TextBox>
|
||||||
|
|
||||||
|
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
</UserControl>
|
</UserControl>
|
|
@ -30,7 +30,7 @@ namespace v2rayN.Views
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void DelegateAppendText(string msg)
|
private void DelegateAppendText(string msg)
|
||||||
{
|
{
|
||||||
Dispatcher.BeginInvoke(AppendText, DispatcherPriority.Send, msg);
|
Dispatcher.BeginInvoke(AppendText, DispatcherPriority.Send, msg);
|
||||||
}
|
}
|
||||||
|
@ -109,10 +109,10 @@ namespace v2rayN.Views
|
||||||
{
|
{
|
||||||
ClearMsg();
|
ClearMsg();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void cmbMsgFilter_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
|
private void cmbMsgFilter_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
|
||||||
{
|
{
|
||||||
_config.uiItem.mainMsgFilter = cmbMsgFilter.Text.TrimEx();
|
_config.uiItem.mainMsgFilter = cmbMsgFilter.Text.TrimEx();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -335,7 +335,6 @@
|
||||||
TextWrapping="Wrap"
|
TextWrapping="Wrap"
|
||||||
VerticalScrollBarVisibility="Auto" />
|
VerticalScrollBarVisibility="Auto" />
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
|
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
|
||||||
<!--<TabItem Header="{x:Static resx:ResUI.TbSettingsCoreKcp}">
|
<!--<TabItem Header="{x:Static resx:ResUI.TbSettingsCoreKcp}">
|
||||||
|
@ -455,7 +454,6 @@
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
Margin="{StaticResource SettingItemMargin}"
|
Margin="{StaticResource SettingItemMargin}"
|
||||||
HorizontalAlignment="Left" />
|
HorizontalAlignment="Left" />
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</TabItem>-->
|
</TabItem>-->
|
||||||
|
|
||||||
|
@ -771,7 +769,6 @@
|
||||||
Margin="{StaticResource SettingItemMargin}"
|
Margin="{StaticResource SettingItemMargin}"
|
||||||
materialDesign:HintAssist.Hint="Protocol"
|
materialDesign:HintAssist.Hint="Protocol"
|
||||||
Style="{StaticResource DefComboBox}" />
|
Style="{StaticResource DefComboBox}" />
|
||||||
|
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|
||||||
<TextBlock
|
<TextBlock
|
||||||
|
@ -939,7 +936,6 @@
|
||||||
Text="{x:Static resx:ResUI.TbSettingsTunModeBypassModeTip}" />
|
Text="{x:Static resx:ResUI.TbSettingsTunModeBypassModeTip}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
|
|
||||||
<Grid
|
<Grid
|
||||||
x:Name="gridTunModeDirect"
|
x:Name="gridTunModeDirect"
|
||||||
Width="800"
|
Width="800"
|
||||||
|
@ -1037,7 +1033,6 @@
|
||||||
VerticalScrollBarVisibility="Auto" />
|
VerticalScrollBarVisibility="Auto" />
|
||||||
</GroupBox>
|
</GroupBox>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
|
|
||||||
|
@ -1149,4 +1144,4 @@
|
||||||
</TabItem>
|
</TabItem>
|
||||||
</TabControl>
|
</TabControl>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
</reactiveui:ReactiveWindow>
|
</reactiveui:ReactiveWindow>
|
|
@ -134,11 +134,9 @@ namespace v2rayN.Views
|
||||||
this.Bind(ViewModel, vm => vm.defFingerprint, v => v.cmbdefFingerprint.Text).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.defUserAgent, v => v.cmbdefUserAgent.Text).DisposeWith(disposables);
|
||||||
|
|
||||||
|
|
||||||
this.Bind(ViewModel, vm => vm.domainStrategy4Freedom, v => v.cmbdomainStrategy4Freedom.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.domainStrategy4Freedom, v => v.cmbdomainStrategy4Freedom.Text).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.remoteDNS, v => v.txtremoteDNS.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.remoteDNS, v => v.txtremoteDNS.Text).DisposeWith(disposables);
|
||||||
|
|
||||||
|
|
||||||
//this.Bind(ViewModel, vm => vm.Kcpmtu, v => v.txtKcpmtu.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.Kcptti, v => v.txtKcptti.Text).DisposeWith(disposables);
|
||||||
//this.Bind(ViewModel, vm => vm.KcpuplinkCapacity, v => v.txtKcpuplinkCapacity.Text).DisposeWith(disposables);
|
//this.Bind(ViewModel, vm => vm.KcpuplinkCapacity, v => v.txtKcpuplinkCapacity.Text).DisposeWith(disposables);
|
||||||
|
@ -147,7 +145,6 @@ namespace v2rayN.Views
|
||||||
//this.Bind(ViewModel, vm => vm.KcpwriteBufferSize, v => v.txtKcpwriteBufferSize.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.Kcpcongestion, v => v.togKcpcongestion.IsChecked).DisposeWith(disposables);
|
||||||
|
|
||||||
|
|
||||||
this.Bind(ViewModel, vm => vm.AutoRun, v => v.togAutoRun.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.EnableStatistics, v => v.togEnableStatistics.IsChecked).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.StatisticsFreshRate, v => v.cmbStatisticsFreshRate.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.StatisticsFreshRate, v => v.cmbStatisticsFreshRate.Text).DisposeWith(disposables);
|
||||||
|
@ -166,11 +163,9 @@ namespace v2rayN.Views
|
||||||
this.Bind(ViewModel, vm => vm.SpeedTestUrl, v => v.cmbSpeedTestUrl.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SpeedTestUrl, v => v.cmbSpeedTestUrl.Text).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.EnableHWA, v => v.togEnableHWA.IsChecked).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.EnableHWA, v => v.togEnableHWA.IsChecked).DisposeWith(disposables);
|
||||||
|
|
||||||
|
|
||||||
this.Bind(ViewModel, vm => vm.systemProxyAdvancedProtocol, v => v.cmbsystemProxyAdvancedProtocol.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.systemProxyExceptions, v => v.txtsystemProxyExceptions.Text).DisposeWith(disposables);
|
||||||
|
|
||||||
|
|
||||||
this.Bind(ViewModel, vm => vm.TunShowWindow, v => v.togShowWindow.IsChecked).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.TunShowWindow, v => v.togShowWindow.IsChecked).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.TunEnabledLog, v => v.togEnabledLog.IsChecked).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.TunEnabledLog, v => v.togEnabledLog.IsChecked).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.TunStrictRoute, v => v.togStrictRoute.IsChecked).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.TunStrictRoute, v => v.togStrictRoute.IsChecked).DisposeWith(disposables);
|
||||||
|
@ -187,7 +182,6 @@ namespace v2rayN.Views
|
||||||
this.Bind(ViewModel, vm => vm.TunProxyProcess, v => v.txtProxyProcess.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.TunProxyProcess, v => v.txtProxyProcess.Text).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.TunProxyDNS, v => v.txtProxyDNS.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.TunProxyDNS, v => v.txtProxyDNS.Text).DisposeWith(disposables);
|
||||||
|
|
||||||
|
|
||||||
this.Bind(ViewModel, vm => vm.CoreType1, v => v.cmbCoreType1.Text).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.CoreType2, v => v.cmbCoreType2.Text).DisposeWith(disposables);
|
||||||
this.Bind(ViewModel, vm => vm.CoreType3, v => v.cmbCoreType3.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.CoreType3, v => v.cmbCoreType3.Text).DisposeWith(disposables);
|
||||||
|
@ -196,9 +190,9 @@ namespace v2rayN.Views
|
||||||
this.Bind(ViewModel, vm => vm.CoreType6, v => v.cmbCoreType6.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);
|
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables);
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
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://www.v2fly.org/config/dns.html#dnsobject");
|
||||||
|
@ -208,6 +202,7 @@ namespace v2rayN.Views
|
||||||
{
|
{
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void btnBrowse_Click(object sender, System.Windows.RoutedEventArgs e)
|
private void btnBrowse_Click(object sender, System.Windows.RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
var openFileDialog1 = new OpenFileDialog();
|
var openFileDialog1 = new OpenFileDialog();
|
||||||
|
@ -217,4 +212,4 @@ namespace v2rayN.Views
|
||||||
txtCustomTemplate.Text = openFileDialog1.FileName;
|
txtCustomTemplate.Text = openFileDialog1.FileName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -44,6 +44,5 @@
|
||||||
IsCancel="True"
|
IsCancel="True"
|
||||||
IsDefault="True"
|
IsDefault="True"
|
||||||
Style="{StaticResource MaterialDesignFlatButton}" />
|
Style="{StaticResource MaterialDesignFlatButton}" />
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
</UserControl>
|
</UserControl>
|
|
@ -9,4 +9,4 @@ namespace v2rayN.Views
|
||||||
InitializeComponent();
|
InitializeComponent();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -198,4 +198,4 @@
|
||||||
</GroupBox>
|
</GroupBox>
|
||||||
</Grid>
|
</Grid>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
</reactiveui:ReactiveWindow>
|
</reactiveui:ReactiveWindow>
|
|
@ -52,7 +52,6 @@ namespace v2rayN.Views
|
||||||
this.Bind(ViewModel, vm => vm.AutoSort, v => v.chkAutoSort.IsChecked).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.AutoSort, v => v.chkAutoSort.IsChecked).DisposeWith(disposables);
|
||||||
|
|
||||||
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables);
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,10 +59,12 @@ namespace v2rayN.Views
|
||||||
{
|
{
|
||||||
cmbOutboundTag.Focus();
|
cmbOutboundTag.Focus();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ClbProtocol_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
|
private void ClbProtocol_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
ViewModel.ProtocolItems = clbProtocol.SelectedItems.Cast<string>().ToList();
|
ViewModel.ProtocolItems = clbProtocol.SelectedItems.Cast<string>().ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ClbInboundTag_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
|
private void ClbInboundTag_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
ViewModel.InboundTagItems = clbInboundTag.SelectedItems.Cast<string>().ToList();
|
ViewModel.InboundTagItems = clbInboundTag.SelectedItems.Cast<string>().ToList();
|
||||||
|
@ -79,4 +80,4 @@ namespace v2rayN.Views
|
||||||
Utils.ProcessStart("https://www.v2fly.org/config/routing.html#ruleobject");
|
Utils.ProcessStart("https://www.v2fly.org/config/routing.html#ruleobject");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -207,7 +207,6 @@
|
||||||
HorizontalAlignment="Left"
|
HorizontalAlignment="Left"
|
||||||
AcceptsReturn="True"
|
AcceptsReturn="True"
|
||||||
Style="{StaticResource DefTextBox}" />
|
Style="{StaticResource DefTextBox}" />
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
|
|
||||||
<TabControl x:Name="tabAdvanced">
|
<TabControl x:Name="tabAdvanced">
|
||||||
|
@ -291,11 +290,9 @@
|
||||||
Width="80"
|
Width="80"
|
||||||
Binding="{Binding enabled}"
|
Binding="{Binding enabled}"
|
||||||
Header="enabled" />
|
Header="enabled" />
|
||||||
|
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
</TabControl>
|
</TabControl>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
|
</reactiveui:ReactiveWindow>
|
||||||
</reactiveui:ReactiveWindow>
|
|
|
@ -51,9 +51,9 @@ namespace v2rayN.Views
|
||||||
this.BindCommand(ViewModel, vm => vm.MoveBottomCmd, v => v.menuMoveBottom).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.MoveBottomCmd, v => v.menuMoveBottom).DisposeWith(disposables);
|
||||||
|
|
||||||
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables);
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
txtRemarks.Focus();
|
txtRemarks.Focus();
|
||||||
|
@ -102,6 +102,7 @@ namespace v2rayN.Views
|
||||||
{
|
{
|
||||||
ViewModel?.RuleEdit(false);
|
ViewModel?.RuleEdit(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void menuRuleSelectAll_Click(object sender, System.Windows.RoutedEventArgs e)
|
private void menuRuleSelectAll_Click(object sender, System.Windows.RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
lstRules.SelectAll();
|
lstRules.SelectAll();
|
||||||
|
@ -116,4 +117,4 @@ namespace v2rayN.Views
|
||||||
txtCustomIcon.Text = openFileDialog1.FileName;
|
txtCustomIcon.Text = openFileDialog1.FileName;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -109,7 +109,6 @@
|
||||||
Width="80"
|
Width="80"
|
||||||
Margin="8,0,0,0"
|
Margin="8,0,0,0"
|
||||||
Style="{StaticResource DefComboBox}" />
|
Style="{StaticResource DefComboBox}" />
|
||||||
|
|
||||||
</ToolBar>
|
</ToolBar>
|
||||||
</ToolBarTray>
|
</ToolBarTray>
|
||||||
|
|
||||||
|
@ -326,5 +325,4 @@
|
||||||
</TabControl>
|
</TabControl>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
|
</reactiveui:ReactiveWindow>
|
||||||
</reactiveui:ReactiveWindow>
|
|
|
@ -29,7 +29,6 @@ namespace v2rayN.Views
|
||||||
cmbdomainMatcher.Items.Add(it);
|
cmbdomainMatcher.Items.Add(it);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
this.WhenActivated(disposables =>
|
this.WhenActivated(disposables =>
|
||||||
{
|
{
|
||||||
this.OneWayBind(ViewModel, vm => vm.RoutingItems, v => v.lstRoutings.ItemsSource).DisposeWith(disposables);
|
this.OneWayBind(ViewModel, vm => vm.RoutingItems, v => v.lstRoutings.ItemsSource).DisposeWith(disposables);
|
||||||
|
@ -60,7 +59,6 @@ namespace v2rayN.Views
|
||||||
this.BindCommand(ViewModel, vm => vm.RoutingAdvancedImportRulesCmd, v => v.menuRoutingAdvancedImportRules2).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.RoutingAdvancedImportRulesCmd, v => v.menuRoutingAdvancedImportRules2).DisposeWith(disposables);
|
||||||
|
|
||||||
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables);
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -87,10 +85,12 @@ namespace v2rayN.Views
|
||||||
{
|
{
|
||||||
lstRoutings.SelectAll();
|
lstRoutings.SelectAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void lstRoutings_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
|
private void lstRoutings_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
ViewModel.SelectedSources = lstRoutings.SelectedItems.Cast<RoutingItemModel>().ToList();
|
ViewModel.SelectedSources = lstRoutings.SelectedItems.Cast<RoutingItemModel>().ToList();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LstRoutings_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
private void LstRoutings_MouseDoubleClick(object sender, MouseButtonEventArgs e)
|
||||||
{
|
{
|
||||||
ViewModel?.RoutingAdvancedEdit(false);
|
ViewModel?.RoutingAdvancedEdit(false);
|
||||||
|
@ -113,4 +113,4 @@ namespace v2rayN.Views
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -211,7 +211,6 @@
|
||||||
VerticalAlignment="Top"
|
VerticalAlignment="Top"
|
||||||
AcceptsReturn="True"
|
AcceptsReturn="True"
|
||||||
Style="{StaticResource MyOutlinedTextBox}" />
|
Style="{StaticResource MyOutlinedTextBox}" />
|
||||||
|
|
||||||
</Grid>
|
</Grid>
|
||||||
<Grid
|
<Grid
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
|
@ -240,4 +239,4 @@
|
||||||
</Grid>
|
</Grid>
|
||||||
</Grid>
|
</Grid>
|
||||||
</ScrollViewer>
|
</ScrollViewer>
|
||||||
</reactiveui:ReactiveWindow>
|
</reactiveui:ReactiveWindow>
|
|
@ -28,9 +28,9 @@ namespace v2rayN.Views
|
||||||
this.Bind(ViewModel, vm => vm.SelectedSource.filter, v => v.txtFilter.Text).DisposeWith(disposables);
|
this.Bind(ViewModel, vm => vm.SelectedSource.filter, v => v.txtFilter.Text).DisposeWith(disposables);
|
||||||
|
|
||||||
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables);
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
private void Window_Loaded(object sender, RoutedEventArgs e)
|
private void Window_Loaded(object sender, RoutedEventArgs e)
|
||||||
{
|
{
|
||||||
txtRemarks.Focus();
|
txtRemarks.Focus();
|
||||||
|
@ -41,4 +41,4 @@ namespace v2rayN.Views
|
||||||
this.Close();
|
this.Close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -82,7 +82,6 @@
|
||||||
<TextBlock Style="{StaticResource ToolbarTextBlock}" Text="{x:Static resx:ResUI.menuClose}" />
|
<TextBlock Style="{StaticResource ToolbarTextBlock}" Text="{x:Static resx:ResUI.menuClose}" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</Button>
|
</Button>
|
||||||
|
|
||||||
</ToolBar>
|
</ToolBar>
|
||||||
</ToolBarTray>
|
</ToolBarTray>
|
||||||
|
|
||||||
|
@ -123,9 +122,8 @@
|
||||||
Width="80"
|
Width="80"
|
||||||
Binding="{Binding sort}"
|
Binding="{Binding sort}"
|
||||||
Header="{x:Static resx:ResUI.LvSort}" />
|
Header="{x:Static resx:ResUI.LvSort}" />
|
||||||
|
|
||||||
</DataGrid.Columns>
|
</DataGrid.Columns>
|
||||||
</DataGrid>
|
</DataGrid>
|
||||||
</DockPanel>
|
</DockPanel>
|
||||||
</materialDesign:DialogHost>
|
</materialDesign:DialogHost>
|
||||||
</reactiveui:ReactiveWindow>
|
</reactiveui:ReactiveWindow>
|
|
@ -29,7 +29,6 @@ namespace v2rayN.Views
|
||||||
this.BindCommand(ViewModel, vm => vm.SubDeleteCmd, v => v.menuSubDelete).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.SubDeleteCmd, v => v.menuSubDelete).DisposeWith(disposables);
|
||||||
this.BindCommand(ViewModel, vm => vm.SubEditCmd, v => v.menuSubEdit).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.SubEditCmd, v => v.menuSubEdit).DisposeWith(disposables);
|
||||||
this.BindCommand(ViewModel, vm => vm.SubShareCmd, v => v.menuSubShare).DisposeWith(disposables);
|
this.BindCommand(ViewModel, vm => vm.SubShareCmd, v => v.menuSubShare).DisposeWith(disposables);
|
||||||
|
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -45,6 +44,7 @@ namespace v2rayN.Views
|
||||||
{
|
{
|
||||||
ViewModel?.EditSub(false);
|
ViewModel?.EditSub(false);
|
||||||
}
|
}
|
||||||
|
|
||||||
private void LstSubscription_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
|
private void LstSubscription_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
|
||||||
{
|
{
|
||||||
ViewModel.SelectedSources = lstSubscription.SelectedItems.Cast<SubItem>().ToList();
|
ViewModel.SelectedSources = lstSubscription.SelectedItems.Cast<SubItem>().ToList();
|
||||||
|
@ -62,4 +62,4 @@ namespace v2rayN.Views
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -134,6 +134,7 @@ namespace v2rayUpgrade
|
||||||
{
|
{
|
||||||
return Application.StartupPath;
|
return Application.StartupPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static string GetPath(string fileName)
|
public static string GetPath(string fileName)
|
||||||
{
|
{
|
||||||
string startupPath = StartupPath();
|
string startupPath = StartupPath();
|
||||||
|
@ -144,4 +145,4 @@ namespace v2rayUpgrade
|
||||||
return Path.Combine(startupPath, fileName);
|
return Path.Combine(startupPath, fileName);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -3,13 +3,13 @@ using System.Windows.Forms;
|
||||||
|
|
||||||
namespace v2rayUpgrade
|
namespace v2rayUpgrade
|
||||||
{
|
{
|
||||||
static class Program
|
internal static class Program
|
||||||
{
|
{
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 应用程序的主入口点。
|
/// 应用程序的主入口点。
|
||||||
/// </summary>
|
/// </summary>
|
||||||
[STAThread]
|
[STAThread]
|
||||||
static void Main(string[] args)
|
private static void Main(string[] args)
|
||||||
{
|
{
|
||||||
Application.EnableVisualStyles();
|
Application.EnableVisualStyles();
|
||||||
Application.SetHighDpiMode(HighDpiMode.SystemAware);
|
Application.SetHighDpiMode(HighDpiMode.SystemAware);
|
||||||
|
@ -17,4 +17,4 @@ namespace v2rayUpgrade
|
||||||
Application.Run(new MainForm(args));
|
Application.Run(new MainForm(args));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Reference in a new issue