Skip to content

Commit

Permalink
Merge pull request #4738 from NimaZare/master
Browse files Browse the repository at this point in the history
spell check and update
  • Loading branch information
2dust committed Feb 20, 2024
2 parents 6435477 + fc0c8f6 commit 2c5ca97
Show file tree
Hide file tree
Showing 84 changed files with 813 additions and 813 deletions.
6 changes: 3 additions & 3 deletions v2rayN/v2rayN/App.xaml.cs
@@ -1,7 +1,7 @@
using System.Windows;
using System.Windows.Threading;
using v2rayN.Handler;
using v2rayN.Mode;
using v2rayN.Model;

namespace v2rayN
{
Expand All @@ -27,7 +27,7 @@ public App()
/// <param name="e"></param>
protected override void OnStartup(StartupEventArgs e)
{
var exePathKey = Utils.GetMD5(Utils.GetExePath());
var exePathKey = Utile.GetMD5(Utile.GetExePath());

var rebootas = (e.Args ?? new string[] { }).Any(t => t == Global.RebootAs);
ProgramStarted = new EventWaitHandle(false, EventResetMode.AutoReset, exePathKey, out bool bCreatedNew);
Expand All @@ -42,7 +42,7 @@ protected override void OnStartup(StartupEventArgs e)
Logging.Setup();
Init();
Logging.LoggingEnabled(_config.guiItem.enableLog);
Logging.SaveLog($"v2rayN start up | {Utils.GetVersion()} | {Utils.GetExePath()}");
Logging.SaveLog($"v2rayN start up | {Utile.GetVersion()} | {Utile.GetExePath()}");
Logging.ClearLogs();

Thread.CurrentThread.CurrentUICulture = new(_config.uiItem.currentLanguage);
Expand Down
4 changes: 2 additions & 2 deletions v2rayN/v2rayN/Common/DownloaderHelper.cs
Expand Up @@ -19,9 +19,9 @@ internal class DownloaderHelper
Uri uri = new(url);
//Authorization Header
var headers = new WebHeaderCollection();
if (!Utils.IsNullOrEmpty(uri.UserInfo))
if (!Utile.IsNullOrEmpty(uri.UserInfo))
{
headers.Add(HttpRequestHeader.Authorization, "Basic " + Utils.Base64Encode(uri.UserInfo));
headers.Add(HttpRequestHeader.Authorization, "Basic " + Utile.Base64Encode(uri.UserInfo));
}

var downloadOpt = new DownloadConfiguration()
Expand Down
4 changes: 2 additions & 2 deletions v2rayN/v2rayN/Common/FileManager.cs
Expand Up @@ -20,7 +20,7 @@ public static bool ByteArrayToFile(string fileName, byte[] content)
return false;
}

public static void UncompressFile(string fileName, byte[] content)
public static void UncompressedFile(string fileName, byte[] content)
{
try
{
Expand Down Expand Up @@ -67,7 +67,7 @@ public static bool ZipExtractToFile(string fileName, string toPath, string ignor
}
try
{
if (!Utils.IsNullOrEmpty(ignoredName) && entry.Name.Contains(ignoredName))
if (!Utile.IsNullOrEmpty(ignoredName) && entry.Name.Contains(ignoredName))
{
continue;
}
Expand Down
2 changes: 1 addition & 1 deletion v2rayN/v2rayN/Common/HttpClientHelper.cs
Expand Up @@ -35,7 +35,7 @@ public class HttpClientHelper

public async Task PutAsync(string url, Dictionary<string, string> headers)
{
var jsonContent = JsonUtils.Serialize(headers);
var jsonContent = JsonUtile.Serialize(headers);
var content = new StringContent(jsonContent, Encoding.UTF8, MediaTypeNames.Application.Json);

var result = await httpClient.PutAsync(url, content);
Expand Down
Expand Up @@ -5,7 +5,7 @@

namespace v2rayN
{
internal class JsonUtils
internal class JsonUtile
{
/// <summary>
/// DeepCopy
Expand Down
4 changes: 2 additions & 2 deletions v2rayN/v2rayN/Common/Logging.cs
Expand Up @@ -13,7 +13,7 @@ public static void Setup()
FileTarget fileTarget = new();
config.AddTarget("file", fileTarget);
fileTarget.Layout = "${longdate}-${level:uppercase=true} ${message}";
fileTarget.FileName = Utils.GetLogPath("${shortdate}.txt");
fileTarget.FileName = Utile.GetLogPath("${shortdate}.txt");
config.LoggingRules.Add(new LoggingRule("*", LogLevel.Debug, fileTarget));
LogManager.Configuration = config;
}
Expand All @@ -33,7 +33,7 @@ public static void ClearLogs()
try
{
var now = DateTime.Now.AddMonths(-1);
var dir = Utils.GetLogPath();
var dir = Utile.GetLogPath();
var files = Directory.GetFiles(dir, "*.txt");
foreach (var filePath in files)
{
Expand Down
10 changes: 5 additions & 5 deletions v2rayN/v2rayN/Common/QueryableExtension.cs
Expand Up @@ -29,22 +29,22 @@ private static IOrderedQueryable<T> _OrderBy<T>(IQueryable<T> query, string prop

public static IOrderedQueryable<T> OrderByInternal<T, TProp>(IQueryable<T> query, PropertyInfo memberProperty)
{//public
return query.OrderBy(_GetLamba<T, TProp>(memberProperty));
return query.OrderBy(_GetLambda<T, TProp>(memberProperty));
}

public static IOrderedQueryable<T> OrderByDescendingInternal<T, TProp>(IQueryable<T> query, PropertyInfo memberProperty)
{//public
return query.OrderByDescending(_GetLamba<T, TProp>(memberProperty));
return query.OrderByDescending(_GetLambda<T, TProp>(memberProperty));
}

private static Expression<Func<T, TProp>> _GetLamba<T, TProp>(PropertyInfo memberProperty)
private static Expression<Func<T, TProp>> _GetLambda<T, TProp>(PropertyInfo memberProperty)
{
if (memberProperty.PropertyType != typeof(TProp)) throw new Exception();

var thisArg = Expression.Parameter(typeof(T));
var lamba = Expression.Lambda<Func<T, TProp>>(Expression.Property(thisArg, memberProperty), thisArg);
var lambda = Expression.Lambda<Func<T, TProp>>(Expression.Property(thisArg, memberProperty), thisArg);

return lamba;
return lambda;
}
}
}
12 changes: 6 additions & 6 deletions v2rayN/v2rayN/Common/SqliteHelper.cs
Expand Up @@ -3,19 +3,19 @@

namespace v2rayN
{
public sealed class SqliteHelper
public sealed class SQLiteHelper
{
private static readonly Lazy<SqliteHelper> _instance = new(() => new());
public static SqliteHelper Instance => _instance.Value;
private static readonly Lazy<SQLiteHelper> _instance = new(() => new());
public static SQLiteHelper Instance => _instance.Value;
private string _connstr;
private SQLiteConnection _db;
private SQLiteAsyncConnection _dbAsync;
private static readonly object objLock = new();
public readonly string _configDB = "guiNDB.db";

public SqliteHelper()
public SQLiteHelper()
{
_connstr = Utils.GetConfigPath(_configDB);
_connstr = Utile.GetConfigPath(_configDB);
_db = new SQLiteConnection(_connstr, false);
_dbAsync = new SQLiteAsyncConnection(_connstr, false);
}
Expand Down Expand Up @@ -51,7 +51,7 @@ public int Replace(object model)
}
}

public async Task<int> Replacesync(object model)
public async Task<int> ReplaceAsync(object model)
{
return await _dbAsync.InsertOrReplaceAsync(model);
}
Expand Down
Expand Up @@ -25,7 +25,7 @@

namespace v2rayN
{
internal class Utils
internal class Utile
{
#region 资源Json操作

Expand Down Expand Up @@ -404,7 +404,7 @@ public static string Convert2Comma(string text)
/// </summary>
/// <param name="oText"></param>
/// <returns></returns>
public static bool IsNumberic(string oText)
public static bool IsNumeric(string oText)
{
try
{
Expand Down Expand Up @@ -456,7 +456,7 @@ public static bool IsIP(string ip)
string[] cidr = ip.Split('/');
if (cidr.Length == 2)
{
if (!IsNumberic(cidr[0]))
if (!IsNumeric(cidr[0]))
{
return false;
}
Expand Down Expand Up @@ -581,7 +581,7 @@ public static int GetFreePort()
try
{
int defaultPort = 9090;
if (!Utils.PortInUse(defaultPort))
if (!Utile.PortInUse(defaultPort))
{
return defaultPort;
}
Expand Down
2 changes: 1 addition & 1 deletion v2rayN/v2rayN/Converters/MaterialDesignFonts.cs
Expand Up @@ -14,7 +14,7 @@ static MaterialDesignFonts()
var fontFamily = LazyConfig.Instance.GetConfig().uiItem.currentFontFamily;
if (!string.IsNullOrEmpty(fontFamily))
{
var fontPath = Utils.GetFontsPath();
var fontPath = Utile.GetFontsPath();
MyFont = new FontFamily(new Uri(@$"file:///{fontPath}\"), $"./#{fontFamily}");
}
}
Expand Down
30 changes: 15 additions & 15 deletions v2rayN/v2rayN/Global.cs
@@ -1,4 +1,4 @@
using v2rayN.Mode;
using v2rayN.Model;

namespace v2rayN
{
Expand Down Expand Up @@ -35,8 +35,8 @@ internal class Global
public const string CoreSpeedtestConfigFileName = "configSpeedtest.json";
public const string V2raySampleClient = "v2rayN.Sample.SampleClientConfig";
public const string SingboxSampleClient = "v2rayN.Sample.SingboxSampleClientConfig";
public const string V2raySampleHttprequestFileName = "v2rayN.Sample.SampleHttprequest";
public const string V2raySampleHttpresponseFileName = "v2rayN.Sample.SampleHttpresponse";
public const string V2raySampleHttpRequestFileName = "v2rayN.Sample.SampleHttpRequest";
public const string V2raySampleHttpResponseFileName = "v2rayN.Sample.SampleHttpResponse";
public const string V2raySampleInbound = "v2rayN.Sample.SampleInbound";
public const string V2raySampleOutbound = "v2rayN.Sample.SampleOutbound";
public const string SingboxSampleOutbound = "v2rayN.Sample.SingboxSampleOutbound";
Expand All @@ -62,7 +62,7 @@ internal class Global
public const string InboundHttp2 = "http2";
public const string Loopback = "127.0.0.1";
public const string InboundAPITagName = "api";
public const string InboundAPIProtocal = "dokodemo-door";
public const string InboundAPIProtocol = "dokodemo-door";
public const string HttpProtocol = "http://";
public const string HttpsProtocol = "https://";

Expand All @@ -74,8 +74,8 @@ internal class Global
public const string CustomIconName = "v2rayN.ico";
public const string IEProxyExceptions = "localhost;127.*;10.*;172.16.*;172.17.*;172.18.*;172.19.*;172.20.*;172.21.*;172.22.*;172.23.*;172.24.*;172.25.*;172.26.*;172.27.*;172.28.*;172.29.*;172.30.*;172.31.*;192.168.*";
public const string RoutingRuleComma = "<COMMA>";
public const string GrpcgunMode = "gun";
public const string GrpcmultiMode = "multi";
public const string GrpcGunMode = "gun";
public const string GrpcMultiMode = "multi";
public const int MaxPort = 65536;
public const string CommandClearMsg = "CommandClearMsg";
public const string DelayUnit = "";
Expand Down Expand Up @@ -122,7 +122,7 @@ internal class Global
@"https://www.google.com/generate_204",
};

public static readonly Dictionary<string, string> UserAgentTxts = new()
public static readonly Dictionary<string, string> UserAgentTexts = 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" },
{"firefox","Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:90.0) Gecko/20100101 Firefox/90.0" },
Expand Down Expand Up @@ -157,23 +157,23 @@ internal class Global
{EConfigType.Wireguard,"wireguard"}
};

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> SsSecuritysInSingbox = new() { "aes-256-gcm", "aes-192-gcm", "aes-128-gcm", "chacha20-ietf-poly1305", "xchacha20-ietf-poly1305", "none", "2022-blake3-aes-128-gcm", "2022-blake3-aes-256-gcm", "2022-blake3-chacha20-poly1305", "aes-128-ctr", "aes-192-ctr", "aes-256-ctr", "aes-128-cfb", "aes-192-cfb", "aes-256-cfb", "rc4-md5", "chacha20-ietf", "xchacha20" };
public static readonly List<string> VmessSecurities = new() { "aes-128-gcm", "chacha20-poly1305", "auto", "none", "zero" };
public static readonly List<string> SsSecurities = new() { "aes-256-gcm", "aes-128-gcm", "chacha20-poly1305", "chacha20-ietf-poly1305", "none", "plain" };
public static readonly List<string> SsSecuritiesInSagerNet = 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> SsSecuritiesInXray = 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> SsSecuritiesInSingbox = new() { "aes-256-gcm", "aes-192-gcm", "aes-128-gcm", "chacha20-ietf-poly1305", "xchacha20-ietf-poly1305", "none", "2022-blake3-aes-128-gcm", "2022-blake3-aes-256-gcm", "2022-blake3-chacha20-poly1305", "aes-128-ctr", "aes-192-ctr", "aes-256-ctr", "aes-128-cfb", "aes-192-cfb", "aes-256-cfb", "rc4-md5", "chacha20-ietf", "xchacha20" };
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", "sing_box" };
public static readonly List<string> CoreTypes4VLESS = new() { "Xray", "sing_box" };
public static readonly List<string> DomainStrategys = new() { "AsIs", "IPIfNonMatch", "IPOnDemand" };
public static readonly List<string> DomainStrategys4Singbox = new() { "ipv4_only", "ipv6_only", "prefer_ipv4", "prefer_ipv6", "" };
public static readonly List<string> DomainStrategies = new() { "AsIs", "IPIfNonMatch", "IPOnDemand" };
public static readonly List<string> DomainStrategies4Singbox = new() { "ipv4_only", "ipv6_only", "prefer_ipv4", "prefer_ipv6", "" };
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> AllowInsecure = new() { "true", "false", "" };
public static readonly List<string> DomainStrategy4Freedoms = new() { "AsIs", "UseIP", "UseIPv4", "UseIPv6", "" };
public static readonly List<string> Languages = new() { "zh-Hans", "zh-Hant", "en", "fa-Ir", "ru" };
public static readonly List<string> Alpns = new() { "h3", "h2", "http/1.1", "h3,h2,http/1.1", "h3,h2", "h2,http/1.1", "" };
Expand Down

0 comments on commit 2c5ca97

Please sign in to comment.