Compare commits

..

25 Commits

Author SHA1 Message Date
2dust
24ccfb8077 up 7.11.0 2025-04-03 14:24:20 +08:00
2dust
204451db6c Bug fix
https://github.com/2dust/v2rayN/issues/7058
2025-04-03 14:22:12 +08:00
Pk-web6936
f553bbc41e Update Persian Translation (#7053) 2025-04-03 10:19:09 +08:00
2dust
8cb4f2f961 Adjusted the server configuration right-click menu 2025-04-02 15:53:28 +08:00
2dust
4d3db56065 csharp_style_namespace_declarations = file_scoped 2025-04-02 11:44:23 +08:00
NeonSweet
d92540121f Update proxy_set_linux_sh (#7042)
Co-authored-by: neonsweet <neonsweet@126.com>
2025-04-02 09:39:51 +08:00
2dust
17d586ea26 Update Directory.Packages.props 2025-03-31 15:05:07 +08:00
2dust
9a096d31fc Remove ads rules from default routing rules and DNS 2025-03-30 11:07:59 +08:00
2dust
bf83dbdfea Global setting ScrollViewer AllowAutoHide = False for desktop 2025-03-29 20:42:02 +08:00
2dust
e31cd0e199 Update Directory.Packages.props 2025-03-29 20:40:47 +08:00
2dust
1e11477e27 When add a new routing rule, add it to the top 2025-03-29 19:48:15 +08:00
2dust
e0750df96c Update v2rayN.sln 2025-03-29 19:40:32 +08:00
DHR60
e3580b05f7 add xray core leastPing support (#7023)
* add xray core leastPing support

* Refactor multi-server configuration UI logic

* Remove unused functions
2025-03-29 16:44:42 +08:00
patterniha
6ad0762731 set xray.location.cert to asset(bin) path (#7004)
* Update Global.cs

* Update CoreHandler.cs
2025-03-27 09:50:19 +08:00
2dust
70b05d7812 Update ResUI.fa-Ir.resx 2025-03-24 09:50:25 +08:00
Pk-web6936
5403fc9e21 Update ResUI.fa-Ir.resx (#6986)
Update Persian translate
2025-03-24 09:17:28 +08:00
dashi
5bffca9584 Update translate for ResUI.ru.resx (#6983)
It may contain spelling errors.
2025-03-24 09:17:11 +08:00
Pk-web6936
2060539c34 Update Persian translate (#6973)
Update Persian translate
2025-03-23 10:28:21 +08:00
2dust
de3cdb4f7e up Resx 2025-03-23 10:18:36 +08:00
2dust
2a4ba2a751 up Resx 2025-03-21 11:11:53 +08:00
dependabot[bot]
48747aabe0 Bump actions/upload-artifact from 4.6.1 to 4.6.2 (#6950)
Bumps [actions/upload-artifact](https://github.com/actions/upload-artifact) from 4.6.1 to 4.6.2.
- [Release notes](https://github.com/actions/upload-artifact/releases)
- [Commits](https://github.com/actions/upload-artifact/compare/v4.6.1...v4.6.2)

---
updated-dependencies:
- dependency-name: actions/upload-artifact
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-20 09:13:01 +08:00
2dust
7182be921d Update proxy_set_linux_sh
https://github.com/2dust/v2rayN/issues/6937
2025-03-19 10:04:06 +08:00
2dust
9d7dcd2c4f Update Directory.Packages.props 2025-03-19 10:03:55 +08:00
2dust
c3e56e84f1 Bug fix
https://github.com/2dust/v2rayN/issues/6932
2025-03-18 16:18:27 +08:00
dependabot[bot]
f1ef5a1f51 Bump actions/setup-dotnet from 4.3.0 to 4.3.1 (#6929)
Bumps [actions/setup-dotnet](https://github.com/actions/setup-dotnet) from 4.3.0 to 4.3.1.
- [Release notes](https://github.com/actions/setup-dotnet/releases)
- [Commits](https://github.com/actions/setup-dotnet/compare/v4.3.0...v4.3.1)

---
updated-dependencies:
- dependency-name: actions/setup-dotnet
  dependency-type: direct:production
  update-type: version-update:semver-patch
...

Signed-off-by: dependabot[bot] <support@github.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
2025-03-18 10:01:15 +08:00
213 changed files with 25167 additions and 24899 deletions

View File

@@ -32,7 +32,7 @@ jobs:
fetch-depth: '0'
- name: Setup
uses: actions/setup-dotnet@v4.3.0
uses: actions/setup-dotnet@v4.3.1
with:
dotnet-version: '8.0.x'
@@ -45,7 +45,7 @@ jobs:
dotnet publish ./AmazTool/AmazTool.csproj -c Release -r linux-arm64 --self-contained=true -p:PublishTrimmed=true -o $OutputPathArm64
- name: Upload build artifacts
uses: actions/upload-artifact@v4.6.1
uses: actions/upload-artifact@v4.6.2
with:
name: v2rayN-linux
path: |

View File

@@ -32,7 +32,7 @@ jobs:
fetch-depth: '0'
- name: Setup
uses: actions/setup-dotnet@v4.3.0
uses: actions/setup-dotnet@v4.3.1
with:
dotnet-version: '8.0.x'
@@ -45,7 +45,7 @@ jobs:
dotnet publish ./AmazTool/AmazTool.csproj -c Release -r osx-arm64 --self-contained=true -p:PublishTrimmed=true -o $OutputPathArm64
- name: Upload build artifacts
uses: actions/upload-artifact@v4.6.1
uses: actions/upload-artifact@v4.6.2
with:
name: v2rayN-macos
path: |

View File

@@ -32,7 +32,7 @@ jobs:
fetch-depth: '0'
- name: Setup
uses: actions/setup-dotnet@v4.3.0
uses: actions/setup-dotnet@v4.3.1
with:
dotnet-version: '8.0.x'
@@ -45,7 +45,7 @@ jobs:
dotnet publish ./AmazTool/AmazTool.csproj -c Release -r win-arm64 --self-contained=true -p:EnableWindowsTargeting=true -p:PublishTrimmed=true -o $OutputPathArm64
- name: Upload build artifacts
uses: actions/upload-artifact@v4.6.1
uses: actions/upload-artifact@v4.6.2
with:
name: v2rayN-windows-desktop
path: |

View File

@@ -30,7 +30,7 @@ jobs:
uses: actions/checkout@v4.2.2
- name: Setup
uses: actions/setup-dotnet@v4.3.0
uses: actions/setup-dotnet@v4.3.1
with:
dotnet-version: '8.0.x'
@@ -46,7 +46,7 @@ jobs:
- name: Upload build artifacts
uses: actions/upload-artifact@v4.6.1
uses: actions/upload-artifact@v4.6.2
with:
name: v2rayN-windows
path: |

View File

@@ -1,7 +1,7 @@
namespace AmazTool
namespace AmazTool;
internal static class Program
{
internal static class Program
{
[STAThread]
private static void Main(string[] args)
{
@@ -22,5 +22,4 @@ namespace AmazTool
UpgradeApp.Upgrade(argData);
}
}
}

View File

@@ -61,7 +61,7 @@ namespace AmazTool.Resx {
}
/// <summary>
/// 查找类似 Failed to terminate the v2rayN.Close it manually,or the upgrade may fail. 的本地化字符串。
/// 查找类似 Failed to terminate the v2rayN. Close it manually, or the upgrade may fail. 的本地化字符串。
/// </summary>
internal static string FailedTerminateProcess {
get {

View File

@@ -133,7 +133,7 @@
<value>Try to terminate the v2rayN process...</value>
</data>
<data name="FailedTerminateProcess" xml:space="preserve">
<value>Failed to terminate the v2rayN.Close it manually,or the upgrade may fail.</value>
<value>Failed to terminate the v2rayN. Close it manually, or the upgrade may fail.</value>
</data>
<data name="StartUnzipping" xml:space="preserve">
<value>Start extracting the update package...</value>

View File

@@ -133,7 +133,7 @@
<value>尝试结束 v2rayN 进程...</value>
</data>
<data name="FailedTerminateProcess" xml:space="preserve">
<value>请手动关闭正在运行的v2rayN否则可能升级失败。</value>
<value>请手动关闭正在运行的 v2rayN否则可能升级失败。</value>
</data>
<data name="StartUnzipping" xml:space="preserve">
<value>开始解压缩更新包...</value>

View File

@@ -0,0 +1,156 @@
<?xml version="1.0" encoding="utf-8"?>
<root>
<!--
Microsoft ResX Schema
Version 2.0
The primary goals of this format is to allow a simple XML format
that is mostly human readable. The generation and parsing of the
various data types are done through the TypeConverter classes
associated with the data types.
Example:
... ado.net/XML headers & schema ...
<resheader name="resmimetype">text/microsoft-resx</resheader>
<resheader name="version">2.0</resheader>
<resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
<resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
<data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
<data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
<data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
<value>[base64 mime encoded serialized .NET Framework object]</value>
</data>
<data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
<value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
<comment>This is a comment</comment>
</data>
There are any number of "resheader" rows that contain simple
name/value pairs.
Each data row contains a name, and value. The row also contains a
type or mimetype. Type corresponds to a .NET class that support
text/value conversion through the TypeConverter architecture.
Classes that don't support this are serialized and stored with the
mimetype set.
The mimetype is used for serialized objects, and tells the
ResXResourceReader how to depersist the object. This is currently not
extensible. For a given mimetype the value must be set accordingly:
Note - application/x-microsoft.net.object.binary.base64 is the format
that the ResXResourceWriter will generate, however the reader can
read any of the formats listed below.
mimetype: application/x-microsoft.net.object.binary.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.soap.base64
value : The object must be serialized with
: System.Runtime.Serialization.Formatters.Soap.SoapFormatter
: and then encoded with base64 encoding.
mimetype: application/x-microsoft.net.object.bytearray.base64
value : The object must be serialized into a byte array
: using a System.ComponentModel.TypeConverter
: and then encoded with base64 encoding.
-->
<xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
<xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
<xsd:element name="root" msdata:IsDataSet="true">
<xsd:complexType>
<xsd:choice maxOccurs="unbounded">
<xsd:element name="metadata">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" />
</xsd:sequence>
<xsd:attribute name="name" use="required" type="xsd:string" />
<xsd:attribute name="type" type="xsd:string" />
<xsd:attribute name="mimetype" type="xsd:string" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="assembly">
<xsd:complexType>
<xsd:attribute name="alias" type="xsd:string" />
<xsd:attribute name="name" type="xsd:string" />
</xsd:complexType>
</xsd:element>
<xsd:element name="data">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
<xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
<xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
<xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
<xsd:attribute ref="xml:space" />
</xsd:complexType>
</xsd:element>
<xsd:element name="resheader">
<xsd:complexType>
<xsd:sequence>
<xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
</xsd:sequence>
<xsd:attribute name="name" type="xsd:string" use="required" />
</xsd:complexType>
</xsd:element>
</xsd:choice>
</xsd:complexType>
</xsd:element>
</xsd:schema>
<resheader name="resmimetype">
<value>text/microsoft-resx</value>
</resheader>
<resheader name="version">
<value>2.0</value>
</resheader>
<resheader name="reader">
<value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<resheader name="writer">
<value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
</resheader>
<data name="Restartv2rayN" xml:space="preserve">
<value>正在重啟,請等待...</value>
</data>
<data name="Guidelines" xml:space="preserve">
<value>請從主應用程式運行。</value>
</data>
<data name="UpgradeFileNotFound" xml:space="preserve">
<value>升級失敗,檔案不存在。</value>
</data>
<data name="InProgress" xml:space="preserve">
<value>正在進行中,請等待...</value>
</data>
<data name="TryTerminateProcess" xml:space="preserve">
<value>嘗試結束 v2rayN 進程...</value>
</data>
<data name="FailedTerminateProcess" xml:space="preserve">
<value>請手動關閉正在執行的 v2rayN否則可能會升級失敗。</value>
</data>
<data name="StartUnzipping" xml:space="preserve">
<value>開始解壓縮更新包...</value>
</data>
<data name="SuccessUnzipping" xml:space="preserve">
<value>解壓縮更新包成功。</value>
</data>
<data name="FailedUnzipping" xml:space="preserve">
<value>解壓縮更新包失敗。</value>
</data>
<data name="FailedUpgrade" xml:space="preserve">
<value>升級失敗。</value>
</data>
<data name="SuccessUpgrade" xml:space="preserve">
<value>升級成功。</value>
</data>
<data name="Information" xml:space="preserve">
<value>提示</value>
</data>
</root>

View File

@@ -2,10 +2,10 @@ using System.Diagnostics;
using System.IO.Compression;
using System.Text;
namespace AmazTool
namespace AmazTool;
internal class UpgradeApp
{
internal class UpgradeApp
{
public static void Upgrade(string fileName)
{
Console.WriteLine($"{Resx.Resource.StartUnzipping}\n{fileName}");
@@ -113,5 +113,4 @@ namespace AmazTool
Utils.StartV2RayN();
}
}
}

View File

@@ -1,9 +1,9 @@
using System.Diagnostics;
namespace AmazTool
namespace AmazTool;
internal class Utils
{
internal class Utils
{
public static string GetExePath()
{
return Environment.ProcessPath ?? Process.GetCurrentProcess().MainModule?.FileName ?? string.Empty;
@@ -48,5 +48,4 @@ namespace AmazTool
Thread.Sleep(1000);
}
}
}
}

View File

@@ -1,14 +1,14 @@
<Project>
<PropertyGroup>
<Version>7.10.5</Version>
<Version>7.11.0</Version>
</PropertyGroup>
<PropertyGroup>
<TargetFramework>net8.0</TargetFramework>
<TargetLatestRuntimePatch>true</TargetLatestRuntimePatch>
<CheckForOverflowUnderflow>true</CheckForOverflowUnderflow>
<NoWarn>CA1031;CS1591;NU1507;CA1416</NoWarn>
<NoWarn>CA1031;CS1591;NU1507;CA1416;IDE0058</NoWarn>
<Nullable>annotations</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
<Authors>2dust</Authors>

View File

@@ -5,25 +5,25 @@
<CentralPackageVersionOverrideEnabled>false</CentralPackageVersionOverrideEnabled>
</PropertyGroup>
<ItemGroup>
<PackageVersion Include="Avalonia.Controls.DataGrid" Version="11.2.5" />
<PackageVersion Include="Avalonia.Desktop" Version="11.2.5" />
<PackageVersion Include="Avalonia.Diagnostics" Version="11.2.5" />
<PackageVersion Include="Avalonia.ReactiveUI" Version="11.2.5" />
<PackageVersion Include="Avalonia.Controls.DataGrid" Version="11.2.6" />
<PackageVersion Include="Avalonia.Desktop" Version="11.2.6" />
<PackageVersion Include="Avalonia.Diagnostics" Version="11.2.6" />
<PackageVersion Include="Avalonia.ReactiveUI" Version="11.2.6" />
<PackageVersion Include="CliWrap" Version="3.8.2" />
<PackageVersion Include="Downloader" Version="3.3.4" />
<PackageVersion Include="H.NotifyIcon.Wpf" Version="2.3.0" />
<PackageVersion Include="MaterialDesignThemes" Version="5.2.1" />
<PackageVersion Include="MessageBox.Avalonia" Version="3.2.0" />
<PackageVersion Include="QRCoder" Version="1.6.0" />
<PackageVersion Include="ReactiveUI" Version="20.1.63" />
<PackageVersion Include="ReactiveUI" Version="20.2.45" />
<PackageVersion Include="ReactiveUI.Fody" Version="19.5.41" />
<PackageVersion Include="ReactiveUI.WPF" Version="20.1.63" />
<PackageVersion Include="Semi.Avalonia" Version="11.2.1.5" />
<PackageVersion Include="Semi.Avalonia.DataGrid" Version="11.2.1.5" />
<PackageVersion Include="ReactiveUI.WPF" Version="20.2.45" />
<PackageVersion Include="Semi.Avalonia" Version="11.2.1.6" />
<PackageVersion Include="Semi.Avalonia.DataGrid" Version="11.2.1.6" />
<PackageVersion Include="Splat.NLog" Version="15.3.1" />
<PackageVersion Include="sqlite-net-pcl" Version="1.9.172" />
<PackageVersion Include="TaskScheduler" Version="2.12.1" />
<PackageVersion Include="WebDav.Client" Version="2.8.0" />
<PackageVersion Include="WebDav.Client" Version="2.9.0" />
<PackageVersion Include="YamlDotNet" Version="16.3.0" />
<PackageVersion Include="ZXing.Net.Bindings.SkiaSharp" Version="0.16.14" />
</ItemGroup>

View File

@@ -1,10 +1,9 @@
using ReactiveUI;
using ReactiveUI;
namespace ServiceLib.Base
namespace ServiceLib.Base;
public class MyReactiveObject : ReactiveObject
{
public class MyReactiveObject : ReactiveObject
{
protected static Config? _config;
protected Func<EViewAction, object?, Task<bool>>? _updateView;
}
}

View File

@@ -1,10 +1,10 @@
using System.Security.Cryptography;
using System.Text;
namespace ServiceLib.Common
namespace ServiceLib.Common;
public class AesUtils
{
public class AesUtils
{
private const int KeySize = 256; // AES-256
private const int IvSize = 16; // AES block size
private const int Iterations = 10000;
@@ -97,5 +97,4 @@ namespace ServiceLib.Common
rng.GetBytes(randomNumber);
return randomNumber;
}
}
}

View File

@@ -1,10 +1,10 @@
using System.Security.Cryptography;
using System.Text;
namespace ServiceLib.Common
namespace ServiceLib.Common;
public class DesUtils
{
public class DesUtils
{
/// <summary>
/// Encrypt
/// </summary>
@@ -71,5 +71,4 @@ namespace ServiceLib.Common
{
return Utils.GetMd5(Utils.GetHomePath() + "DesUtils");
}
}
}

View File

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

View File

@@ -2,10 +2,10 @@ using System.Formats.Tar;
using System.IO.Compression;
using System.Text;
namespace ServiceLib.Common
namespace ServiceLib.Common;
public static class FileManager
{
public static class FileManager
{
private static readonly string _tag = "FileManager";
public static bool ByteArrayToFile(string fileName, byte[] content)
@@ -223,5 +223,4 @@ namespace ServiceLib.Common
// ignored
}
}
}
}

View File

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

View File

@@ -1,8 +1,7 @@
using System.Diagnostics;
using System.Runtime.InteropServices;
namespace ServiceLib.Common
{
namespace ServiceLib.Common;
/*
* See:
* http://stackoverflow.com/questions/6266820/working-example-of-createjobobject-setinformationjobobject-pinvoke-in-net
@@ -178,4 +177,4 @@ namespace ServiceLib.Common
}
#endregion Helper classes
}

View File

@@ -1,11 +1,11 @@
using System.Text.Json;
using System.Text.Json;
using System.Text.Json.Nodes;
using System.Text.Json.Serialization;
namespace ServiceLib.Common
namespace ServiceLib.Common;
public class JsonUtils
{
public class JsonUtils
{
private static readonly string _tag = "JsonUtils";
/// <summary>
@@ -127,5 +127,4 @@ namespace ServiceLib.Common
/// <param name="obj"></param>
/// <returns></returns>
public static JsonNode? SerializeToNode(object? obj) => JsonSerializer.SerializeToNode(obj);
}
}

View File

@@ -2,10 +2,13 @@ using NLog;
using NLog.Config;
using NLog.Targets;
namespace ServiceLib.Common
namespace ServiceLib.Common;
public class Logging
{
public class Logging
{
private static readonly Logger _logger1 = LogManager.GetLogger("Log1");
private static readonly Logger _logger2 = LogManager.GetLogger("Log2");
public static void Setup()
{
LoggingConfiguration config = new();
@@ -32,7 +35,7 @@ namespace ServiceLib.Common
return;
}
LogManager.GetLogger("Log1").Info(strContent);
_logger1.Info(strContent);
}
public static void SaveLog(string strTitle, Exception ex)
@@ -42,13 +45,11 @@ namespace ServiceLib.Common
return;
}
var logger = LogManager.GetLogger("Log2");
logger.Debug($"{strTitle},{ex.Message}");
logger.Debug(ex.StackTrace);
_logger2.Debug($"{strTitle},{ex.Message}");
_logger2.Debug(ex.StackTrace);
if (ex?.InnerException != null)
{
logger.Error(ex.InnerException);
}
_logger2.Error(ex.InnerException);
}
}
}

View File

@@ -1,11 +1,11 @@
using QRCoder;
using QRCoder;
using SkiaSharp;
using ZXing.SkiaSharp;
namespace ServiceLib.Common
namespace ServiceLib.Common;
public class QRCodeHelper
{
public class QRCodeHelper
{
public static byte[]? GenQRCode(string? url)
{
using QRCodeGenerator qrGenerator = new();
@@ -86,5 +86,4 @@ namespace ServiceLib.Common
canvas.DrawBitmap(bmp, 0, 0);
return flipped;
}
}
}

View File

@@ -1,7 +1,7 @@
namespace ServiceLib.Common
namespace ServiceLib.Common;
public class SemanticVersion
{
public class SemanticVersion
{
private readonly int major;
private readonly int minor;
private readonly int patch;
@@ -183,5 +183,4 @@ namespace ServiceLib.Common
}
#endregion Private
}
}

View File

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

View File

@@ -1,9 +1,9 @@
using System.Diagnostics.CodeAnalysis;
namespace ServiceLib.Common
namespace ServiceLib.Common;
public static class StringEx
{
public static class StringEx
{
public static bool IsNullOrEmpty([NotNullWhen(false)] this string? value)
{
return string.IsNullOrEmpty(value) || string.IsNullOrWhiteSpace(value);
@@ -79,5 +79,4 @@ namespace ServiceLib.Common
{
return int.TryParse(value, out var result) ? result : defaultValue;
}
}
}

View File

@@ -11,10 +11,10 @@ using System.Text;
using CliWrap;
using CliWrap.Buffered;
namespace ServiceLib.Common
namespace ServiceLib.Common;
public class Utils
{
public class Utils
{
private static readonly string _tag = "Utils";
#region
@@ -862,5 +862,4 @@ namespace ServiceLib.Common
}
#endregion Platform
}
}

View File

@@ -2,10 +2,10 @@ using System.Security.Cryptography;
using System.Text;
using Microsoft.Win32;
namespace ServiceLib.Common
namespace ServiceLib.Common;
internal static class WindowsUtils
{
internal static class WindowsUtils
{
private static readonly string _tag = "WindowsUtils";
public static string? RegReadValue(string path, string name, string def)
@@ -70,5 +70,4 @@ namespace ServiceLib.Common
Logging.SaveLog(_tag, ex);
}
}
}
}

View File

@@ -2,10 +2,10 @@ using YamlDotNet.Core;
using YamlDotNet.Serialization;
using YamlDotNet.Serialization.NamingConventions;
namespace ServiceLib.Common
namespace ServiceLib.Common;
public class YamlUtils
{
public class YamlUtils
{
private static readonly string _tag = "YamlUtils";
#region YAML
@@ -76,5 +76,4 @@ namespace ServiceLib.Common
}
#endregion YAML
}
}

View File

@@ -1,7 +1,7 @@
namespace ServiceLib.Enums
namespace ServiceLib.Enums;
public enum EConfigType
{
public enum EConfigType
{
VMess = 1,
Custom = 2,
Shadowsocks = 3,
@@ -12,5 +12,4 @@
TUIC = 8,
WireGuard = 9,
HTTP = 10
}
}

View File

@@ -1,7 +1,7 @@
namespace ServiceLib.Enums
namespace ServiceLib.Enums;
public enum ECoreType
{
public enum ECoreType
{
v2fly = 1,
Xray = 2,
v2fly_v5 = 4,
@@ -15,5 +15,4 @@ namespace ServiceLib.Enums
brook = 27,
overtls = 28,
v2rayN = 99
}
}

View File

@@ -1,9 +1,8 @@
namespace ServiceLib.Enums
namespace ServiceLib.Enums;
public enum EGirdOrientation
{
public enum EGirdOrientation
{
Horizontal,
Vertical,
Tab,
}
}

View File

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

View File

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

View File

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

View File

@@ -1,11 +1,10 @@
namespace ServiceLib.Enums
namespace ServiceLib.Enums;
public enum EMsgCommand
{
public enum EMsgCommand
{
ClearMsg,
SendMsgView,
SendSnackMsg,
RefreshProfiles,
AppExit
}
}

View File

@@ -0,0 +1,9 @@
namespace ServiceLib.Enums;
public enum EMultipleLoad
{
Random,
RoundRobin,
LeastPing,
LeastLoad
}

View File

@@ -1,9 +1,8 @@
namespace ServiceLib.Enums
namespace ServiceLib.Enums;
public enum EPresetType
{
public enum EPresetType
{
Default = 0,
Russia = 1,
Iran = 2,
}
}

View File

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

View File

@@ -1,7 +1,7 @@
namespace ServiceLib.Enums
namespace ServiceLib.Enums;
public enum EServerColName
{
public enum EServerColName
{
Def = 0,
ConfigType,
Remarks,
@@ -17,5 +17,4 @@
TodayUp,
TotalDown,
TotalUp
}
}

View File

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

View File

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

View File

@@ -1,7 +1,7 @@
namespace ServiceLib.Enums
namespace ServiceLib.Enums;
public enum ETheme
{
public enum ETheme
{
FollowSystem,
Dark,
Light,
@@ -9,5 +9,4 @@
Desert,
Dusk,
NightSky
}
}

View File

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

View File

@@ -1,7 +1,7 @@
namespace ServiceLib.Enums
namespace ServiceLib.Enums;
public enum EViewAction
{
public enum EViewAction
{
CloseWindow,
ShowYesNo,
SaveFileDialog,
@@ -42,5 +42,4 @@
DispatcherCheckUpdate,
DispatcherCheckUpdateFinished,
DispatcherShowMsg,
}
}

View File

@@ -1,7 +1,7 @@
namespace ServiceLib
namespace ServiceLib;
public class Global
{
public class Global
{
#region const
public const string AppName = "v2rayN";
@@ -72,6 +72,7 @@ namespace ServiceLib
public const string LocalAppData = "V2RAYN_LOCAL_APPLICATION_DATA_V2";
public const string V2RayLocalAsset = "V2RAY_LOCATION_ASSET";
public const string XrayLocalAsset = "XRAY_LOCATION_ASSET";
public const string XrayLocalCert = "XRAY_LOCATION_CERT";
public const int SpeedTestPageSize = 1000;
public const string LinuxBash = "/bin/bash";
@@ -519,5 +520,4 @@ namespace ServiceLib
];
#endregion const
}
}

View File

@@ -1,7 +1,7 @@
namespace ServiceLib.Handler
namespace ServiceLib.Handler;
public sealed class AppHandler
{
public sealed class AppHandler
{
#region Property
private static readonly Lazy<AppHandler> _instance = new(() => new());
@@ -80,6 +80,10 @@ namespace ServiceLib.Handler
Logging.SaveLog($"v2rayN start up | {Utils.GetRuntimeInfo()}");
Logging.LoggingEnabled(_config.GuiItem.EnableLog);
//First determine the port value
_ = StatePort;
_ = StatePort2;
return true;
}
@@ -240,5 +244,4 @@ namespace ServiceLib.Handler
}
#endregion Core Type
}
}

View File

@@ -1,10 +1,10 @@
using System.Security.Principal;
using System.Text.RegularExpressions;
namespace ServiceLib.Handler
namespace ServiceLib.Handler;
public static class AutoStartupHandler
{
public static class AutoStartupHandler
{
private static readonly string _tag = "AutoStartupHandler";
public static async Task<bool> UpdateTask(Config config)
@@ -238,5 +238,4 @@ namespace ServiceLib.Handler
}
#endregion macOS
}
}

View File

@@ -1,9 +1,9 @@
using static ServiceLib.Models.ClashProxies;
namespace ServiceLib.Handler
namespace ServiceLib.Handler;
public sealed class ClashApiHandler
{
public sealed class ClashApiHandler
{
private static readonly Lazy<ClashApiHandler> instance = new(() => new());
public static ClashApiHandler Instance => instance.Value;
@@ -184,5 +184,4 @@ namespace ServiceLib.Handler
{
return $"{Global.HttpProtocol}{Global.Loopback}:{AppHandler.Instance.StatePort2}";
}
}
}

View File

@@ -1,13 +1,13 @@
using System.Data;
using System.Text.RegularExpressions;
namespace ServiceLib.Handler
namespace ServiceLib.Handler;
/// <summary>
/// 本软件配置文件处理类
/// </summary>
public class ConfigHandler
{
/// <summary>
/// 本软件配置文件处理类
/// </summary>
public class ConfigHandler
{
private static readonly string _configRes = Global.ConfigFileName;
private static readonly string _tag = "ConfigHandler";
@@ -1005,12 +1005,12 @@ namespace ServiceLib.Handler
return 0;
}
public static async Task<RetResult> AddCustomServer4Multiple(Config config, List<ProfileItem> selecteds, ECoreType coreType)
public static async Task<RetResult> AddCustomServer4Multiple(Config config, List<ProfileItem> selecteds, ECoreType coreType, EMultipleLoad multipleLoad)
{
var indexId = Utils.GetMd5(Global.CoreMultipleLoadConfigFileName);
var configPath = Utils.GetConfigPath(Global.CoreMultipleLoadConfigFileName);
var result = await CoreConfigHandler.GenerateClientMultipleLoadConfig(config, configPath, selecteds, coreType);
var result = await CoreConfigHandler.GenerateClientMultipleLoadConfig(config, configPath, selecteds, coreType, multipleLoad);
if (result.Success != true)
{
return result;
@@ -1023,7 +1023,14 @@ namespace ServiceLib.Handler
var profileItem = await AppHandler.Instance.GetProfileItem(indexId) ?? new();
profileItem.IndexId = indexId;
profileItem.Remarks = coreType == ECoreType.sing_box ? ResUI.menuSetDefaultMultipleServer : ResUI.menuSetDefaultLoadBalanceServer;
profileItem.Remarks = multipleLoad switch
{
EMultipleLoad.Random => ResUI.menuSetDefaultMultipleServerXrayRandom,
EMultipleLoad.RoundRobin => ResUI.menuSetDefaultMultipleServerXrayRoundRobin,
EMultipleLoad.LeastPing => ResUI.menuSetDefaultMultipleServerXrayLeastPing,
EMultipleLoad.LeastLoad => ResUI.menuSetDefaultMultipleServerXrayLeastLoad,
_ => ResUI.menuSetDefaultMultipleServerXrayRoundRobin,
};
profileItem.Address = Global.CoreMultipleLoadConfigFileName;
profileItem.ConfigType = EConfigType.Custom;
profileItem.CoreType = coreType;
@@ -1915,5 +1922,4 @@ namespace ServiceLib.Handler
}
#endregion Regional Presets
}
}

View File

@@ -1,10 +1,10 @@
namespace ServiceLib.Handler
namespace ServiceLib.Handler;
/// <summary>
/// Core configuration file processing class
/// </summary>
public class CoreConfigHandler
{
/// <summary>
/// Core configuration file processing class
/// </summary>
public class CoreConfigHandler
{
private static readonly string _tag = "CoreConfigHandler";
public static async Task<RetResult> GenerateClientConfig(ProfileItem node, string? fileName)
@@ -133,16 +133,16 @@ namespace ServiceLib.Handler
return result;
}
public static async Task<RetResult> GenerateClientMultipleLoadConfig(Config config, string fileName, List<ProfileItem> selecteds, ECoreType coreType)
public static async Task<RetResult> GenerateClientMultipleLoadConfig(Config config, string fileName, List<ProfileItem> selecteds, ECoreType coreType, EMultipleLoad multipleLoad)
{
var result = new RetResult();
if (coreType == ECoreType.sing_box)
{
result = await new CoreConfigSingboxService(config).GenerateClientMultipleLoadConfig(selecteds);
}
else if (coreType == ECoreType.Xray)
else
{
result = await new CoreConfigV2rayService(config).GenerateClientMultipleLoadConfig(selecteds);
result = await new CoreConfigV2rayService(config).GenerateClientMultipleLoadConfig(selecteds, multipleLoad);
}
if (result.Success != true)
@@ -152,5 +152,4 @@ namespace ServiceLib.Handler
await File.WriteAllTextAsync(fileName, result.Data.ToString());
return result;
}
}
}

View File

@@ -1,13 +1,13 @@
using System.Diagnostics;
using System.Text;
namespace ServiceLib.Handler
namespace ServiceLib.Handler;
/// <summary>
/// Core process processing class
/// </summary>
public class CoreHandler
{
/// <summary>
/// Core process processing class
/// </summary>
public class CoreHandler
{
private static readonly Lazy<CoreHandler> _instance = new(() => new());
public static CoreHandler Instance => _instance.Value;
private Config _config;
@@ -24,6 +24,7 @@ namespace ServiceLib.Handler
Environment.SetEnvironmentVariable(Global.V2RayLocalAsset, Utils.GetBinPath(""), EnvironmentVariableTarget.Process);
Environment.SetEnvironmentVariable(Global.XrayLocalAsset, Utils.GetBinPath(""), EnvironmentVariableTarget.Process);
Environment.SetEnvironmentVariable(Global.XrayLocalCert, Utils.GetBinPath(""), EnvironmentVariableTarget.Process);
//Copy the bin folder to the storage location (for init)
if (Environment.GetEnvironmentVariable(Global.LocalAppData) == "1")
@@ -405,5 +406,4 @@ namespace ServiceLib.Handler
}
#endregion Linux
}
}

View File

@@ -1,7 +1,7 @@
namespace ServiceLib.Handler
namespace ServiceLib.Handler;
public sealed class CoreInfoHandler
{
public sealed class CoreInfoHandler
{
private static readonly Lazy<CoreInfoHandler> _instance = new(() => new());
private List<CoreInfo>? _coreInfo;
public static CoreInfoHandler Instance => _instance.Value;
@@ -214,5 +214,4 @@ namespace ServiceLib.Handler
{
return $"{Global.GithubUrl}/{Global.CoreUrls[eCoreType]}/releases";
}
}
}

View File

@@ -1,9 +1,9 @@
using System.Collections.Specialized;
namespace ServiceLib.Handler.Fmt
namespace ServiceLib.Handler.Fmt;
public class BaseFmt
{
public class BaseFmt
{
protected static string GetIpv6(string address)
{
if (Utils.IsIpv6(address))
@@ -238,5 +238,4 @@ namespace ServiceLib.Handler.Fmt
var url = $"{Utils.UrlEncode(userInfo)}@{GetIpv6(address)}:{port}";
return $"{Global.ProtocolShares[eConfigType]}{url}{query}{remark}";
}
}
}

View File

@@ -1,7 +1,7 @@
namespace ServiceLib.Handler.Fmt
namespace ServiceLib.Handler.Fmt;
public class ClashFmt : BaseFmt
{
public class ClashFmt : BaseFmt
{
public static ProfileItem? ResolveFull(string strData, string? subRemarks)
{
if (Contains(strData, "port", "socks-port", "proxies"))
@@ -19,5 +19,4 @@
return null;
}
}
}

View File

@@ -1,7 +1,7 @@
namespace ServiceLib.Handler.Fmt
namespace ServiceLib.Handler.Fmt;
public class FmtHandler
{
public class FmtHandler
{
private static readonly string _tag = "FmtHandler";
public static string? GetShareUri(ProfileItem item)
@@ -88,5 +88,4 @@
return null;
}
}
}
}

View File

@@ -1,7 +1,7 @@
namespace ServiceLib.Handler.Fmt
namespace ServiceLib.Handler.Fmt;
public class Hysteria2Fmt : BaseFmt
{
public class Hysteria2Fmt : BaseFmt
{
public static ProfileItem? Resolve(string str, out string msg)
{
msg = ResUI.ConfigurationFormatIncorrect;
@@ -98,5 +98,4 @@ namespace ServiceLib.Handler.Fmt
return null;
}
}
}

View File

@@ -1,7 +1,7 @@
namespace ServiceLib.Handler.Fmt
namespace ServiceLib.Handler.Fmt;
public class NaiveproxyFmt : BaseFmt
{
public class NaiveproxyFmt : BaseFmt
{
public static ProfileItem? ResolveFull(string strData, string? subRemarks)
{
if (Contains(strData, "listen", "proxy", "<html>", "<body>"))
@@ -19,5 +19,4 @@
return null;
}
}
}

View File

@@ -1,9 +1,9 @@
using System.Text.RegularExpressions;
namespace ServiceLib.Handler.Fmt
namespace ServiceLib.Handler.Fmt;
public class ShadowsocksFmt : BaseFmt
{
public class ShadowsocksFmt : BaseFmt
{
public static ProfileItem? Resolve(string str, out string msg)
{
msg = ResUI.ConfigurationFormatIncorrect;
@@ -176,5 +176,4 @@ namespace ServiceLib.Handler.Fmt
}
return null;
}
}
}

View File

@@ -1,7 +1,7 @@
namespace ServiceLib.Handler.Fmt
namespace ServiceLib.Handler.Fmt;
public class SingboxFmt : BaseFmt
{
public class SingboxFmt : BaseFmt
{
public static List<ProfileItem>? ResolveFullArray(string strData, string? subRemarks)
{
var configObjects = JsonUtils.Deserialize<object[]>(strData);
@@ -44,5 +44,4 @@ namespace ServiceLib.Handler.Fmt
return profileItem;
}
}
}

View File

@@ -1,7 +1,7 @@
namespace ServiceLib.Handler.Fmt
namespace ServiceLib.Handler.Fmt;
public class SocksFmt : BaseFmt
{
public class SocksFmt : BaseFmt
{
public static ProfileItem? Resolve(string str, out string msg)
{
msg = ResUI.ConfigurationFormatIncorrect;
@@ -111,5 +111,4 @@ namespace ServiceLib.Handler.Fmt
return item;
}
}
}

View File

@@ -1,7 +1,7 @@
namespace ServiceLib.Handler.Fmt
namespace ServiceLib.Handler.Fmt;
public class TrojanFmt : BaseFmt
{
public class TrojanFmt : BaseFmt
{
public static ProfileItem? Resolve(string str, out string msg)
{
msg = ResUI.ConfigurationFormatIncorrect;
@@ -44,5 +44,4 @@ namespace ServiceLib.Handler.Fmt
return ToUri(EConfigType.Trojan, item.Address, item.Port, item.Id, dicQuery, remark);
}
}
}

View File

@@ -1,7 +1,7 @@
namespace ServiceLib.Handler.Fmt
namespace ServiceLib.Handler.Fmt;
public class TuicFmt : BaseFmt
{
public class TuicFmt : BaseFmt
{
public static ProfileItem? Resolve(string str, out string msg)
{
msg = ResUI.ConfigurationFormatIncorrect;
@@ -60,5 +60,4 @@ namespace ServiceLib.Handler.Fmt
return ToUri(EConfigType.TUIC, item.Address, item.Port, $"{item.Id}:{item.Security}", dicQuery, remark);
}
}
}

View File

@@ -1,7 +1,7 @@
namespace ServiceLib.Handler.Fmt
namespace ServiceLib.Handler.Fmt;
public class V2rayFmt : BaseFmt
{
public class V2rayFmt : BaseFmt
{
public static List<ProfileItem>? ResolveFullArray(string strData, string? subRemarks)
{
var configObjects = JsonUtils.Deserialize<object[]>(strData);
@@ -45,5 +45,4 @@ namespace ServiceLib.Handler.Fmt
return profileItem;
}
}
}

View File

@@ -1,7 +1,7 @@
namespace ServiceLib.Handler.Fmt
namespace ServiceLib.Handler.Fmt;
public class VLESSFmt : BaseFmt
{
public class VLESSFmt : BaseFmt
{
public static ProfileItem? Resolve(string str, out string msg)
{
msg = ResUI.ConfigurationFormatIncorrect;
@@ -56,5 +56,4 @@ namespace ServiceLib.Handler.Fmt
return ToUri(EConfigType.VLESS, item.Address, item.Port, item.Id, dicQuery, remark);
}
}
}

View File

@@ -1,7 +1,7 @@
namespace ServiceLib.Handler.Fmt
namespace ServiceLib.Handler.Fmt;
public class VmessFmt : BaseFmt
{
public class VmessFmt : BaseFmt
{
public static ProfileItem? Resolve(string str, out string msg)
{
msg = ResUI.ConfigurationFormatIncorrect;
@@ -122,5 +122,4 @@ namespace ServiceLib.Handler.Fmt
return item;
}
}
}

View File

@@ -1,7 +1,7 @@
namespace ServiceLib.Handler.Fmt
namespace ServiceLib.Handler.Fmt;
public class WireguardFmt : BaseFmt
{
public class WireguardFmt : BaseFmt
{
public static ProfileItem? Resolve(string str, out string msg)
{
msg = ResUI.ConfigurationFormatIncorrect;
@@ -64,5 +64,4 @@ namespace ServiceLib.Handler.Fmt
}
return ToUri(EConfigType.WireGuard, item.Address, item.Port, item.Id, dicQuery, remark);
}
}
}

View File

@@ -1,9 +1,9 @@
using ReactiveUI;
using ReactiveUI;
namespace ServiceLib.Handler
namespace ServiceLib.Handler;
public class NoticeHandler
{
public class NoticeHandler
{
private static readonly Lazy<NoticeHandler> _instance = new(() => new());
public static NoticeHandler Instance => _instance.Value;
@@ -40,5 +40,4 @@ namespace ServiceLib.Handler
Enqueue(msg);
SendMessage(msg);
}
}
}

View File

@@ -1,10 +1,10 @@
using System.Net.Sockets;
using System.Text;
namespace ServiceLib.Handler
namespace ServiceLib.Handler;
public class PacHandler
{
public class PacHandler
{
private static string _configPath;
private static int _httpPort;
private static int _pacPort;
@@ -111,5 +111,4 @@ namespace ServiceLib.Handler
// ignored
}
}
}
}

View File

@@ -2,10 +2,10 @@ using System.Collections.Concurrent;
//using System.Reactive.Linq;
namespace ServiceLib.Handler
namespace ServiceLib.Handler;
public class ProfileExHandler
{
public class ProfileExHandler
{
private static readonly Lazy<ProfileExHandler> _instance = new(() => new());
private ConcurrentBag<ProfileExItem> _lstProfileEx = [];
private readonly Queue<string> _queIndexIds = new();
@@ -178,5 +178,4 @@ namespace ServiceLib.Handler
}
return _lstProfileEx.Max(t => t == null ? 0 : t.Sort);
}
}
}

View File

@@ -1,7 +1,7 @@
namespace ServiceLib.Handler
namespace ServiceLib.Handler;
public class StatisticsHandler
{
public class StatisticsHandler
{
private static readonly Lazy<StatisticsHandler> instance = new(() => new());
public static StatisticsHandler Instance => instance.Value;
@@ -160,5 +160,4 @@
_serverStatItem.DateNow = ticks;
}
}
}
}

View File

@@ -1,7 +1,7 @@
namespace ServiceLib.Handler.SysProxy
namespace ServiceLib.Handler.SysProxy;
public class ProxySettingLinux
{
public class ProxySettingLinux
{
private static readonly string _proxySetFileName = $"{Global.ProxySetLinuxShellFileName.Replace(Global.NamespaceSample, "")}.sh";
public static async Task SetProxy(string host, int port, string exceptions)
@@ -29,5 +29,4 @@ namespace ServiceLib.Handler.SysProxy
await Utils.GetCliWrapOutput(fileName, args);
}
}
}

View File

@@ -1,7 +1,7 @@
namespace ServiceLib.Handler.SysProxy
namespace ServiceLib.Handler.SysProxy;
public class ProxySettingOSX
{
public class ProxySettingOSX
{
private static readonly string _proxySetFileName = $"{Global.ProxySetOSXShellFileName.Replace(Global.NamespaceSample, "")}.sh";
public static async Task SetProxy(string host, int port, string exceptions)
@@ -34,5 +34,4 @@ namespace ServiceLib.Handler.SysProxy
await Utils.GetCliWrapOutput(fileName, args);
}
}
}

View File

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

View File

@@ -1,7 +1,7 @@
namespace ServiceLib.Handler.SysProxy
namespace ServiceLib.Handler.SysProxy;
public static class SysProxyHandler
{
public static class SysProxyHandler
{
private static readonly string _tag = "SysProxyHandler";
public static async Task<bool> UpdateSysProxy(Config config, bool forceDisable)
@@ -95,5 +95,4 @@
var strProxy = $"{Global.HttpProtocol}{Global.Loopback}:{portPac}/pac?t={DateTime.Now.Ticks}";
ProxySettingWindows.SetProxy(strProxy, "", 4);
}
}
}

View File

@@ -1,7 +1,7 @@
namespace ServiceLib.Handler
namespace ServiceLib.Handler;
public class TaskHandler
{
public class TaskHandler
{
private static readonly Lazy<TaskHandler> _instance = new(() => new());
public static TaskHandler Instance => _instance.Value;
@@ -94,5 +94,4 @@ namespace ServiceLib.Handler
});
}
}
}
}

View File

@@ -1,10 +1,10 @@
using System.Net;
using WebDav;
namespace ServiceLib.Handler
namespace ServiceLib.Handler;
public sealed class WebDavHandler
{
public sealed class WebDavHandler
{
private static readonly Lazy<WebDavHandler> _instance = new(() => new());
public static WebDavHandler Instance => _instance.Value;
@@ -178,5 +178,4 @@ namespace ServiceLib.Handler
}
public string GetLastError() => _lastDescription ?? string.Empty;
}
}

View File

@@ -1,11 +1,10 @@
namespace ServiceLib.Models
namespace ServiceLib.Models;
public class CheckUpdateModel
{
public class CheckUpdateModel
{
public bool? IsSelected { get; set; }
public string? CoreType { get; set; }
public string? Remarks { get; set; }
public string? FileName { get; set; }
public bool? IsFinished { get; set; }
}
}

View File

@@ -1,7 +1,7 @@
namespace ServiceLib.Models
namespace ServiceLib.Models;
public class ClashConnectionModel
{
public class ClashConnectionModel
{
public string? Id { get; set; }
public string? Network { get; set; }
public string? Type { get; set; }
@@ -13,5 +13,4 @@
public double Time { get; set; }
public string? Elapsed { get; set; }
public string? Chain { get; set; }
}
}

View File

@@ -1,14 +1,14 @@
namespace ServiceLib.Models
namespace ServiceLib.Models;
public class ClashConnections
{
public class ClashConnections
{
public ulong downloadTotal { get; set; }
public ulong uploadTotal { get; set; }
public List<ConnectionItem>? connections { get; set; }
}
}
public class ConnectionItem
{
public class ConnectionItem
{
public string? id { get; set; }
public MetadataItem? metadata { get; set; }
public ulong upload { get; set; }
@@ -17,10 +17,10 @@
public List<string>? chains { get; set; }
public string? rule { get; set; }
public string? rulePayload { get; set; }
}
}
public class MetadataItem
{
public class MetadataItem
{
public string? network { get; set; }
public string? type { get; set; }
public string? sourceIP { get; set; }
@@ -33,5 +33,4 @@
public string? process { get; set; }
public string? processPath { get; set; }
public string? remoteDestination { get; set; }
}
}

View File

@@ -1,9 +1,9 @@
using static ServiceLib.Models.ClashProxies;
using static ServiceLib.Models.ClashProxies;
namespace ServiceLib.Models
namespace ServiceLib.Models;
public class ClashProviders
{
public class ClashProviders
{
public Dictionary<string, ProvidersItem>? providers { get; set; }
public class ProvidersItem
@@ -13,5 +13,4 @@ namespace ServiceLib.Models
public string? type { get; set; }
public string? vehicleType { get; set; }
}
}
}

View File

@@ -1,7 +1,7 @@
namespace ServiceLib.Models
namespace ServiceLib.Models;
public class ClashProxies
{
public class ClashProxies
{
public Dictionary<string, ProxiesItem>? proxies { get; set; }
public class ProxiesItem
@@ -20,5 +20,4 @@
public string? time { get; set; }
public int delay { get; set; }
}
}
}

View File

@@ -1,8 +1,8 @@
namespace ServiceLib.Models
namespace ServiceLib.Models;
[Serializable]
public class ClashProxyModel
{
[Serializable]
public class ClashProxyModel
{
public string? Name { get; set; }
public string? Type { get; set; }
@@ -14,5 +14,4 @@
public string? DelayName { get; set; }
public bool IsActive { get; set; }
}
}

View File

@@ -1,8 +1,7 @@
namespace ServiceLib.Models
namespace ServiceLib.Models;
public class CmdItem
{
public class CmdItem
{
public string? Cmd { get; set; }
public List<string>? Arguments { get; set; }
}
}

View File

@@ -1,7 +1,7 @@
namespace ServiceLib.Models
namespace ServiceLib.Models;
public class ComboItem
{
public class ComboItem
{
public string? ID
{
get; set;
@@ -11,5 +11,4 @@
{
get; set;
}
}
}

View File

@@ -1,11 +1,11 @@
namespace ServiceLib.Models
namespace ServiceLib.Models;
/// <summary>
/// 本软件配置文件实体类
/// </summary>
[Serializable]
public class Config
{
/// <summary>
/// 本软件配置文件实体类
/// </summary>
[Serializable]
public class Config
{
#region property
public string IndexId { get; set; }
@@ -53,5 +53,4 @@
public List<CoreTypeItem> CoreTypeItem { get; set; }
#endregion other entities
}
}

View File

@@ -1,8 +1,8 @@
namespace ServiceLib.Models
namespace ServiceLib.Models;
[Serializable]
public class CoreBasicItem
{
[Serializable]
public class CoreBasicItem
{
public bool LogEnabled { get; set; }
public string Loglevel { get; set; }
@@ -18,11 +18,11 @@ namespace ServiceLib.Models
public bool EnableFragment { get; set; }
public bool EnableCacheFile4Sbox { get; set; } = true;
}
}
[Serializable]
public class InItem
{
[Serializable]
public class InItem
{
public int LocalPort { get; set; }
public string Protocol { get; set; }
public bool UdpEnabled { get; set; }
@@ -34,11 +34,11 @@ namespace ServiceLib.Models
public string User { get; set; }
public string Pass { get; set; }
public bool SecondLocalPortEnabled { get; set; }
}
}
[Serializable]
public class KcpItem
{
[Serializable]
public class KcpItem
{
public int Mtu { get; set; }
public int Tti { get; set; }
@@ -52,20 +52,20 @@ namespace ServiceLib.Models
public int ReadBufferSize { get; set; }
public int WriteBufferSize { get; set; }
}
}
[Serializable]
public class GrpcItem
{
[Serializable]
public class GrpcItem
{
public int? IdleTimeout { get; set; }
public int? HealthCheckTimeout { get; set; }
public bool? PermitWithoutStream { get; set; }
public int? InitialWindowsSize { get; set; }
}
}
[Serializable]
public class GUIItem
{
[Serializable]
public class GUIItem
{
public bool AutoRun { get; set; }
public bool EnableStatistics { get; set; }
public bool DisplayRealTimeSpeed { get; set; }
@@ -75,18 +75,18 @@ namespace ServiceLib.Models
public int TrayMenuServersLimit { get; set; } = 20;
public bool EnableHWA { get; set; } = false;
public bool EnableLog { get; set; } = true;
}
}
[Serializable]
public class MsgUIItem
{
[Serializable]
public class MsgUIItem
{
public string? MainMsgFilter { get; set; }
public bool? AutoRefresh { get; set; }
}
}
[Serializable]
public class UIItem
{
[Serializable]
public class UIItem
{
public bool EnableAutoAdjustMainLvColWidth { get; set; }
public bool EnableUpdateSubOnlyRemarksExist { get; set; }
public double MainWidth { get; set; }
@@ -105,20 +105,20 @@ namespace ServiceLib.Models
public bool Hide2TrayWhenClose { get; set; }
public List<ColumnItem> MainColumnItem { get; set; }
public bool ShowInTaskbar { get; set; }
}
}
[Serializable]
public class ConstItem
{
[Serializable]
public class ConstItem
{
public string? SubConvertUrl { get; set; }
public string? GeoSourceUrl { get; set; }
public string? SrsSourceUrl { get; set; }
public string? RouteRulesTemplateSourceUrl { get; set; }
}
}
[Serializable]
public class KeyEventItem
{
[Serializable]
public class KeyEventItem
{
public EGlobalHotkey EGlobalHotkey { get; set; }
public bool Alt { get; set; }
@@ -128,19 +128,19 @@ namespace ServiceLib.Models
public bool Shift { get; set; }
public int? KeyCode { get; set; }
}
}
[Serializable]
public class CoreTypeItem
{
[Serializable]
public class CoreTypeItem
{
public EConfigType ConfigType { get; set; }
public ECoreType CoreType { get; set; }
}
}
[Serializable]
public class TunModeItem
{
[Serializable]
public class TunModeItem
{
public bool EnableTun { get; set; }
public bool StrictRoute { get; set; } = true;
public string Stack { get; set; }
@@ -148,61 +148,61 @@ namespace ServiceLib.Models
public bool EnableExInbound { get; set; }
public bool EnableIPv6Address { get; set; }
public string? LinuxSudoPwd { get; set; }
}
}
[Serializable]
public class SpeedTestItem
{
[Serializable]
public class SpeedTestItem
{
public int SpeedTestTimeout { get; set; }
public string SpeedTestUrl { get; set; }
public string SpeedPingTestUrl { get; set; }
public int MixedConcurrencyCount { get; set; }
}
}
[Serializable]
public class RoutingBasicItem
{
[Serializable]
public class RoutingBasicItem
{
public string DomainStrategy { get; set; }
public string DomainStrategy4Singbox { get; set; }
public string DomainMatcher { get; set; }
public string RoutingIndexId { get; set; }
}
}
[Serializable]
public class ColumnItem
{
[Serializable]
public class ColumnItem
{
public string Name { get; set; }
public int Width { get; set; }
public int Index { get; set; }
}
}
[Serializable]
public class Mux4RayItem
{
[Serializable]
public class Mux4RayItem
{
public int? Concurrency { get; set; }
public int? XudpConcurrency { get; set; }
public string? XudpProxyUDP443 { get; set; }
}
}
[Serializable]
public class Mux4SboxItem
{
[Serializable]
public class Mux4SboxItem
{
public string Protocol { get; set; }
public int MaxConnections { get; set; }
public bool? Padding { get; set; }
}
}
[Serializable]
public class HysteriaItem
{
[Serializable]
public class HysteriaItem
{
public int UpMbps { get; set; }
public int DownMbps { get; set; }
public int HopInterval { get; set; } = 30;
}
}
[Serializable]
public class ClashUIItem
{
[Serializable]
public class ClashUIItem
{
public ERuleMode RuleMode { get; set; }
public bool EnableIPv6 { get; set; }
public bool EnableMixinContent { get; set; }
@@ -211,38 +211,37 @@ namespace ServiceLib.Models
public int ProxiesAutoDelayTestInterval { get; set; } = 10;
public bool ConnectionsAutoRefresh { get; set; }
public int ConnectionsRefreshInterval { get; set; } = 2;
}
}
[Serializable]
public class SystemProxyItem
{
[Serializable]
public class SystemProxyItem
{
public ESysProxyType SysProxyType { get; set; }
public string SystemProxyExceptions { get; set; }
public bool NotProxyLocalAddress { get; set; } = true;
public string SystemProxyAdvancedProtocol { get; set; }
}
}
[Serializable]
public class WebDavItem
{
[Serializable]
public class WebDavItem
{
public string? Url { get; set; }
public string? UserName { get; set; }
public string? Password { get; set; }
public string? DirName { get; set; }
}
}
[Serializable]
public class CheckUpdateItem
{
[Serializable]
public class CheckUpdateItem
{
public bool CheckPreReleaseUpdate { get; set; }
public List<string>? SelectedCoreTypes { get; set; }
}
}
[Serializable]
public class Fragment4RayItem
{
[Serializable]
public class Fragment4RayItem
{
public string? Packets { get; set; }
public string? Length { get; set; }
public string? Interval { get; set; }
}
}

View File

@@ -1,8 +1,8 @@
namespace ServiceLib.Models
namespace ServiceLib.Models;
[Serializable]
public class CoreInfo
{
[Serializable]
public class CoreInfo
{
public ECoreType CoreType { get; set; }
public List<string>? CoreExes { get; set; }
public string? Arguments { get; set; }
@@ -17,5 +17,4 @@ namespace ServiceLib.Models
public string? Match { get; set; }
public string? VersionArg { get; set; }
public bool AbsolutePath { get; set; }
}
}

View File

@@ -1,10 +1,10 @@
using SQLite;
using SQLite;
namespace ServiceLib.Models
namespace ServiceLib.Models;
[Serializable]
public class DNSItem
{
[Serializable]
public class DNSItem
{
[PrimaryKey]
public string Id { get; set; }
@@ -16,5 +16,4 @@ namespace ServiceLib.Models
public string? TunDNS { get; set; }
public string? DomainStrategy4Freedom { get; set; }
public string? DomainDNSAddress { get; set; }
}
}

View File

@@ -1,9 +1,9 @@
using System.Text.Json.Serialization;
using System.Text.Json.Serialization;
namespace ServiceLib.Models
namespace ServiceLib.Models;
public class GitHubReleaseAsset
{
public class GitHubReleaseAsset
{
[JsonPropertyName("url")] public string? Url { get; set; }
[JsonPropertyName("id")] public int Id { get; set; }
@@ -27,10 +27,10 @@ namespace ServiceLib.Models
[JsonPropertyName("updated_at")] public DateTime UpdatedAt { get; set; }
[JsonPropertyName("browser_download_url")] public string? BrowserDownloadUrl { get; set; }
}
}
public class GitHubRelease
{
public class GitHubRelease
{
[JsonPropertyName("url")] public string? Url { get; set; }
[JsonPropertyName("assets_url")] public string? AssetsUrl { get; set; }
@@ -64,5 +64,4 @@ namespace ServiceLib.Models
[JsonPropertyName("zipball_url")] public string? ZipballUrl { get; set; }
[JsonPropertyName("body")] public string? Body { get; set; }
}
}

View File

@@ -1,7 +1,7 @@
namespace ServiceLib.Models
namespace ServiceLib.Models;
internal class IPAPIInfo
{
internal class IPAPIInfo
{
public string? ip { get; set; }
public string? city { get; set; }
public string? region { get; set; }
@@ -9,5 +9,4 @@
public string? country { get; set; }
public string? country_name { get; set; }
public string? country_code { get; set; }
}
}

View File

@@ -1,10 +1,10 @@
using SQLite;
namespace ServiceLib.Models
namespace ServiceLib.Models;
[Serializable]
public class ProfileExItem
{
[Serializable]
public class ProfileExItem
{
[PrimaryKey]
public string IndexId { get; set; }
@@ -12,5 +12,4 @@ namespace ServiceLib.Models
public decimal Speed { get; set; }
public int Sort { get; set; }
public string? Message { get; set; }
}
}

View File

@@ -1,10 +1,10 @@
using SQLite;
namespace ServiceLib.Models
namespace ServiceLib.Models;
[Serializable]
public class ProfileItem
{
[Serializable]
public class ProfileItem
{
public ProfileItem()
{
IndexId = string.Empty;
@@ -64,6 +64,7 @@ namespace ServiceLib.Models
[PrimaryKey]
public string IndexId { get; set; }
public EConfigType ConfigType { get; set; }
public int ConfigVersion { get; set; }
public string Address { get; set; }
@@ -92,5 +93,4 @@ namespace ServiceLib.Models
public string ShortId { get; set; }
public string SpiderX { get; set; }
public string Extra { get; set; }
}
}

View File

@@ -1,8 +1,8 @@
namespace ServiceLib.Models
namespace ServiceLib.Models;
[Serializable]
public class ProfileItemModel : ProfileItem
{
[Serializable]
public class ProfileItemModel : ProfileItem
{
public bool IsActive { get; set; }
public string SubRemarks { get; set; }
public int Delay { get; set; }
@@ -14,5 +14,4 @@
public string TodayDown { get; set; }
public string TotalUp { get; set; }
public string TotalDown { get; set; }
}
}

View File

@@ -1,7 +1,7 @@
namespace ServiceLib.Models
namespace ServiceLib.Models;
public class RetResult
{
public class RetResult
{
public bool Success { get; set; }
public string? Msg { get; set; }
public object? Data { get; set; }
@@ -23,5 +23,4 @@
Msg = msg;
Data = data;
}
}
}

View File

@@ -1,10 +1,10 @@
using SQLite;
using SQLite;
namespace ServiceLib.Models
namespace ServiceLib.Models;
[Serializable]
public class RoutingItem
{
[Serializable]
public class RoutingItem
{
[PrimaryKey]
public string Id { get; set; }
@@ -19,5 +19,4 @@ namespace ServiceLib.Models
public string DomainStrategy { get; set; }
public string DomainStrategy4Singbox { get; set; }
public int Sort { get; set; }
}
}

View File

@@ -1,8 +1,7 @@
namespace ServiceLib.Models
namespace ServiceLib.Models;
[Serializable]
public class RoutingItemModel : RoutingItem
{
[Serializable]
public class RoutingItemModel : RoutingItem
{
public bool IsActive { get; set; }
}
}

View File

@@ -1,9 +1,8 @@
namespace ServiceLib.Models
namespace ServiceLib.Models;
[Serializable]
public class RoutingTemplate
{
[Serializable]
public class RoutingTemplate
{
public string Version { get; set; }
public RoutingItem[] RoutingItems { get; set; }
}
}

View File

@@ -1,8 +1,8 @@
namespace ServiceLib.Models
namespace ServiceLib.Models;
[Serializable]
public class RulesItem
{
[Serializable]
public class RulesItem
{
public string Id { get; set; }
public string? Type { get; set; }
public string? Port { get; set; }
@@ -15,5 +15,4 @@
public List<string>? Process { get; set; }
public bool Enabled { get; set; } = true;
public string? Remarks { get; set; }
}
}

View File

@@ -1,11 +1,10 @@
namespace ServiceLib.Models
namespace ServiceLib.Models;
[Serializable]
public class RulesItemModel : RulesItem
{
[Serializable]
public class RulesItemModel : RulesItem
{
public string InboundTags { get; set; }
public string Ips { get; set; }
public string Domains { get; set; }
public string Protocols { get; set; }
}
}

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