mirror of https://github.com/2dust/v2rayN
Refactoring Project
parent
bbe7c7b884
commit
61bea05f63
|
@ -1,10 +1,9 @@
|
|||
using Downloader;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
|
||||
namespace v2rayN
|
||||
namespace ServiceLib.Common
|
||||
{
|
||||
internal class DownloaderHelper
|
||||
public class DownloaderHelper
|
||||
{
|
||||
private static readonly Lazy<DownloaderHelper> _instance = new(() => new());
|
||||
public static DownloaderHelper Instance => _instance.Value;
|
|
@ -1,8 +1,7 @@
|
|||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.IO.Compression;
|
||||
using System.Text;
|
||||
|
||||
namespace v2rayN
|
||||
namespace ServiceLib.Common
|
||||
{
|
||||
public static class FileManager
|
||||
{
|
||||
|
@ -86,5 +85,19 @@ namespace v2rayN
|
|||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
public static bool CreateFromDirectory(string sourceDirectoryName, string destinationArchiveFileName)
|
||||
{
|
||||
try
|
||||
{
|
||||
ZipFile.CreateFromDirectory(sourceDirectoryName, destinationArchiveFileName);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
Logging.SaveLog(ex.Message, ex);
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -1,10 +1,8 @@
|
|||
using System.IO;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Net.Mime;
|
||||
using System.Text;
|
||||
|
||||
namespace v2rayN
|
||||
namespace ServiceLib.Common
|
||||
{
|
||||
/// <summary>
|
||||
/// </summary>
|
|
@ -1,7 +1,7 @@
|
|||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace v2rayN
|
||||
namespace ServiceLib.Common
|
||||
{
|
||||
/*
|
||||
* See:
|
|
@ -1,11 +1,10 @@
|
|||
using System.IO;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Nodes;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace v2rayN
|
||||
namespace ServiceLib.Common
|
||||
{
|
||||
internal class JsonUtils
|
||||
public class JsonUtils
|
||||
{
|
||||
/// <summary>
|
||||
/// DeepCopy
|
|
@ -1,9 +1,8 @@
|
|||
using NLog;
|
||||
using NLog.Config;
|
||||
using NLog.Targets;
|
||||
using System.IO;
|
||||
|
||||
namespace v2rayN
|
||||
namespace ServiceLib.Common
|
||||
{
|
||||
public class Logging
|
||||
{
|
|
@ -1,7 +1,7 @@
|
|||
using System.Linq.Expressions;
|
||||
using System.Reflection;
|
||||
|
||||
namespace v2rayN
|
||||
namespace ServiceLib.Common
|
||||
{
|
||||
public static class QueryableExtension
|
||||
{
|
|
@ -1,4 +1,4 @@
|
|||
namespace v2rayN
|
||||
namespace ServiceLib.Common
|
||||
{
|
||||
public class SemanticVersion
|
||||
{
|
|
@ -1,7 +1,7 @@
|
|||
using SQLite;
|
||||
using System.Collections;
|
||||
|
||||
namespace v2rayN
|
||||
namespace ServiceLib.Common
|
||||
{
|
||||
public sealed class SQLiteHelper
|
||||
{
|
|
@ -1,9 +1,8 @@
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.IO;
|
||||
|
||||
namespace v2rayN
|
||||
namespace ServiceLib.Common
|
||||
{
|
||||
internal static class StringEx
|
||||
public static class StringEx
|
||||
{
|
||||
public static bool IsNullOrEmpty([NotNullWhen(false)] this string? value)
|
||||
{
|
|
@ -1,6 +1,5 @@
|
|||
using System.Collections.Specialized;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.IO.Compression;
|
||||
using System.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
|
@ -10,9 +9,9 @@ using System.Security.Cryptography;
|
|||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace v2rayN
|
||||
namespace ServiceLib.Common
|
||||
{
|
||||
internal class Utils
|
||||
public class Utils
|
||||
{
|
||||
#region 资源Json操作
|
||||
|
|
@ -1,9 +1,9 @@
|
|||
using YamlDotNet.Serialization;
|
||||
using YamlDotNet.Serialization.NamingConventions;
|
||||
|
||||
namespace v2rayN.Common
|
||||
namespace ServiceLib.Common
|
||||
{
|
||||
internal class YamlUtils
|
||||
public class YamlUtils
|
||||
{
|
||||
#region YAML
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
namespace v2rayN.Enums
|
||||
namespace ServiceLib.Enums
|
||||
{
|
||||
public enum EConfigType
|
||||
{
|
|
@ -1,4 +1,4 @@
|
|||
namespace v2rayN.Enums
|
||||
namespace ServiceLib.Enums
|
||||
{
|
||||
public enum ECoreType
|
||||
{
|
|
@ -1,4 +1,4 @@
|
|||
namespace v2rayN.Enums
|
||||
namespace ServiceLib.Enums
|
||||
{
|
||||
public enum EGirdOrientation
|
||||
{
|
|
@ -1,4 +1,4 @@
|
|||
namespace v2rayN.Enums
|
||||
namespace ServiceLib.Enums
|
||||
{
|
||||
public enum EGlobalHotkey
|
||||
{
|
|
@ -1,4 +1,4 @@
|
|||
namespace v2rayN.Enums
|
||||
namespace ServiceLib.Enums
|
||||
{
|
||||
public enum EInboundProtocol
|
||||
{
|
|
@ -1,4 +1,4 @@
|
|||
namespace v2rayN.Enums
|
||||
namespace ServiceLib.Enums
|
||||
{
|
||||
public enum EMove
|
||||
{
|
|
@ -1,4 +1,4 @@
|
|||
namespace v2rayN.Enums
|
||||
namespace ServiceLib.Enums
|
||||
{
|
||||
public enum ERuleMode
|
||||
{
|
|
@ -1,4 +1,4 @@
|
|||
namespace v2rayN.Enums
|
||||
namespace ServiceLib.Enums
|
||||
{
|
||||
public enum EServerColName
|
||||
{
|
|
@ -1,4 +1,4 @@
|
|||
namespace v2rayN.Enums
|
||||
namespace ServiceLib.Enums
|
||||
{
|
||||
public enum ESpeedActionType
|
||||
{
|
|
@ -1,4 +1,4 @@
|
|||
namespace v2rayN.Enums
|
||||
namespace ServiceLib.Enums
|
||||
{
|
||||
public enum ESysProxyType
|
||||
{
|
|
@ -1,4 +1,4 @@
|
|||
namespace v2rayN.Enums
|
||||
namespace ServiceLib.Enums
|
||||
{
|
||||
public enum ETransport
|
||||
{
|
|
@ -1,4 +1,4 @@
|
|||
namespace v2rayN.Enums
|
||||
namespace ServiceLib.Enums
|
||||
{
|
||||
public enum EViewAction
|
||||
{
|
|
@ -1,8 +1,6 @@
|
|||
using v2rayN.Enums;
|
||||
|
||||
namespace v2rayN
|
||||
namespace ServiceLib
|
||||
{
|
||||
internal class Global
|
||||
public class Global
|
||||
{
|
||||
#region const
|
||||
|
||||
|
@ -32,21 +30,21 @@ namespace v2rayN
|
|||
public const string CoreSpeedtestConfigFileName = "configSpeedtest.json";
|
||||
public const string CoreMultipleLoadConfigFileName = "configMultipleLoad.json";
|
||||
public const string ClashMixinConfigFileName = "Mixin.yaml";
|
||||
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 V2raySampleInbound = "v2rayN.Sample.SampleInbound";
|
||||
public const string V2raySampleOutbound = "v2rayN.Sample.SampleOutbound";
|
||||
public const string SingboxSampleOutbound = "v2rayN.Sample.SingboxSampleOutbound";
|
||||
public const string CustomRoutingFileName = "v2rayN.Sample.custom_routing_";
|
||||
public const string TunSingboxDNSFileName = "v2rayN.Sample.tun_singbox_dns";
|
||||
public const string TunSingboxInboundFileName = "v2rayN.Sample.tun_singbox_inbound";
|
||||
public const string TunSingboxRulesFileName = "v2rayN.Sample.tun_singbox_rules";
|
||||
public const string DNSV2rayNormalFileName = "v2rayN.Sample.dns_v2ray_normal";
|
||||
public const string DNSSingboxNormalFileName = "v2rayN.Sample.dns_singbox_normal";
|
||||
public const string ClashMixinYaml = "v2rayN.Sample.clash_mixin_yaml";
|
||||
public const string ClashTunYaml = "v2rayN.Sample.clash_tun_yaml";
|
||||
public const string V2raySampleClient = "ServiceLib.Sample.SampleClientConfig";
|
||||
public const string SingboxSampleClient = "ServiceLib.Sample.SingboxSampleClientConfig";
|
||||
public const string V2raySampleHttpRequestFileName = "ServiceLib.Sample.SampleHttpRequest";
|
||||
public const string V2raySampleHttpResponseFileName = "ServiceLib.Sample.SampleHttpResponse";
|
||||
public const string V2raySampleInbound = "ServiceLib.Sample.SampleInbound";
|
||||
public const string V2raySampleOutbound = "ServiceLib.Sample.SampleOutbound";
|
||||
public const string SingboxSampleOutbound = "ServiceLib.Sample.SingboxSampleOutbound";
|
||||
public const string CustomRoutingFileName = "ServiceLib.Sample.custom_routing_";
|
||||
public const string TunSingboxDNSFileName = "ServiceLib.Sample.tun_singbox_dns";
|
||||
public const string TunSingboxInboundFileName = "ServiceLib.Sample.tun_singbox_inbound";
|
||||
public const string TunSingboxRulesFileName = "ServiceLib.Sample.tun_singbox_rules";
|
||||
public const string DNSV2rayNormalFileName = "ServiceLib.Sample.dns_v2ray_normal";
|
||||
public const string DNSSingboxNormalFileName = "ServiceLib.Sample.dns_singbox_normal";
|
||||
public const string ClashMixinYaml = "ServiceLib.Sample.clash_mixin_yaml";
|
||||
public const string ClashTunYaml = "ServiceLib.Sample.clash_tun_yaml";
|
||||
|
||||
public const string DefaultSecurity = "auto";
|
||||
public const string DefaultNetwork = "tcp";
|
|
@ -0,0 +1,7 @@
|
|||
global using ServiceLib.Common;
|
||||
global using ServiceLib.Enums;
|
||||
global using ServiceLib.Handler.CoreConfig;
|
||||
global using ServiceLib.Handler.Fmt;
|
||||
global using ServiceLib.Handler.Statistics;
|
||||
global using ServiceLib.Models;
|
||||
global using ServiceLib.Resx;
|
|
@ -1,7 +1,6 @@
|
|||
using v2rayN.Models;
|
||||
using static v2rayN.Models.ClashProxies;
|
||||
using static ServiceLib.Models.ClashProxies;
|
||||
|
||||
namespace v2rayN.Handler
|
||||
namespace ServiceLib.Handler
|
||||
{
|
||||
public sealed class ClashApiHandler
|
||||
{
|
|
@ -1,18 +1,13 @@
|
|||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Web;
|
||||
using v2rayN.Enums;
|
||||
using v2rayN.Handler.CoreConfig;
|
||||
using v2rayN.Handler.Fmt;
|
||||
using v2rayN.Models;
|
||||
|
||||
namespace v2rayN.Handler
|
||||
namespace ServiceLib.Handler
|
||||
{
|
||||
/// <summary>
|
||||
/// 本软件配置文件处理类
|
||||
/// </summary>
|
||||
internal class ConfigHandler
|
||||
public class ConfigHandler
|
||||
{
|
||||
private static string configRes = Global.ConfigFileName;
|
||||
private static readonly object objLock = new();
|
||||
|
@ -1156,7 +1151,7 @@ namespace v2rayN.Handler
|
|||
|
||||
var profileItem = LazyConfig.Instance.GetProfileItem(indexId) ?? new();
|
||||
profileItem.indexId = indexId;
|
||||
profileItem.remarks = coreType == ECoreType.sing_box ? Resx.ResUI.menuSetDefaultMultipleServer : Resx.ResUI.menuSetDefaultLoadBalanceServer;
|
||||
profileItem.remarks = coreType == ECoreType.sing_box ? ResUI.menuSetDefaultMultipleServer : ResUI.menuSetDefaultLoadBalanceServer;
|
||||
profileItem.address = Global.CoreMultipleLoadConfigFileName;
|
||||
profileItem.configType = EConfigType.Custom;
|
||||
profileItem.coreType = coreType;
|
|
@ -1,15 +1,9 @@
|
|||
using System.IO;
|
||||
using v2rayN.Common;
|
||||
using v2rayN.Enums;
|
||||
using v2rayN.Models;
|
||||
using v2rayN.Resx;
|
||||
|
||||
namespace v2rayN.Handler.CoreConfig
|
||||
namespace ServiceLib.Handler.CoreConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// Core configuration file processing class
|
||||
/// </summary>
|
||||
internal class CoreConfigClash
|
||||
public class CoreConfigClash
|
||||
{
|
||||
private Config _config;
|
||||
|
|
@ -1,14 +1,9 @@
|
|||
using System.IO;
|
||||
using v2rayN.Enums;
|
||||
using v2rayN.Models;
|
||||
using v2rayN.Resx;
|
||||
|
||||
namespace v2rayN.Handler.CoreConfig
|
||||
namespace ServiceLib.Handler.CoreConfig
|
||||
{
|
||||
/// <summary>
|
||||
/// Core configuration file processing class
|
||||
/// </summary>
|
||||
internal class CoreConfigHandler
|
||||
public class CoreConfigHandler
|
||||
{
|
||||
public static int GenerateClientConfig(ProfileItem node, string? fileName, out string msg, out string content)
|
||||
{
|
|
@ -1,14 +1,10 @@
|
|||
using System.Data;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
using v2rayN.Enums;
|
||||
using v2rayN.Models;
|
||||
using v2rayN.Resx;
|
||||
|
||||
namespace v2rayN.Handler.CoreConfig
|
||||
namespace ServiceLib.Handler.CoreConfig
|
||||
{
|
||||
internal class CoreConfigSingbox
|
||||
public class CoreConfigSingbox
|
||||
{
|
||||
private Config _config;
|
||||
|
|
@ -1,13 +1,10 @@
|
|||
using System.Net;
|
||||
using System.Net.NetworkInformation;
|
||||
using System.Text.Json.Nodes;
|
||||
using v2rayN.Enums;
|
||||
using v2rayN.Models;
|
||||
using v2rayN.Resx;
|
||||
|
||||
namespace v2rayN.Handler.CoreConfig
|
||||
namespace ServiceLib.Handler.CoreConfig
|
||||
{
|
||||
internal class CoreConfigV2ray
|
||||
public class CoreConfigV2ray
|
||||
{
|
||||
private Config _config;
|
||||
|
|
@ -1,17 +1,12 @@
|
|||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Text;
|
||||
using v2rayN.Enums;
|
||||
using v2rayN.Handler.CoreConfig;
|
||||
using v2rayN.Models;
|
||||
using v2rayN.Resx;
|
||||
|
||||
namespace v2rayN.Handler
|
||||
namespace ServiceLib.Handler
|
||||
{
|
||||
/// <summary>
|
||||
/// Core process processing class
|
||||
/// </summary>
|
||||
internal class CoreHandler
|
||||
public class CoreHandler
|
||||
{
|
||||
private Config _config;
|
||||
private Process? _process;
|
|
@ -1,8 +1,6 @@
|
|||
using System.Runtime.Intrinsics.X86;
|
||||
using v2rayN.Enums;
|
||||
using v2rayN.Models;
|
||||
|
||||
namespace v2rayN.Handler
|
||||
namespace ServiceLib.Handler
|
||||
{
|
||||
public sealed class CoreInfoHandler
|
||||
{
|
|
@ -1,18 +1,14 @@
|
|||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Net.Http.Headers;
|
||||
using System.Net.Sockets;
|
||||
using v2rayN.Enums;
|
||||
using v2rayN.Resx;
|
||||
|
||||
namespace v2rayN.Handler
|
||||
namespace ServiceLib.Handler
|
||||
{
|
||||
/// <summary>
|
||||
///Download
|
||||
/// </summary>
|
||||
internal class DownloadHandler
|
||||
public class DownloadHandler
|
||||
{
|
||||
public event EventHandler<ResultEventArgs>? UpdateCompleted;
|
||||
|
|
@ -1,11 +1,8 @@
|
|||
using System.Collections.Specialized;
|
||||
using System.IO;
|
||||
using v2rayN.Enums;
|
||||
using v2rayN.Models;
|
||||
|
||||
namespace v2rayN.Handler.Fmt
|
||||
namespace ServiceLib.Handler.Fmt
|
||||
{
|
||||
internal class BaseFmt
|
||||
public class BaseFmt
|
||||
{
|
||||
protected static string GetIpv6(string address)
|
||||
{
|
|
@ -1,9 +1,6 @@
|
|||
using v2rayN.Enums;
|
||||
using v2rayN.Models;
|
||||
|
||||
namespace v2rayN.Handler.Fmt
|
||||
namespace ServiceLib.Handler.Fmt
|
||||
{
|
||||
internal class ClashFmt : BaseFmt
|
||||
public class ClashFmt : BaseFmt
|
||||
{
|
||||
public static ProfileItem? ResolveFull(string strData, string? subRemarks)
|
||||
{
|
|
@ -1,10 +1,6 @@
|
|||
using v2rayN.Enums;
|
||||
using v2rayN.Models;
|
||||
using v2rayN.Resx;
|
||||
|
||||
namespace v2rayN.Handler.Fmt
|
||||
namespace ServiceLib.Handler.Fmt
|
||||
{
|
||||
internal class FmtHandler
|
||||
public class FmtHandler
|
||||
{
|
||||
public static string? GetShareUri(ProfileItem item)
|
||||
{
|
|
@ -1,10 +1,6 @@
|
|||
using v2rayN.Enums;
|
||||
using v2rayN.Models;
|
||||
using v2rayN.Resx;
|
||||
|
||||
namespace v2rayN.Handler.Fmt
|
||||
namespace ServiceLib.Handler.Fmt
|
||||
{
|
||||
internal class Hysteria2Fmt : BaseFmt
|
||||
public class Hysteria2Fmt : BaseFmt
|
||||
{
|
||||
public static ProfileItem? Resolve(string str, out string msg)
|
||||
{
|
|
@ -1,9 +1,6 @@
|
|||
using v2rayN.Enums;
|
||||
using v2rayN.Models;
|
||||
|
||||
namespace v2rayN.Handler.Fmt
|
||||
namespace ServiceLib.Handler.Fmt
|
||||
{
|
||||
internal class NaiveproxyFmt : BaseFmt
|
||||
public class NaiveproxyFmt : BaseFmt
|
||||
{
|
||||
public static ProfileItem? ResolveFull(string strData, string? subRemarks)
|
||||
{
|
|
@ -1,11 +1,8 @@
|
|||
using System.Text.RegularExpressions;
|
||||
using v2rayN.Enums;
|
||||
using v2rayN.Models;
|
||||
using v2rayN.Resx;
|
||||
|
||||
namespace v2rayN.Handler.Fmt
|
||||
namespace ServiceLib.Handler.Fmt
|
||||
{
|
||||
internal class ShadowsocksFmt : BaseFmt
|
||||
public class ShadowsocksFmt : BaseFmt
|
||||
{
|
||||
public static ProfileItem? Resolve(string str, out string msg)
|
||||
{
|
|
@ -1,9 +1,6 @@
|
|||
using v2rayN.Enums;
|
||||
using v2rayN.Models;
|
||||
|
||||
namespace v2rayN.Handler.Fmt
|
||||
namespace ServiceLib.Handler.Fmt
|
||||
{
|
||||
internal class SingboxFmt : BaseFmt
|
||||
public class SingboxFmt : BaseFmt
|
||||
{
|
||||
public static List<ProfileItem>? ResolveFullArray(string strData, string? subRemarks)
|
||||
{
|
|
@ -1,10 +1,6 @@
|
|||
using v2rayN.Enums;
|
||||
using v2rayN.Models;
|
||||
using v2rayN.Resx;
|
||||
|
||||
namespace v2rayN.Handler.Fmt
|
||||
namespace ServiceLib.Handler.Fmt
|
||||
{
|
||||
internal class SocksFmt : BaseFmt
|
||||
public class SocksFmt : BaseFmt
|
||||
{
|
||||
public static ProfileItem? Resolve(string str, out string msg)
|
||||
{
|
|
@ -1,10 +1,6 @@
|
|||
using v2rayN.Enums;
|
||||
using v2rayN.Models;
|
||||
using v2rayN.Resx;
|
||||
|
||||
namespace v2rayN.Handler.Fmt
|
||||
namespace ServiceLib.Handler.Fmt
|
||||
{
|
||||
internal class TrojanFmt : BaseFmt
|
||||
public class TrojanFmt : BaseFmt
|
||||
{
|
||||
public static ProfileItem? Resolve(string str, out string msg)
|
||||
{
|
|
@ -1,10 +1,6 @@
|
|||
using v2rayN.Enums;
|
||||
using v2rayN.Models;
|
||||
using v2rayN.Resx;
|
||||
|
||||
namespace v2rayN.Handler.Fmt
|
||||
namespace ServiceLib.Handler.Fmt
|
||||
{
|
||||
internal class TuicFmt : BaseFmt
|
||||
public class TuicFmt : BaseFmt
|
||||
{
|
||||
public static ProfileItem? Resolve(string str, out string msg)
|
||||
{
|
|
@ -1,9 +1,6 @@
|
|||
using v2rayN.Enums;
|
||||
using v2rayN.Models;
|
||||
|
||||
namespace v2rayN.Handler.Fmt
|
||||
namespace ServiceLib.Handler.Fmt
|
||||
{
|
||||
internal class V2rayFmt : BaseFmt
|
||||
public class V2rayFmt : BaseFmt
|
||||
{
|
||||
public static List<ProfileItem>? ResolveFullArray(string strData, string? subRemarks)
|
||||
{
|
|
@ -1,10 +1,6 @@
|
|||
using v2rayN.Enums;
|
||||
using v2rayN.Models;
|
||||
using v2rayN.Resx;
|
||||
|
||||
namespace v2rayN.Handler.Fmt
|
||||
namespace ServiceLib.Handler.Fmt
|
||||
{
|
||||
internal class VLESSFmt : BaseFmt
|
||||
public class VLESSFmt : BaseFmt
|
||||
{
|
||||
public static ProfileItem? Resolve(string str, out string msg)
|
||||
{
|
|
@ -1,10 +1,6 @@
|
|||
using v2rayN.Enums;
|
||||
using v2rayN.Models;
|
||||
using v2rayN.Resx;
|
||||
|
||||
namespace v2rayN.Handler.Fmt
|
||||
namespace ServiceLib.Handler.Fmt
|
||||
{
|
||||
internal class VmessFmt : BaseFmt
|
||||
public class VmessFmt : BaseFmt
|
||||
{
|
||||
public static ProfileItem? Resolve(string str, out string msg)
|
||||
{
|
|
@ -1,10 +1,6 @@
|
|||
using v2rayN.Enums;
|
||||
using v2rayN.Models;
|
||||
using v2rayN.Resx;
|
||||
|
||||
namespace v2rayN.Handler.Fmt
|
||||
namespace ServiceLib.Handler.Fmt
|
||||
{
|
||||
internal class WireguardFmt : BaseFmt
|
||||
public class WireguardFmt : BaseFmt
|
||||
{
|
||||
public static ProfileItem? Resolve(string str, out string msg)
|
||||
{
|
|
@ -1,8 +1,4 @@
|
|||
using v2rayN.Enums;
|
||||
using v2rayN.Handler.Statistics;
|
||||
using v2rayN.Models;
|
||||
|
||||
namespace v2rayN.Handler
|
||||
namespace ServiceLib.Handler
|
||||
{
|
||||
public sealed class LazyConfig
|
||||
{
|
|
@ -1,10 +1,10 @@
|
|||
using System.Collections.Concurrent;
|
||||
using System.Reactive.Linq;
|
||||
using v2rayN.Models;
|
||||
|
||||
namespace v2rayN.Handler
|
||||
//using System.Reactive.Linq;
|
||||
|
||||
namespace ServiceLib.Handler
|
||||
{
|
||||
internal class ProfileExHandler
|
||||
public class ProfileExHandler
|
||||
{
|
||||
private static readonly Lazy<ProfileExHandler> _instance = new(() => new());
|
||||
private ConcurrentBag<ProfileExItem> _lstProfileEx = [];
|
|
@ -1,25 +1,17 @@
|
|||
using ReactiveUI;
|
||||
using System.Diagnostics;
|
||||
using System.Diagnostics;
|
||||
using System.Net;
|
||||
using System.Net.Sockets;
|
||||
using v2rayN.Enums;
|
||||
using v2rayN.Models;
|
||||
using v2rayN.Resx;
|
||||
|
||||
namespace v2rayN.Handler
|
||||
namespace ServiceLib.Handler
|
||||
{
|
||||
internal class SpeedtestHandler
|
||||
public class SpeedtestHandler
|
||||
{
|
||||
private Config? _config;
|
||||
private CoreHandler _coreHandler;
|
||||
private List<ServerTestItem> _selecteds;
|
||||
private ESpeedActionType _actionType;
|
||||
private Action<SpeedTestResult> _updateFunc;
|
||||
|
||||
public SpeedtestHandler(Config config)
|
||||
{
|
||||
_config = config;
|
||||
}
|
||||
private bool _exitLoop = false;
|
||||
|
||||
public SpeedtestHandler(Config config, CoreHandler coreHandler, List<ProfileItem> selecteds, ESpeedActionType actionType, Action<SpeedTestResult> update)
|
||||
{
|
||||
|
@ -91,6 +83,12 @@ namespace v2rayN.Handler
|
|||
}
|
||||
}
|
||||
|
||||
public void ExitLoop()
|
||||
{
|
||||
_exitLoop = true;
|
||||
UpdateFunc("", ResUI.SpeedtestingStop);
|
||||
}
|
||||
|
||||
private Task RunTcping()
|
||||
{
|
||||
try
|
||||
|
@ -215,20 +213,9 @@ namespace v2rayN.Handler
|
|||
|
||||
DownloadHandler downloadHandle = new();
|
||||
|
||||
var exitLoop = false;
|
||||
MessageBus.Current.Listen<string>(Global.CommandStopSpeedTest)
|
||||
.Subscribe(x =>
|
||||
{
|
||||
if (!exitLoop)
|
||||
{
|
||||
UpdateFunc("", ResUI.SpeedtestingStop);
|
||||
}
|
||||
exitLoop = true;
|
||||
});
|
||||
|
||||
foreach (var it in _selecteds)
|
||||
{
|
||||
if (exitLoop)
|
||||
if (_exitLoop)
|
||||
{
|
||||
UpdateFunc(it.indexId, "", ResUI.SpeedtestingSkip);
|
||||
continue;
|
||||
|
@ -288,20 +275,9 @@ namespace v2rayN.Handler
|
|||
|
||||
DownloadHandler downloadHandle = new();
|
||||
|
||||
var exitLoop = false;
|
||||
MessageBus.Current.Listen<string>(Global.CommandStopSpeedTest)
|
||||
.Subscribe(x =>
|
||||
{
|
||||
if (!exitLoop)
|
||||
{
|
||||
UpdateFunc("", ResUI.SpeedtestingStop);
|
||||
}
|
||||
exitLoop = true;
|
||||
});
|
||||
|
||||
foreach (var it in _selecteds)
|
||||
{
|
||||
if (exitLoop)
|
||||
if (_exitLoop)
|
||||
{
|
||||
UpdateFunc(it.indexId, "", ResUI.SpeedtestingSkip);
|
||||
continue;
|
|
@ -1,8 +1,6 @@
|
|||
using v2rayN.Models;
|
||||
|
||||
namespace v2rayN.Handler.Statistics
|
||||
namespace ServiceLib.Handler.Statistics
|
||||
{
|
||||
internal class StatisticsHandler
|
||||
public class StatisticsHandler
|
||||
{
|
||||
private static readonly Lazy<StatisticsHandler> instance = new(() => new());
|
||||
public static StatisticsHandler Instance => instance.Value;
|
|
@ -1,11 +1,9 @@
|
|||
using System.Net.WebSockets;
|
||||
using System.Text;
|
||||
using v2rayN.Enums;
|
||||
using v2rayN.Models;
|
||||
|
||||
namespace v2rayN.Handler.Statistics
|
||||
namespace ServiceLib.Handler.Statistics
|
||||
{
|
||||
internal class StatisticsSingbox
|
||||
public class StatisticsSingbox
|
||||
{
|
||||
private Config _config;
|
||||
private bool _exitFlag;
|
|
@ -1,12 +1,10 @@
|
|||
using Grpc.Core;
|
||||
using Grpc.Net.Client;
|
||||
using ProtosLib.Statistics;
|
||||
using v2rayN.Enums;
|
||||
using v2rayN.Models;
|
||||
|
||||
namespace v2rayN.Handler.Statistics
|
||||
namespace ServiceLib.Handler.Statistics
|
||||
{
|
||||
internal class StatisticsV2ray
|
||||
public class StatisticsV2ray
|
||||
{
|
||||
private Models.Config _config;
|
||||
private GrpcChannel? _channel;
|
|
@ -1,8 +1,6 @@
|
|||
using v2rayN.Models;
|
||||
|
||||
namespace v2rayN.Handler
|
||||
namespace ServiceLib.Handler
|
||||
{
|
||||
internal class TaskHandler
|
||||
public class TaskHandler
|
||||
{
|
||||
private static readonly Lazy<TaskHandler> _instance = new(() => new());
|
||||
public static TaskHandler Instance => _instance.Value;
|
|
@ -1,17 +1,11 @@
|
|||
using DynamicData;
|
||||
using Splat;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using v2rayN.Enums;
|
||||
using v2rayN.Models;
|
||||
using v2rayN.Resx;
|
||||
|
||||
namespace v2rayN.Handler
|
||||
namespace ServiceLib.Handler
|
||||
{
|
||||
internal class UpdateHandler
|
||||
public class UpdateHandler
|
||||
{
|
||||
private Action<bool, string> _updateFunc;
|
||||
private Config _config;
|
||||
|
@ -44,30 +38,9 @@ namespace v2rayN.Handler
|
|||
if (args.Success)
|
||||
{
|
||||
_updateFunc(false, ResUI.MsgDownloadV2rayCoreSuccessfully);
|
||||
|
||||
try
|
||||
{
|
||||
string fileName = Utils.GetTempPath(Utils.GetDownloadFileName(url));
|
||||
fileName = Utils.UrlEncode(fileName);
|
||||
Process process = new()
|
||||
{
|
||||
StartInfo = new ProcessStartInfo
|
||||
{
|
||||
FileName = "v2rayUpgrade.exe",
|
||||
Arguments = fileName.AppendQuotes(),
|
||||
WorkingDirectory = Utils.StartupPath()
|
||||
}
|
||||
};
|
||||
process.Start();
|
||||
if (process.Id > 0)
|
||||
{
|
||||
_updateFunc(true, "");
|
||||
}
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
_updateFunc(false, ex.Message);
|
||||
}
|
||||
string fileName = Utils.GetTempPath(Utils.GetDownloadFileName(url));
|
||||
fileName = Utils.UrlEncode(fileName);
|
||||
_updateFunc(true, fileName);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -82,7 +55,7 @@ namespace v2rayN.Handler
|
|||
{
|
||||
if (args.Success)
|
||||
{
|
||||
_updateFunc(false, string.Format(ResUI.MsgParsingSuccessfully, "v2rayN"));
|
||||
_updateFunc(false, string.Format(ResUI.MsgParsingSuccessfully, ECoreType.v2rayN));
|
||||
_updateFunc(false, args.Msg);
|
||||
|
||||
url = args.Url;
|
||||
|
@ -93,11 +66,10 @@ namespace v2rayN.Handler
|
|||
}
|
||||
else
|
||||
{
|
||||
Locator.Current.GetService<NoticeHandler>()?.Enqueue(args.Msg);
|
||||
_updateFunc(false, args.Msg);
|
||||
}
|
||||
};
|
||||
_updateFunc(false, string.Format(ResUI.MsgStartUpdating, "v2rayN"));
|
||||
_updateFunc(false, string.Format(ResUI.MsgStartUpdating, ECoreType.v2rayN));
|
||||
CheckUpdateAsync(ECoreType.v2rayN, preRelease);
|
||||
}
|
||||
|
||||
|
@ -138,7 +110,7 @@ namespace v2rayN.Handler
|
|||
{
|
||||
if (args.Success)
|
||||
{
|
||||
_updateFunc(false, string.Format(ResUI.MsgParsingSuccessfully, "Core"));
|
||||
_updateFunc(false, string.Format(ResUI.MsgParsingSuccessfully, type));
|
||||
_updateFunc(false, args.Msg);
|
||||
|
||||
url = args.Url;
|
||||
|
@ -149,11 +121,10 @@ namespace v2rayN.Handler
|
|||
}
|
||||
else
|
||||
{
|
||||
Locator.Current.GetService<NoticeHandler>()?.Enqueue(args.Msg);
|
||||
_updateFunc(false, args.Msg);
|
||||
}
|
||||
};
|
||||
_updateFunc(false, string.Format(ResUI.MsgStartUpdating, "Core"));
|
||||
_updateFunc(false, string.Format(ResUI.MsgStartUpdating, type));
|
||||
CheckUpdateAsync(type, preRelease);
|
||||
}
|
||||
|
||||
|
@ -232,10 +203,7 @@ namespace v2rayN.Handler
|
|||
result = Utils.Base64Decode(result);
|
||||
}
|
||||
|
||||
var lstUrl = new List<string>
|
||||
{
|
||||
item.moreUrl.TrimEx().Split(",")
|
||||
};
|
||||
var lstUrl = item.moreUrl.TrimEx().Split(",") ?? [];
|
||||
foreach (var it in lstUrl)
|
||||
{
|
||||
var url2 = Utils.GetPunycode(it);
|
||||
|
@ -570,11 +538,6 @@ namespace v2rayN.Handler
|
|||
string fileName = Utils.GetTempPath(Utils.GetDownloadFileName(url));
|
||||
if (File.Exists(fileName))
|
||||
{
|
||||
//Global.coreTypes.ForEach(it =>
|
||||
//{
|
||||
// string targetPath = Utile.GetBinPath($"{geoName}.dat", (ECoreType)Enum.Parse(typeof(ECoreType), it));
|
||||
// File.Copy(fileName, targetPath, true);
|
||||
//});
|
||||
string targetPath = Utils.GetBinPath($"{geoName}.dat");
|
||||
File.Copy(fileName, targetPath, true);
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
namespace v2rayN.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
public class ClashConnectionModel
|
||||
{
|
|
@ -1,4 +1,4 @@
|
|||
namespace v2rayN.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
public class ClashConnections
|
||||
{
|
|
@ -1,6 +1,6 @@
|
|||
using static v2rayN.Models.ClashProxies;
|
||||
using static ServiceLib.Models.ClashProxies;
|
||||
|
||||
namespace v2rayN.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
public class ClashProviders
|
||||
{
|
|
@ -1,4 +1,4 @@
|
|||
namespace v2rayN.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
public class ClashProxies
|
||||
{
|
|
@ -1,26 +1,18 @@
|
|||
using ReactiveUI.Fody.Helpers;
|
||||
|
||||
namespace v2rayN.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
[Serializable]
|
||||
public class ClashProxyModel
|
||||
{
|
||||
[Reactive]
|
||||
public string name { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public string type { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public string now { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public int delay { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public string delayName { get; set; }
|
||||
|
||||
[Reactive]
|
||||
public bool isActive { get; set; }
|
||||
}
|
||||
}
|
|
@ -1,4 +1,4 @@
|
|||
namespace v2rayN.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
public class ComboItem
|
||||
{
|
|
@ -1,6 +1,4 @@
|
|||
using v2rayN.Enums;
|
||||
|
||||
namespace v2rayN.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// 本软件配置文件实体类
|
|
@ -1,6 +1,4 @@
|
|||
using v2rayN.Enums;
|
||||
|
||||
namespace v2rayN.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
[Serializable]
|
||||
public class CoreBasicItem
|
|
@ -1,6 +1,4 @@
|
|||
using v2rayN.Enums;
|
||||
|
||||
namespace v2rayN.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
[Serializable]
|
||||
public class CoreInfo
|
|
@ -1,7 +1,6 @@
|
|||
using SQLite;
|
||||
using v2rayN.Enums;
|
||||
|
||||
namespace v2rayN.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
[Serializable]
|
||||
public class DNSItem
|
|
@ -1,6 +1,6 @@
|
|||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace v2rayN.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
public class GitHubReleaseAsset
|
||||
{
|
|
@ -1,6 +1,6 @@
|
|||
using SQLite;
|
||||
|
||||
namespace v2rayN.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
[Serializable]
|
||||
public class ProfileExItem
|
|
@ -1,7 +1,6 @@
|
|||
using SQLite;
|
||||
using v2rayN.Enums;
|
||||
|
||||
namespace v2rayN.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
[Serializable]
|
||||
public class ProfileItem
|
|
@ -1,4 +1,4 @@
|
|||
namespace v2rayN.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
[Serializable]
|
||||
public class ProfileItemModel : ProfileItem
|
|
@ -1,6 +1,6 @@
|
|||
using SQLite;
|
||||
|
||||
namespace v2rayN.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
[Serializable]
|
||||
public class RoutingItem
|
|
@ -1,4 +1,4 @@
|
|||
namespace v2rayN.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
[Serializable]
|
||||
public class RoutingItemModel : RoutingItem
|
|
@ -1,4 +1,4 @@
|
|||
namespace v2rayN.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
[Serializable]
|
||||
public class RulesItem
|
|
@ -1,4 +1,4 @@
|
|||
namespace v2rayN.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
[Serializable]
|
||||
public class RulesItemModel : RulesItem
|
|
@ -1,4 +1,4 @@
|
|||
namespace v2rayN.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
[Serializable]
|
||||
public class ServerSpeedItem : ServerStatItem
|
|
@ -1,6 +1,6 @@
|
|||
using SQLite;
|
||||
|
||||
namespace v2rayN.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
[Serializable]
|
||||
public class ServerStatItem
|
|
@ -1,9 +1,7 @@
|
|||
using v2rayN.Enums;
|
||||
|
||||
namespace v2rayN.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
[Serializable]
|
||||
internal class ServerTestItem
|
||||
public class ServerTestItem
|
||||
{
|
||||
public string indexId { get; set; }
|
||||
public string address { get; set; }
|
|
@ -1,4 +1,4 @@
|
|||
namespace v2rayN.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
public class SingboxConfig
|
||||
{
|
|
@ -1,4 +1,4 @@
|
|||
namespace v2rayN.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
[Serializable]
|
||||
public class SpeedTestResult
|
|
@ -1,4 +1,4 @@
|
|||
namespace v2rayN.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
public class SsSIP008
|
||||
{
|
|
@ -1,6 +1,6 @@
|
|||
using SQLite;
|
||||
|
||||
namespace v2rayN.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
[Serializable]
|
||||
public class SubItem
|
|
@ -1,6 +1,6 @@
|
|||
namespace v2rayN.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
internal class SysProxyConfig
|
||||
public class SysProxyConfig
|
||||
{
|
||||
public bool UserSettingsRecorded;
|
||||
public string Flags;
|
|
@ -1,6 +1,6 @@
|
|||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace v2rayN.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// v2ray配置文件实体类 例子SampleConfig.txt
|
|
@ -1,4 +1,4 @@
|
|||
namespace v2rayN.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Tcp伪装http的Request,只要Host
|
|
@ -1,12 +1,12 @@
|
|||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace v2rayN.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// https://github.com/2dust/v2rayN/wiki/
|
||||
/// </summary>
|
||||
[Serializable]
|
||||
internal class VmessQRCode
|
||||
public class VmessQRCode
|
||||
{
|
||||
[JsonNumberHandling(JsonNumberHandling.AllowReadingFromString | JsonNumberHandling.WriteAsString)]
|
||||
public int v { get; set; } = 2;
|
|
@ -8,7 +8,7 @@
|
|||
// </auto-generated>
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
namespace v2rayN.Resx {
|
||||
namespace ServiceLib.Resx {
|
||||
using System;
|
||||
|
||||
|
||||
|
@ -29,7 +29,7 @@ namespace v2rayN.Resx {
|
|||
private static global::System.Globalization.CultureInfo resourceCulture;
|
||||
|
||||
[global::System.Diagnostics.CodeAnalysis.SuppressMessageAttribute("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
|
||||
internal ResUI() {
|
||||
public ResUI() {
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
@ -39,7 +39,7 @@ namespace v2rayN.Resx {
|
|||
public static global::System.Resources.ResourceManager ResourceManager {
|
||||
get {
|
||||
if (object.ReferenceEquals(resourceMan, null)) {
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("v2rayN.Resx.ResUI", typeof(ResUI).Assembly);
|
||||
global::System.Resources.ResourceManager temp = new global::System.Resources.ResourceManager("ServiceLib.Resx.ResUI", typeof(ResUI).Assembly);
|
||||
resourceMan = temp;
|
||||
}
|
||||
return resourceMan;
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue