Modern namespaces and typos fixed

This commit is contained in:
UMMANCODE 2024-07-18 17:52:32 +04:00
parent 70ea21fca2
commit 9b01195f29
35 changed files with 3518 additions and 3556 deletions

View file

@ -1,13 +1,12 @@
using ProtosLib.Statistics; using ProtosLib.Statistics;
namespace ProtosLib namespace ProtosLib;
public class Tests
{ {
public class Tests
{
private StatsService.StatsServiceClient client_; private StatsService.StatsServiceClient client_;
public Tests() public Tests()
{ {
} }
}
} }

View file

@ -1,9 +1,7 @@
using System.Windows.Controls; using System.Windows.Controls;
namespace v2rayN.Base namespace v2rayN.Base;
{
internal class MyDGTextColumn : DataGridTextColumn internal class MyDGTextColumn : DataGridTextColumn {
{
public string ExName { get; set; } public string ExName { get; set; }
}
} }

View file

@ -2,10 +2,10 @@
using System.IO; using System.IO;
using System.Net; using System.Net;
namespace v2rayN namespace v2rayN;
internal class DownloaderHelper
{ {
internal class DownloaderHelper
{
private static readonly Lazy<DownloaderHelper> _instance = new(() => new()); private static readonly Lazy<DownloaderHelper> _instance = new(() => new());
public static DownloaderHelper Instance => _instance.Value; public static DownloaderHelper Instance => _instance.Value;
@ -177,5 +177,4 @@ namespace v2rayN
downloadOpt = null; downloadOpt = null;
} }
}
} }

View file

@ -2,10 +2,10 @@
using System.IO.Compression; using System.IO.Compression;
using System.Text; using System.Text;
namespace v2rayN namespace v2rayN;
public static class FileManager
{ {
public static class FileManager
{
public static bool ByteArrayToFile(string fileName, byte[] content) public static bool ByteArrayToFile(string fileName, byte[] content)
{ {
try try
@ -86,5 +86,4 @@ namespace v2rayN
} }
return true; return true;
} }
}
} }

View file

@ -4,12 +4,12 @@ using System.Net.Http.Headers;
using System.Net.Mime; using System.Net.Mime;
using System.Text; using System.Text;
namespace v2rayN namespace v2rayN;
/// <summary>
/// </summary>
public class HttpClientHelper
{ {
/// <summary>
/// </summary>
public class HttpClientHelper
{
private static readonly Lazy<HttpClientHelper> _instance = new(() => private static readonly Lazy<HttpClientHelper> _instance = new(() =>
{ {
HttpClientHandler handler = new() { UseCookies = false }; HttpClientHandler handler = new() { UseCookies = false };
@ -184,5 +184,4 @@ namespace v2rayN
} }
} while (isMoreToRead); } while (isMoreToRead);
} }
}
} }

View file

@ -1,15 +1,14 @@
using System.Diagnostics; using System.Diagnostics;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
namespace v2rayN namespace v2rayN;
{ /*
/*
* See: * See:
* http://stackoverflow.com/questions/6266820/working-example-of-createjobobject-setinformationjobobject-pinvoke-in-net * http://stackoverflow.com/questions/6266820/working-example-of-createjobobject-setinformationjobobject-pinvoke-in-net
*/ */
public class Job : IDisposable public class Job : IDisposable
{ {
private IntPtr handle = IntPtr.Zero; private IntPtr handle = IntPtr.Zero;
public Job() public Job()
@ -113,24 +112,24 @@ namespace v2rayN
private static extern bool CloseHandle(IntPtr hObject); private static extern bool CloseHandle(IntPtr hObject);
#endregion Interop #endregion Interop
} }
#region Helper classes #region Helper classes
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
internal struct IO_COUNTERS internal struct IO_COUNTERS
{ {
public UInt64 ReadOperationCount; public UInt64 ReadOperationCount;
public UInt64 WriteOperationCount; public UInt64 WriteOperationCount;
public UInt64 OtherOperationCount; public UInt64 OtherOperationCount;
public UInt64 ReadTransferCount; public UInt64 ReadTransferCount;
public UInt64 WriteTransferCount; public UInt64 WriteTransferCount;
public UInt64 OtherTransferCount; public UInt64 OtherTransferCount;
} }
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
internal struct JOBOBJECT_BASIC_LIMIT_INFORMATION internal struct JOBOBJECT_BASIC_LIMIT_INFORMATION
{ {
public Int64 PerProcessUserTimeLimit; public Int64 PerProcessUserTimeLimit;
public Int64 PerJobUserTimeLimit; public Int64 PerJobUserTimeLimit;
public UInt32 LimitFlags; public UInt32 LimitFlags;
@ -140,29 +139,29 @@ namespace v2rayN
public UIntPtr Affinity; public UIntPtr Affinity;
public UInt32 PriorityClass; public UInt32 PriorityClass;
public UInt32 SchedulingClass; public UInt32 SchedulingClass;
} }
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
public struct SECURITY_ATTRIBUTES public struct SECURITY_ATTRIBUTES
{ {
public UInt32 nLength; public UInt32 nLength;
public IntPtr lpSecurityDescriptor; public IntPtr lpSecurityDescriptor;
public Int32 bInheritHandle; public Int32 bInheritHandle;
} }
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]
internal struct JOBOBJECT_EXTENDED_LIMIT_INFORMATION internal struct JOBOBJECT_EXTENDED_LIMIT_INFORMATION
{ {
public JOBOBJECT_BASIC_LIMIT_INFORMATION BasicLimitInformation; public JOBOBJECT_BASIC_LIMIT_INFORMATION BasicLimitInformation;
public IO_COUNTERS IoInfo; public IO_COUNTERS IoInfo;
public UIntPtr ProcessMemoryLimit; public UIntPtr ProcessMemoryLimit;
public UIntPtr JobMemoryLimit; public UIntPtr JobMemoryLimit;
public UIntPtr PeakProcessMemoryUsed; public UIntPtr PeakProcessMemoryUsed;
public UIntPtr PeakJobMemoryUsed; public UIntPtr PeakJobMemoryUsed;
} }
public enum JobObjectInfoType public enum JobObjectInfoType
{ {
AssociateCompletionPortInformation = 7, AssociateCompletionPortInformation = 7,
BasicLimitInformation = 2, BasicLimitInformation = 2,
BasicUIRestrictions = 4, BasicUIRestrictions = 4,
@ -170,7 +169,6 @@ namespace v2rayN
ExtendedLimitInformation = 9, ExtendedLimitInformation = 9,
SecurityLimitInformation = 5, SecurityLimitInformation = 5,
GroupInformation = 11 GroupInformation = 11
}
#endregion Helper classes
} }
#endregion Helper classes

View file

@ -3,10 +3,10 @@ using System.Text.Json;
using System.Text.Json.Nodes; using System.Text.Json.Nodes;
using System.Text.Json.Serialization; using System.Text.Json.Serialization;
namespace v2rayN namespace v2rayN;
internal class JsonUtils
{ {
internal class JsonUtils
{
/// <summary> /// <summary>
/// DeepCopy /// DeepCopy
/// </summary> /// </summary>
@ -130,5 +130,4 @@ namespace v2rayN
return -1; return -1;
} }
} }
}
} }

View file

@ -3,10 +3,10 @@ using NLog.Config;
using NLog.Targets; using NLog.Targets;
using System.IO; using System.IO;
namespace v2rayN namespace v2rayN;
public class Logging
{ {
public class Logging
{
public static void Setup() public static void Setup()
{ {
LoggingConfiguration config = new(); LoggingConfiguration config = new();
@ -74,5 +74,4 @@ namespace v2rayN
} }
} }
} }
}
} }

View file

@ -1,10 +1,10 @@
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using static v2rayN.Common.ProxySetting.InternetConnectionOption; using static v2rayN.Common.ProxySetting.InternetConnectionOption;
namespace v2rayN.Common namespace v2rayN.Common;
internal class ProxySetting
{ {
internal class ProxySetting
{
private const string _regPath = @"Software\Microsoft\Windows\CurrentVersion\Internet Settings"; private const string _regPath = @"Software\Microsoft\Windows\CurrentVersion\Internet Settings";
private static bool SetProxyFallback(string? strProxy, string? exceptions, int type) private static bool SetProxyFallback(string? strProxy, string? exceptions, int type)
@ -356,5 +356,4 @@ namespace v2rayN.Common
ref int lpcEntries // Number of entries written to the buffer ref int lpcEntries // Number of entries written to the buffer
); );
} }
}
} }

View file

@ -9,13 +9,13 @@ using ZXing.Common;
using ZXing.QrCode; using ZXing.QrCode;
using ZXing.Windows.Compatibility; using ZXing.Windows.Compatibility;
namespace v2rayN namespace v2rayN;
/// <summary>
/// 含有QR码的描述类和包装编码和渲染
/// </summary>
public class QRCodeHelper
{ {
/// <summary>
/// 含有QR码的描述类和包装编码和渲染
/// </summary>
public class QRCodeHelper
{
public static DrawingImage? GetQRCode(string? strContent) public static DrawingImage? GetQRCode(string? strContent)
{ {
if (strContent is null) if (strContent is null)
@ -100,5 +100,4 @@ namespace v2rayN
return new(96 / g.DpiX, 96 / g.DpiY); return new(96 / g.DpiX, 96 / g.DpiY);
} }
}
} }

View file

@ -1,10 +1,10 @@
using System.Linq.Expressions; using System.Linq.Expressions;
using System.Reflection; using System.Reflection;
namespace v2rayN namespace v2rayN;
public static class QueryableExtension
{ {
public static class QueryableExtension
{
public static IOrderedQueryable<T> OrderBy<T>(this IQueryable<T> query, string propertyName) public static IOrderedQueryable<T> OrderBy<T>(this IQueryable<T> query, string propertyName)
{ {
return _OrderBy<T>(query, propertyName, false); return _OrderBy<T>(query, propertyName, false);
@ -46,5 +46,4 @@ namespace v2rayN
return lambda; return lambda;
} }
}
} }

View file

@ -1,7 +1,7 @@
namespace v2rayN namespace v2rayN;
public class SemanticVersion
{ {
public class SemanticVersion
{
private int major; private int major;
private int minor; private int minor;
private int patch; private int patch;
@ -176,5 +176,4 @@
} }
#endregion Private #endregion Private
}
} }

View file

@ -1,10 +1,10 @@
using SQLite; using SQLite;
using System.Collections; using System.Collections;
namespace v2rayN namespace v2rayN;
public sealed class SQLiteHelper
{ {
public sealed class SQLiteHelper
{
private static readonly Lazy<SQLiteHelper> _instance = new(() => new()); private static readonly Lazy<SQLiteHelper> _instance = new(() => new());
public static SQLiteHelper Instance => _instance.Value; public static SQLiteHelper Instance => _instance.Value;
private string _connstr; private string _connstr;
@ -119,5 +119,4 @@ namespace v2rayN
{ {
return _dbAsync.Table<T>(); return _dbAsync.Table<T>();
} }
}
} }

View file

@ -1,10 +1,10 @@
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using System.IO; using System.IO;
namespace v2rayN namespace v2rayN;
internal static class StringEx
{ {
internal static class StringEx
{
public static bool IsNullOrEmpty([NotNullWhen(false)] this string? value) public static bool IsNullOrEmpty([NotNullWhen(false)] this string? value)
{ {
return string.IsNullOrEmpty(value); return string.IsNullOrEmpty(value);
@ -90,5 +90,4 @@ namespace v2rayN
return $"\"{value}\""; return $"\"{value}\"";
} }
}
} }

View file

@ -1,10 +1,10 @@
using Microsoft.Win32; using Microsoft.Win32;
using System.Windows; using System.Windows;
namespace v2rayN namespace v2rayN;
internal class UI
{ {
internal class UI
{
private static readonly string caption = "v2rayN"; private static readonly string caption = "v2rayN";
public static void Show(string msg) public static void Show(string msg)
@ -35,5 +35,4 @@ namespace v2rayN
return true; return true;
} }
}
} }

View file

@ -19,10 +19,10 @@ using System.Windows.Interop;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Media.Imaging; using System.Windows.Media.Imaging;
namespace v2rayN namespace v2rayN;
internal class Utils
{ {
internal class Utils
{
#region Json操作 #region Json操作
/// <summary> /// <summary>
@ -1126,5 +1126,4 @@ namespace v2rayN
public static extern int DwmSetWindowAttribute(IntPtr hwnd, DWMWINDOWATTRIBUTE attribute, ref int attributeValue, uint attributeSize); public static extern int DwmSetWindowAttribute(IntPtr hwnd, DWMWINDOWATTRIBUTE attribute, ref int attributeValue, uint attributeSize);
#endregion Windows API #endregion Windows API
}
} }

View file

@ -1,10 +1,10 @@
using YamlDotNet.Serialization; using YamlDotNet.Serialization;
using YamlDotNet.Serialization.NamingConventions; using YamlDotNet.Serialization.NamingConventions;
namespace v2rayN.Common namespace v2rayN.Common;
internal class YamlUtils
{ {
internal class YamlUtils
{
#region YAML #region YAML
/// <summary> /// <summary>
@ -54,5 +54,4 @@ namespace v2rayN.Common
} }
#endregion YAML #endregion YAML
}
} }

View file

@ -1,10 +1,10 @@
using System.Windows.Data; using System.Windows.Data;
using System.Windows.Media; using System.Windows.Media;
namespace v2rayN.Converters namespace v2rayN.Converters;
public class DelayColorConverter : IValueConverter
{ {
public class DelayColorConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{ {
int.TryParse(value.ToString(), out var delay); int.TryParse(value.ToString(), out var delay);
@ -21,5 +21,4 @@ namespace v2rayN.Converters
{ {
return null; return null;
} }
}
} }

View file

@ -1,11 +1,11 @@
using System.Globalization; using System.Globalization;
using System.Windows.Data; using System.Windows.Data;
namespace v2rayN.Converters namespace v2rayN.Converters;
[ValueConversion(typeof(bool), typeof(bool))]
public class InverseBooleanConverter : IValueConverter
{ {
[ValueConversion(typeof(bool), typeof(bool))]
public class InverseBooleanConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, CultureInfo culture) public object Convert(object value, Type targetType, object parameter, CultureInfo culture)
{ {
if (targetType != typeof(bool)) if (targetType != typeof(bool))
@ -20,5 +20,4 @@ namespace v2rayN.Converters
{ {
throw new NotImplementedException(); throw new NotImplementedException();
} }
}
} }

View file

@ -1,10 +1,10 @@
using System.Windows.Media; using System.Windows.Media;
using v2rayN.Handler; using v2rayN.Handler;
namespace v2rayN.Converters namespace v2rayN.Converters;
public class MaterialDesignFonts
{ {
public class MaterialDesignFonts
{
public static FontFamily MyFont { get; } public static FontFamily MyFont { get; }
static MaterialDesignFonts() static MaterialDesignFonts()
@ -23,5 +23,4 @@ namespace v2rayN.Converters
} }
MyFont ??= new FontFamily("Microsoft YaHei"); MyFont ??= new FontFamily("Microsoft YaHei");
} }
}
} }

View file

@ -1,7 +1,7 @@
namespace v2rayN.Enums namespace v2rayN.Enums;
public enum EConfigType
{ {
public enum EConfigType
{
VMess = 1, VMess = 1,
Custom = 2, Custom = 2,
Shadowsocks = 3, Shadowsocks = 3,
@ -12,5 +12,4 @@
Tuic = 8, Tuic = 8,
Wireguard = 9, Wireguard = 9,
Http = 10 Http = 10
}
} }

View file

@ -1,7 +1,7 @@
namespace v2rayN.Enums namespace v2rayN.Enums;
public enum ECoreType
{ {
public enum ECoreType
{
v2fly = 1, v2fly = 1,
Xray = 2, Xray = 2,
SagerNet = 3, SagerNet = 3,
@ -16,5 +16,4 @@
juicity = 25, juicity = 25,
hysteria2 = 26, hysteria2 = 26,
v2rayN = 99 v2rayN = 99
}
} }

View file

@ -1,11 +1,10 @@
namespace v2rayN.Enums namespace v2rayN.Enums;
public enum EGlobalHotkey
{ {
public enum EGlobalHotkey
{
ShowForm = 0, ShowForm = 0,
SystemProxyClear = 1, SystemProxyClear = 1,
SystemProxySet = 2, SystemProxySet = 2,
SystemProxyUnchanged = 3, SystemProxyUnchanged = 3,
SystemProxyPac = 4, SystemProxyPac = 4,
}
} }

View file

@ -1,7 +1,7 @@
namespace v2rayN.Enums namespace v2rayN.Enums;
public enum EInboundProtocol
{ {
public enum EInboundProtocol
{
socks = 0, socks = 0,
http, http,
socks2, socks2,
@ -10,5 +10,4 @@
api, api,
api2, api2,
speedtest = 21 speedtest = 21
}
} }

View file

@ -1,11 +1,10 @@
namespace v2rayN.Enums namespace v2rayN.Enums;
public enum EMove
{ {
public enum EMove
{
Top = 1, Top = 1,
Up = 2, Up = 2,
Down = 3, Down = 3,
Bottom = 4, Bottom = 4,
Position = 5 Position = 5
}
} }

View file

@ -1,10 +1,9 @@
namespace v2rayN.Enums namespace v2rayN.Enums;
public enum ERuleMode
{ {
public enum ERuleMode
{
Rule = 0, Rule = 0,
Global = 1, Global = 1,
Direct = 2, Direct = 2,
Unchanged = 3 Unchanged = 3
}
} }

View file

@ -1,7 +1,7 @@
namespace v2rayN.Enums namespace v2rayN.Enums;
public enum EServerColName
{ {
public enum EServerColName
{
def = 0, def = 0,
configType, configType,
remarks, remarks,
@ -17,5 +17,4 @@
todayUp, todayUp,
totalDown, totalDown,
totalUp totalUp
}
} }

View file

@ -1,10 +1,9 @@
namespace v2rayN.Enums namespace v2rayN.Enums;
public enum ESpeedActionType
{ {
public enum ESpeedActionType
{
Tcping, Tcping,
Realping, Realping,
Speedtest, Speedtest,
Mixedtest Mixedtest
}
} }

View file

@ -1,10 +1,9 @@
namespace v2rayN.Enums namespace v2rayN.Enums;
public enum ESysProxyType
{ {
public enum ESysProxyType
{
ForcedClear = 0, ForcedClear = 0,
ForcedChange = 1, ForcedChange = 1,
Unchanged = 2, Unchanged = 2,
Pac = 3 Pac = 3
}
} }

View file

@ -1,7 +1,7 @@
namespace v2rayN.Enums namespace v2rayN.Enums;
public enum ETransport
{ {
public enum ETransport
{
tcp, tcp,
kcp, kcp,
ws, ws,
@ -11,5 +11,4 @@
http, http,
quic, quic,
grpc grpc
}
} }

View file

@ -1,8 +1,7 @@
namespace v2rayN.Enums namespace v2rayN.Enums;
public enum EViewAction
{ {
public enum EViewAction
{
AdjustMainLvColWidth, AdjustMainLvColWidth,
ProfilesFocus ProfilesFocus
}
} }

View file

@ -1,9 +1,9 @@
using v2rayN.Enums; using v2rayN.Enums;
namespace v2rayN namespace v2rayN;
internal class Global
{ {
internal class Global
{
#region const #region const
public const string GithubUrl = "https://github.com"; public const string GithubUrl = "https://github.com";
@ -193,5 +193,4 @@ namespace v2rayN
public static readonly List<string> proxyVehicleType = new List<string> { "file", "http" }; public static readonly List<string> proxyVehicleType = new List<string> { "file", "http" };
#endregion const #endregion const
}
} }

View file

@ -8,21 +8,20 @@
// </auto-generated> // </auto-generated>
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
namespace v2rayN.Properties { namespace v2rayN.Properties;
using System;
/// <summary> /// <summary>
/// 一个强类型的资源类,用于查找本地化的字符串等。 /// 一个强类型的资源类,用于查找本地化的字符串等。
/// </summary> /// </summary>
// 此类是由 StronglyTypedResourceBuilder // 此类是由 StronglyTypedResourceBuilder
// 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。 // 类通过类似于 ResGen 或 Visual Studio 的工具自动生成的。
// 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen // 若要添加或移除成员,请编辑 .ResX 文件,然后重新运行 ResGen
// (以 /str 作为命令选项),或重新生成 VS 项目。 // (以 /str 作为命令选项),或重新生成 VS 项目。
[global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")] [global::System.CodeDom.Compiler.GeneratedCodeAttribute("System.Resources.Tools.StronglyTypedResourceBuilder", "17.0.0.0")]
[global::System.Diagnostics.DebuggerNonUserCodeAttribute()] [global::System.Diagnostics.DebuggerNonUserCodeAttribute()]
[global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()] [global::System.Runtime.CompilerServices.CompilerGeneratedAttribute()]
internal class Resources { internal class Resources {
private static global::System.Resources.ResourceManager resourceMan; private static global::System.Resources.ResourceManager resourceMan;
@ -219,5 +218,4 @@ namespace v2rayN.Properties {
return ((System.Drawing.Bitmap)(obj)); return ((System.Drawing.Bitmap)(obj));
} }
} }
}
} }

View file

@ -5,10 +5,10 @@ using System.IO.Compression;
using System.Text; using System.Text;
using System.Windows.Forms; using System.Windows.Forms;
namespace v2rayUpgrade namespace v2rayUpgrade;
public partial class MainForm : Form
{ {
public partial class MainForm : Form
{
private readonly string defaultFilename = "v2ray-windows.zip"; private readonly string defaultFilename = "v2ray-windows.zip";
private string? fileName; private string? fileName;
@ -143,5 +143,4 @@ namespace v2rayUpgrade
} }
return Path.Combine(startupPath, fileName); return Path.Combine(startupPath, fileName);
} }
}
} }

View file

@ -1,10 +1,10 @@
using System; using System;
using System.Windows.Forms; using System.Windows.Forms;
namespace v2rayUpgrade namespace v2rayUpgrade;
internal static class Program
{ {
internal static class Program
{
/// <summary> /// <summary>
/// 应用程序的主入口点。 /// 应用程序的主入口点。
/// </summary> /// </summary>
@ -17,5 +17,4 @@ namespace v2rayUpgrade
Application.SetCompatibleTextRenderingDefault(false); Application.SetCompatibleTextRenderingDefault(false);
Application.Run(new MainForm(args)); Application.Run(new MainForm(args));
} }
}
} }