Compare commits

..

33 Commits
6.21 ... 6.23

Author SHA1 Message Date
2dust
f612ce5db8 up 6.23 2023-04-21 15:55:05 +08:00
2dust
831a20ff91 Code clean 2023-04-21 15:15:35 +08:00
2dust
38ae669070 bug fixes for ErrorDataReceived 2023-04-21 14:49:33 +08:00
2dust
fed7e7764e bug fixes 2023-04-21 14:09:55 +08:00
2dust
f3804fce40 Add subscription conversion
https://github.com/tindy2013/subconverter/blob/master/README-cn.md
2023-04-21 12:15:24 +08:00
2dust
88e7cd09d7 The skip delay is -1 speed test in multi-threaded test 2023-04-21 12:11:09 +08:00
2dust
1ce5571ac6 Hide tray tip text 2023-04-21 10:32:41 +08:00
2dust
355bf84af4 bug fixes 2023-04-19 16:33:08 +08:00
2dust
6e8a3a4867 Code clean 2023-04-16 20:45:47 +08:00
2dust
bf6dcdf2bd Code clean 2023-04-14 20:49:36 +08:00
2dust
165454dc57 Migrate from Grpc.Core to Grpc.Net.Client 2023-04-14 15:51:34 +08:00
2dust
34b4b9d099 up 6.22 2023-04-13 16:00:30 +08:00
2dust
0808ec1612 Add Check update for sing-box core 2023-04-13 15:50:28 +08:00
2dust
6b12549cd9 bug fixes 2023-04-12 20:15:17 +08:00
2dust
92baf9025a Update StatisticsHandler.cs 2023-04-12 15:30:07 +08:00
2dust
d58861ab88 Adjust some style 2023-04-12 14:26:37 +08:00
2dust
142230e56a Fix description 2023-04-12 14:08:30 +08:00
2dust
b8959c8f12 Optimize server filter 2023-04-12 11:34:42 +08:00
2dust
3fa22fdc55 bug fixes 2023-04-11 20:18:49 +08:00
2dust
a1c743e59c bug fixes 2023-04-10 17:30:27 +08:00
2dust
ebd0f45c10 Adjust VLESS flow config 2023-04-10 16:21:19 +08:00
2dust
fce6c46250 Can set the update interval for each subscription 2023-04-10 16:00:32 +08:00
2dust
6114e4ff55 Temporary fix for arm64 grpc issues 2023-04-10 11:28:53 +08:00
2dust
cc3d1ff7de Update Package Reference 2023-04-09 09:13:28 +08:00
2dust
2f721c8535 Merge pull request #3635 from kidfruit/core-arm
Core arm
2023-04-09 08:26:33 +08:00
kidfruit
ddb790104f delete .vs 2023-04-08 12:57:11 +08:00
liqi
181dfd2f51 add arm64 download path for core 2023-04-07 21:32:28 +08:00
liqi
fca062f75a add arm64 download path for core 2023-04-07 18:13:37 +08:00
2dust
52b84c3201 bug fixes 2023-04-07 15:38:30 +08:00
2dust
e1021a6832 Merge pull request #3631 from fonaix/master
fix bug #3630
2023-04-07 15:37:28 +08:00
fonaix
aa338d2da5 fix bug #3630 2023-04-07 15:21:09 +08:00
2dust
44471c4926 Update README.md 2023-04-07 13:56:16 +08:00
2dust
930c7e4ce5 Update README.md 2023-04-07 13:55:32 +08:00
107 changed files with 1201 additions and 746 deletions

View File

@@ -1,5 +1,5 @@
# v2rayN
A V2Ray client for Windows, support [Xray core](https://github.com/XTLS/Xray-core) and [v2fly core](https://github.com/v2fly/v2ray-core)
A GUI client for Windows, support [Xray core](https://github.com/XTLS/Xray-core) and [v2fly core](https://github.com/v2fly/v2ray-core) and [others](https://github.com/2dust/v2rayN/wiki/List-of-supported-cores)
[![GitHub commit activity](https://img.shields.io/github/commit-activity/m/2dust/v2rayN)](https://github.com/2dust/v2rayN/commits/master)
@@ -7,15 +7,16 @@ A V2Ray client for Windows, support [Xray core](https://github.com/XTLS/Xray-cor
[![GitHub Releases](https://img.shields.io/github/downloads/2dust/v2rayN/latest/total?logo=github)](https://github.com/2dust/v2rayN/releases)
[![Chat on Telegram](https://img.shields.io/badge/Chat%20on-Telegram-brightgreen.svg)](https://t.me/v2rayn)
### How to use
- If you are new to this, please download v2rayN-Core.zip from [releases](https://github.com/2dust/v2rayN/releases)
- Otherwise please download v2rayN.zip (you will also need to download v2ray core into the same folder with v2rayN.exe)
## How to use
- If you are new to this, please download v2rayN-With-Core.zip from [releases](https://github.com/2dust/v2rayN/releases)
- Otherwise please download v2rayN.zip (you will also need to download cores in the bin directory)
- Run v2rayN.exe
### Requirements
- Microsoft [.NET Framework 4.8 Runtime](https://dotnet.microsoft.com/zh-cn/download/dotnet-framework/thank-you/net48-offline-installer)
- v2fly core [https://github.com/v2fly/v2ray-core/releases](https://github.com/v2fly/v2ray-core/releases)
- Xray core [https://github.com/XTLS/Xray-core/releases](https://github.com/XTLS/Xray-core/releases)
## Requirements
- [Microsoft .NET 6.0 Desktop Runtime ](https://download.visualstudio.microsoft.com/download/pr/513d13b7-b456-45af-828b-b7b7981ff462/edf44a743b78f8b54a2cec97ce888346/windowsdesktop-runtime-6.0.15-win-x64.exe)
- [Supported cores](https://github.com/2dust/v2rayN/wiki/List-of-supported-cores)
### Telegram Channel
## Telegram Channel
[github_2dust](https://t.me/github_2dust)

View File

@@ -17,11 +17,10 @@ public class PacHandler
private static bool _isRunning;
private static bool _needRestart = true;
public static void Start(string configPath, int httpPort, int pacPort)
{
_needRestart = (configPath != _configPath || httpPort != _httpPort || pacPort != _pacPort || !_isRunning);
_configPath = configPath;
_httpPort = httpPort;
_pacPort = pacPort;
@@ -83,9 +82,7 @@ public class PacHandler
{
}
}
}, TaskCreationOptions.LongRunning);
}
public static void Stop()

View File

@@ -9,13 +9,9 @@
</ItemGroup>
<ItemGroup>
<PackageReference Include="Google.Protobuf">
<Version>3.21.9</Version>
</PackageReference>
<PackageReference Include="Grpc.Core">
<Version>2.46.5</Version>
</PackageReference>
<PackageReference Include="Grpc.Tools" Version="2.50.0">
<PackageReference Include="Google.Protobuf" Version="3.22.3" />
<PackageReference Include="Grpc.Net.Client" Version="2.52.0" />
<PackageReference Include="Grpc.Tools" Version="2.53.0">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>

View File

@@ -8,8 +8,6 @@ namespace ProtosLib
public Tests()
{
}
}
}
}

View File

@@ -1,10 +1,9 @@
<Application
x:Class="v2rayN.App"
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:conv="clr-namespace:v2rayN.Converters"
xmlns:local="clr-namespace:v2rayN"
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
ShutdownMode="OnExplicitShutdown"
StartupUri="Views/MainWindow.xaml">
<Application.Resources>
@@ -141,10 +140,6 @@
TargetType="{x:Type ListBoxItem}">
<Setter Property="Margin" Value="-2,0" />
</Style>
</ResourceDictionary>
</Application.Resources>
</Application>
</Application>

View File

@@ -48,13 +48,11 @@ namespace v2rayN
Utils.SaveLog($"v2rayN start up | {Utils.GetVersion()} | {Utils.GetExePath()}");
Logging.ClearLogs();
Thread.CurrentThread.CurrentUICulture = new(_config.uiItem.currentLanguage);
base.OnStartup(e);
}
private void Init()
{
if (ConfigHandler.LoadConfig(ref _config) != 0)
@@ -64,7 +62,12 @@ namespace v2rayN
Environment.Exit(0);
return;
}
//if (RuntimeInformation.ProcessArchitecture != Architecture.X86 && RuntimeInformation.ProcessArchitecture != Architecture.X64)
//{
// _config.guiItem.enableStatistics = false;
//}
}
private void App_DispatcherUnhandledException(object sender, DispatcherUnhandledExceptionEventArgs e)
{
Utils.SaveLog("App_DispatcherUnhandledException", e.Exception);
@@ -79,9 +82,9 @@ namespace v2rayN
}
}
private void TaskScheduler_UnobservedTaskException(object sender, UnobservedTaskExceptionEventArgs e)
private void TaskScheduler_UnobservedTaskException(object? sender, UnobservedTaskExceptionEventArgs e)
{
Utils.SaveLog("TaskScheduler_UnobservedTaskException", e.Exception);
}
}
}
}

View File

@@ -7,4 +7,4 @@ using System.Windows;
ResourceDictionaryLocation.SourceAssembly //where the generic resource dictionary is located
//(used if a resource is not found in the page,
// app, or any theme specific resource dictionaries)
)]
)]

View File

@@ -56,7 +56,6 @@ namespace v2rayN.Base
return reader.ReadToEnd();
}
public async Task DownloadDataAsync4Speed(IWebProxy webProxy, string url, IProgress<string> progress, int timeout)
{
if (string.IsNullOrEmpty(url))

View File

@@ -9,12 +9,13 @@ namespace v2rayN.Base
/// </summary>
public class HttpClientHelper
{
private readonly static Lazy<HttpClientHelper> _instance = new(() =>
private static readonly Lazy<HttpClientHelper> _instance = new(() =>
{
HttpClientHandler handler = new() { UseCookies = false };
HttpClientHelper helper = new(new HttpClient(handler));
return helper;
});
public static HttpClientHelper Instance => _instance.Value;
private readonly HttpClient httpClient;
@@ -82,7 +83,6 @@ namespace v2rayN.Base
if (canReportProgress)
{
progress!.Report(101);
}
}
@@ -136,7 +136,7 @@ namespace v2rayN.Base
var data = new byte[read];
buffer.ToList().CopyTo(0, data, 0, read);
// TODO:
// TODO:
totalRead += read;
TimeSpan ts = (DateTime.Now - totalDatetime);
@@ -153,6 +153,5 @@ namespace v2rayN.Base
}
} while (isMoreToRead);
}
}
}
}

View File

@@ -5,6 +5,5 @@ namespace v2rayN.Base
internal class MyDGTextColumn : DataGridTextColumn
{
public string ExName { get; set; }
}
}

View File

@@ -1,5 +1,4 @@

using SQLite;
using SQLite;
using System.Collections;
namespace v2rayN.Base
@@ -29,6 +28,7 @@ namespace v2rayN.Base
{
return _db.Insert(model);
}
public int InsertAll(IEnumerable models)
{
lock (objLock)
@@ -36,10 +36,12 @@ namespace v2rayN.Base
return _db.InsertAll(models);
}
}
public async Task<int> InsertAsync(object model)
{
return await _dbAsync.InsertAsync(model);
}
public int Replace(object model)
{
lock (objLock)
@@ -47,6 +49,7 @@ namespace v2rayN.Base
return _db.InsertOrReplace(model);
}
}
public async Task<int> Replacesync(object model)
{
return await _dbAsync.InsertOrReplaceAsync(model);
@@ -59,10 +62,12 @@ namespace v2rayN.Base
return _db.Update(model);
}
}
public async Task<int> UpdateAsync(object model)
{
return await _dbAsync.UpdateAsync(model);
}
public int UpdateAll(IEnumerable models)
{
lock (objLock)
@@ -78,22 +83,27 @@ namespace v2rayN.Base
return _db.Delete(model);
}
}
public async Task<int> DeleteAsync(object model)
{
return await _dbAsync.DeleteAsync(model);
}
public List<T> Query<T>(string sql) where T : new()
{
return _db.Query<T>(sql);
}
public async Task<List<T>> QueryAsync<T>(string sql) where T : new()
{
return await _dbAsync.QueryAsync<T>(sql);
}
public int Execute(string sql)
{
return _db.Execute(sql);
}
public async Task<int> ExecuteAsync(string sql)
{
return await _dbAsync.ExecuteAsync(sql);
@@ -103,6 +113,7 @@ namespace v2rayN.Base
{
return _db.Table<T>();
}
public AsyncTableQuery<T> TableAsync<T>() where T : new()
{
return _dbAsync.Table<T>();

View File

@@ -3,7 +3,7 @@ using System.IO;
namespace v2rayN.Base
{
static class StringEx
internal static class StringEx
{
public static bool IsNullOrEmpty([NotNullWhen(false)] this string? value)
{
@@ -32,7 +32,6 @@ namespace v2rayN.Base
return true;
}
public static IEnumerable<string> NonWhiteSpaceLines(this TextReader reader)
{
string? line;
@@ -48,4 +47,4 @@ namespace v2rayN.Base
return value == null ? string.Empty : value.Trim();
}
}
}
}

View File

@@ -22,4 +22,4 @@ namespace v2rayN.Converters
return null;
}
}
}
}

View File

@@ -1,8 +1,9 @@
namespace v2rayN
{
class Global
internal class Global
{
#region const
public const string githubUrl = "https://github.com";
public const string githubApiUrl = "https://api.github.com/repos";
public const string v2rayWebsiteUrl = @"https://www.v2fly.org/";
@@ -89,18 +90,31 @@
"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> 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> ssSecuritysInXray = new() { "aes-256-gcm", "aes-128-gcm", "chacha20-poly1305", "chacha20-ietf-poly1305", "xchacha20-poly1305", "xchacha20-ietf-poly1305", "none", "plain", "2022-blake3-aes-128-gcm", "2022-blake3-aes-256-gcm", "2022-blake3-chacha20-poly1305" };
public static readonly List<string> flows = new() { "", "xtls-rprx-vision", "xtls-rprx-vision-udp443" };
public static readonly List<string> networks = new() { "tcp", "kcp", "ws", "h2", "quic", "grpc" };
public static readonly List<string> kcpHeaderTypes = new() { "srtp", "utp", "wechat-video", "dtls", "wireguard" };
public static readonly List<string> coreTypes = new() { "v2fly", "SagerNet", "Xray", "v2fly_v5" };
public static readonly List<string> domainStrategys = new() { "AsIs", "IPIfNonMatch", "IPOnDemand" };
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> userAgent = new() { "chrome", "firefox", "safari", "edge", "none" };
public static readonly List<string> SubConvertUrls = new List<string> {
@"https://sub.xeton.dev/sub?url={0}",
@"https://api.dler.io/sub?url={0}",
@"http://127.0.0.1:25500/sub?url={0}",
""
};
public static readonly List<string> SubConvertConfig = new List<string> {
@"https://raw.githubusercontent.com/ACL4SSR/ACL4SSR/master/Clash/config/ACL4SSR_Online.ini"
};
public static readonly List<string> SubConvertTargets = new List<string> {
"",
"mixed",
"v2ray",
"clash",
"ss",
};
public static readonly List<string> SpeedTestUrls = new() {
@"http://cachefly.cachefly.net/100mb.test",
@"http://cachefly.cachefly.net/10mb.test"
};
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" },
@@ -109,6 +123,21 @@
{"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",""}
};
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> 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> ssSecuritysInXray = new() { "aes-256-gcm", "aes-128-gcm", "chacha20-poly1305", "chacha20-ietf-poly1305", "xchacha20-poly1305", "xchacha20-ietf-poly1305", "none", "plain", "2022-blake3-aes-128-gcm", "2022-blake3-aes-256-gcm", "2022-blake3-chacha20-poly1305" };
public static readonly List<string> flows = new() { "", "xtls-rprx-vision", "xtls-rprx-vision-udp443" };
public static readonly List<string> networks = new() { "tcp", "kcp", "ws", "h2", "quic", "grpc" };
public static readonly List<string> kcpHeaderTypes = new() { "srtp", "utp", "wechat-video", "dtls", "wireguard" };
public static readonly List<string> coreTypes = new() { "v2fly", "SagerNet", "Xray", "v2fly_v5" };
public static readonly List<string> coreTypes4VLESS = new() { "Xray" };
public static readonly List<string> domainStrategys = new() { "AsIs", "IPIfNonMatch", "IPOnDemand" };
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> userAgent = new() { "chrome", "firefox", "safari", "edge", "none" };
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> Languages = new() { "zh-Hans", "en", "fa-Ir", "ru" };
@@ -119,9 +148,8 @@
public static readonly List<string> TunMtus = new() { "9000", "1500" };
public static readonly List<string> TunStacks = new() { "gvisor", "system" };
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" };
#endregion
#endregion const
#region global variable
@@ -130,7 +158,6 @@
public static bool ShowInTaskbar { get; set; }
public static string ExePathKey { get; set; }
#endregion
#endregion global variable
}
}
}

View File

@@ -10,7 +10,7 @@ namespace v2rayN.Handler
/// <summary>
/// 本软件配置文件处理类
/// </summary>
class ConfigHandler
internal class ConfigHandler
{
private static string configRes = Global.ConfigFileName;
private static readonly object objLock = new();
@@ -24,7 +24,7 @@ namespace v2rayN.Handler
/// <returns></returns>
public static int LoadConfig(ref Config config)
{
//载入配置文件
//载入配置文件
string result = Utils.LoadResource(Utils.GetConfigPath(configRes));
if (!Utils.IsNullOrEmpty(result))
{
@@ -198,6 +198,7 @@ namespace v2rayN.Handler
LazyConfig.Instance.SetConfig(config);
return 0;
}
/// <summary>
/// 保参数
/// </summary>
@@ -205,7 +206,6 @@ namespace v2rayN.Handler
/// <returns></returns>
public static int SaveConfig(ref Config config, bool reload = true)
{
ToJsonFile(config);
return 0;
@@ -221,7 +221,6 @@ namespace v2rayN.Handler
{
try
{
//save temp file
var resPath = Utils.GetConfigPath(configRes);
var tempPath = $"{resPath}_temp";
@@ -342,7 +341,8 @@ namespace v2rayN.Handler
return 0;
}
#endregion
#endregion ConfigHandler
#region Server
@@ -463,10 +463,11 @@ namespace v2rayN.Handler
}
if (lstProfile.Count > 0)
{
return SetDefaultServerIndex(ref config, lstProfile[0].indexId);
return SetDefaultServerIndex(ref config, lstProfile.Where(t => t.port > 0).FirstOrDefault()?.indexId);
}
return SetDefaultServerIndex(ref config, SqliteHelper.Instance.Table<ProfileItem>().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)
{
var item = LazyConfig.Instance.GetProfileItem(config.indexId);
@@ -592,10 +593,8 @@ namespace v2rayN.Handler
profileItem.remarks = $"import custom@{DateTime.Now.ToShortDateString()}";
}
AddServerCommon(ref config, profileItem, true);
return 0;
}
@@ -682,7 +681,6 @@ namespace v2rayN.Handler
return 0;
}
public static int SortServers(ref Config config, string subId, string colName, bool asc)
{
var lstModel = LazyConfig.Instance.ProfileItems(subId, "");
@@ -709,7 +707,6 @@ namespace v2rayN.Handler
sort = t33 == null ? 0 : t33.sort
}).ToList();
Enum.TryParse(colName, true, out EServerColName name);
var propertyName = string.Empty;
switch (name)
@@ -723,15 +720,19 @@ namespace v2rayN.Handler
case EServerColName.streamSecurity:
propertyName = name.ToString();
break;
case EServerColName.delayVal:
propertyName = "delay";
break;
case EServerColName.speedVal:
propertyName = "speed";
break;
case EServerColName.subRemarks:
propertyName = "subid";
break;
default:
return -1;
}
@@ -797,7 +798,7 @@ namespace v2rayN.Handler
if (!Global.flows.Contains(profileItem.flow))
{
return -1;
profileItem.flow = Global.flows.First();
}
AddServerCommon(ref config, profileItem, toFile);
@@ -811,7 +812,7 @@ namespace v2rayN.Handler
List<ProfileItem> lstKeep = new();
List<ProfileItem> lstRemove = new();
if (config.guiItem.keepOlderDedupl) lstProfile.Reverse();
if (!config.guiItem.keepOlderDedupl) lstProfile.Reverse();
foreach (ProfileItem item in lstProfile)
{
@@ -871,8 +872,7 @@ namespace v2rayN.Handler
return false;
}
return o.configVersion == n.configVersion
&& o.configType == n.configType
return o.configType == n.configType
&& o.address == n.address
&& o.port == n.port
&& o.id == n.id
@@ -911,7 +911,8 @@ namespace v2rayN.Handler
return 0;
}
#endregion
#endregion Server
#region Batch add servers
@@ -941,7 +942,11 @@ namespace v2rayN.Handler
//Check for duplicate indexId
List<string>? lstDbIndexId = null;
List<ProfileItem> lstAdd = new();
string[] arrData = clipboardData.Split(Environment.NewLine.ToCharArray());
var arrData = clipboardData.Split(Environment.NewLine.ToCharArray()).Where(t => !t.IsNullOrEmpty());
if (isSub)
{
arrData = arrData.Distinct();
}
foreach (string str in arrData)
{
//maybe sub
@@ -1014,7 +1019,7 @@ namespace v2rayN.Handler
addStatus = AddVlessServer(ref config, profileItem, false);
}
if (addStatus == 0)
if (addStatus == 0 && profileItem.port > 0)
{
countServers++;
lstAdd.Add(profileItem);
@@ -1120,7 +1125,6 @@ namespace v2rayN.Handler
if (AddCustomServer(ref config, profileItem, true) == 0)
{
return 1;
}
else
{
@@ -1206,7 +1210,7 @@ namespace v2rayN.Handler
counter = AddBatchServers4SsSIP008(ref config, clipboardData, subid, isSub, lstOriSub);
}
//maybe other sub
//maybe other sub
if (counter < 1)
{
counter = AddBatchServers4Custom(ref config, clipboardData, subid, isSub, lstOriSub);
@@ -1215,8 +1219,7 @@ namespace v2rayN.Handler
return counter;
}
#endregion
#endregion Batch add servers
#region Sub & Group
@@ -1270,7 +1273,6 @@ namespace v2rayN.Handler
}
}
/// <summary>
/// 移除服务器
/// </summary>
@@ -1283,7 +1285,7 @@ namespace v2rayN.Handler
{
return -1;
}
var customProfile = SqliteHelper.Instance.Table<ProfileItem>().Where(t => t.subid == subid && t.configType == EConfigType.Custom).ToList();
var customProfile = SqliteHelper.Instance.Table<ProfileItem>().Where(t => t.subid == subid && t.isSub == isSub && t.configType == EConfigType.Custom).ToList();
if (isSub)
{
SqliteHelper.Instance.Execute($"delete from ProfileItem where isSub = 1 and subid = '{subid}'");
@@ -1323,9 +1325,10 @@ namespace v2rayN.Handler
return 0;
}
#endregion
#region Routing
#endregion Sub & Group
#region Routing
public static int SaveRoutingItem(ref Config config, RoutingItem item)
{
@@ -1458,7 +1461,6 @@ namespace v2rayN.Handler
rules.Remove(removeItem);
break;
}
}
return 0;
}
@@ -1474,6 +1476,7 @@ namespace v2rayN.Handler
return 0;
}
public static RoutingItem GetDefaultRouting(ref Config config)
{
var item = LazyConfig.Instance.GetRoutingItem(config.routingBasicItem.routingIndexId);
@@ -1548,6 +1551,7 @@ namespace v2rayN.Handler
{
SqliteHelper.Instance.Delete(routingItem);
}
#endregion
#endregion Routing
}
}
}

View File

@@ -10,7 +10,7 @@ namespace v2rayN.Handler
/// <summary>
/// Core configuration file processing class
/// </summary>
class CoreConfigHandler
internal class CoreConfigHandler
{
private static string SampleClient = Global.v2raySampleClient;
private static string SampleServer = Global.v2raySampleServer;
@@ -228,6 +228,7 @@ namespace v2rayN.Handler
}
return 0;
}
private static int routingUserRule(RulesItem rules, ref V2rayConfig v2rayConfig)
{
try
@@ -372,7 +373,6 @@ namespace v2rayN.Handler
serversItem.password = node.id;
serversItem.method = LazyConfig.Instance.GetShadowsocksSecuritys(node).Contains(node.security) ? node.security : "none";
serversItem.ota = false;
serversItem.level = 1;
@@ -456,14 +456,8 @@ namespace v2rayN.Handler
boundStreamSettings(node, "out", outbound.streamSettings);
if (node.streamSecurity == Global.StreamSecurityReality)
{
usersItem.flow = node.flow;
outbound.mux.enabled = false;
outbound.mux.concurrency = -1;
}
else if (node.streamSecurity == Global.StreamSecurity)
if (node.streamSecurity == Global.StreamSecurityReality
|| node.streamSecurity == Global.StreamSecurity)
{
if (!Utils.IsNullOrEmpty(node.flow))
{
@@ -669,6 +663,7 @@ namespace v2rayN.Handler
}
}
break;
case "grpc":
GrpcSettings grpcSettings = new()
{
@@ -681,6 +676,7 @@ namespace v2rayN.Handler
};
streamSettings.grpcSettings = grpcSettings;
break;
default:
//tcp
if (node.headerType == Global.TcpHeaderHttp)
@@ -834,11 +830,11 @@ namespace v2rayN.Handler
/// <param name="fileName"></param>
/// <param name="msg"></param>
/// <returns></returns>
private static int GenerateClientCustomConfig(ProfileItem node, string fileName, out string msg)
private static int GenerateClientCustomConfig(ProfileItem node, string? fileName, out string msg)
{
try
{
if (node == null)
if (node == null || fileName is null)
{
msg = ResUI.CheckServerSettings;
return -1;
@@ -880,9 +876,10 @@ namespace v2rayN.Handler
case ECoreType.Xray:
case ECoreType.v2fly_v5:
break;
case ECoreType.clash:
case ECoreType.clash_meta:
//remove the original
//remove the original
var indexPort = fileContent.FindIndex(t => t.Contains("port:"));
if (indexPort >= 0)
{
@@ -916,7 +913,8 @@ namespace v2rayN.Handler
{
try
{
if (node == null)
if (node == null
|| node.port <= 0)
{
msg = ResUI.CheckServerSettings;
return -1;
@@ -966,7 +964,7 @@ namespace v2rayN.Handler
return 0;
}
#endregion
#endregion Generate client configuration
#region Generate server-side configuration
@@ -1041,7 +1039,6 @@ namespace v2rayN.Handler
{
inbound.protocol = Global.vmessProtocolLite;
usersItem.alterId = node.alterId;
}
else if (node.configType == EConfigType.VLESS)
{
@@ -1074,7 +1071,8 @@ namespace v2rayN.Handler
}
return 0;
}
#endregion
#endregion Generate server-side configuration
#region Import (export) client/server configuration
@@ -1345,11 +1343,10 @@ namespace v2rayN.Handler
return GenerateServerConfig(node, fileName, out msg);
}
#endregion
#endregion Import (export) client/server configuration
#region Gen speedtest config
public static string GenerateClientSpeedtestConfigString(Config config, List<ServerTestItem> selecteds, out string msg)
{
try
@@ -1496,7 +1493,6 @@ namespace v2rayN.Handler
}
}
#endregion
#endregion Gen speedtest config
}
}
}

View File

@@ -9,13 +9,13 @@ namespace v2rayN.Handler
/// <summary>
/// Core process processing class
/// </summary>
class CoreHandler
internal class CoreHandler
{
private static string _coreCConfigRes = Global.coreConfigFileName;
private CoreInfo? _coreInfo;
private int _processId = 0;
private Process? _process;
Action<bool, string> _updateFunc;
private Action<bool, string> _updateFunc;
public CoreHandler(Action<bool, string> update)
{
@@ -119,7 +119,6 @@ namespace v2rayN.Handler
CoreStopPid(_processId);
_processId = 0;
}
}
catch (Exception ex)
{
@@ -190,6 +189,14 @@ namespace v2rayN.Handler
if (displayLog)
{
p.OutputDataReceived += (sender, e) =>
{
if (!string.IsNullOrEmpty(e.Data))
{
string msg = e.Data + Environment.NewLine;
ShowMsg(false, msg);
}
};
p.ErrorDataReceived += (sender, e) =>
{
if (!string.IsNullOrEmpty(e.Data))
{
@@ -202,6 +209,7 @@ namespace v2rayN.Handler
if (displayLog)
{
p.BeginOutputReadLine();
p.BeginErrorReadLine();
}
_process = p;
@@ -214,7 +222,7 @@ namespace v2rayN.Handler
}
catch (Exception ex)
{
Utils.SaveLog(Utils.ToJson(node));
//Utils.SaveLog(Utils.ToJson(node));
Utils.SaveLog(ex.Message, ex);
string msg = ex.Message;
ShowMsg(true, msg);
@@ -255,8 +263,17 @@ namespace v2rayN.Handler
ShowMsg(false, msg);
}
};
p.ErrorDataReceived += (sender, e) =>
{
if (!string.IsNullOrEmpty(e.Data))
{
string msg = e.Data + Environment.NewLine;
ShowMsg(false, msg);
}
};
p.Start();
p.BeginOutputReadLine();
p.BeginErrorReadLine();
p.StandardInput.Write(configStr);
p.StandardInput.Close();
@@ -318,4 +335,4 @@ namespace v2rayN.Handler
return 0;
}
}
}
}

View File

@@ -12,13 +12,12 @@ namespace v2rayN.Handler
/// <summary>
///Download
/// </summary>
class DownloadHandle
internal class DownloadHandle
{
public event EventHandler<ResultEventArgs>? UpdateCompleted;
public event ErrorEventHandler? Error;
public class ResultEventArgs : EventArgs
{
public bool Success;
@@ -175,13 +174,12 @@ namespace v2rayN.Handler
}
}
return null;
}
/// <summary>
/// DownloadString
/// </summary>
/// </summary>
/// <param name="url"></param>
public async Task<string?> DownloadStringAsync(string url, bool blProxy, string userAgent)
{
@@ -228,7 +226,7 @@ namespace v2rayN.Handler
/// <summary>
/// DownloadString
/// </summary>
/// </summary>
/// <param name="url"></param>
public async Task<string?> DownloadStringViaDownloader(string url, bool blProxy, string userAgent)
{
@@ -257,7 +255,6 @@ namespace v2rayN.Handler
return null;
}
public int RunAvailabilityCheck(IWebProxy? webProxy)
{
try
@@ -345,4 +342,4 @@ namespace v2rayN.Handler
}
}
}
}
}

View File

@@ -15,15 +15,20 @@ namespace v2rayN.Handler
public static HotkeyHandler Instance = _instance.Value;
private const int WmHotkey = 0x0312;
private Config _config
{
get => LazyConfig.Instance.GetConfig();
}
private Dictionary<int, List<EGlobalHotkey>> _hotkeyTriggerDic;
public bool IsPause { get; set; } = false;
public event Action<bool, string>? UpdateViewEvent;
public event Action<EGlobalHotkey>? HotkeyTriggerEvent;
public HotkeyHandler()
{
_hotkeyTriggerDic = new();
@@ -57,6 +62,7 @@ namespace v2rayN.Handler
}
}
}
public void Load()
{
foreach (var _hotkeyCode in _hotkeyTriggerDic.Keys)
@@ -82,7 +88,6 @@ namespace v2rayN.Handler
}
UpdateViewEvent?.Invoke(false, msg);
}
}
}
@@ -98,6 +103,7 @@ namespace v2rayN.Handler
Init();
Load();
}
private (int fsModifiers, int vKey, string hotkeyStr, List<string> Names) GetHotkeyInfo(int hotkeycode)
{
var _fsModifiers = hotkeycode & 0xffff;
@@ -117,9 +123,9 @@ namespace v2rayN.Handler
_names.Add(name.ToString());
}
return (_fsModifiers, _vkey, _hotkeyStr.ToString(), _names);
}
private void OnThreadPreProcessMessage(ref MSG msg, ref bool handled)
{
if (msg.message != WmHotkey || !_hotkeyTriggerDic.ContainsKey((int)msg.lParam))
@@ -153,11 +159,13 @@ namespace v2rayN.Handler
}
}
}
[DllImport("user32.dll", SetLastError = true)]
private static extern bool RegisterHotKey(IntPtr hWnd, int id, int fsModifiers, int vlc);
[DllImport("user32.dll", SetLastError = true)]
private static extern bool UnregisterHotKey(IntPtr hWnd, int id);
[Flags]
private enum KeyModifiers
{
@@ -169,4 +177,4 @@ namespace v2rayN.Handler
NoRepeat = 0x4000
}
}
}
}

View File

@@ -26,6 +26,7 @@ namespace v2rayN.Handler
{
_config = config;
}
public Config GetConfig()
{
return _config;
@@ -65,6 +66,7 @@ namespace v2rayN.Handler
{
return SqliteHelper.Instance.Table<SubItem>().ToList();
}
public SubItem GetSubItem(string subid)
{
return SqliteHelper.Instance.Table<SubItem>().FirstOrDefault(t => t.id == subid);
@@ -75,19 +77,18 @@ namespace v2rayN.Handler
if (Utils.IsNullOrEmpty(subid))
{
return SqliteHelper.Instance.Table<ProfileItem>().ToList();
}
else
{
return SqliteHelper.Instance.Table<ProfileItem>().Where(t => t.subid == subid).ToList();
}
}
public List<string> ProfileItemIndexs(string subid)
{
if (Utils.IsNullOrEmpty(subid))
{
return SqliteHelper.Instance.Table<ProfileItem>().Select(t => t.indexId).ToList();
}
else
{
@@ -97,10 +98,10 @@ namespace v2rayN.Handler
public List<ProfileItemModel> ProfileItems(string subid, string filter)
{
var sql = @$"select a.*
,b.remarks subRemarks
var sql = @$"select a.*
,b.remarks subRemarks
from ProfileItem a
left join SubItem b on a.subid = b.id
left join SubItem b on a.subid = b.id
where 1=1 ";
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();
}
public RoutingItem GetRoutingItem(string id)
{
return SqliteHelper.Instance.Table<RoutingItem>().FirstOrDefault(it => it.locked == false && it.id == id);
}
#endregion
#endregion Config
#region Core Type
@@ -200,8 +202,9 @@ namespace v2rayN.Handler
coreType = ECoreType.v2rayN,
coreUrl = Global.NUrl,
coreReleaseApiUrl = Global.NUrl.Replace(Global.githubUrl, Global.githubApiUrl),
coreDownloadUrl32 = Global.NUrl + "/download/{0}/v2rayN.zip",
coreDownloadUrl32 = Global.NUrl + "/download/{0}/v2rayN-32.zip",
coreDownloadUrl64 = Global.NUrl + "/download/{0}/v2rayN.zip",
coreDownloadUrlArm64 = Global.NUrl + "/download/{0}/v2rayN-arm64.zip"
});
coreInfos.Add(new CoreInfo
@@ -213,6 +216,7 @@ namespace v2rayN.Handler
coreReleaseApiUrl = Global.v2flyCoreUrl.Replace(Global.githubUrl, Global.githubApiUrl),
coreDownloadUrl32 = Global.v2flyCoreUrl + "/download/{0}/v2ray-windows-{1}.zip",
coreDownloadUrl64 = Global.v2flyCoreUrl + "/download/{0}/v2ray-windows-{1}.zip",
coreDownloadUrlArm64 = Global.v2flyCoreUrl + "/download/{0}/v2ray-windows-{1}.zip",
match = "V2Ray",
versionArg = "-version",
redirectInfo = true,
@@ -227,6 +231,7 @@ namespace v2rayN.Handler
coreReleaseApiUrl = Global.SagerNetCoreUrl.Replace(Global.githubUrl, Global.githubApiUrl),
coreDownloadUrl32 = Global.SagerNetCoreUrl + "/download/{0}/v2ray-windows-{1}.zip",
coreDownloadUrl64 = Global.SagerNetCoreUrl + "/download/{0}/v2ray-windows-{1}.zip",
coreDownloadUrlArm64 = Global.SagerNetCoreUrl + "/download/{0}/v2ray-windows-{1}.zip",
match = "V2Ray",
versionArg = "version",
redirectInfo = true,
@@ -241,6 +246,7 @@ namespace v2rayN.Handler
coreReleaseApiUrl = Global.v2flyCoreUrl.Replace(Global.githubUrl, Global.githubApiUrl),
coreDownloadUrl32 = Global.v2flyCoreUrl + "/download/{0}/v2ray-windows-{1}.zip",
coreDownloadUrl64 = Global.v2flyCoreUrl + "/download/{0}/v2ray-windows-{1}.zip",
coreDownloadUrlArm64 = Global.v2flyCoreUrl + "/download/{0}/v2ray-windows-{1}.zip",
match = "V2Ray",
versionArg = "version",
redirectInfo = true,
@@ -255,6 +261,7 @@ namespace v2rayN.Handler
coreReleaseApiUrl = Global.xrayCoreUrl.Replace(Global.githubUrl, Global.githubApiUrl),
coreDownloadUrl32 = Global.xrayCoreUrl + "/download/{0}/Xray-windows-{1}.zip",
coreDownloadUrl64 = Global.xrayCoreUrl + "/download/{0}/Xray-windows-{1}.zip",
coreDownloadUrlArm64 = Global.xrayCoreUrl + "/download/{0}/Xray-windows-{1}.zip",
match = "Xray",
versionArg = "-version",
redirectInfo = true,
@@ -269,6 +276,7 @@ namespace v2rayN.Handler
coreReleaseApiUrl = Global.clashCoreUrl.Replace(Global.githubUrl, Global.githubApiUrl),
coreDownloadUrl32 = Global.clashCoreUrl + "/download/{0}/clash-windows-386-{0}.zip",
coreDownloadUrl64 = Global.clashCoreUrl + "/download/{0}/clash-windows-amd64-{0}.zip",
coreDownloadUrlArm64 = Global.clashCoreUrl + "/download/{0}/clash-windows-arm64-{0}.zip",
match = "v",
versionArg = "-v",
redirectInfo = true,
@@ -283,6 +291,7 @@ namespace v2rayN.Handler
coreReleaseApiUrl = Global.clashMetaCoreUrl.Replace(Global.githubUrl, Global.githubApiUrl),
coreDownloadUrl32 = Global.clashMetaCoreUrl + "/download/{0}/Clash.Meta-windows-386-{0}.zip",
coreDownloadUrl64 = Global.clashMetaCoreUrl + "/download/{0}/Clash.Meta-windows-amd64-compatible-{0}.zip",
coreDownloadUrlArm64 = Global.clashMetaCoreUrl + "/download/{0}/Clash.Meta-windows-arm64-{0}.zip",
match = "v",
versionArg = "-v",
redirectInfo = true,
@@ -297,6 +306,7 @@ namespace v2rayN.Handler
coreReleaseApiUrl = Global.hysteriaCoreUrl.Replace(Global.githubUrl, Global.githubApiUrl),
coreDownloadUrl32 = Global.hysteriaCoreUrl + "/download/{0}/hysteria-windows-386.exe",
coreDownloadUrl64 = Global.hysteriaCoreUrl + "/download/{0}/hysteria-windows-amd64.exe",
coreDownloadUrlArm64 = Global.hysteriaCoreUrl + "/download/{0}/hysteria-windows-arm64.exe",
redirectInfo = true,
});
@@ -325,9 +335,15 @@ namespace v2rayN.Handler
arguments = "run",
coreUrl = Global.singboxCoreUrl,
redirectInfo = true,
coreReleaseApiUrl = Global.singboxCoreUrl.Replace(Global.githubUrl, Global.githubApiUrl),
coreDownloadUrl32 = Global.singboxCoreUrl + "/download/{0}/sing-box-{1}-windows-386.zip",
coreDownloadUrl64 = Global.singboxCoreUrl + "/download/{0}/sing-box-{1}-windows-amd64.zip",
coreDownloadUrlArm64 = Global.singboxCoreUrl + "/download/{0}/sing-box-{1}-windows-arm64.zip",
match = "sing-box",
versionArg = "version",
});
}
#endregion
#endregion Core Type
}
}
}

View File

@@ -1,5 +1,4 @@

using Microsoft.Win32;
using Microsoft.Win32;
using System.Drawing;
using System.IO;
using System.Windows.Media.Imaging;
@@ -11,14 +10,6 @@ namespace v2rayN.Handler
public sealed class MainFormHandler
{
private static readonly Lazy<MainFormHandler> instance = new(() => new());
//Action<bool, string> _updateUI;
//private DownloadHandle downloadHandle2;
//private Config _config;
//private V2rayHandler _v2rayHandler;
//private List<int> _selecteds;
//private Thread _workThread;
//Action<int, string> _updateFunc;
public static MainFormHandler Instance => instance.Value;
public Icon GetNotifyIcon(Config config)
@@ -64,10 +55,12 @@ namespace v2rayN.Handler
case 0:
index = 1;
break;
case 1:
case 3:
index = 2;
break;
case 2:
index = 3;
break;
@@ -105,7 +98,7 @@ namespace v2rayN.Handler
SolidBrush drawBrush = new(color);
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.FillEllipse(drawBrush, width / 2, width / 2, width / 2, width / 2);
@@ -233,7 +226,6 @@ namespace v2rayN.Handler
{
if (ret == 0)
{
UI.Show(ResUI.OperationSuccess);
}
else
@@ -285,37 +277,52 @@ namespace v2rayN.Handler
public void UpdateTask(Config config, Action<bool, string> update)
{
Task.Run(() => UpdateTaskRun(config, update));
Task.Run(() => UpdateTaskRunSubscription(config, update));
Task.Run(() => UpdateTaskRunGeo(config, update));
}
private void UpdateTaskRun(Config config, Action<bool, string> update)
private void UpdateTaskRunSubscription(Config config, Action<bool, string> update)
{
Thread.Sleep(60000);
Utils.SaveLog("UpdateTaskRunSubscription");
var updateHandle = new UpdateHandle();
while (true)
{
var updateTime = ((DateTimeOffset)DateTime.Now).ToUnixTimeSeconds();
var lstSubs = LazyConfig.Instance.SubItems()
.Where(t => t.autoUpdateInterval > 0)
.Where(t => updateTime - t.updateTime >= t.autoUpdateInterval * 60)
.ToList();
foreach (var item in lstSubs)
{
updateHandle.UpdateSubscriptionProcess(config, item.id, true, (bool success, string msg) =>
{
update(success, msg);
if (success)
Utils.SaveLog("subscription" + msg);
});
item.updateTime = updateTime;
ConfigHandler.AddSubItem(ref config, item);
Thread.Sleep(5000);
}
Thread.Sleep(60000);
}
}
private void UpdateTaskRunGeo(Config config, Action<bool, string> update)
{
var autoUpdateSubTime = DateTime.Now;
var autoUpdateGeoTime = DateTime.Now;
Thread.Sleep(60000);
Utils.SaveLog("UpdateTaskRun");
Thread.Sleep(1000 * 120);
Utils.SaveLog("UpdateTaskRunGeo");
var updateHandle = new UpdateHandle();
while (true)
{
var dtNow = DateTime.Now;
if (config.guiItem.autoUpdateSubInterval > 0)
{
if ((dtNow - autoUpdateSubTime).Hours % config.guiItem.autoUpdateSubInterval == 0)
{
updateHandle.UpdateSubscriptionProcess(config, "", true, (bool success, string msg) =>
{
update(success, msg);
if (success)
Utils.SaveLog("subscription" + msg);
});
autoUpdateSubTime = dtNow;
}
Thread.Sleep(60000);
}
if (config.guiItem.autoUpdateInterval > 0)
{
if ((dtNow - autoUpdateGeoTime).Hours % config.guiItem.autoUpdateInterval == 0)
@@ -347,6 +354,5 @@ namespace v2rayN.Handler
HotkeyHandler.Instance.HotkeyTriggerEvent += handler;
HotkeyHandler.Instance.Load();
}
}
}

View File

@@ -18,16 +18,16 @@ namespace v2rayN.Handler
{
_snackbarMessageQueue?.Enqueue(content);
}
public void SendMessage(string msg)
{
MessageBus.Current.SendMessage(msg, "MsgView");
}
public void SendMessage(string msg, bool time)
{
msg = $"{DateTime.Now} {msg}";
MessageBus.Current.SendMessage(msg, "MsgView");
}
}
}
}

View File

@@ -5,7 +5,7 @@ using v2rayN.Mode;
namespace v2rayN.Handler
{
class ProfileExHandler
internal class ProfileExHandler
{
private static readonly Lazy<ProfileExHandler> _instance = new(() => new());
private ConcurrentBag<ProfileExItem> _lstProfileEx;
@@ -132,6 +132,7 @@ namespace v2rayN.Handler
}
return profileEx.sort;
}
public int GetMaxSort()
{
if (_lstProfileEx.Count <= 0)
@@ -141,4 +142,4 @@ namespace v2rayN.Handler
return _lstProfileEx.Max(t => t == null ? 0 : t.sort);
}
}
}
}

View File

@@ -3,7 +3,7 @@ using System.Runtime.InteropServices;
namespace v2rayN.Handler
{
class ProxySetting
internal class ProxySetting
{
public static bool UnsetProxy()
{
@@ -62,7 +62,6 @@ namespace v2rayN.Handler
list.dwOptionCount = options.Length;
list.dwOptionError = 0;
int optSize = Marshal.SizeOf(typeof(InternetConnectionOption));
// make a pointer out of all that ...
IntPtr optionsPtr = Marshal.AllocCoTaskMem(optSize * options.Length);
@@ -106,8 +105,8 @@ namespace v2rayN.Handler
return (returnvalue < 0);
}
#region WinInet structures
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public struct InternetPerConnOptionList
{
@@ -115,6 +114,7 @@ namespace v2rayN.Handler
public IntPtr szConnection; // connection name to set/query options
public int dwOptionCount; // number of options to set/query
public int dwOptionError; // on error, which option failed
//[MarshalAs(UnmanagedType.)]
public IntPtr options;
};
@@ -122,9 +122,10 @@ namespace v2rayN.Handler
[StructLayout(LayoutKind.Sequential, CharSet = CharSet.Auto)]
public struct InternetConnectionOption
{
static readonly int Size;
private static readonly int Size;
public PerConnOption m_Option;
public InternetConnectionOptionValue m_Value;
static InternetConnectionOption()
{
Size = Marshal.SizeOf(typeof(InternetConnectionOption));
@@ -137,15 +138,19 @@ namespace v2rayN.Handler
// Fields
[FieldOffset(0)]
public System.Runtime.InteropServices.ComTypes.FILETIME m_FileTime;
[FieldOffset(0)]
public int m_Int;
[FieldOffset(0)]
public IntPtr m_StringPtr;
}
}
#endregion
#endregion WinInet structures
#region WinInet enums
//
// options manifests for Internet{Query|Set}Option
//
@@ -159,11 +164,10 @@ namespace v2rayN.Handler
//
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_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_AUTOCONFIG_URL = 4//, // Sets or retrieves a string containing the URL to the automatic configuration script.
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_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.
}
//
@@ -177,7 +181,8 @@ namespace v2rayN.Handler
PROXY_TYPE_AUTO_PROXY_URL = 0x00000004, // autoproxy URL
PROXY_TYPE_AUTO_DETECT = 0x00000008 // use autoproxy detection
}
#endregion
#endregion WinInet enums
internal static class NativeMethods
{
@@ -199,13 +204,13 @@ namespace v2rayN.Handler
return false;
}
}
//获得代理的IP和端口
public static string? GetProxyProxyServer()
{
using RegistryKey? rk = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Internet Settings", true);
string ProxyServer = rk.GetValue("ProxyServer").ToString();
return ProxyServer;
}
}
}
}

View File

@@ -24,7 +24,5 @@ namespace v2rayN.Handler
return null;
}
}
}
}
}

View File

@@ -7,9 +7,8 @@ using v2rayN.Resx;
namespace v2rayN.Handler
{
class ShareHandler
internal class ShareHandler
{
#region GetShareUrl
/// <summary>
@@ -162,6 +161,7 @@ namespace v2rayN.Handler
url = $"{Global.vlessProtocol}{url}{query}{remark}";
return url;
}
private static string GetIpv6(string address)
{
return Utils.IsIpv6(address) ? $"[{address}]" : address;
@@ -221,6 +221,7 @@ namespace v2rayN.Handler
dicQuery.Add("host", Utils.UrlEncode(item.requestHost));
}
break;
case "kcp":
dicQuery.Add("headerType", !Utils.IsNullOrEmpty(item.headerType) ? item.headerType : "none");
if (!Utils.IsNullOrEmpty(item.path))
@@ -258,6 +259,7 @@ namespace v2rayN.Handler
dicQuery.Add("quicSecurity", Utils.UrlEncode(item.requestHost));
dicQuery.Add("key", Utils.UrlEncode(item.path));
break;
case "grpc":
if (!Utils.IsNullOrEmpty(item.path))
{
@@ -272,10 +274,9 @@ namespace v2rayN.Handler
return 0;
}
#endregion
#region ImportShareUrl
#endregion GetShareUrl
#region ImportShareUrl
/// <summary>
/// 从剪贴板导入URL
@@ -290,7 +291,7 @@ namespace v2rayN.Handler
try
{
//载入配置文件
//载入配置文件
string result = clipboardData.TrimEx();// Utils.GetClipboardData();
if (Utils.IsNullOrEmpty(result))
{
@@ -309,7 +310,6 @@ namespace v2rayN.Handler
{
profileItem = ResolveVmess(result, out msg);
}
}
else if (result.StartsWith(Global.ssProtocol))
{
@@ -352,7 +352,6 @@ namespace v2rayN.Handler
else if (result.StartsWith(Global.vlessProtocol))
{
profileItem = ResolveStdVLESS(result);
}
else
{
@@ -487,6 +486,7 @@ namespace v2rayN.Handler
case "tls":
// TODO tls config
break;
default:
if (!string.IsNullOrWhiteSpace(i.streamSecurity))
return null;
@@ -502,6 +502,7 @@ namespace v2rayN.Handler
// TODO http option
break;
case "kcp":
i.headerType = q["type"] ?? "none";
// TODO kcp seed
@@ -636,7 +637,6 @@ namespace v2rayN.Handler
return server;
}
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);
@@ -738,6 +738,7 @@ namespace v2rayN.Handler
return item;
}
private static ProfileItem ResolveStdVLESS(string result)
{
ProfileItem item = new()
@@ -780,6 +781,7 @@ namespace v2rayN.Handler
item.requestHost = Utils.UrlDecode(query["host"] ?? "");
break;
case "kcp":
item.headerType = query["headerType"] ?? "none";
item.path = Utils.UrlDecode(query["seed"] ?? "");
@@ -802,16 +804,18 @@ namespace v2rayN.Handler
item.requestHost = query["quicSecurity"] ?? "none";
item.path = Utils.UrlDecode(query["key"] ?? "");
break;
case "grpc":
item.path = Utils.UrlDecode(query["serviceName"] ?? "");
item.headerType = Utils.UrlDecode(query["mode"] ?? Global.GrpcgunMode);
break;
default:
break;
}
return 0;
}
#endregion
#endregion ImportShareUrl
}
}
}

View File

@@ -7,13 +7,13 @@ using v2rayN.Resx;
namespace v2rayN.Handler
{
class SpeedtestHandler
internal class SpeedtestHandler
{
private Config _config;
private CoreHandler _coreHandler;
private List<ServerTestItem> _selecteds;
private ESpeedActionType _actionType;
Action<string, string, string> _updateFunc;
private Action<string, string, string> _updateFunc;
public SpeedtestHandler(Config config)
{
@@ -57,10 +57,12 @@ namespace v2rayN.Handler
UpdateFunc(it.indexId, ResUI.Speedtesting, "");
ProfileExHandler.Instance.SetTestDelay(it.indexId, "0");
break;
case ESpeedActionType.Speedtest:
UpdateFunc(it.indexId, "", ResUI.SpeedtestingWait);
ProfileExHandler.Instance.SetTestSpeed(it.indexId, "0");
break;
case ESpeedActionType.Mixedtest:
UpdateFunc(it.indexId, ResUI.Speedtesting, ResUI.SpeedtestingWait);
ProfileExHandler.Instance.SetTestDelay(it.indexId, "0");
@@ -74,15 +76,19 @@ namespace v2rayN.Handler
case ESpeedActionType.Ping:
Task.Run(RunPing);
break;
case ESpeedActionType.Tcping:
Task.Run(RunTcping);
break;
case ESpeedActionType.Realping:
Task.Run(RunRealPing);
break;
case ESpeedActionType.Speedtest:
Task.Run(RunSpeedTestAsync);
break;
case ESpeedActionType.Mixedtest:
Task.Run(RunMixedtestAsync);
break;
@@ -113,7 +119,6 @@ namespace v2rayN.Handler
}
}
private void RunPing()
{
RunPingSub((ServerTestItem it) =>
@@ -169,7 +174,6 @@ namespace v2rayN.Handler
{
try
{
WebProxy webProxy = new(Global.Loopback, it.port);
string output = GetRealPingTime(downloadHandle, webProxy);
@@ -243,7 +247,7 @@ namespace v2rayN.Handler
WebProxy webProxy = new(Global.Loopback, it.port);
await downloadHandle.DownloadDataAsync(url, webProxy, timeout, async (bool success, string msg) =>
await downloadHandle.DownloadDataAsync(url, webProxy, timeout, (bool success, string msg) =>
{
decimal.TryParse(msg, out decimal dec);
if (dec > 0)
@@ -287,6 +291,11 @@ namespace v2rayN.Handler
{
continue;
}
if (it.delay < 0)
{
UpdateFunc(it.indexId, "", ResUI.SpeedtestingSkip);
continue;
}
ProfileExHandler.Instance.SetTestSpeed(it.indexId, "-1");
UpdateFunc(it.indexId, "", ResUI.Speedtesting);
@@ -294,7 +303,7 @@ namespace v2rayN.Handler
if (item is null) continue;
WebProxy webProxy = new(Global.Loopback, it.port);
_ = downloadHandle.DownloadDataAsync(url, webProxy, timeout, async (bool success, string msg) =>
_ = downloadHandle.DownloadDataAsync(url, webProxy, timeout, (bool success, string msg) =>
{
decimal.TryParse(msg, out decimal dec);
if (dec > 0)
@@ -365,7 +374,6 @@ namespace v2rayN.Handler
return responseTime;
}
/// <summary>
/// Ping
/// </summary>
@@ -417,4 +425,4 @@ namespace v2rayN.Handler
_updateFunc(indexId, delay, speed);
}
}
}
}

View File

@@ -1,4 +1,5 @@
using Grpc.Core;
using Grpc.Net.Client;
using ProtosLib.Statistics;
using System.Net;
using System.Net.Sockets;
@@ -7,17 +8,17 @@ using v2rayN.Mode;
namespace v2rayN.Handler
{
class StatisticsHandler
internal class StatisticsHandler
{
private Mode.Config config_;
private Channel channel_;
private StatsService.StatsServiceClient client_;
private bool exitFlag_;
private GrpcChannel _channel;
private StatsService.StatsServiceClient _client;
private bool _exitFlag;
private ServerStatItem? _serverStatItem;
private List<ServerStatItem> _lstServerStat;
public List<ServerStatItem> ServerStat => _lstServerStat;
Action<ServerSpeedItem> updateFunc_;
private Action<ServerSpeedItem> _updateFunc;
public bool Enable
{
@@ -28,8 +29,8 @@ namespace v2rayN.Handler
{
config_ = config;
Enable = config.guiItem.enableStatistics;
updateFunc_ = update;
exitFlag_ = false;
_updateFunc = update;
_exitFlag = false;
Init();
GrpcInit();
@@ -39,13 +40,12 @@ namespace v2rayN.Handler
private void GrpcInit()
{
if (channel_ == null)
if (_channel == null)
{
Global.statePort = GetFreePort();
channel_ = new Channel($"{Global.Loopback}:{Global.statePort}", ChannelCredentials.Insecure);
channel_.ConnectAsync();
client_ = new StatsService.StatsServiceClient(channel_);
_channel = GrpcChannel.ForAddress($"{Global.httpProtocol}{Global.Loopback}:{Global.statePort}");
_client = new StatsService.StatsServiceClient(_channel);
}
}
@@ -53,8 +53,8 @@ namespace v2rayN.Handler
{
try
{
exitFlag_ = true;
channel_.ShutdownAsync();
_exitFlag = true;
//channel_.ShutdownAsync();
}
catch (Exception ex)
{
@@ -62,18 +62,18 @@ namespace v2rayN.Handler
}
}
public void Run()
public async void Run()
{
while (!exitFlag_)
while (!_exitFlag)
{
try
{
if (Enable && channel_.State == ChannelState.Ready)
if (Enable && _channel.State == ConnectivityState.Ready)
{
QueryStatsResponse? res = null;
try
{
res = client_.QueryStats(new QueryStatsRequest() { Pattern = "", Reset = true });
res = await _client.QueryStatsAsync(new QueryStatsRequest() { Pattern = "", Reset = true });
}
catch (Exception ex)
{
@@ -99,13 +99,13 @@ namespace v2rayN.Handler
server.todayDown = _serverStatItem.todayDown;
server.totalUp = _serverStatItem.totalUp;
server.totalDown = _serverStatItem.totalDown;
updateFunc_(server);
_updateFunc(server);
}
}
}
var sleep = config_.guiItem.statisticsFreshRate < 1 ? 1 : config_.guiItem.statisticsFreshRate;
Thread.Sleep(1000 * sleep);
channel_.ConnectAsync();
await _channel.ConnectAsync();
}
catch
{
@@ -134,6 +134,8 @@ namespace v2rayN.Handler
private void Init()
{
SqliteHelper.Instance.Execute($"delete from ServerStatItem where indexId not in ( select indexId from ProfileItem )");
long ticks = DateTime.Now.Date.Ticks;
SqliteHelper.Instance.Execute($"update ServerStatItem set todayUp = 0,todayDown=0,dateNow={ticks} where dateNow<>{ticks}");
@@ -180,7 +182,6 @@ namespace v2rayN.Handler
server = new();
try
{
foreach (Stat stat in source)
{
string name = stat.Name;
@@ -243,4 +244,4 @@ namespace v2rayN.Handler
}
}
}
}
}

View File

@@ -22,7 +22,7 @@ namespace v2rayN.Handler
// <pac-url>
private static SysproxyConfig? _userSettings = null;
enum RET_ERRORS : int
private enum RET_ERRORS : int
{
RET_NO_ERROR = 0,
INVALID_FORMAT = 1,
@@ -45,7 +45,6 @@ namespace v2rayN.Handler
}
}
public static bool UpdateSysProxy(Config config, bool forceDisable)
{
var type = config.sysProxyType;
@@ -120,7 +119,6 @@ namespace v2rayN.Handler
}
}
public static void SetIEProxy(bool global, string strProxy, string strExceptions)
{
string arguments = global
@@ -209,7 +207,6 @@ namespace v2rayN.Handler
}
catch (System.ComponentModel.Win32Exception e)
{
// log the arguments
throw new Exception(process.StartInfo.Arguments);
}
@@ -231,7 +228,5 @@ namespace v2rayN.Handler
// _queryStr = stdout;
//}
}
}
}
}

View File

@@ -204,7 +204,6 @@ namespace v2rayN.Base
configStr = configStr.Replace("$ruleProxyProcess$", "");
configStr = configStr.Replace("$ruleFinally$", "");
File.WriteAllText(Utils.GetConfigPath(_tunConfigName), configStr);
return true;

View File

@@ -2,6 +2,7 @@
using Splat;
using System.Diagnostics;
using System.IO;
using System.Runtime.InteropServices;
using System.Text;
using System.Text.RegularExpressions;
using System.Windows;
@@ -11,9 +12,9 @@ using v2rayN.Resx;
namespace v2rayN.Handler
{
class UpdateHandle
internal class UpdateHandle
{
Action<bool, string> _updateFunc;
private Action<bool, string> _updateFunc;
private Config _config;
public event EventHandler<ResultEventArgs> AbsoluteCompleted;
@@ -95,7 +96,6 @@ namespace v2rayN.Handler
CheckUpdateAsync(ECoreType.v2rayN, preRelease);
}
public void CheckUpdateCore(ECoreType type, Config config, Action<bool, string> update, bool preRelease)
{
_config = config;
@@ -147,7 +147,6 @@ namespace v2rayN.Handler
CheckUpdateAsync(type, preRelease);
}
public void UpdateSubscriptionProcess(Config config, string subId, bool blProxy, Action<bool, string> update)
{
_config = config;
@@ -191,6 +190,20 @@ namespace v2rayN.Handler
//one url
url = Utils.GetPunycode(url);
//convert
if (!Utils.IsNullOrEmpty(item.convertTarget))
{
var subConvertUrl = string.IsNullOrEmpty(config.constItem.subConvertUrl) ? Global.SubConvertUrls.FirstOrDefault() : config.constItem.subConvertUrl;
url = string.Format(subConvertUrl!, Utils.UrlEncode(url));
if (!url.Contains("target="))
{
url += string.Format("&target={0}", item.convertTarget);
}
if (!url.Contains("config="))
{
url += string.Format("&config={0}", Global.SubConvertConfig.FirstOrDefault());
}
}
var result = await downloadHandle.TryDownloadString(url, blProxy, userAgent);
if (blProxy && Utils.IsNullOrEmpty(result))
{
@@ -198,7 +211,7 @@ namespace v2rayN.Handler
}
//more url
if (!Utils.IsNullOrEmpty(item.moreUrl.TrimEx()))
if (Utils.IsNullOrEmpty(item.convertTarget) && !Utils.IsNullOrEmpty(item.moreUrl.TrimEx()))
{
if (!Utils.IsNullOrEmpty(result) && Utils.IsBase64String(result))
{
@@ -263,7 +276,6 @@ namespace v2rayN.Handler
}
_updateFunc(true, $"{ResUI.MsgUpdateSubscriptionEnd}");
});
}
@@ -312,7 +324,6 @@ namespace v2rayN.Handler
_updateFunc(false, args.GetException().Message);
};
askToDownload(downloadHandle, url, false);
}
public void RunAvailabilityCheck(Action<bool, string> update)
@@ -359,7 +370,6 @@ namespace v2rayN.Handler
{
try
{
var coreInfo = LazyConfig.Instance.GetCoreInfo(type);
string filePath = string.Empty;
foreach (string name in coreInfo.coreExes)
@@ -400,10 +410,15 @@ namespace v2rayN.Handler
case ECoreType.v2fly_v5:
version = Regex.Match(echo, $"{coreInfo.match} ([0-9.]+) \\(").Groups[1].Value;
break;
case ECoreType.clash:
case ECoreType.clash_meta:
version = Regex.Match(echo, $"v[0-9.]+").Groups[0].Value;
break;
case ECoreType.sing_box:
version = Regex.Match(echo, $"([0-9.]+)").Groups[1].Value;
break;
}
return version;
}
@@ -414,6 +429,7 @@ namespace v2rayN.Handler
return "";
}
}
private void responseHandler(ECoreType type, string gitHubReleaseApi, bool preRelease)
{
try
@@ -442,7 +458,22 @@ namespace v2rayN.Handler
{
curVersion = "v" + getCoreVersion(type);
message = string.Format(ResUI.IsLatestCore, curVersion);
string osBit = Environment.Is64BitProcess ? "64" : "32";
string osBit = "64";
switch (RuntimeInformation.ProcessArchitecture)
{
case Architecture.Arm64:
osBit = "arm64-v8a";
break;
case Architecture.X86:
osBit = "32";
break;
default:
osBit = "64";
break;
}
url = string.Format(coreInfo.coreDownloadUrl64, version, osBit);
break;
}
@@ -451,21 +482,62 @@ namespace v2rayN.Handler
{
curVersion = getCoreVersion(type);
message = string.Format(ResUI.IsLatestCore, curVersion);
if (Environment.Is64BitProcess)
switch (RuntimeInformation.ProcessArchitecture)
{
url = string.Format(coreInfo.coreDownloadUrl64, version);
case Architecture.Arm64:
url = coreInfo.coreDownloadUrlArm64;
break;
case Architecture.X86:
url = coreInfo.coreDownloadUrl32;
break;
default:
url = coreInfo.coreDownloadUrl64;
break;
}
else
url = string.Format(url, version);
break;
}
case ECoreType.sing_box:
{
curVersion = "v" + getCoreVersion(type);
message = string.Format(ResUI.IsLatestCore, curVersion);
switch (RuntimeInformation.ProcessArchitecture)
{
url = string.Format(coreInfo.coreDownloadUrl32, version);
case Architecture.Arm64:
url = coreInfo.coreDownloadUrlArm64;
break;
case Architecture.X86:
url = coreInfo.coreDownloadUrl32;
break;
default:
url = coreInfo.coreDownloadUrl64;
break;
}
url = string.Format(url, version, version.Replace("v", ""));
break;
}
case ECoreType.v2rayN:
{
curVersion = FileVersionInfo.GetVersionInfo(Utils.GetExePath()).FileVersion.ToString();
message = string.Format(ResUI.IsLatestN, curVersion);
url = string.Format(coreInfo.coreDownloadUrl64, version);
switch (RuntimeInformation.ProcessArchitecture)
{
case Architecture.Arm64:
url = string.Format(coreInfo.coreDownloadUrlArm64, version);
break;
case Architecture.X86:
url = string.Format(coreInfo.coreDownloadUrl32, version);
break;
default:
url = string.Format(coreInfo.coreDownloadUrl64, version);
break;
}
break;
}
default:
@@ -517,6 +589,7 @@ namespace v2rayN.Handler
downloadHandle.DownloadFileAsync(url, true, 600);
}
}
#endregion
#endregion private
}
}
}

View File

@@ -6,9 +6,10 @@
{
get; set;
}
public string Text
{
get; set;
}
}
}
}

View File

@@ -12,6 +12,7 @@
public string subIndexId { get; set; }
public string remoteDNS { get; set; }
/// <summary>
/// Outbound Freedom domainStrategy
/// </summary>
@@ -21,7 +22,7 @@
public string systemProxyExceptions { get; set; }
public string systemProxyAdvancedProtocol { get; set; }
#endregion
#endregion property
#region other entities
@@ -38,7 +39,6 @@
public List<KeyEventItem> globalHotkeys { get; set; }
public List<CoreTypeItem> coreTypeItem { get; set; }
#endregion
#endregion other entities
}
}
}

View File

@@ -1,4 +1,5 @@
using System.Windows.Input;
namespace v2rayN.Mode
{
[Serializable]
@@ -51,7 +52,6 @@ namespace v2rayN.Mode
public string user { get; set; }
public string pass { get; set; }
}
[Serializable]
@@ -96,8 +96,6 @@ namespace v2rayN.Mode
public int autoUpdateInterval { get; set; } = 10;
public int autoUpdateSubInterval { get; set; } = 10;
public bool checkPreReleaseUpdate { get; set; } = false;
public bool enableSecurityProtocolTls13 { get; set; }
@@ -126,14 +124,15 @@ namespace v2rayN.Mode
public bool doubleClick2Activate { get; set; }
public bool autoHideStartup { get; set; } = true;
public string mainMsgFilter { get; set; }
public bool showTrayTip { get; set; }
public List<ColumnItem> mainColumnItem { get; set; }
}
[Serializable]
public class ConstItem
{
public string defIEProxyExceptions { get; set; }
public string subConvertUrl { get; set; } = string.Empty;
}
[Serializable]
@@ -148,7 +147,6 @@ namespace v2rayN.Mode
public bool Shift { get; set; }
public Key? KeyCode { get; set; }
}
[Serializable]
@@ -176,7 +174,6 @@ namespace v2rayN.Mode
public List<string> proxyIP { get; set; }
public List<string> proxyProcess { get; set; }
public string proxyDNS { get; set; }
}
[Serializable]
@@ -185,7 +182,6 @@ namespace v2rayN.Mode
public int speedTestTimeout { get; set; }
public string speedTestUrl { get; set; }
public string speedPingTestUrl { get; set; }
}
[Serializable]
@@ -195,6 +191,7 @@ namespace v2rayN.Mode
/// 域名解析策略
/// </summary>
public string domainStrategy { get; set; }
public string domainMatcher { get; set; }
public string routingIndexId { get; set; }
public bool enableRoutingAdvanced { get; set; }
@@ -207,4 +204,4 @@ namespace v2rayN.Mode
public int Width { get; set; }
public int Index { get; set; }
}
}
}

View File

@@ -35,7 +35,7 @@
}
/// <summary>
///
///
/// </summary>
public ESysProxyType sysProxyType
{
@@ -97,14 +97,17 @@
{
get; set;
}
public string domainMatcher
{
get; set;
}
public int routingIndex
{
get; set;
}
public bool enableRoutingAdvanced
{
get; set;
@@ -122,6 +125,7 @@
{
get; set;
}
public string systemProxyAdvancedProtocol { get; set; }
public int autoUpdateInterval { get; set; } = 0;
@@ -137,7 +141,7 @@
public int trayMenuServersLimit { get; set; }
#endregion
#endregion property
#region other entities
@@ -172,6 +176,7 @@
{
get; set;
}
/// <summary>
/// UI
/// </summary>
@@ -179,6 +184,7 @@
{
get; set;
}
public List<RoutingItemOld> routings
{
get; set;
@@ -194,14 +200,12 @@
get; set;
}
public List<CoreTypeItem> coreTypeItem
{
get; set;
}
#endregion
#endregion other entities
}
[Serializable]
@@ -231,7 +235,6 @@
groupId = string.Empty;
}
public string indexId
{
get; set;
@@ -265,6 +268,7 @@
{
get; set;
}
/// <summary>
/// 远程服务器端口
/// </summary>
@@ -272,6 +276,7 @@
{
get; set;
}
/// <summary>
/// 远程服务器ID
/// </summary>
@@ -279,6 +284,7 @@
{
get; set;
}
/// <summary>
/// 远程服务器额外ID
/// </summary>
@@ -286,6 +292,7 @@
{
get; set;
}
/// <summary>
/// 本地安全策略
/// </summary>
@@ -293,6 +300,7 @@
{
get; set;
}
/// <summary>
/// tcp,kcp,ws,h2,quic
/// </summary>
@@ -300,8 +308,9 @@
{
get; set;
}
/// <summary>
///
///
/// </summary>
public string remarks
{
@@ -349,7 +358,7 @@
}
/// <summary>
///
///
/// </summary>
public string testResult
{
@@ -371,6 +380,7 @@
{
get; set;
}
/// <summary>
/// tls sni
/// </summary>
@@ -404,23 +414,27 @@
{
get; set;
}
public string url
{
get; set;
}
public List<RulesItem> rules
{
get; set;
}
public bool enabled { get; set; } = true;
public bool locked
{
get; set;
}
public string customIcon
{
get; set;
}
}
}
}

View File

@@ -17,10 +17,11 @@
public string coreDownloadUrl64 { get; set; }
public string coreDownloadUrlArm64 { get; set; }
public string match { get; set; }
public string versionArg { get; set; }
public bool redirectInfo { get; set; }
}
}
}

View File

@@ -1,5 +1,4 @@

namespace v2rayN.Mode
namespace v2rayN.Mode
{
public enum EConfigType
{
@@ -10,4 +9,4 @@ namespace v2rayN.Mode
VLESS = 5,
Trojan = 6
}
}
}

View File

@@ -1,5 +1,4 @@

namespace v2rayN.Mode
namespace v2rayN.Mode
{
public enum ECoreType
{
@@ -15,4 +14,4 @@ namespace v2rayN.Mode
sing_box = 24,
v2rayN = 99
}
}
}

View File

@@ -1,5 +1,4 @@

namespace v2rayN.Mode
namespace v2rayN.Mode
{
public enum EGlobalHotkey
{
@@ -9,4 +8,4 @@ namespace v2rayN.Mode
SystemProxyUnchanged = 3,
SystemProxyPac = 4,
}
}
}

View File

@@ -1,5 +1,4 @@

namespace v2rayN.Mode
namespace v2rayN.Mode
{
public enum EMove
{
@@ -9,4 +8,4 @@ namespace v2rayN.Mode
Bottom = 4,
Position = 5
}
}
}

View File

@@ -1,5 +1,4 @@

namespace v2rayN.Mode
namespace v2rayN.Mode
{
public enum EServerColName
{

View File

@@ -1,5 +1,4 @@

namespace v2rayN.Mode
namespace v2rayN.Mode
{
public enum ESpeedActionType
{
@@ -9,4 +8,4 @@ namespace v2rayN.Mode
Speedtest,
Mixedtest
}
}
}

View File

@@ -1,5 +1,4 @@

namespace v2rayN.Mode
namespace v2rayN.Mode
{
public enum ESysProxyType
{
@@ -8,4 +7,4 @@ namespace v2rayN.Mode
Unchanged = 2,
Pac = 3
}
}
}

View File

@@ -4,6 +4,5 @@
{
AdjustMainLvColWidth,
ProfilesFocus
}
}
}

View File

@@ -7,8 +7,9 @@ namespace v2rayN.Mode
{
[PrimaryKey]
public string indexId { get; set; }
public int delay { get; set; }
public decimal speed { get; set; }
public int sort { get; set; }
}
}
}

View File

@@ -28,6 +28,7 @@ namespace v2rayN.Mode
}
#region function
public string GetSummary()
{
string summary = string.Format("[{0}] ", (configType).ToString());
@@ -54,6 +55,7 @@ namespace v2rayN.Mode
case EConfigType.Trojan:
summary += string.Format("{0}({1}:{2})", remarks, addr, port);
break;
default:
summary += string.Format("{0}", remarks);
break;
@@ -82,7 +84,7 @@ namespace v2rayN.Mode
return network.TrimEx();
}
#endregion
#endregion function
[PrimaryKey]
public string indexId { get; set; }
@@ -91,6 +93,7 @@ namespace v2rayN.Mode
/// config type(1=normal,2=custom)
/// </summary>
public EConfigType configType { get; set; }
/// <summary>
/// 版本(现在=2)
/// </summary>
@@ -100,28 +103,34 @@ namespace v2rayN.Mode
/// 远程服务器地址
/// </summary>
public string address { get; set; }
/// <summary>
/// 远程服务器端口
/// </summary>
public int port { get; set; }
/// <summary>
/// 远程服务器ID
/// </summary>
public string id { get; set; }
/// <summary>
/// 远程服务器额外ID
/// </summary>
public int alterId { get; set; }
/// <summary>
/// 本地安全策略
/// </summary>
public string security { get; set; }
/// <summary>
/// tcp,kcp,ws,h2,quic
/// </summary>
public string network { get; set; }
/// <summary>
///
///
/// </summary>
public string remarks { get; set; }
@@ -154,22 +163,24 @@ namespace v2rayN.Mode
/// SubItem id
/// </summary>
public string subid { get; set; }
public bool isSub { get; set; } = true;
/// <summary>
/// VLESS flow
/// </summary>
public string flow { get; set; }
/// <summary>
/// tls sni
/// </summary>
public string sni { get; set; }
/// <summary>
/// tls alpn
/// </summary>
public string alpn { get; set; } = string.Empty;
public ECoreType? coreType { get; set; }
public int preSocksPort { get; set; }
@@ -181,4 +192,4 @@ namespace v2rayN.Mode
public string shortId { get; set; }
public string spiderX { get; set; }
}
}
}

View File

@@ -14,6 +14,5 @@
public string todayDown { get; set; }
public string totalUp { get; set; }
public string totalDown { get; set; }
}
}
}

View File

@@ -7,6 +7,7 @@ namespace v2rayN.Mode
{
[PrimaryKey]
public string id { get; set; }
public string remarks { get; set; }
public string url { get; set; }
public string ruleSet { get; set; }
@@ -16,6 +17,5 @@ namespace v2rayN.Mode
public string customIcon { get; set; }
public string domainStrategy { get; set; }
public int sort { get; set; }
}
}
}

View File

@@ -4,6 +4,5 @@
public class RoutingItemModel : RoutingItem
{
public bool isActive { get; set; }
}
}
}

View File

@@ -19,7 +19,5 @@
public List<string> protocol { get; set; }
public bool enabled { get; set; } = true;
}
}
}

View File

@@ -10,6 +10,5 @@
public string domains { get; set; }
public string protocols { get; set; }
}
}
}

View File

@@ -1,23 +1,26 @@
namespace v2rayN.Mode
{
[Serializable]
class ServerSpeedItem : ServerStatItem
internal class ServerSpeedItem : ServerStatItem
{
public long proxyUp
{
get; set;
}
public long proxyDown
{
get; set;
}
public long directUp
{
get; set;
}
public long directDown
{
get; set;
}
}
}
}

View File

@@ -10,25 +10,30 @@ namespace v2rayN.Mode
{
get; set;
}
public long totalUp
{
get; set;
}
public long totalDown
{
get; set;
}
public long todayUp
{
get; set;
}
public long todayDown
{
get; set;
}
public long dateNow
{
get; set;
}
}
}
}

View File

@@ -1,7 +1,7 @@
namespace v2rayN.Mode
{
[Serializable]
class ServerTestItem
internal class ServerTestItem
{
public string indexId { get; set; }
public string address { get; set; }
@@ -10,4 +10,4 @@
public bool allowTest { get; set; }
public int delay { get; set; }
}
}
}

View File

@@ -15,5 +15,4 @@
public string password { get; set; }
public string plugin { get; set; }
}
}
}

View File

@@ -20,7 +20,12 @@ namespace v2rayN.Mode
public int sort { get; set; }
public string filter { get; set; }
public string? filter { get; set; }
public int autoUpdateInterval { get; set; }
public long updateTime { get; set; }
public string? convertTarget { get; set; }
}
}
}

View File

@@ -1,7 +1,6 @@

namespace v2rayN.Mode
namespace v2rayN.Mode
{
class SysproxyConfig
internal class SysproxyConfig
{
public bool UserSettingsRecorded;
public string Flags;
@@ -18,4 +17,4 @@ namespace v2rayN.Mode
PacUrl = "";
}
}
}
}

View File

@@ -12,10 +12,12 @@ namespace v2rayN.Mode
/// 日志配置
/// </summary>
public Log log { get; set; }
/// <summary>
/// 传入连接配置
/// </summary>
public List<Inbounds> inbounds { get; set; }
/// <summary>
/// 传出连接配置
/// </summary>
@@ -36,13 +38,15 @@ namespace v2rayN.Mode
/// DNS 配置
/// </summary>
public object dns { get; set; }
/// <summary>
/// 路由配置
/// </summary>
public Routing routing { get; set; }
}
public class Stats { };
public class Stats
{ };
public class API
{
@@ -64,15 +68,17 @@ namespace v2rayN.Mode
public class Log
{
/// <summary>
///
///
/// </summary>
public string access { get; set; }
/// <summary>
///
///
/// </summary>
public string error { get; set; }
/// <summary>
///
///
/// </summary>
public string loglevel { get; set; }
}
@@ -80,46 +86,52 @@ namespace v2rayN.Mode
public class Inbounds
{
public string tag { get; set; }
/// <summary>
///
///
/// </summary>
public int port { get; set; }
/// <summary>
///
///
/// </summary>
public string listen { get; set; }
/// <summary>
///
///
/// </summary>
public string protocol { get; set; }
/// <summary>
///
///
/// </summary>
public Sniffing sniffing { get; set; }
/// <summary>
///
///
/// </summary>
public Inboundsettings settings { get; set; }
/// <summary>
///
///
/// </summary>
public StreamSettings streamSettings { get; set; }
}
public class Inboundsettings
{
/// <summary>
///
///
/// </summary>
public string auth { get; set; }
/// <summary>
///
///
/// </summary>
public bool udp { get; set; }
/// <summary>
///
///
/// </summary>
public string ip { get; set; }
@@ -129,11 +141,10 @@ namespace v2rayN.Mode
public string address { get; set; }
/// <summary>
///
///
/// </summary>
public List<UsersItem> clients { get; set; }
/// <summary>
/// VLESS
/// </summary>
@@ -147,19 +158,22 @@ namespace v2rayN.Mode
public class UsersItem
{
/// <summary>
///
///
/// </summary>
public string id { get; set; }
/// <summary>
///
///
/// </summary>
public int alterId { get; set; }
/// <summary>
///
///
/// </summary>
public string email { get; set; }
/// <summary>
///
///
/// </summary>
public string security { get; set; }
@@ -173,6 +187,7 @@ namespace v2rayN.Mode
/// </summary>
public string flow { get; set; }
}
public class Sniffing
{
public bool enabled { get; set; }
@@ -186,20 +201,24 @@ namespace v2rayN.Mode
/// 默认值agentout
/// </summary>
public string tag { get; set; }
/// <summary>
///
///
/// </summary>
public string protocol { get; set; }
/// <summary>
///
///
/// </summary>
public Outboundsettings settings { get; set; }
/// <summary>
///
///
/// </summary>
public StreamSettings streamSettings { get; set; }
/// <summary>
///
///
/// </summary>
public Mux mux { get; set; }
}
@@ -207,26 +226,27 @@ namespace v2rayN.Mode
public class Outboundsettings
{
/// <summary>
///
///
/// </summary>
public List<VnextItem> vnext { get; set; }
/// <summary>
///
///
/// </summary>
public List<ServersItem> servers { get; set; }
/// <summary>
///
///
/// </summary>
public Response response { get; set; }
/// <summary>
///
///
/// </summary>
public string domainStrategy { get; set; }
/// <summary>
///
///
/// </summary>
public int? userLevel { get; set; }
}
@@ -234,46 +254,55 @@ namespace v2rayN.Mode
public class VnextItem
{
/// <summary>
///
///
/// </summary>
public string address { get; set; }
/// <summary>
///
///
/// </summary>
public int port { get; set; }
/// <summary>
///
///
/// </summary>
public List<UsersItem> users { get; set; }
}
public class ServersItem
{
/// <summary>
///
///
/// </summary>
public string email { get; set; }
/// <summary>
///
///
/// </summary>
public string address { get; set; }
/// <summary>
///
///
/// </summary>
public string method { get; set; }
/// <summary>
///
///
/// </summary>
public bool ota { get; set; }
/// <summary>
///
///
/// </summary>
public string password { get; set; }
/// <summary>
///
///
/// </summary>
public int port { get; set; }
/// <summary>
///
///
/// </summary>
public int level { get; set; }
@@ -283,7 +312,7 @@ namespace v2rayN.Mode
public string flow { get; set; }
/// <summary>
///
///
/// </summary>
public List<SocksUsersItem> users { get; set; }
}
@@ -291,29 +320,30 @@ namespace v2rayN.Mode
public class SocksUsersItem
{
/// <summary>
///
///
/// </summary>
public string user { get; set; }
/// <summary>
///
///
/// </summary>
public string pass { get; set; }
/// <summary>
///
///
/// </summary>
public int level { get; set; }
}
public class Mux
{
/// <summary>
///
///
/// </summary>
public bool enabled { get; set; }
/// <summary>
///
///
/// </summary>
public int concurrency { get; set; }
}
@@ -321,7 +351,7 @@ namespace v2rayN.Mode
public class Response
{
/// <summary>
///
///
/// </summary>
public string type { get; set; }
}
@@ -329,7 +359,7 @@ namespace v2rayN.Mode
public class Dns
{
/// <summary>
///
///
/// </summary>
public List<string> servers { get; set; }
}
@@ -337,15 +367,17 @@ namespace v2rayN.Mode
public class Routing
{
/// <summary>
///
///
/// </summary>
public string domainStrategy { get; set; }
/// <summary>
///
///
/// </summary>
public string domainMatcher { get; set; }
/// <summary>
///
///
/// </summary>
public List<RulesItem> rules { get; set; }
}
@@ -353,16 +385,17 @@ namespace v2rayN.Mode
public class StreamSettings
{
/// <summary>
///
///
/// </summary>
public string network { get; set; }
/// <summary>
///
///
/// </summary>
public string security { get; set; }
/// <summary>
///
///
/// </summary>
public TlsSettings tlsSettings { get; set; }
@@ -370,14 +403,17 @@ namespace v2rayN.Mode
/// Tcp传输额外设置
/// </summary>
public TcpSettings tcpSettings { get; set; }
/// <summary>
/// Kcp传输额外设置
/// </summary>
public KcpSettings kcpSettings { get; set; }
/// <summary>
/// ws传输额外设置
/// </summary>
public WsSettings wsSettings { get; set; }
/// <summary>
/// h2传输额外设置
/// </summary>
@@ -392,11 +428,11 @@ namespace v2rayN.Mode
/// VLESS only
/// </summary>
public TlsSettings realitySettings { get; set; }
/// <summary>
/// grpc
/// </summary>
public GrpcSettings grpcSettings { get; set; }
}
public class TlsSettings
@@ -407,11 +443,12 @@ namespace v2rayN.Mode
public bool? allowInsecure { get; set; }
/// <summary>
///
///
/// </summary>
public string? serverName { get; set; }
/// <summary>
///
///
/// </summary>
public List<string>? alpn { get; set; }
@@ -421,7 +458,6 @@ namespace v2rayN.Mode
public string? publicKey { get; set; }
public string? shortId { get; set; }
public string? spiderX { get; set; }
}
public class TcpSettings
@@ -438,10 +474,12 @@ namespace v2rayN.Mode
/// 伪装
/// </summary>
public string type { get; set; }
/// <summary>
/// 结构复杂,直接存起来
/// </summary>
public object request { get; set; }
/// <summary>
/// 结构复杂,直接存起来
/// </summary>
@@ -451,39 +489,47 @@ namespace v2rayN.Mode
public class KcpSettings
{
/// <summary>
///
///
/// </summary>
public int mtu { get; set; }
/// <summary>
///
///
/// </summary>
public int tti { get; set; }
/// <summary>
///
///
/// </summary>
public int uplinkCapacity { get; set; }
/// <summary>
///
///
/// </summary>
public int downlinkCapacity { get; set; }
/// <summary>
///
///
/// </summary>
public bool congestion { get; set; }
/// <summary>
///
///
/// </summary>
public int readBufferSize { get; set; }
/// <summary>
///
///
/// </summary>
public int writeBufferSize { get; set; }
/// <summary>
///
///
/// </summary>
public Header header { get; set; }
/// <summary>
///
///
/// </summary>
public string seed { get; set; }
}
@@ -491,19 +537,20 @@ namespace v2rayN.Mode
public class WsSettings
{
/// <summary>
///
///
/// </summary>
public string path { get; set; }
/// <summary>
///
///
/// </summary>
public Headers headers { get; set; }
}
public class Headers
{
/// <summary>
///
///
/// </summary>
public string Host { get; set; }
@@ -517,30 +564,30 @@ namespace v2rayN.Mode
public class HttpSettings
{
/// <summary>
///
///
/// </summary>
public string path { get; set; }
/// <summary>
///
///
/// </summary>
public List<string> host { get; set; }
}
public class QuicSettings
{
/// <summary>
///
///
/// </summary>
public string security { get; set; }
/// <summary>
///
///
/// </summary>
public string key { get; set; }
/// <summary>
///
///
/// </summary>
public Header header { get; set; }
}
@@ -558,12 +605,13 @@ namespace v2rayN.Mode
public class AccountsItem
{
/// <summary>
///
///
/// </summary>
public string user { get; set; }
/// <summary>
///
///
/// </summary>
public string pass { get; set; }
}
}
}

View File

@@ -6,7 +6,7 @@
public class V2rayTcpRequest
{
/// <summary>
///
///
/// </summary>
public RequestHeaders headers { get; set; }
}
@@ -14,10 +14,8 @@
public class RequestHeaders
{
/// <summary>
///
///
/// </summary>
public List<string> Host { get; set; }
}
}
}

View File

@@ -4,69 +4,81 @@
/// https://github.com/2dust/v2rayN/wiki/
/// </summary>
[Serializable]
class VmessQRCode
internal class VmessQRCode
{
/// <summary>
///
///
/// </summary>
public string v { get; set; } = string.Empty;
/// <summary>
///
///
/// </summary>
public string ps { get; set; } = string.Empty;
/// <summary>
///
///
/// </summary>
public string add { get; set; } = string.Empty;
/// <summary>
///
///
/// </summary>
public string port { get; set; } = string.Empty;
/// <summary>
///
///
/// </summary>
public string id { get; set; } = string.Empty;
/// <summary>
///
///
/// </summary>
public string aid { get; set; } = string.Empty;
/// <summary>
///
///
/// </summary>
public string scy { get; set; } = string.Empty;
/// <summary>
///
///
/// </summary>
public string net { get; set; } = string.Empty;
/// <summary>
///
///
/// </summary>
public string type { get; set; } = string.Empty;
/// <summary>
///
///
/// </summary>
public string host { get; set; } = string.Empty;
/// <summary>
///
///
/// </summary>
public string path { get; set; } = string.Empty;
/// <summary>
/// TLS
/// </summary>
public string tls { get; set; } = string.Empty;
/// <summary>
/// TLS SNI
/// </summary>
public string sni { get; set; } = string.Empty;
/// <summary>
/// TLS alpn
/// </summary>
public string alpn { get; set; } = string.Empty;
/// <summary>
/// TLS fingerprint
/// </summary>
public string fp { get; set; } = string.Empty;
}
}
}

View File

@@ -366,6 +366,33 @@ namespace v2rayN.Resx {
}
}
/// <summary>
/// 查找类似 Automatic update interval(minutes) 的本地化字符串。
/// </summary>
public static string LvAutoUpdateInterval {
get {
return ResourceManager.GetString("LvAutoUpdateInterval", resourceCulture);
}
}
/// <summary>
/// 查找类似 Convert target type 的本地化字符串。
/// </summary>
public static string LvConvertTarget {
get {
return ResourceManager.GetString("LvConvertTarget", resourceCulture);
}
}
/// <summary>
/// 查找类似 Please leave blank if no conversion is required 的本地化字符串。
/// </summary>
public static string LvConvertTargetTip {
get {
return ResourceManager.GetString("LvConvertTargetTip", resourceCulture);
}
}
/// <summary>
/// 查找类似 Count 的本地化字符串。
/// </summary>
@@ -412,7 +439,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 More urls, separated by commas 的本地化字符串。
/// 查找类似 More urls, separated by commas;Subscription conversion will be invalid 的本地化字符串。
/// </summary>
public static string LvMoreUrl {
get {
@@ -1033,7 +1060,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Rule Setting 的本地化字符串。
/// 查找类似 Rule Settings 的本地化字符串。
/// </summary>
public static string menuRoutingRuleSetting {
get {
@@ -1114,7 +1141,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Setting 的本地化字符串。
/// 查找类似 Settings 的本地化字符串。
/// </summary>
public static string menuSetting {
get {
@@ -1204,7 +1231,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Subscription group Setting 的本地化字符串。
/// 查找类似 Subscription group Settings 的本地化字符串。
/// </summary>
public static string menuSubSetting {
get {
@@ -1402,7 +1429,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 Servers Filter 的本地化字符串。
/// 查找类似 Servers Filter, press Enter to execute 的本地化字符串。
/// </summary>
public static string MsgServerTitle {
get {
@@ -1979,7 +2006,7 @@ namespace v2rayN.Resx {
}
/// <summary>
/// 查找类似 GlobalHotkey Setting 的本地化字符串。
/// 查找类似 GlobalHotkey Settings 的本地化字符串。
/// </summary>
public static string TbGlobalHotkeySetting {
get {
@@ -2257,15 +2284,6 @@ namespace v2rayN.Resx {
}
}
/// <summary>
/// 查找类似 Automatic update interval of subscriptions (hours) 的本地化字符串。
/// </summary>
public static string TbSettingsAutoUpdate {
get {
return ResourceManager.GetString("TbSettingsAutoUpdate", resourceCulture);
}
}
/// <summary>
/// 查找类似 Automatic update interval of and Geo (hours) 的本地化字符串。
/// </summary>
@@ -2509,6 +2527,15 @@ namespace v2rayN.Resx {
}
}
/// <summary>
/// 查找类似 Enable logging to file 的本地化字符串。
/// </summary>
public static string TbSettingsLogEnabledToFile {
get {
return ResourceManager.GetString("TbSettingsLogEnabledToFile", resourceCulture);
}
}
/// <summary>
/// 查找类似 Log Level 的本地化字符串。
/// </summary>

View File

@@ -724,9 +724,6 @@
<data name="TbSettingsAutoHideStartup" xml:space="preserve">
<value>Auto hide startup</value>
</data>
<data name="TbSettingsAutoUpdate" xml:space="preserve">
<value>فاصله به روز رسانی خودکار اشتراک ها (ساعت)</value>
</data>
<data name="TbSettingsAutoUpdateInterval" xml:space="preserve">
<value>فاصله به روز رسانی خودکار و Geo (ساعت)</value>
</data>

View File

@@ -434,7 +434,7 @@
<value>Local</value>
</data>
<data name="MsgServerTitle" xml:space="preserve">
<value>Servers Filter</value>
<value>Servers Filter, press Enter to execute</value>
</data>
<data name="menuCheckUpdate" xml:space="preserve">
<value>Check Update</value>
@@ -467,7 +467,7 @@
<value>Servers</value>
</data>
<data name="menuSetting" xml:space="preserve">
<value>Setting</value>
<value>Settings</value>
</data>
<data name="menuSubGroupUpdate" xml:space="preserve">
<value>Update current subscription without proxy</value>
@@ -479,7 +479,7 @@
<value>Subscription group</value>
</data>
<data name="menuSubSetting" xml:space="preserve">
<value>Subscription group Setting</value>
<value>Subscription group Settings</value>
</data>
<data name="menuSubUpdate" xml:space="preserve">
<value>Update subscription without proxy</value>
@@ -724,9 +724,6 @@
<data name="TbSettingsAutoHideStartup" xml:space="preserve">
<value>Auto hide startup</value>
</data>
<data name="TbSettingsAutoUpdate" xml:space="preserve">
<value>Automatic update interval of subscriptions (hours)</value>
</data>
<data name="TbSettingsAutoUpdateInterval" xml:space="preserve">
<value>Automatic update interval of and Geo (hours)</value>
</data>
@@ -830,7 +827,7 @@
<value>Display GUI</value>
</data>
<data name="TbGlobalHotkeySetting" xml:space="preserve">
<value>GlobalHotkey Setting</value>
<value>GlobalHotkey Settings</value>
</data>
<data name="TbGlobalHotkeySettingTip" xml:space="preserve">
<value>Set directly by pressing the keyboard, Take effect after restart</value>
@@ -932,7 +929,7 @@
<value>Import Rules From Sub Url</value>
</data>
<data name="menuRoutingRuleSetting" xml:space="preserve">
<value>Rule Setting</value>
<value>Rule Settings</value>
</data>
<data name="menuRuleAdd" xml:space="preserve">
<value>Rule Add</value>
@@ -1106,9 +1103,21 @@
<value>Reboot as administrator</value>
</data>
<data name="LvMoreUrl" xml:space="preserve">
<value>More urls, separated by commas</value>
<value>More urls, separated by commas;Subscription conversion will be invalid</value>
</data>
<data name="SpeedDisplayText" xml:space="preserve">
<value>{0}:{1}/s↑ | {2}/s↓</value>
</data>
<data name="LvAutoUpdateInterval" xml:space="preserve">
<value>Automatic update interval(minutes)</value>
</data>
<data name="TbSettingsLogEnabledToFile" xml:space="preserve">
<value>Enable logging to file</value>
</data>
<data name="LvConvertTarget" xml:space="preserve">
<value>Convert target type</value>
</data>
<data name="LvConvertTargetTip" xml:space="preserve">
<value>Please leave blank if no conversion is required</value>
</data>
</root>

View File

@@ -724,9 +724,6 @@
<data name="TbSettingsAutoHideStartup" xml:space="preserve">
<value>Auto hide startup</value>
</data>
<data name="TbSettingsAutoUpdate" xml:space="preserve">
<value>Интервал автоматического обновления подписок в часах</value>
</data>
<data name="TbSettingsAutoUpdateInterval" xml:space="preserve">
<value>Интервал автоматического обновления Geo в часах</value>
</data>

View File

@@ -434,7 +434,7 @@
<value>本地</value>
</data>
<data name="MsgServerTitle" xml:space="preserve">
<value>服务器过滤器</value>
<value>服务器过滤器,按回车执行</value>
</data>
<data name="menuCheckUpdate" xml:space="preserve">
<value>检查更新</value>
@@ -724,9 +724,6 @@
<data name="TbSettingsAutoHideStartup" xml:space="preserve">
<value>启动后隐藏窗口</value>
</data>
<data name="TbSettingsAutoUpdate" xml:space="preserve">
<value>自动更新订阅的间隔(单位小时)</value>
</data>
<data name="TbSettingsAutoUpdateInterval" xml:space="preserve">
<value>自动更新Geo文件的间隔(单位小时)</value>
</data>
@@ -770,7 +767,7 @@
<value>去重时保留序号较小的项</value>
</data>
<data name="TbSettingsLogEnabled" xml:space="preserve">
<value>启用日志(默认关闭)</value>
<value>启用日志</value>
</data>
<data name="TbSettingsLogLevel" xml:space="preserve">
<value>日志等级</value>
@@ -1106,6 +1103,18 @@
<value>以管理员身份重启</value>
</data>
<data name="LvMoreUrl" xml:space="preserve">
<value>更多地址(url),用逗号(,)分隔</value>
<value>更多地址(url),用逗号(,)分隔;订阅转换将失效</value>
</data>
<data name="LvAutoUpdateInterval" xml:space="preserve">
<value>自动更新间隔(分钟)</value>
</data>
<data name="TbSettingsLogEnabledToFile" xml:space="preserve">
<value>启用日志存到文件</value>
</data>
<data name="LvConvertTarget" xml:space="preserve">
<value>订阅转换目标类型</value>
</data>
<data name="LvConvertTargetTip" xml:space="preserve">
<value>不需要转换时请留空</value>
</data>
</root>

View File

@@ -53,6 +53,7 @@ namespace v2rayN.Tool
throw;
}
}
public static bool ZipExtractToFile(string fileName, string toPath, string ignoredName)
{
try
@@ -86,4 +87,4 @@ namespace v2rayN.Tool
return true;
}
}
}
}

View File

@@ -1,13 +1,13 @@
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace v2rayN
{
/*
* See:
* http://stackoverflow.com/questions/6266820/working-example-of-createjobobject-setinformationjobobject-pinvoke-in-net
*/
public class Job : IDisposable
{
private IntPtr handle = IntPtr.Zero;
@@ -95,7 +95,7 @@ namespace v2rayN
Dispose(false);
}
#endregion
#endregion IDisposable
#region Interop
@@ -112,13 +112,13 @@ namespace v2rayN
[return: MarshalAs(UnmanagedType.Bool)]
private static extern bool CloseHandle(IntPtr hObject);
#endregion
#endregion Interop
}
#region Helper classes
[StructLayout(LayoutKind.Sequential)]
struct IO_COUNTERS
internal struct IO_COUNTERS
{
public UInt64 ReadOperationCount;
public UInt64 WriteOperationCount;
@@ -128,9 +128,8 @@ namespace v2rayN
public UInt64 OtherTransferCount;
}
[StructLayout(LayoutKind.Sequential)]
struct JOBOBJECT_BASIC_LIMIT_INFORMATION
internal struct JOBOBJECT_BASIC_LIMIT_INFORMATION
{
public Int64 PerProcessUserTimeLimit;
public Int64 PerJobUserTimeLimit;
@@ -152,7 +151,7 @@ namespace v2rayN
}
[StructLayout(LayoutKind.Sequential)]
struct JOBOBJECT_EXTENDED_LIMIT_INFORMATION
internal struct JOBOBJECT_EXTENDED_LIMIT_INFORMATION
{
public JOBOBJECT_BASIC_LIMIT_INFORMATION BasicLimitInformation;
public IO_COUNTERS IoInfo;
@@ -173,5 +172,5 @@ namespace v2rayN
GroupInformation = 11
}
#endregion
}
#endregion Helper classes
}

View File

@@ -17,6 +17,7 @@ namespace v2rayN.Tool
config.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, fileTarget));
LogManager.Configuration = config;
}
public static void LoggingEnabled(bool enable)
{
if (!enable)
@@ -51,4 +52,4 @@ namespace v2rayN.Tool
});
}
}
}
}

View File

@@ -9,12 +9,13 @@ namespace v2rayN.Tool
{
return _OrderBy<T>(query, propertyName, false);
}
public static IOrderedQueryable<T> OrderByDescending<T>(this IQueryable<T> query, string propertyName)
{
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";
@@ -25,15 +26,18 @@ namespace v2rayN.Tool
return (IOrderedQueryable<T>)method.Invoke(null, new object[] { query, memberProp });
}
public static IOrderedQueryable<T> OrderByInternal<T, TProp>(IQueryable<T> query, PropertyInfo memberProperty)
{//public
return query.OrderBy(_GetLamba<T, TProp>(memberProperty));
}
public static IOrderedQueryable<T> OrderByDescendingInternal<T, TProp>(IQueryable<T> query, PropertyInfo memberProperty)
{//public
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();
@@ -43,4 +47,4 @@ namespace v2rayN.Tool
return lamba;
}
}
}
}

View File

@@ -2,21 +2,23 @@
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)
{
MessageBox.Show(msg, caption, MessageBoxButton.OK, MessageBoxImage.Information, MessageBoxResult.OK);
}
public static void ShowWarning(string msg)
{
MessageBox.Show(msg, caption, MessageBoxButton.OK, MessageBoxImage.Warning, MessageBoxResult.OK);
}
public static MessageBoxResult ShowYesNo(string msg)
{
return MessageBox.Show(msg, caption, MessageBoxButton.YesNo, MessageBoxImage.Question);
}
}
}
}

View File

@@ -31,9 +31,8 @@ using ZXing.Windows.Compatibility;
namespace v2rayN
{
class Utils
internal class Utils
{
#region Json操作
/// <summary>
@@ -60,7 +59,6 @@ namespace v2rayN
return result;
}
/// <summary>
/// 取得存储资源
/// </summary>
@@ -178,7 +176,8 @@ namespace v2rayN
return null;
}
}
#endregion
#endregion Json操作
#region
@@ -210,6 +209,7 @@ namespace v2rayN
return string.Empty;
}
}
/// <summary>
/// 逗号分隔的字符串,转List<string>
/// </summary>
@@ -318,6 +318,7 @@ namespace v2rayN
return 0;
}
}
public static bool ToBool(object obj)
{
try
@@ -367,23 +368,22 @@ namespace v2rayN
if (GBs > 0)
{
// multi GB
/*ulong TBs = GBs / factor;
long TBs = GBs / factor;
if (TBs > 0)
{
// 你是魔鬼吗? 用这么多流量
result = TBs + GBs % factor / (factor + 0.0);
result = TBs + ((GBs % factor) / (factor + 0.0));
unit = "TB";
return;
}*/
result = GBs + MBs % factor / (factor + 0.0);
}
result = GBs + ((MBs % factor) / (factor + 0.0));
unit = "GB";
return;
}
result = MBs + KBs % factor / (factor + 0.0);
result = MBs + ((KBs % factor) / (factor + 0.0));
unit = "MB";
return;
}
result = KBs + amount % factor / (factor + 0.0);
result = KBs + ((amount % factor) / (factor + 0.0));
unit = "KB";
return;
}
@@ -405,6 +405,7 @@ namespace v2rayN
return Uri.EscapeDataString(url);
//return HttpUtility.UrlEncode(url);
}
public static string UrlDecode(string url)
{
return HttpUtility.UrlDecode(url);
@@ -421,6 +422,7 @@ namespace v2rayN
}
return sb.ToString();
}
public static ImageSource IconToImageSource(Icon icon)
{
return Imaging.CreateBitmapSourceFromHIcon(
@@ -464,8 +466,7 @@ namespace v2rayN
return Convert.TryFromBase64String(plainText, buffer, out int _);
}
#endregion
#endregion
#region
@@ -509,7 +510,7 @@ namespace v2rayN
/// <summary>
/// 验证IP地址是否合法
/// </summary>
/// <param name="ip"></param>
/// <param name="ip"></param>
public static bool IsIP(string ip)
{
//如果为空
@@ -534,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?)$";
@@ -545,7 +545,7 @@ namespace v2rayN
/// <summary>
/// 验证Domain地址是否合法
/// </summary>
/// <param name="domain"></param>
/// <param name="domain"></param>
public static bool IsDomain(string domain)
{
//如果为空
@@ -568,7 +568,7 @@ namespace v2rayN
/// 验证输入字符串是否与模式字符串匹配匹配返回true
/// </summary>
/// <param name="input">输入字符串</param>
/// <param name="pattern">模式字符串</param>
/// <param name="pattern">模式字符串</param>
public static bool IsMatch(string input, string pattern)
{
return Regex.IsMatch(input, pattern, RegexOptions.IgnoreCase);
@@ -588,11 +588,10 @@ namespace v2rayN
return false;
}
#endregion
#endregion
#region
/// <summary>
/// 开机自动启动
/// </summary>
@@ -798,7 +797,7 @@ namespace v2rayN
taskService.RootFolder.RegisterTaskDefinition(TaskName, task);
}
#endregion
#endregion
#region
@@ -863,7 +862,8 @@ namespace v2rayN
}
return inUse;
}
#endregion
#endregion
#region
@@ -996,7 +996,6 @@ namespace v2rayN
}
}
public static string GetDownloadFileName(string url)
{
var fileName = Path.GetFileName(url);
@@ -1023,6 +1022,7 @@ namespace v2rayN
{
return Guid.TryParse(strSrc, out Guid g);
}
public static void ProcessStart(string fileName)
{
try
@@ -1044,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, ref attribute, attributeSize);
}
#endregion
#endregion
#region TempPath
@@ -1084,6 +1085,7 @@ namespace v2rayN
}
return Path.Combine(_tempPath, filename);
}
public static string GetConfigPath(string filename = "")
{
string _tempPath = Path.Combine(StartupPath(), "guiConfigs");
@@ -1100,6 +1102,7 @@ namespace v2rayN
return Path.Combine(_tempPath, filename);
}
}
public static string GetBinPath(string filename, ECoreType? coreType = null)
{
string _tempPath = Path.Combine(StartupPath(), "bin");
@@ -1124,6 +1127,7 @@ namespace v2rayN
return Path.Combine(_tempPath, filename);
}
}
public static string GetLogPath(string filename = "")
{
string _tempPath = Path.Combine(StartupPath(), "guiLogs");
@@ -1140,6 +1144,7 @@ namespace v2rayN
return Path.Combine(_tempPath, filename);
}
}
public static string GetFontsPath(string filename = "")
{
string _tempPath = Path.Combine(StartupPath(), "guiFonts");
@@ -1157,7 +1162,7 @@ namespace v2rayN
}
}
#endregion
#endregion TempPath
#region Log
@@ -1169,6 +1174,7 @@ namespace v2rayN
logger.Info(strContent);
}
}
public static void SaveLog(string strTitle, Exception ex)
{
if (LogManager.IsLoggingEnabled())
@@ -1183,8 +1189,7 @@ namespace v2rayN
}
}
#endregion
#endregion Log
#region scan screen
@@ -1244,12 +1249,10 @@ namespace v2rayN
return new(96 / g.DpiX, 96 / g.DpiY);
}
#endregion
#endregion scan screen
#region Windows API
[Flags]
public enum DWMWINDOWATTRIBUTE : uint
{
@@ -1260,6 +1263,6 @@ namespace v2rayN
[DllImport("dwmapi.dll")]
public static extern int DwmSetWindowAttribute(IntPtr hwnd, DWMWINDOWATTRIBUTE attribute, ref int attributeValue, uint attributeSize);
#endregion
#endregion Windows API
}
}
}

View File

@@ -22,7 +22,6 @@ namespace v2rayN.ViewModels
[Reactive]
public ProfileItem SelectedSource { get; set; }
public ReactiveCommand<Unit, Unit> BrowseServerCmd { get; }
public ReactiveCommand<Unit, Unit> EditServerCmd { get; }
public ReactiveCommand<Unit, Unit> SaveServerCmd { get; }
@@ -158,4 +157,4 @@ namespace v2rayN.ViewModels
}
}
}
}
}

View File

@@ -21,7 +21,6 @@ namespace v2rayN.ViewModels
public ReactiveCommand<Unit, Unit> SaveCmd { get; }
public AddServerViewModel(ProfileItem profileItem, Window view)
{
_config = LazyConfig.Instance.GetConfig();
@@ -130,15 +129,19 @@ namespace v2rayN.ViewModels
case EConfigType.VMess:
ret = ConfigHandler.AddServer(ref _config, item);
break;
case EConfigType.Shadowsocks:
ret = ConfigHandler.AddShadowsocksServer(ref _config, item);
break;
case EConfigType.Socks:
ret = ConfigHandler.AddSocksServer(ref _config, item);
break;
case EConfigType.VLESS:
ret = ConfigHandler.AddVlessServer(ref _config, item);
break;
case EConfigType.Trojan:
ret = ConfigHandler.AddTrojanServer(ref _config, item);
break;
@@ -156,4 +159,4 @@ namespace v2rayN.ViewModels
}
}
}
}
}

View File

@@ -22,7 +22,6 @@ using v2rayN.Resx;
using v2rayN.Tool;
using v2rayN.Views;
namespace v2rayN.ViewModels
{
public class MainWindowViewModel : ReactiveObject
@@ -40,7 +39,7 @@ namespace v2rayN.ViewModels
private Dictionary<string, bool> _dicHeaderSort = new();
private Action<EViewAction> _updateView;
#endregion
#endregion private prop
#region ObservableCollection
@@ -58,25 +57,34 @@ namespace v2rayN.ViewModels
[Reactive]
public ProfileItemModel SelectedProfile { get; set; }
public IList<ProfileItemModel> SelectedProfiles { get; set; }
[Reactive]
public SubItem SelectedSub { get; set; }
[Reactive]
public SubItem SelectedMoveToGroup { get; set; }
[Reactive]
public RoutingItem SelectedRouting { get; set; }
[Reactive]
public ComboItem SelectedServer { get; set; }
[Reactive]
public string ServerFilter { get; set; }
[Reactive]
public bool BlServers { get; set; }
#endregion
#endregion ObservableCollection
#region Menu
//servers
public ReactiveCommand<Unit, Unit> AddVmessServerCmd { get; }
public ReactiveCommand<Unit, Unit> AddVlessServerCmd { get; }
public ReactiveCommand<Unit, Unit> AddShadowsocksServerCmd { get; }
public ReactiveCommand<Unit, Unit> AddSocksServerCmd { get; }
@@ -84,34 +92,42 @@ namespace v2rayN.ViewModels
public ReactiveCommand<Unit, Unit> AddCustomServerCmd { get; }
public ReactiveCommand<Unit, Unit> AddServerViaClipboardCmd { get; }
public ReactiveCommand<Unit, Unit> AddServerViaScanCmd { get; }
//servers delete
public ReactiveCommand<Unit, Unit> EditServerCmd { get; }
public ReactiveCommand<Unit, Unit> RemoveServerCmd { get; }
public ReactiveCommand<Unit, Unit> RemoveDuplicateServerCmd { get; }
public ReactiveCommand<Unit, Unit> CopyServerCmd { get; }
public ReactiveCommand<Unit, Unit> SetDefaultServerCmd { get; }
public ReactiveCommand<Unit, Unit> ShareServerCmd { get; }
//servers move
//servers move
public ReactiveCommand<Unit, Unit> MoveTopCmd { get; }
public ReactiveCommand<Unit, Unit> MoveUpCmd { get; }
public ReactiveCommand<Unit, Unit> MoveDownCmd { get; }
public ReactiveCommand<Unit, Unit> MoveBottomCmd { get; }
//servers ping
//servers ping
public ReactiveCommand<Unit, Unit> MixedTestServerCmd { get; }
public ReactiveCommand<Unit, Unit> PingServerCmd { get; }
public ReactiveCommand<Unit, Unit> TcpingServerCmd { get; }
public ReactiveCommand<Unit, Unit> RealPingServerCmd { get; }
public ReactiveCommand<Unit, Unit> SpeedServerCmd { get; }
public ReactiveCommand<Unit, Unit> SortServerResultCmd { get; }
//servers export
public ReactiveCommand<Unit, Unit> Export2ClientConfigCmd { get; }
public ReactiveCommand<Unit, Unit> Export2ServerConfigCmd { get; }
public ReactiveCommand<Unit, Unit> Export2ShareUrlCmd { get; }
public ReactiveCommand<Unit, Unit> Export2SubContentCmd { get; }
//Subscription
public ReactiveCommand<Unit, Unit> SubSettingCmd { get; }
public ReactiveCommand<Unit, Unit> AddSubCmd { get; }
public ReactiveCommand<Unit, Unit> SubUpdateCmd { get; }
public ReactiveCommand<Unit, Unit> SubUpdateViaProxyCmd { get; }
@@ -120,6 +136,7 @@ namespace v2rayN.ViewModels
//Setting
public ReactiveCommand<Unit, Unit> OptionSettingCmd { get; }
public ReactiveCommand<Unit, Unit> RoutingSettingCmd { get; }
public ReactiveCommand<Unit, Unit> GlobalHotkeySettingCmd { get; }
public ReactiveCommand<Unit, Unit> RebootAsAdminCmd { get; }
@@ -128,35 +145,47 @@ namespace v2rayN.ViewModels
//CheckUpdate
public ReactiveCommand<Unit, Unit> CheckUpdateNCmd { get; }
public ReactiveCommand<Unit, Unit> CheckUpdateV2flyCoreCmd { get; }
public ReactiveCommand<Unit, Unit> CheckUpdateSagerNetCoreCmd { get; }
public ReactiveCommand<Unit, Unit> CheckUpdateXrayCoreCmd { get; }
public ReactiveCommand<Unit, Unit> CheckUpdateClashCoreCmd { get; }
public ReactiveCommand<Unit, Unit> CheckUpdateClashMetaCoreCmd { get; }
public ReactiveCommand<Unit, Unit> CheckUpdateSingBoxCoreCmd { get; }
public ReactiveCommand<Unit, Unit> CheckUpdateGeoCmd { get; }
public ReactiveCommand<Unit, Unit> ReloadCmd { get; }
[Reactive]
public bool BlReloadEnabled { get; set; }
public ReactiveCommand<Unit, Unit> NotifyLeftClickCmd { get; }
[Reactive]
public Icon NotifyIcon { get; set; }
[Reactive]
public ImageSource AppIcon { get; set; }
#endregion
#region System Proxy
[Reactive]
public bool BlShowTrayTip { get; set; }
#endregion Menu
#region System Proxy
[Reactive]
public bool BlSystemProxyClear { get; set; }
[Reactive]
public bool BlSystemProxySet { get; set; }
[Reactive]
public bool BlSystemProxyNothing { get; set; }
[Reactive]
public bool BlSystemProxyPac { get; set; }
public ReactiveCommand<Unit, Unit> SystemProxyClearCmd { get; }
public ReactiveCommand<Unit, Unit> SystemProxySetCmd { get; }
public ReactiveCommand<Unit, Unit> SystemProxyNothingCmd { get; }
@@ -164,41 +193,54 @@ namespace v2rayN.ViewModels
[Reactive]
public bool BlRouting { get; set; }
[Reactive]
public int SystemProxySelected { get; set; }
#endregion
#endregion System Proxy
#region UI
[Reactive]
public string InboundDisplay { get; set; }
[Reactive]
public string InboundLanDisplay { get; set; }
[Reactive]
public string RunningServerDisplay { get; set; }
[Reactive]
public string RunningServerToolTipText { get; set; }
[Reactive]
public string RunningInfoDisplay { get; set; }
[Reactive]
public string SpeedProxyDisplay { get; set; }
[Reactive]
public string SpeedDirectDisplay { get; set; }
[Reactive]
public bool EnableTun { get; set; }
[Reactive]
public bool ColorModeDark { get; set; }
private IObservableCollection<Swatch> _swatches = new ObservableCollectionExtended<Swatch>();
public IObservableCollection<Swatch> Swatches => _swatches;
[Reactive]
public Swatch SelectedSwatch { get; set; }
[Reactive]
public int CurrentFontSize { get; set; }
[Reactive]
public string CurrentLanguage { get; set; }
#endregion
#endregion UI
#region Init
@@ -329,7 +371,7 @@ namespace v2rayN.ViewModels
{
ShareServer();
}, canEditRemove);
//servers move
//servers move
MoveTopCmd = ReactiveCommand.Create(() =>
{
MoveServer(EMove.Top);
@@ -390,7 +432,6 @@ namespace v2rayN.ViewModels
Export2SubContent();
}, canEditRemove);
//Subscription
SubSettingCmd = ReactiveCommand.Create(() =>
{
@@ -472,6 +513,10 @@ namespace v2rayN.ViewModels
{
CheckUpdateCore(ECoreType.clash_meta);
});
CheckUpdateSingBoxCoreCmd = ReactiveCommand.Create(() =>
{
CheckUpdateCore(ECoreType.sing_box);
});
CheckUpdateGeoCmd = ReactiveCommand.Create(() =>
{
CheckUpdateGeo();
@@ -505,7 +550,6 @@ namespace v2rayN.ViewModels
SetListenerType(ESysProxyType.Pac);
});
Global.ShowInTaskbar = true;
}
@@ -526,6 +570,7 @@ namespace v2rayN.ViewModels
Reload();
ChangeSystemProxyStatus(_config.sysProxyType, true);
}
private void OnProgramStarted(object state, bool timeout)
{
Application.Current.Dispatcher.Invoke((Action)(() =>
@@ -534,13 +579,15 @@ namespace v2rayN.ViewModels
}));
}
#endregion
#endregion Init
#region Actions
private void UpdateHandler(bool notify, string msg)
{
_noticeHandler?.SendMessage(msg);
}
private void UpdateTaskHandler(bool success, string msg)
{
_noticeHandler?.SendMessage(msg);
@@ -558,6 +605,7 @@ namespace v2rayN.ViewModels
}
}
}
private void UpdateStatisticsHandler(ServerSpeedItem update)
{
try
@@ -605,6 +653,7 @@ namespace v2rayN.ViewModels
Utils.SaveLog(ex.Message, ex);
}
}
private void UpdateSpeedtestHandler(string indexId, string delay, string speed)
{
Application.Current.Dispatcher.Invoke((Action)(() =>
@@ -612,6 +661,7 @@ namespace v2rayN.ViewModels
SetTestResult(indexId, delay, speed);
}));
}
private void SetTestResult(string indexId, string delay, string speed)
{
if (Utils.IsNullOrEmpty(indexId))
@@ -644,20 +694,25 @@ namespace v2rayN.ViewModels
case EGlobalHotkey.ShowForm:
ShowHideWindow(null);
break;
case EGlobalHotkey.SystemProxyClear:
SetListenerType(ESysProxyType.ForcedClear);
break;
case EGlobalHotkey.SystemProxySet:
SetListenerType(ESysProxyType.ForcedChange);
break;
case EGlobalHotkey.SystemProxyUnchanged:
SetListenerType(ESysProxyType.Unchanged);
break;
case EGlobalHotkey.SystemProxyPac:
SetListenerType(ESysProxyType.Pac);
break;
}
}
public void MyAppExit(bool blWindowsShutDown)
{
try
@@ -693,7 +748,7 @@ namespace v2rayN.ViewModels
}
}
#endregion
#endregion Actions
#region Servers && Groups
@@ -718,10 +773,13 @@ namespace v2rayN.ViewModels
return;
}
_serverFilter = ServerFilter;
RefreshServers();
if (Utils.IsNullOrEmpty(_serverFilter))
{
RefreshServers();
}
}
private void RefreshServers()
public void RefreshServers()
{
List<ProfileItemModel> lstModel = LazyConfig.Instance.ProfileItems(_subId, _serverFilter);
@@ -781,7 +839,7 @@ namespace v2rayN.ViewModels
RefreshServersMenu();
//display running server
//display running server
var running = ConfigHandler.GetDefaultServer(ref _config);
if (running != null)
{
@@ -840,9 +898,10 @@ namespace v2rayN.ViewModels
}
}
#endregion
#endregion Servers && Groups
#region Add Servers
private int GetProfileItems(out List<ProfileItem> lstSelecteds, bool latest)
{
lstSelecteds = new List<ProfileItem>();
@@ -917,8 +976,8 @@ namespace v2rayN.ViewModels
public void AddServerViaClipboard()
{
string clipboardData = Utils.GetClipboardData();
int ret = ConfigHandler.AddBatchServers(ref _config, clipboardData, _subId, false);
var clipboardData = Utils.GetClipboardData();
int ret = ConfigHandler.AddBatchServers(ref _config, clipboardData!, _subId, false);
if (ret > 0)
{
InitSubscriptionView();
@@ -926,6 +985,7 @@ namespace v2rayN.ViewModels
_noticeHandler?.Enqueue(string.Format(ResUI.SuccessfullyImportedServerViaClipboard, ret));
}
}
public async Task ScanScreenTaskAsync()
{
ShowHideWindow(false);
@@ -953,9 +1013,10 @@ namespace v2rayN.ViewModels
}
}
}
public void RemoveServer()
{
if (GetProfileItems(out List<ProfileItem> lstSelecteds, false) < 0)
if (GetProfileItems(out List<ProfileItem> lstSelecteds, true) < 0)
{
return;
}
@@ -983,6 +1044,7 @@ namespace v2rayN.ViewModels
Reload();
_noticeHandler?.Enqueue(string.Format(ResUI.RemoveDuplicateServerResult, tuple.Item1, tuple.Item2));
}
private void CopyServer()
{
if (GetProfileItems(out List<ProfileItem> lstSelecteds, false) < 0)
@@ -1004,6 +1066,7 @@ namespace v2rayN.ViewModels
}
SetDefaultServer(SelectedProfile.indexId);
}
private void SetDefaultServer(string indexId)
{
if (Utils.IsNullOrEmpty(indexId))
@@ -1027,6 +1090,7 @@ namespace v2rayN.ViewModels
Reload();
}
}
private void ServerSelectedChanged(bool c)
{
if (!c)
@@ -1044,7 +1108,6 @@ namespace v2rayN.ViewModels
SetDefaultServer(SelectedServer.ID);
}
public async void ShareServer()
{
var item = LazyConfig.Instance.GetProfileItem(SelectedProfile.indexId);
@@ -1245,7 +1308,7 @@ namespace v2rayN.ViewModels
}
}
#endregion
#endregion Add Servers
#region Subscription
@@ -1257,6 +1320,7 @@ namespace v2rayN.ViewModels
SubSelectedChanged(true);
}
}
private void AddSub()
{
SubItem item = new();
@@ -1273,7 +1337,7 @@ namespace v2rayN.ViewModels
(new UpdateHandle()).UpdateSubscriptionProcess(_config, subId, blProxy, UpdateTaskHandler);
}
#endregion
#endregion Subscription
#region Setting
@@ -1287,6 +1351,7 @@ namespace v2rayN.ViewModels
TunModeSwitch();
}
}
private void RoutingSetting()
{
var ret = (new RoutingSettingWindow()).ShowDialog();
@@ -1349,7 +1414,7 @@ namespace v2rayN.ViewModels
}
}
#endregion
#endregion Setting
#region CheckUpdate
@@ -1362,7 +1427,7 @@ namespace v2rayN.ViewModels
{
MyAppExit(false);
}
};
}
(new UpdateHandle()).CheckUpdateGuiN(_config, _updateUI, _config.guiItem.checkPreReleaseUpdate);
}
@@ -1391,7 +1456,7 @@ namespace v2rayN.ViewModels
File.Delete(fileName);
}
}
};
}
(new UpdateHandle()).CheckUpdateCore(type, _config, _updateUI, _config.guiItem.checkPreReleaseUpdate);
}
@@ -1405,7 +1470,7 @@ namespace v2rayN.ViewModels
});
}
#endregion
#endregion CheckUpdate
#region v2ray job
@@ -1414,8 +1479,7 @@ namespace v2rayN.ViewModels
_ = LoadV2ray();
}
async Task LoadV2ray()
private async Task LoadV2ray()
{
Application.Current.Dispatcher.Invoke((Action)(() =>
{
@@ -1452,7 +1516,7 @@ namespace v2rayN.ViewModels
_coreHandler.CoreStop();
}
#endregion
#endregion v2ray job
#region System proxy and Routings
@@ -1541,7 +1605,7 @@ namespace v2rayN.ViewModels
}
}
void DoSystemProxySelected(bool c)
private void DoSystemProxySelected(bool c)
{
if (!c)
{
@@ -1554,7 +1618,7 @@ namespace v2rayN.ViewModels
SetListenerType((ESysProxyType)SystemProxySelected);
}
void DoEnableTun(bool c)
private void DoEnableTun(bool c)
{
if (_config.tunModeItem.enableTun != EnableTun)
{
@@ -1563,7 +1627,7 @@ namespace v2rayN.ViewModels
TunModeSwitch();
}
void TunModeSwitch()
private void TunModeSwitch()
{
if (EnableTun)
{
@@ -1575,7 +1639,7 @@ namespace v2rayN.ViewModels
}
}
#endregion
#endregion System proxy and Routings
#region UI
@@ -1599,7 +1663,7 @@ namespace v2rayN.ViewModels
//Application.Current.MainWindow.ShowInTaskbar = false;
//IntPtr windowHandle = new WindowInteropHelper(Application.Current.MainWindow).Handle;
//Utils.RegWriteValue(Global.MyRegPath, Utils.WindowHwndKey, Convert.ToString((long)windowHandle));
};
}
Global.ShowInTaskbar = bl;
}
@@ -1618,6 +1682,7 @@ namespace v2rayN.ViewModels
}
}
}
private void StorageUI()
{
}
@@ -1632,6 +1697,7 @@ namespace v2rayN.ViewModels
}
CurrentFontSize = _config.uiItem.currentFontSize;
CurrentLanguage = _config.uiItem.currentLanguage;
BlShowTrayTip = _config.uiItem.showTrayTip;
this.WhenAnyValue(
x => x.ColorModeDark,
@@ -1743,6 +1809,7 @@ namespace v2rayN.ViewModels
Utils.SetDarkBorder(Application.Current.MainWindow, isDarkTheme);
}
public void ChangePrimaryColor(System.Windows.Media.Color color)
{
var theme = _paletteHelper.GetTheme();
@@ -1770,6 +1837,6 @@ namespace v2rayN.ViewModels
}
}
#endregion
#endregion UI
}
}
}

View File

@@ -16,6 +16,7 @@ namespace v2rayN.ViewModels
private Window _view;
#region Core
[Reactive] public int localPort { get; set; }
[Reactive] public bool udpEnabled { get; set; }
[Reactive] public bool sniffingEnabled { get; set; }
@@ -30,14 +31,18 @@ namespace v2rayN.ViewModels
[Reactive] public bool defAllowInsecure { get; set; }
[Reactive] public string defFingerprint { get; set; }
[Reactive] public string defUserAgent { get; set; }
#endregion
#endregion Core
#region Core DNS
[Reactive] public string domainStrategy4Freedom { get; set; }
[Reactive] public string remoteDNS { get; set; }
#endregion
#endregion Core DNS
#region Core KCP
//[Reactive] public int Kcpmtu { get; set; }
//[Reactive] public int Kcptti { get; set; }
//[Reactive] public int KcpuplinkCapacity { get; set; }
@@ -45,9 +50,11 @@ namespace v2rayN.ViewModels
//[Reactive] public int KcpreadBufferSize { get; set; }
//[Reactive] public int KcpwriteBufferSize { get; set; }
//[Reactive] public bool Kcpcongestion { get; set; }
#endregion
#endregion Core KCP
#region UI
[Reactive] public bool AutoRun { get; set; }
[Reactive] public bool EnableStatistics { get; set; }
[Reactive] public int StatisticsFreshRate { get; set; }
@@ -60,21 +67,24 @@ namespace v2rayN.ViewModels
[Reactive] public bool EnableDragDropSort { get; set; }
[Reactive] public bool DoubleClick2Activate { get; set; }
[Reactive] public int autoUpdateInterval { get; set; }
[Reactive] public int autoUpdateSubInterval { get; set; }
[Reactive] public int trayMenuServersLimit { get; set; }
[Reactive] public string currentFontFamily { get; set; }
[Reactive] public int SpeedTestTimeout { get; set; }
[Reactive] public string SpeedTestUrl { get; set; }
[Reactive] public bool EnableHWA { get; set; }
[Reactive] public string SubConvertUrl { get; set; }
#endregion
#endregion UI
#region System proxy
[Reactive] public string systemProxyAdvancedProtocol { get; set; }
[Reactive] public string systemProxyExceptions { get; set; }
#endregion
#endregion System proxy
#region Tun mode
[Reactive] public bool TunShowWindow { get; set; }
[Reactive] public bool TunEnabledLog { get; set; }
[Reactive] public bool TunStrictRoute { get; set; }
@@ -89,9 +99,11 @@ namespace v2rayN.ViewModels
[Reactive] public string TunProxyIP { get; set; }
[Reactive] public string TunProxyProcess { get; set; }
[Reactive] public string TunProxyDNS { get; set; }
#endregion
#endregion Tun mode
#region CoreType
[Reactive] public string CoreType1 { get; set; }
[Reactive] public string CoreType2 { get; set; }
[Reactive] public string CoreType3 { get; set; }
@@ -99,11 +111,10 @@ namespace v2rayN.ViewModels
[Reactive] public string CoreType5 { get; set; }
[Reactive] public string CoreType6 { get; set; }
#endregion
#endregion CoreType
public ReactiveCommand<Unit, Unit> SaveCmd { get; }
public OptionSettingViewModel(Window view)
{
_config = LazyConfig.Instance.GetConfig();
@@ -111,6 +122,7 @@ namespace v2rayN.ViewModels
_view = view;
#region Core
var inbound = _config.inbound[0];
localPort = inbound.localPort;
udpEnabled = inbound.udpEnabled;
@@ -126,14 +138,18 @@ namespace v2rayN.ViewModels
defAllowInsecure = _config.coreBasicItem.defAllowInsecure;
defFingerprint = _config.coreBasicItem.defFingerprint;
defUserAgent = _config.coreBasicItem.defUserAgent;
#endregion
#endregion Core
#region Core DNS
domainStrategy4Freedom = _config.domainStrategy4Freedom;
remoteDNS = _config.remoteDNS;
#endregion
#endregion Core DNS
#region Core KCP
//Kcpmtu = _config.kcpItem.mtu;
//Kcptti = _config.kcpItem.tti;
//KcpuplinkCapacity = _config.kcpItem.uplinkCapacity;
@@ -141,9 +157,11 @@ namespace v2rayN.ViewModels
//KcpreadBufferSize = _config.kcpItem.readBufferSize;
//KcpwriteBufferSize = _config.kcpItem.writeBufferSize;
//Kcpcongestion = _config.kcpItem.congestion;
#endregion
#endregion Core KCP
#region UI
AutoRun = _config.guiItem.autoRun;
EnableStatistics = _config.guiItem.enableStatistics;
StatisticsFreshRate = _config.guiItem.statisticsFreshRate;
@@ -156,19 +174,21 @@ namespace v2rayN.ViewModels
EnableDragDropSort = _config.uiItem.enableDragDropSort;
DoubleClick2Activate = _config.uiItem.doubleClick2Activate;
autoUpdateInterval = _config.guiItem.autoUpdateInterval;
autoUpdateSubInterval = _config.guiItem.autoUpdateSubInterval;
trayMenuServersLimit = _config.guiItem.trayMenuServersLimit;
currentFontFamily = _config.uiItem.currentFontFamily;
SpeedTestTimeout = _config.speedTestItem.speedTestTimeout;
SpeedTestUrl = _config.speedTestItem.speedTestUrl;
EnableHWA = _config.guiItem.enableHWA;
SubConvertUrl = _config.constItem.subConvertUrl;
#endregion
#endregion UI
#region System proxy
systemProxyAdvancedProtocol = _config.systemProxyAdvancedProtocol;
systemProxyExceptions = _config.systemProxyExceptions;
#endregion
#endregion System proxy
#region Tun mode
@@ -189,7 +209,7 @@ namespace v2rayN.ViewModels
x => x.TunBypassMode)
.Subscribe(c => TunBypassMode2 = !TunBypassMode);
#endregion
#endregion Tun mode
InitCoreType();
@@ -229,18 +249,23 @@ namespace v2rayN.ViewModels
case 1:
CoreType1 = type;
break;
case 2:
CoreType2 = type;
break;
case 3:
CoreType3 = type;
break;
case 4:
CoreType4 = type;
break;
case 5:
CoreType5 = type;
break;
case 6:
CoreType6 = type;
break;
@@ -248,7 +273,6 @@ namespace v2rayN.ViewModels
});
}
private void SaveSetting()
{
if (Utils.IsNullOrEmpty(localPort.ToString()) || !Utils.IsNumberic(localPort.ToString())
@@ -302,12 +326,10 @@ namespace v2rayN.ViewModels
_config.coreBasicItem.defFingerprint = defFingerprint;
_config.coreBasicItem.defUserAgent = defUserAgent;
//DNS
_config.remoteDNS = remoteDNS;
_config.domainStrategy4Freedom = domainStrategy4Freedom;
//Kcp
//_config.kcpItem.mtu = Kcpmtu;
//_config.kcpItem.tti = Kcptti;
@@ -317,7 +339,6 @@ namespace v2rayN.ViewModels
//_config.kcpItem.writeBufferSize = KcpwriteBufferSize;
//_config.kcpItem.congestion = Kcpcongestion;
//UI
Utils.SetAutoRun(AutoRun);
_config.guiItem.autoRun = AutoRun;
@@ -333,7 +354,6 @@ namespace v2rayN.ViewModels
_config.guiItem.enableSecurityProtocolTls13 = EnableSecurityProtocolTls13;
_config.uiItem.autoHideStartup = AutoHideStartup;
_config.guiItem.autoUpdateInterval = autoUpdateInterval;
_config.guiItem.autoUpdateSubInterval = autoUpdateSubInterval;
_config.guiItem.checkPreReleaseUpdate = EnableCheckPreReleaseUpdate;
_config.uiItem.enableDragDropSort = EnableDragDropSort;
_config.uiItem.doubleClick2Activate = DoubleClick2Activate;
@@ -342,6 +362,7 @@ namespace v2rayN.ViewModels
_config.speedTestItem.speedTestTimeout = SpeedTestTimeout;
_config.speedTestItem.speedTestUrl = SpeedTestUrl;
_config.guiItem.enableHWA = EnableHWA;
_config.constItem.subConvertUrl = SubConvertUrl;
//systemProxy
_config.systemProxyExceptions = systemProxyExceptions;
@@ -362,7 +383,7 @@ namespace v2rayN.ViewModels
_config.tunModeItem.proxyProcess = Utils.String2List(TunProxyProcess);
_config.tunModeItem.proxyDNS = Utils.ToJson(Utils.ParseJson(TunProxyDNS));
//coreType
//coreType
SaveCoreType();
if (ConfigHandler.SaveConfig(ref _config) == 0)
@@ -374,8 +395,8 @@ namespace v2rayN.ViewModels
{
UI.ShowWarning(ResUI.OperationFailed);
}
}
private int SaveCoreType()
{
for (int k = 1; k <= _config.coreTypeItem.Count; k++)
@@ -387,18 +408,23 @@ namespace v2rayN.ViewModels
case 1:
type = CoreType1;
break;
case 2:
type = CoreType2;
break;
case 3:
type = CoreType3;
break;
case 4:
type = CoreType4;
break;
case 5:
type = CoreType5;
break;
case 6:
type = CoreType6;
break;
@@ -408,4 +434,4 @@ namespace v2rayN.ViewModels
return 0;
}
}
}
}

View File

@@ -31,10 +31,8 @@ namespace v2rayN.ViewModels
[Reactive]
public bool AutoSort { get; set; }
public ReactiveCommand<Unit, Unit> SaveCmd { get; }
public RoutingRuleDetailsViewModel(RulesItem rulesItem, Window view)
{
_config = LazyConfig.Instance.GetConfig();
@@ -63,6 +61,7 @@ namespace v2rayN.ViewModels
Utils.SetDarkBorder(view, _config.uiItem.colorModeDark);
}
private void SaveRules()
{
if (AutoSort)
@@ -96,4 +95,4 @@ namespace v2rayN.ViewModels
_view.DialogResult = true;
}
}
}
}

View File

@@ -26,8 +26,10 @@ namespace v2rayN.ViewModels
private IObservableCollection<RulesItemModel> _rulesItems = new ObservableCollectionExtended<RulesItemModel>();
public IObservableCollection<RulesItemModel> RulesItems => _rulesItems;
[Reactive]
public RulesItemModel SelectedSource { get; set; }
public IList<RulesItemModel> SelectedSources { get; set; }
public ReactiveCommand<Unit, Unit> RuleAddCmd { get; }
@@ -43,7 +45,6 @@ namespace v2rayN.ViewModels
public ReactiveCommand<Unit, Unit> SaveCmd { get; }
public RoutingRuleSettingViewModel(RoutingItem routingItem, Window view)
{
_config = LazyConfig.Instance.GetConfig();
@@ -188,6 +189,7 @@ namespace v2rayN.ViewModels
RefreshRulesItems();
}
public void RuleExportSelected()
{
if (SelectedSource is null || SelectedSource.outboundTag.IsNullOrEmpty())
@@ -299,6 +301,7 @@ namespace v2rayN.ViewModels
UI.Show(ResUI.OperationSuccess);
}
}
private async Task ImportRulesFromUrl()
{
var url = SelectedRouting.url;
@@ -319,6 +322,7 @@ namespace v2rayN.ViewModels
UI.Show(ResUI.OperationSuccess);
}
}
private int AddBatchRoutingRules(RoutingItem routingItem, string clipboardData)
{
bool blReplace = false;
@@ -351,6 +355,6 @@ namespace v2rayN.ViewModels
return 0;
}
#endregion
#endregion Import rules
}
}
}

View File

@@ -20,34 +20,43 @@ namespace v2rayN.ViewModels
private RoutingItem _lockedItem;
private List<RulesItem> _lockedRules;
#region Reactive
private IObservableCollection<RoutingItemModel> _routingItems = new ObservableCollectionExtended<RoutingItemModel>();
public IObservableCollection<RoutingItemModel> RoutingItems => _routingItems;
[Reactive]
public RoutingItemModel SelectedSource { get; set; }
public IList<RoutingItemModel> SelectedSources { get; set; }
[Reactive]
public bool enableRoutingAdvanced { get; set; }
[Reactive]
public bool enableRoutingBasic { get; set; }
[Reactive]
public string domainStrategy { get; set; }
[Reactive]
public string domainMatcher { get; set; }
[Reactive]
public string ProxyDomain { get; set; }
[Reactive]
public string ProxyIP { get; set; }
[Reactive]
public string DirectDomain { get; set; }
[Reactive]
public string DirectIP { get; set; }
[Reactive]
public string BlockDomain { get; set; }
[Reactive]
public string BlockIP { get; set; }
@@ -59,7 +68,8 @@ namespace v2rayN.ViewModels
public ReactiveCommand<Unit, Unit> SaveCmd { get; }
public bool IsModified { get; set; }
#endregion
#endregion Reactive
public RoutingSettingViewModel(Window view)
{
@@ -117,6 +127,7 @@ namespace v2rayN.ViewModels
}
#region locked
private void BindingLockedData()
{
_lockedItem = ConfigHandler.GetLockedRoutingItem(ref _config);
@@ -133,6 +144,7 @@ namespace v2rayN.ViewModels
BlockIP = Utils.List2String(_lockedRules[2].ip, true);
}
}
private void EndBindingLockedData()
{
if (_lockedItem != null)
@@ -151,9 +163,11 @@ namespace v2rayN.ViewModels
ConfigHandler.SaveRoutingItem(ref _config, _lockedItem);
}
}
#endregion
#endregion locked
#region Refresh Save
public void RefreshRoutingItems()
{
_routingItems.Clear();
@@ -180,6 +194,7 @@ namespace v2rayN.ViewModels
_routingItems.Add(it);
}
}
private void SaveRouting()
{
_config.routingBasicItem.domainStrategy = domainStrategy;
@@ -199,7 +214,7 @@ namespace v2rayN.ViewModels
}
}
#endregion
#endregion Refresh Save
private void RoutingBasicImportRules()
{
@@ -275,6 +290,7 @@ namespace v2rayN.ViewModels
IsModified = true;
}
}
private void RoutingAdvancedImportRules()
{
if (ConfigHandler.InitBuiltinRouting(ref _config, true) == 0)
@@ -284,4 +300,4 @@ namespace v2rayN.ViewModels
}
}
}
}
}

View File

@@ -21,7 +21,6 @@ namespace v2rayN.ViewModels
public ReactiveCommand<Unit, Unit> SaveCmd { get; }
public SubEditViewModel(SubItem subItem, Window view)
{
_config = LazyConfig.Instance.GetConfig();
@@ -44,6 +43,7 @@ namespace v2rayN.ViewModels
Utils.SetDarkBorder(view, _config.uiItem.colorModeDark);
}
private void SaveSub()
{
string remarks = SelectedSource.remarks;
@@ -64,9 +64,11 @@ namespace v2rayN.ViewModels
item.url = SelectedSource.url;
item.moreUrl = SelectedSource.moreUrl;
item.enabled = SelectedSource.enabled;
item.autoUpdateInterval = SelectedSource.autoUpdateInterval;
item.userAgent = SelectedSource.userAgent;
item.sort = SelectedSource.sort;
item.filter = SelectedSource.filter;
item.convertTarget = SelectedSource.convertTarget;
}
if (ConfigHandler.AddSubItem(ref _config, item) == 0)
@@ -81,4 +83,4 @@ namespace v2rayN.ViewModels
}
}
}
}
}

View File

@@ -21,8 +21,10 @@ namespace v2rayN.ViewModels
private IObservableCollection<SubItem> _subItems = new ObservableCollectionExtended<SubItem>();
public IObservableCollection<SubItem> SubItems => _subItems;
[Reactive]
public SubItem SelectedSource { get; set; }
public IList<SubItem> SelectedSources { get; set; }
public ReactiveCommand<Unit, Unit> SubAddCmd { get; }
@@ -91,7 +93,6 @@ namespace v2rayN.ViewModels
RefreshSubItems();
IsModified = true;
}
}
private void DeleteSub()
@@ -125,6 +126,5 @@ namespace v2rayN.ViewModels
await DialogHost.Show(dialog, "SubDialog");
}
}
}
}

View File

@@ -150,7 +150,6 @@
Text="{x:Static resx:ResUI.TipDisplayLog}" />
</StackPanel>
<TextBlock
Grid.Row="5"
Grid.Column="0"
@@ -178,7 +177,6 @@
Text="{x:Static resx:ResUI.TipPreSocksPort}"
TextWrapping="Wrap" />
</StackPanel>
</Grid>
<Grid
@@ -204,9 +202,6 @@
IsCancel="true"
Style="{StaticResource DefButton}" />
</Grid>
</Grid>
</ScrollViewer>
</reactiveui:ReactiveWindow>

View File

@@ -34,15 +34,14 @@ namespace v2rayN.Views
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.SaveServerCmd, v => v.btnSave).DisposeWith(disposables);
});
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
txtRemarks.Focus();
}
private void btnCancel_Click(object sender, System.Windows.RoutedEventArgs e)
{
if (ViewModel?.IsModified == true)
@@ -54,8 +53,5 @@ namespace v2rayN.Views
this.Close();
}
}
}
}
}

View File

@@ -193,7 +193,6 @@
Width="200"
Margin="{StaticResource ServerItemMargin}"
Style="{StaticResource DefComboBox}" />
</Grid>
<Grid
x:Name="gridSs"
@@ -239,7 +238,6 @@
Width="300"
Margin="{StaticResource ServerItemMargin}"
Style="{StaticResource DefComboBox}" />
</Grid>
<Grid
x:Name="gridSocks"
@@ -285,7 +283,6 @@
Width="400"
Margin="{StaticResource ServerItemMargin}"
Style="{StaticResource DefTextBox}" />
</Grid>
<Grid
x:Name="gridVLESS"
@@ -523,7 +520,6 @@
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbPath}" />
</Grid>
<Separator
@@ -732,8 +728,6 @@
Margin="{StaticResource ServerItemMargin}"
HorizontalAlignment="Left"
Style="{StaticResource DefTextBox}" />
</Grid>
<Separator
Grid.Row="8"
@@ -765,7 +759,6 @@
IsCancel="true"
Style="{StaticResource DefButton}" />
</Grid>
</Grid>
</ScrollViewer>
</reactiveui:ReactiveWindow>
</reactiveui:ReactiveWindow>

View File

@@ -12,7 +12,6 @@ namespace v2rayN.Views
{
public partial class AddServerWindow
{
public AddServerWindow(ProfileItem profileItem)
{
InitializeComponent();
@@ -23,10 +22,20 @@ namespace v2rayN.Views
ViewModel = new AddServerViewModel(profileItem, this);
Global.coreTypes.ForEach(it =>
if (profileItem.configType == EConfigType.VLESS)
{
cmbCoreType.Items.Add(it);
});
Global.coreTypes4VLESS.ForEach(it =>
{
cmbCoreType.Items.Add(it);
});
}
else
{
Global.coreTypes.ForEach(it =>
{
cmbCoreType.Items.Add(it);
});
}
cmbCoreType.Items.Add(string.Empty);
cmbStreamSecurity.Items.Add(string.Empty);
@@ -63,6 +72,7 @@ namespace v2rayN.Views
profileItem.security = Global.DefaultSecurity;
}
break;
case EConfigType.Shadowsocks:
gridSs.Visibility = Visibility.Visible;
LazyConfig.Instance.GetShadowsocksSecuritys(profileItem).ForEach(it =>
@@ -70,9 +80,11 @@ namespace v2rayN.Views
cmbSecurity3.Items.Add(it);
});
break;
case EConfigType.Socks:
gridSocks.Visibility = Visibility.Visible;
break;
case EConfigType.VLESS:
gridVLESS.Visibility = Visibility.Visible;
cmbStreamSecurity.Items.Add(Global.StreamSecurityReality);
@@ -85,6 +97,7 @@ namespace v2rayN.Views
profileItem.security = Global.None;
}
break;
case EConfigType.Trojan:
gridTrojan.Visibility = Visibility.Visible;
Global.flows.ForEach(it =>
@@ -110,19 +123,23 @@ namespace v2rayN.Views
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);
break;
case EConfigType.Shadowsocks:
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);
break;
case EConfigType.Socks:
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);
break;
case EConfigType.VLESS:
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.security, v => v.txtSecurity5.Text).DisposeWith(disposables);
break;
case EConfigType.Trojan:
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);
@@ -145,9 +162,7 @@ namespace v2rayN.Views
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.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables);
});
this.Title = $"{profileItem.configType}";
@@ -163,6 +178,7 @@ namespace v2rayN.Views
SetHeaderType();
SetTips();
}
private void CmbStreamSecurity_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
var security = cmbStreamSecurity.SelectedItem.ToString();
@@ -182,6 +198,7 @@ namespace v2rayN.Views
gridTlsMore.Visibility = Visibility.Hidden;
}
}
private void btnGUID_Click(object sender, RoutedEventArgs e)
{
txtId.Text =
@@ -242,23 +259,28 @@ namespace v2rayN.Views
tipRequestHost.Text = ResUI.TransportRequestHostTip1;
tipHeaderType.Text = ResUI.TransportHeaderTypeTip1;
break;
case "kcp":
tipHeaderType.Text = ResUI.TransportHeaderTypeTip2;
tipPath.Text = ResUI.TransportPathTip5;
break;
case "ws":
tipRequestHost.Text = ResUI.TransportRequestHostTip2;
tipPath.Text = ResUI.TransportPathTip1;
break;
case "h2":
tipRequestHost.Text = ResUI.TransportRequestHostTip3;
tipPath.Text = ResUI.TransportPathTip2;
break;
case "quic":
tipRequestHost.Text = ResUI.TransportRequestHostTip4;
tipPath.Text = ResUI.TransportPathTip3;
tipHeaderType.Text = ResUI.TransportHeaderTypeTip3;
break;
case "grpc":
tipPath.Text = ResUI.TransportPathTip4;
tipHeaderType.Text = ResUI.TransportHeaderTypeTip4;
@@ -271,6 +293,5 @@ namespace v2rayN.Views
{
this.Close();
}
}
}
}

View File

@@ -181,4 +181,4 @@
</Grid>
</Grid>
</ScrollViewer>
</reactiveui:ReactiveWindow>
</reactiveui:ReactiveWindow>

View File

@@ -45,7 +45,6 @@ namespace v2rayN.Views
BindingData();
}
private void TxtGlobalHotkey_KeyDown(object sender, KeyEventArgs e)
{
e.Handled = true;
@@ -68,8 +67,8 @@ namespace v2rayN.Views
Shift = false,
KeyCode = null
});
}
private string KeyEventItemToString(KeyEventItem item)
{
var res = new StringBuilder();
@@ -82,6 +81,7 @@ namespace v2rayN.Views
return res.ToString();
}
private void BindingData()
{
foreach (var item in _TextBoxKeyEventItem)
@@ -137,4 +137,4 @@ namespace v2rayN.Views
}
}
}
}
}

View File

@@ -94,7 +94,6 @@
x:Name="menuAddServerViaScan"
Height="{StaticResource MenuItemHeight}"
Header="{x:Static resx:ResUI.menuAddServerViaScan}" />
</MenuItem>
</Menu>
<Separator />
@@ -229,6 +228,11 @@
Height="{StaticResource MenuItemHeight}"
Header="Clash.Meta Core" />
<Separator Margin="-40,5" />
<MenuItem
x:Name="menuCheckUpdateSingBoxCore"
Height="{StaticResource MenuItemHeight}"
Header="SingBox Core" />
<Separator Margin="-40,5" />
<MenuItem
x:Name="menuCheckUpdateGeo"
Height="{StaticResource MenuItemHeight}"
@@ -356,7 +360,6 @@
Margin="8"
materialDesign:HintAssist.Hint="Language"
Style="{StaticResource DefComboBox}" />
</Grid>
</StackPanel>
</materialDesign:PopupBox>
@@ -499,6 +502,7 @@
GridLinesVisibility="All"
HeadersVisibility="All"
IsReadOnly="True"
RowHeaderWidth="40"
Style="{StaticResource DefDataGrid}">
<DataGrid.InputBindings>
<KeyBinding Command="ApplicationCommands.NotACommand" Gesture="Ctrl+C" />
@@ -621,7 +625,6 @@
<DataGrid.Resources>
<Style BasedOn="{StaticResource MaterialDesignDataGridRow}" TargetType="DataGridRow">
<EventSetter Event="MouseDoubleClick" Handler="LstProfiles_MouseDoubleClick" />
</Style>
<Style BasedOn="{StaticResource MaterialDesignDataGridColumnHeader}" TargetType="DataGridColumnHeader">
<EventSetter Event="Click" Handler="LstProfiles_ColumnHeader_Click" />
@@ -636,7 +639,6 @@
</DataTrigger>
</Style.Triggers>
</Style>
</DataGrid.Resources>
<DataGrid.Columns>
@@ -728,13 +730,11 @@
Binding="{Binding totalDown}"
ExName="totalDown"
Header="{x:Static resx:ResUI.LvTotalDownloadDataAmount}" />
</DataGrid.Columns>
</DataGrid>
<GridSplitter Grid.Row="1" HorizontalAlignment="Stretch" />
<local:MsgView Grid.Row="2" />
</Grid>
</DockPanel>
<tb:TaskbarIcon
x:Name="tbNotify"
@@ -790,7 +790,7 @@
</StackPanel>
</MenuItem.Header>
</MenuItem>
<Separator />
<Separator x:Name="sepRoutings" />
<MenuItem x:Name="menuRoutings" Height="Auto">
<MenuItem.Header>
<DockPanel>
@@ -844,6 +844,7 @@
</tb:TaskbarIcon.ContextMenu>
<tb:TaskbarIcon.TrayToolTip>
<Border
x:Name="borTrayToolTip"
Width="Auto"
Height="Auto"
Background="{DynamicResource MaterialDesignLightBackground}"
@@ -861,6 +862,5 @@
</tb:TaskbarIcon>
<materialDesign:Snackbar x:Name="MainSnackbar" MessageQueue="{materialDesign:MessageQueue}" />
</Grid>
</materialDesign:DialogHost>
</reactiveui:ReactiveWindow>
</reactiveui:ReactiveWindow>

View File

@@ -30,10 +30,10 @@ namespace v2rayN.Views
this.Closing += MainWindow_Closing;
this.PreviewKeyDown += MainWindow_PreviewKeyDown;
btnAutofitColumnWidth.Click += BtnAutofitColumnWidth_Click;
txtServerFilter.PreviewKeyDown += TxtServerFilter_PreviewKeyDown;
lstProfiles.PreviewKeyDown += LstProfiles_PreviewKeyDown;
lstProfiles.SelectionChanged += lstProfiles_SelectionChanged;
lstProfiles.LoadingRow += LstProfiles_LoadingRow;
lstProfiles.RowHeaderWidth = 30;
if (_config.uiItem.enableDragDropSort)
{
lstProfiles.AllowDrop = true;
@@ -93,7 +93,7 @@ namespace v2rayN.Views
this.BindCommand(ViewModel, vm => vm.MoveDownCmd, v => v.menuMoveDown).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.PingServerCmd, v => v.menuPingServer).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.TcpingServerCmd, v => v.menuTcpingServer).DisposeWith(disposables);
@@ -129,6 +129,7 @@ namespace v2rayN.Views
this.BindCommand(ViewModel, vm => vm.CheckUpdateXrayCoreCmd, v => v.menuCheckUpdateXrayCore).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.CheckUpdateClashCoreCmd, v => v.menuCheckUpdateClashCore).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.CheckUpdateClashMetaCoreCmd, v => v.menuCheckUpdateClashMetaCore).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.CheckUpdateSingBoxCoreCmd, v => v.menuCheckUpdateSingBoxCore).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.CheckUpdateGeoCmd, v => v.menuCheckUpdateGeo).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.ReloadCmd, v => v.menuReload).DisposeWith(disposables);
@@ -148,6 +149,7 @@ namespace v2rayN.Views
this.OneWayBind(ViewModel, vm => vm.RoutingItems, v => v.cmbRoutings.ItemsSource).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedRouting, v => v.cmbRoutings.SelectedItem).DisposeWith(disposables);
this.OneWayBind(ViewModel, vm => vm.BlRouting, v => v.menuRoutings.Visibility).DisposeWith(disposables);
this.OneWayBind(ViewModel, vm => vm.BlRouting, v => v.sepRoutings.Visibility).DisposeWith(disposables);
this.OneWayBind(ViewModel, vm => vm.Servers, v => v.cmbServers.ItemsSource).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SelectedServer, v => v.cmbServers.SelectedItem).DisposeWith(disposables);
@@ -163,6 +165,7 @@ namespace v2rayN.Views
this.OneWayBind(ViewModel, vm => vm.RunningServerToolTipText, v => v.tbNotify.ToolTipText).DisposeWith(disposables);
this.OneWayBind(ViewModel, vm => vm.NotifyLeftClickCmd, v => v.tbNotify.LeftClickCommand).DisposeWith(disposables);
this.OneWayBind(ViewModel, vm => vm.AppIcon, v => v.Icon).DisposeWith(disposables);
this.OneWayBind(ViewModel, vm => vm.BlShowTrayTip, v => v.borTrayToolTip.Visibility).DisposeWith(disposables);
//status bar
this.OneWayBind(ViewModel, vm => vm.InboundDisplay, v => v.txtInboundDisplay.Text).DisposeWith(disposables);
@@ -205,7 +208,7 @@ namespace v2rayN.Views
}
}
#region Event
#region Event
private void UpdateViewHandler(EViewAction action)
{
@@ -246,6 +249,7 @@ namespace v2rayN.Views
{
ViewModel.SelectedProfiles = lstProfiles.SelectedItems.Cast<ProfileItemModel>().ToList();
}
private void LstProfiles_LoadingRow(object? sender, DataGridRowEventArgs e)
{
//if (e.Row.GetIndex() == 0)
@@ -377,12 +381,12 @@ namespace v2rayN.Views
}
}
private void menuClose_Click(object sender, RoutedEventArgs e)
{
StorageUI();
ViewModel?.ShowHideWindow(false);
}
private void menuPromotion_Click(object sender, RoutedEventArgs e)
{
Utils.ProcessStart($"{Utils.Base64Decode(Global.PromotionUrl)}?t={DateTime.Now.Ticks}");
@@ -392,6 +396,7 @@ namespace v2rayN.Views
{
ViewModel?.TestServerAvailability();
}
private void menuSettingsSetUWP_Click(object sender, RoutedEventArgs e)
{
Utils.ProcessStart(Utils.GetBinPath("EnableLoopback.exe"));
@@ -401,6 +406,7 @@ namespace v2rayN.Views
{
AutofitColumnWidth();
}
private void AutofitColumnWidth()
{
foreach (var it in lstProfiles.Columns)
@@ -408,9 +414,18 @@ namespace v2rayN.Views
it.Width = new DataGridLength(1, DataGridLengthUnitType.Auto);
}
}
#endregion
#region UI
private void TxtServerFilter_PreviewKeyDown(object sender, KeyEventArgs e)
{
if (e.Key is Key.Enter or Key.Return)
{
ViewModel?.RefreshServers();
}
}
#endregion Event
#region UI
private void RestoreUI()
{
@@ -439,7 +454,7 @@ namespace v2rayN.Views
var item2 = (MyDGTextColumn)lstProfiles.Columns[k];
if (item2.ExName == item.Name)
{
if (item.Width <= 0)
if (item.Width < 0)
{
item2.Visibility = Visibility.Hidden;
}
@@ -460,13 +475,14 @@ namespace v2rayN.Views
colTotalDown.Visibility = Visibility.Hidden;
}
}
private void StorageUI()
{
_config.uiItem.mainWidth = this.Width;
_config.uiItem.mainHeight = this.Height;
List<ColumnItem> lvColumnItem = new();
for (int k = 1; k < lstProfiles.Columns.Count; k++)
for (int k = 0; k < lstProfiles.Columns.Count; k++)
{
var item2 = (MyDGTextColumn)lstProfiles.Columns[k];
lvColumnItem.Add(new()
@@ -496,6 +512,7 @@ namespace v2rayN.Views
menuHelp.Items.Add(item);
}
}
private void MenuItem_Click(object sender, RoutedEventArgs e)
{
if (sender is MenuItem item)
@@ -504,8 +521,8 @@ namespace v2rayN.Views
}
}
#endregion UI
#endregion
#region Drag and Drop
private Point startPoint = new();
@@ -532,12 +549,12 @@ namespace v2rayN.Views
return null;
}
private void LstProfiles_PreviewMouseLeftButtonDown(object sender, MouseButtonEventArgs e)
{
// Get current mouse position
startPoint = e.GetPosition(null);
}
private void LstProfiles_MouseMove(object sender, MouseEventArgs e)
{
// Get the current mouse position
@@ -586,7 +603,7 @@ namespace v2rayN.Views
// Find the data behind the Item
ProfileItemModel item = (ProfileItemModel)listView.ItemContainerGenerator.ItemFromContainer(listViewItem);
if (item == null) return;
// Move item into observable collection
// Move item into observable collection
// (this will be automatically reflected to lstView.ItemsSource)
e.Effects = DragDropEffects.Move;
@@ -596,8 +613,6 @@ namespace v2rayN.Views
}
}
#endregion
#endregion Drag and Drop
}
}

View File

@@ -74,11 +74,8 @@
Height="{StaticResource MenuItemHeight}"
Click="menuMsgViewClear_Click"
Header="{x:Static resx:ResUI.menuMsgViewClear}" />
</ContextMenu>
</TextBox.ContextMenu>
</TextBox>
</DockPanel>
</UserControl>
</UserControl>

View File

@@ -30,7 +30,7 @@ namespace v2rayN.Views
}
}
void DelegateAppendText(string msg)
private void DelegateAppendText(string msg)
{
Dispatcher.BeginInvoke(AppendText, DispatcherPriority.Send, msg);
}
@@ -109,10 +109,10 @@ namespace v2rayN.Views
{
ClearMsg();
}
private void cmbMsgFilter_TextChanged(object sender, System.Windows.Controls.TextChangedEventArgs e)
{
_config.uiItem.mainMsgFilter = cmbMsgFilter.Text.TrimEx();
}
}
}

View File

@@ -216,7 +216,7 @@
Margin="{StaticResource SettingItemMargin}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSettingsLogEnabled}" />
Text="{x:Static resx:ResUI.TbSettingsLogEnabledToFile}" />
<ToggleButton
x:Name="toglogEnabled"
Grid.Row="9"
@@ -335,7 +335,6 @@
TextWrapping="Wrap"
VerticalScrollBarVisibility="Auto" />
</DockPanel>
</TabItem>
<!--<TabItem Header="{x:Static resx:ResUI.TbSettingsCoreKcp}">
@@ -455,7 +454,6 @@
Grid.Column="1"
Margin="{StaticResource SettingItemMargin}"
HorizontalAlignment="Left" />
</Grid>
</TabItem>-->
@@ -482,6 +480,7 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
@@ -668,22 +667,6 @@
HorizontalAlignment="Left"
Style="{StaticResource DefTextBox}" />
<TextBlock
Grid.Row="13"
Grid.Column="0"
Margin="{StaticResource SettingItemMargin}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSettingsAutoUpdate}" />
<TextBox
x:Name="txtautoUpdateSubInterval"
Grid.Row="13"
Grid.Column="1"
Width="200"
Margin="{StaticResource SettingItemMargin}"
HorizontalAlignment="Left"
Style="{StaticResource DefTextBox}" />
<TextBlock
Grid.Row="14"
Grid.Column="0"
@@ -767,6 +750,23 @@
Grid.Column="1"
Margin="{StaticResource SettingItemMargin}"
HorizontalAlignment="Left" />
<TextBlock
Grid.Row="19"
Grid.Column="0"
Margin="{StaticResource SettingItemMargin}"
VerticalAlignment="Center"
Style="{StaticResource ToolbarTextBlock}"
Text="{x:Static resx:ResUI.TbSettingsSubConvert}" />
<ComboBox
x:Name="cmbSubConvertUrl"
Grid.Row="19"
Grid.Column="1"
Width="300"
Margin="{StaticResource SettingItemMargin}"
materialDesign:HintAssist.Hint="Convert Url"
IsEditable="True"
Style="{StaticResource DefComboBox}" />
</Grid>
</ScrollViewer>
</TabItem>
@@ -787,7 +787,6 @@
Margin="{StaticResource SettingItemMargin}"
materialDesign:HintAssist.Hint="Protocol"
Style="{StaticResource DefComboBox}" />
</StackPanel>
<TextBlock
@@ -955,7 +954,6 @@
Text="{x:Static resx:ResUI.TbSettingsTunModeBypassModeTip}" />
</Grid>
<Grid
x:Name="gridTunModeDirect"
Width="800"
@@ -1053,7 +1051,6 @@
VerticalScrollBarVisibility="Auto" />
</GroupBox>
</Grid>
</DockPanel>
</TabItem>
@@ -1165,4 +1162,4 @@
</TabItem>
</TabControl>
</DockPanel>
</reactiveui:ReactiveWindow>
</reactiveui:ReactiveWindow>

View File

@@ -72,6 +72,10 @@ namespace v2rayN.Views
Global.SpeedTestUrls.ForEach(it =>
{
cmbSpeedTestUrl.Items.Add(it);
});
Global.SubConvertUrls.ForEach(it =>
{
cmbSubConvertUrl.Items.Add(it);
});
//fill fonts
@@ -134,11 +138,9 @@ namespace v2rayN.Views
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.domainStrategy4Freedom, v => v.cmbdomainStrategy4Freedom.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.Kcptti, v => v.txtKcptti.Text).DisposeWith(disposables);
//this.Bind(ViewModel, vm => vm.KcpuplinkCapacity, v => v.txtKcpuplinkCapacity.Text).DisposeWith(disposables);
@@ -147,7 +149,6 @@ namespace v2rayN.Views
//this.Bind(ViewModel, vm => vm.KcpwriteBufferSize, v => v.txtKcpwriteBufferSize.Text).DisposeWith(disposables);
//this.Bind(ViewModel, vm => vm.Kcpcongestion, v => v.togKcpcongestion.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.AutoRun, v => v.togAutoRun.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.EnableStatistics, v => v.togEnableStatistics.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.StatisticsFreshRate, v => v.cmbStatisticsFreshRate.Text).DisposeWith(disposables);
@@ -160,18 +161,16 @@ namespace v2rayN.Views
this.Bind(ViewModel, vm => vm.EnableDragDropSort, v => v.togEnableDragDropSort.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.DoubleClick2Activate, v => v.togDoubleClick2Activate.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.autoUpdateInterval, v => v.txtautoUpdateInterval.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.autoUpdateSubInterval, v => v.txtautoUpdateSubInterval.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.trayMenuServersLimit, v => v.txttrayMenuServersLimit.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.currentFontFamily, v => v.cmbcurrentFontFamily.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SpeedTestTimeout, v => v.cmbSpeedTestTimeout.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SpeedTestUrl, v => v.cmbSpeedTestUrl.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.EnableHWA, v => v.togEnableHWA.IsChecked).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.SubConvertUrl, v => v.cmbSubConvertUrl.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.systemProxyAdvancedProtocol, v => v.cmbsystemProxyAdvancedProtocol.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.systemProxyExceptions, v => v.txtsystemProxyExceptions.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.TunShowWindow, v => v.togShowWindow.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);
@@ -188,7 +187,6 @@ namespace v2rayN.Views
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.CoreType1, v => v.cmbCoreType1.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.CoreType2, v => v.cmbCoreType2.Text).DisposeWith(disposables);
this.Bind(ViewModel, vm => vm.CoreType3, v => v.cmbCoreType3.Text).DisposeWith(disposables);
@@ -197,9 +195,9 @@ namespace v2rayN.Views
this.Bind(ViewModel, vm => vm.CoreType6, v => v.cmbCoreType6.Text).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables);
});
}
private void linkDnsObjectDoc_Click(object sender, RoutedEventArgs e)
{
Utils.ProcessStart("https://www.v2fly.org/config/dns.html#dnsobject");
@@ -209,6 +207,7 @@ namespace v2rayN.Views
{
this.Close();
}
private void btnBrowse_Click(object sender, System.Windows.RoutedEventArgs e)
{
var openFileDialog1 = new OpenFileDialog();
@@ -218,4 +217,4 @@ namespace v2rayN.Views
txtCustomTemplate.Text = openFileDialog1.FileName;
}
}
}
}

View File

@@ -44,6 +44,5 @@
IsCancel="True"
IsDefault="True"
Style="{StaticResource MaterialDesignFlatButton}" />
</Grid>
</UserControl>
</UserControl>

View File

@@ -9,4 +9,4 @@ namespace v2rayN.Views
InitializeComponent();
}
}
}
}

View File

@@ -198,4 +198,4 @@
</GroupBox>
</Grid>
</DockPanel>
</reactiveui:ReactiveWindow>
</reactiveui:ReactiveWindow>

View File

@@ -52,7 +52,6 @@ namespace v2rayN.Views
this.Bind(ViewModel, vm => vm.AutoSort, v => v.chkAutoSort.IsChecked).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables);
});
}
@@ -60,10 +59,12 @@ namespace v2rayN.Views
{
cmbOutboundTag.Focus();
}
private void ClbProtocol_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
{
ViewModel.ProtocolItems = clbProtocol.SelectedItems.Cast<string>().ToList();
}
private void ClbInboundTag_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
{
ViewModel.InboundTagItems = clbInboundTag.SelectedItems.Cast<string>().ToList();
@@ -79,4 +80,4 @@ namespace v2rayN.Views
Utils.ProcessStart("https://www.v2fly.org/config/routing.html#ruleobject");
}
}
}
}

View File

@@ -207,7 +207,6 @@
HorizontalAlignment="Left"
AcceptsReturn="True"
Style="{StaticResource DefTextBox}" />
</Grid>
<TabControl x:Name="tabAdvanced">
@@ -291,11 +290,9 @@
Width="80"
Binding="{Binding enabled}"
Header="enabled" />
</DataGrid.Columns>
</DataGrid>
</TabItem>
</TabControl>
</DockPanel>
</reactiveui:ReactiveWindow>
</reactiveui:ReactiveWindow>

View File

@@ -51,9 +51,9 @@ namespace v2rayN.Views
this.BindCommand(ViewModel, vm => vm.MoveBottomCmd, v => v.menuMoveBottom).DisposeWith(disposables);
this.BindCommand(ViewModel, vm => vm.SaveCmd, v => v.btnSave).DisposeWith(disposables);
});
}
private void Window_Loaded(object sender, RoutedEventArgs e)
{
txtRemarks.Focus();
@@ -102,6 +102,7 @@ namespace v2rayN.Views
{
ViewModel?.RuleEdit(false);
}
private void menuRuleSelectAll_Click(object sender, System.Windows.RoutedEventArgs e)
{
lstRules.SelectAll();
@@ -116,4 +117,4 @@ namespace v2rayN.Views
txtCustomIcon.Text = openFileDialog1.FileName;
}
}
}
}

View File

@@ -109,7 +109,6 @@
Width="80"
Margin="8,0,0,0"
Style="{StaticResource DefComboBox}" />
</ToolBar>
</ToolBarTray>
@@ -187,18 +186,18 @@
Header="{x:Static resx:ResUI.menuRoutingAdvancedImportRules}" />
</ContextMenu>
</DataGrid.ContextMenu>
<DataGrid.Resources>
<Style BasedOn="{StaticResource MaterialDesignDataGridCell}" TargetType="DataGridCell">
<Style.Triggers>
<DataTrigger Binding="{Binding isActive}" Value="True">
<Setter Property="Background" Value="{DynamicResource PrimaryHueLightBrush}" />
<Setter Property="Foreground" Value="Black" />
<Setter Property="BorderBrush" Value="{DynamicResource PrimaryHueLightBrush}" />
</DataTrigger>
</Style.Triggers>
</Style>
</DataGrid.Resources>
<DataGrid.Columns>
<DataGridTemplateColumn Width="50">
<DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Border
Width="auto"
Height="auto"
Background="{DynamicResource PrimaryHueLightBrush}"
Visibility="{Binding Path=isActive, Converter={StaticResource BoolToVisConverter}}" />
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
<DataGridTextColumn
Width="200"
Binding="{Binding remarks}"
@@ -326,5 +325,4 @@
</TabControl>
</DockPanel>
</DockPanel>
</reactiveui:ReactiveWindow>
</reactiveui:ReactiveWindow>

View File

@@ -29,7 +29,6 @@ namespace v2rayN.Views
cmbdomainMatcher.Items.Add(it);
});
this.WhenActivated(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.SaveCmd, v => v.btnSave).DisposeWith(disposables);
});
}
@@ -87,10 +85,12 @@ namespace v2rayN.Views
{
lstRoutings.SelectAll();
}
private void lstRoutings_SelectionChanged(object sender, System.Windows.Controls.SelectionChangedEventArgs e)
{
ViewModel.SelectedSources = lstRoutings.SelectedItems.Cast<RoutingItemModel>().ToList();
}
private void LstRoutings_MouseDoubleClick(object sender, MouseButtonEventArgs e)
{
ViewModel?.RoutingAdvancedEdit(false);
@@ -113,4 +113,4 @@ namespace v2rayN.Views
}
}
}
}
}

Some files were not shown because too many files have changed in this diff Show More