mirror of
https://github.com/2dust/v2rayN.git
synced 2025-10-27 02:34:41 +00:00
autofix
This commit is contained in:
parent
98d4801b7e
commit
4ad0c6f5af
254 changed files with 70070 additions and 69848 deletions
|
|
@ -1,4 +1,4 @@
|
|||
namespace AmazTool
|
||||
namespace AmazTool
|
||||
{
|
||||
internal static class Program
|
||||
{
|
||||
|
|
|
|||
2
v2rayN/AmazTool/Resx/Resource.Designer.cs
generated
2
v2rayN/AmazTool/Resx/Resource.Designer.cs
generated
|
|
@ -1,4 +1,4 @@
|
|||
//------------------------------------------------------------------------------
|
||||
//------------------------------------------------------------------------------
|
||||
// <auto-generated>
|
||||
// 此代码由工具生成。
|
||||
// 运行时版本:4.0.30319.42000
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Diagnostics;
|
||||
using System.Diagnostics;
|
||||
using System.IO.Compression;
|
||||
using System.Text;
|
||||
|
||||
|
|
@ -59,7 +59,8 @@ namespace AmazTool
|
|||
Console.WriteLine(entry.FullName);
|
||||
|
||||
var lst = entry.FullName.Split(splitKey);
|
||||
if (lst.Length == 1) continue;
|
||||
if (lst.Length == 1)
|
||||
continue;
|
||||
var fullName = string.Join(splitKey, lst[1..lst.Length]);
|
||||
|
||||
if (string.Equals(Utils.GetExePath(), Utils.GetPath(fullName), StringComparison.OrdinalIgnoreCase))
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Diagnostics;
|
||||
using System.Diagnostics;
|
||||
|
||||
namespace AmazTool
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using ReactiveUI;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace ServiceLib.Base
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using Downloader;
|
||||
using Downloader;
|
||||
using System.Net;
|
||||
|
||||
namespace ServiceLib.Common
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Formats.Tar;
|
||||
using System.Formats.Tar;
|
||||
using System.IO.Compression;
|
||||
using System.Text;
|
||||
|
||||
|
|
|
|||
|
|
@ -38,13 +38,15 @@ namespace ServiceLib.Common
|
|||
|
||||
public async Task<string?> GetAsync(string url)
|
||||
{
|
||||
if (Utils.IsNullOrEmpty(url)) return null;
|
||||
if (Utils.IsNullOrEmpty(url))
|
||||
return null;
|
||||
return await httpClient.GetStringAsync(url);
|
||||
}
|
||||
|
||||
public async Task<string?> GetAsync(HttpClient client, string url, CancellationToken token = default)
|
||||
{
|
||||
if (Utils.IsNullOrEmpty(url)) return null;
|
||||
if (Utils.IsNullOrEmpty(url))
|
||||
return null;
|
||||
return await client.GetStringAsync(url, token);
|
||||
}
|
||||
|
||||
|
|
@ -75,11 +77,13 @@ namespace ServiceLib.Common
|
|||
{
|
||||
ArgumentNullException.ThrowIfNull(url);
|
||||
ArgumentNullException.ThrowIfNull(fileName);
|
||||
if (File.Exists(fileName)) File.Delete(fileName);
|
||||
if (File.Exists(fileName))
|
||||
File.Delete(fileName);
|
||||
|
||||
using var response = await client.GetAsync(url, HttpCompletionOption.ResponseHeadersRead, token);
|
||||
|
||||
if (!response.IsSuccessStatusCode) throw new Exception(response.StatusCode.ToString());
|
||||
if (!response.IsSuccessStatusCode)
|
||||
throw new Exception(response.StatusCode.ToString());
|
||||
|
||||
var total = response.Content.Headers.ContentLength ?? -1L;
|
||||
var canReportProgress = total != -1 && progress != null;
|
||||
|
|
@ -97,7 +101,8 @@ namespace ServiceLib.Common
|
|||
var read = await stream.ReadAsync(buffer, token);
|
||||
totalRead += read;
|
||||
|
||||
if (read == 0) break;
|
||||
if (read == 0)
|
||||
break;
|
||||
await file.WriteAsync(buffer.AsMemory(0, read), token);
|
||||
|
||||
if (canReportProgress)
|
||||
|
|
@ -168,7 +173,7 @@ namespace ServiceLib.Common
|
|||
|
||||
totalRead += read;
|
||||
|
||||
var ts = (DateTime.Now - totalDatetime);
|
||||
var ts = DateTime.Now - totalDatetime;
|
||||
if (progress != null && ts.Seconds > totalSecond)
|
||||
{
|
||||
totalSecond = ts.Seconds;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Diagnostics;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace ServiceLib.Common
|
||||
|
|
@ -75,7 +75,8 @@ namespace ServiceLib.Common
|
|||
|
||||
private void Dispose(bool disposing)
|
||||
{
|
||||
if (disposed) return;
|
||||
if (disposed)
|
||||
return;
|
||||
disposed = true;
|
||||
|
||||
if (disposing)
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Text.Json;
|
||||
using System.Text.Json;
|
||||
using System.Text.Json.Nodes;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using NLog;
|
||||
using NLog;
|
||||
using NLog.Config;
|
||||
using NLog.Targets;
|
||||
|
||||
|
|
@ -27,14 +27,16 @@ namespace ServiceLib.Common
|
|||
|
||||
public static void SaveLog(string strContent)
|
||||
{
|
||||
if (!LogManager.IsLoggingEnabled()) return;
|
||||
if (!LogManager.IsLoggingEnabled())
|
||||
return;
|
||||
|
||||
LogManager.GetLogger("Log1").Info(strContent);
|
||||
}
|
||||
|
||||
public static void SaveLog(string strTitle, Exception ex)
|
||||
{
|
||||
if (!LogManager.IsLoggingEnabled()) return;
|
||||
if (!LogManager.IsLoggingEnabled())
|
||||
return;
|
||||
|
||||
var logger = LogManager.GetLogger("Log2");
|
||||
logger.Debug($"{strTitle},{ex.Message}");
|
||||
|
|
|
|||
|
|
@ -19,8 +19,10 @@ public static class ProcUtils
|
|||
}
|
||||
try
|
||||
{
|
||||
if (fileName.Contains(' ')) fileName = fileName.AppendQuotes();
|
||||
if (arguments.Contains(' ')) arguments = arguments.AppendQuotes();
|
||||
if (fileName.Contains(' '))
|
||||
fileName = fileName.AppendQuotes();
|
||||
if (arguments.Contains(' '))
|
||||
arguments = arguments.AppendQuotes();
|
||||
|
||||
Process process = new()
|
||||
{
|
||||
|
|
@ -83,10 +85,18 @@ public static class ProcUtils
|
|||
|
||||
GetProcessKeyInfo(proc, review, out var procId, out var fileName, out var processName);
|
||||
|
||||
try { proc?.Kill(true); } catch (Exception ex) { Logging.SaveLog(_tag, ex); }
|
||||
try { proc?.Kill(); } catch (Exception ex) { Logging.SaveLog(_tag, ex); }
|
||||
try { proc?.Close(); } catch (Exception ex) { Logging.SaveLog(_tag, ex); }
|
||||
try { proc?.Dispose(); } catch (Exception ex) { Logging.SaveLog(_tag, ex); }
|
||||
try
|
||||
{ proc?.Kill(true); }
|
||||
catch (Exception ex) { Logging.SaveLog(_tag, ex); }
|
||||
try
|
||||
{ proc?.Kill(); }
|
||||
catch (Exception ex) { Logging.SaveLog(_tag, ex); }
|
||||
try
|
||||
{ proc?.Close(); }
|
||||
catch (Exception ex) { Logging.SaveLog(_tag, ex); }
|
||||
try
|
||||
{ proc?.Dispose(); }
|
||||
catch (Exception ex) { Logging.SaveLog(_tag, ex); }
|
||||
|
||||
await Task.Delay(300);
|
||||
await ProcessKillByKeyInfo(review, procId, fileName, processName);
|
||||
|
|
@ -97,7 +107,8 @@ public static class ProcUtils
|
|||
procId = null;
|
||||
fileName = null;
|
||||
processName = null;
|
||||
if (!review) return;
|
||||
if (!review)
|
||||
return;
|
||||
try
|
||||
{
|
||||
procId = proc?.Id;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using QRCoder;
|
||||
using QRCoder;
|
||||
using SkiaSharp;
|
||||
using ZXing.SkiaSharp;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Common
|
||||
namespace ServiceLib.Common
|
||||
{
|
||||
public class SemanticVersion
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,5 +1,5 @@
|
|||
using SQLite;
|
||||
using System.Collections;
|
||||
using SQLite;
|
||||
|
||||
namespace ServiceLib.Common
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
|
||||
namespace ServiceLib.Common
|
||||
{
|
||||
|
|
@ -21,7 +21,8 @@ namespace ServiceLib.Common
|
|||
|
||||
public static bool BeginWithAny(this string s, IEnumerable<char> chars)
|
||||
{
|
||||
if (s.IsNullOrEmpty()) return false;
|
||||
if (s.IsNullOrEmpty())
|
||||
return false;
|
||||
return chars.Contains(s.First());
|
||||
}
|
||||
|
||||
|
|
@ -34,7 +35,8 @@ namespace ServiceLib.Common
|
|||
{
|
||||
while (reader.ReadLine() is { } line)
|
||||
{
|
||||
if (line.IsWhiteSpace()) continue;
|
||||
if (line.IsWhiteSpace())
|
||||
continue;
|
||||
yield return line;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,5 +1,3 @@
|
|||
using CliWrap;
|
||||
using CliWrap.Buffered;
|
||||
using System.Collections.Specialized;
|
||||
using System.Diagnostics;
|
||||
using System.Net;
|
||||
|
|
@ -10,6 +8,8 @@ using System.Runtime.InteropServices;
|
|||
using System.Security.Cryptography;
|
||||
using System.Security.Principal;
|
||||
using System.Text;
|
||||
using CliWrap;
|
||||
using CliWrap.Buffered;
|
||||
|
||||
namespace ServiceLib.Common
|
||||
{
|
||||
|
|
@ -176,7 +176,8 @@ namespace ServiceLib.Common
|
|||
{
|
||||
try
|
||||
{
|
||||
if (plainText.IsNullOrEmpty()) return "";
|
||||
if (plainText.IsNullOrEmpty())
|
||||
return "";
|
||||
plainText = plainText.Trim()
|
||||
.Replace(Environment.NewLine, "")
|
||||
.Replace("\n", "")
|
||||
|
|
@ -256,22 +257,22 @@ namespace ServiceLib.Common
|
|||
var TBs = GBs / factor;
|
||||
if (TBs > 0)
|
||||
{
|
||||
result = TBs + ((GBs % factor) / (factor + 0.0));
|
||||
result = TBs + (GBs % factor / (factor + 0.0));
|
||||
unit = "TB";
|
||||
return;
|
||||
}
|
||||
|
||||
result = GBs + ((MBs % factor) / (factor + 0.0));
|
||||
result = GBs + (MBs % factor / (factor + 0.0));
|
||||
unit = "GB";
|
||||
return;
|
||||
}
|
||||
|
||||
result = MBs + ((KBs % factor) / (factor + 0.0));
|
||||
result = MBs + (KBs % factor / (factor + 0.0));
|
||||
unit = "MB";
|
||||
return;
|
||||
}
|
||||
|
||||
result = KBs + ((amount % factor) / (factor + 0.0));
|
||||
result = KBs + (amount % factor / (factor + 0.0));
|
||||
unit = "KB";
|
||||
return;
|
||||
}
|
||||
|
|
@ -372,7 +373,8 @@ namespace ServiceLib.Common
|
|||
|
||||
public static bool IsBase64String(string? plainText)
|
||||
{
|
||||
if (plainText.IsNullOrEmpty()) return false;
|
||||
if (plainText.IsNullOrEmpty())
|
||||
return false;
|
||||
var buffer = new Span<byte>(new byte[plainText.Length]);
|
||||
return Convert.TryFromBase64String(plainText, buffer, out var _);
|
||||
}
|
||||
|
|
@ -462,9 +464,12 @@ namespace ServiceLib.Common
|
|||
if (IPAddress.TryParse(ip, out var address))
|
||||
{
|
||||
var ipBytes = address.GetAddressBytes();
|
||||
if (ipBytes[0] == 10) return true;
|
||||
if (ipBytes[0] == 172 && ipBytes[1] >= 16 && ipBytes[1] <= 31) return true;
|
||||
if (ipBytes[0] == 192 && ipBytes[1] == 168) return true;
|
||||
if (ipBytes[0] == 10)
|
||||
return true;
|
||||
if (ipBytes[0] == 172 && ipBytes[1] >= 16 && ipBytes[1] <= 31)
|
||||
return true;
|
||||
if (ipBytes[0] == 192 && ipBytes[1] == 168)
|
||||
return true;
|
||||
}
|
||||
|
||||
return false;
|
||||
|
|
@ -604,9 +609,11 @@ namespace ServiceLib.Common
|
|||
|
||||
foreach (var host in hostsList)
|
||||
{
|
||||
if (host.StartsWith("#")) continue;
|
||||
if (host.StartsWith("#"))
|
||||
continue;
|
||||
var hostItem = host.Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries);
|
||||
if (hostItem.Length != 2) continue;
|
||||
if (hostItem.Length != 2)
|
||||
continue;
|
||||
systemHosts.Add(hostItem.Last(), hostItem.First());
|
||||
}
|
||||
}
|
||||
|
|
@ -875,8 +882,10 @@ namespace ServiceLib.Common
|
|||
|
||||
public static async Task<string?> SetLinuxChmod(string? fileName)
|
||||
{
|
||||
if (fileName.IsNullOrEmpty()) return null;
|
||||
if (fileName.Contains(' ')) fileName = fileName.AppendQuotes();
|
||||
if (fileName.IsNullOrEmpty())
|
||||
return null;
|
||||
if (fileName.Contains(' '))
|
||||
fileName = fileName.AppendQuotes();
|
||||
//File.SetUnixFileMode(fileName, UnixFileMode.UserRead | UnixFileMode.UserWrite | UnixFileMode.UserExecute);
|
||||
var arg = new List<string>() { "-c", $"chmod +x {fileName}" };
|
||||
return await GetCliWrapOutput("/bin/bash", arg);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using Microsoft.Win32;
|
||||
using Microsoft.Win32;
|
||||
|
||||
namespace ServiceLib.Common
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using YamlDotNet.Core;
|
||||
using YamlDotNet.Core;
|
||||
using YamlDotNet.Serialization;
|
||||
using YamlDotNet.Serialization.NamingConventions;
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Enums
|
||||
namespace ServiceLib.Enums
|
||||
{
|
||||
public enum EConfigType
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Enums
|
||||
namespace ServiceLib.Enums
|
||||
{
|
||||
public enum ECoreType
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Enums
|
||||
namespace ServiceLib.Enums
|
||||
{
|
||||
public enum EGirdOrientation
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Enums
|
||||
namespace ServiceLib.Enums
|
||||
{
|
||||
public enum EGlobalHotkey
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Enums
|
||||
namespace ServiceLib.Enums
|
||||
{
|
||||
public enum EInboundProtocol
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Enums
|
||||
namespace ServiceLib.Enums
|
||||
{
|
||||
public enum EMove
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Enums
|
||||
namespace ServiceLib.Enums
|
||||
{
|
||||
public enum EMsgCommand
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Enums
|
||||
namespace ServiceLib.Enums
|
||||
{
|
||||
public enum EPresetType
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Enums
|
||||
namespace ServiceLib.Enums
|
||||
{
|
||||
public enum ERuleMode
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Enums
|
||||
namespace ServiceLib.Enums
|
||||
{
|
||||
public enum EServerColName
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Enums
|
||||
namespace ServiceLib.Enums
|
||||
{
|
||||
public enum ESpeedActionType
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Enums
|
||||
namespace ServiceLib.Enums
|
||||
{
|
||||
public enum ESysProxyType
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Enums
|
||||
namespace ServiceLib.Enums
|
||||
{
|
||||
public enum ETheme
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Enums
|
||||
namespace ServiceLib.Enums
|
||||
{
|
||||
public enum ETransport
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Enums
|
||||
namespace ServiceLib.Enums
|
||||
{
|
||||
public enum EViewAction
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,3 +1,3 @@
|
|||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
|
||||
<Weavers xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="FodyWeavers.xsd">
|
||||
<ReactiveUI />
|
||||
</Weavers>
|
||||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib
|
||||
namespace ServiceLib
|
||||
{
|
||||
public class Global
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,11 +1,11 @@
|
|||
global using ServiceLib.Base;
|
||||
global using ServiceLib.Base;
|
||||
global using ServiceLib.Common;
|
||||
global using ServiceLib.Enums;
|
||||
global using ServiceLib.Handler;
|
||||
global using ServiceLib.Handler.Fmt;
|
||||
global using ServiceLib.Services;
|
||||
global using ServiceLib.Services.Statistics;
|
||||
global using ServiceLib.Services.CoreConfig;
|
||||
global using ServiceLib.Handler.SysProxy;
|
||||
global using ServiceLib.Models;
|
||||
global using ServiceLib.Resx;
|
||||
global using ServiceLib.Handler.SysProxy;
|
||||
global using ServiceLib.Services;
|
||||
global using ServiceLib.Services.CoreConfig;
|
||||
global using ServiceLib.Services.Statistics;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Handler
|
||||
namespace ServiceLib.Handler
|
||||
{
|
||||
public sealed class AppHandler
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Security.Principal;
|
||||
using System.Security.Principal;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace ServiceLib.Handler
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using static ServiceLib.Models.ClashProxies;
|
||||
using static ServiceLib.Models.ClashProxies;
|
||||
|
||||
namespace ServiceLib.Handler
|
||||
{
|
||||
|
|
|
|||
|
|
@ -873,7 +873,8 @@ namespace ServiceLib.Handler
|
|||
|
||||
List<ProfileItem> lstKeep = new();
|
||||
List<ProfileItem> lstRemove = new();
|
||||
if (!config.GuiItem.KeepOlderDedupl) lstProfile.Reverse();
|
||||
if (!config.GuiItem.KeepOlderDedupl)
|
||||
lstProfile.Reverse();
|
||||
|
||||
foreach (ProfileItem item in lstProfile)
|
||||
{
|
||||
|
|
@ -1363,7 +1364,8 @@ namespace ServiceLib.Handler
|
|||
};
|
||||
|
||||
var uri = Utils.TryUri(url);
|
||||
if (uri == null) return -1;
|
||||
if (uri == null)
|
||||
return -1;
|
||||
//Do not allow http protocol
|
||||
if (url.StartsWith(Global.HttpProtocol) && !Utils.IsPrivateNetwork(uri.IdnHost))
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Handler
|
||||
namespace ServiceLib.Handler
|
||||
{
|
||||
/// <summary>
|
||||
/// Core configuration file processing class
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Diagnostics;
|
||||
using System.Diagnostics;
|
||||
using System.Text;
|
||||
|
||||
namespace ServiceLib.Handler
|
||||
|
|
@ -193,7 +193,7 @@ namespace ServiceLib.Handler
|
|||
{
|
||||
return _config.TunModeItem.EnableTun
|
||||
&& eCoreType == ECoreType.sing_box
|
||||
&& (Utils.IsNonWindows())
|
||||
&& Utils.IsNonWindows()
|
||||
//&& _config.TunModeItem.LinuxSudoPwd.IsNotEmpty()
|
||||
;
|
||||
}
|
||||
|
|
@ -239,12 +239,14 @@ namespace ServiceLib.Handler
|
|||
{
|
||||
proc.OutputDataReceived += (sender, e) =>
|
||||
{
|
||||
if (Utils.IsNullOrEmpty(e.Data)) return;
|
||||
if (Utils.IsNullOrEmpty(e.Data))
|
||||
return;
|
||||
UpdateFunc(false, e.Data + Environment.NewLine);
|
||||
};
|
||||
proc.ErrorDataReceived += (sender, e) =>
|
||||
{
|
||||
if (Utils.IsNullOrEmpty(e.Data)) return;
|
||||
if (Utils.IsNullOrEmpty(e.Data))
|
||||
return;
|
||||
UpdateFunc(false, e.Data + Environment.NewLine);
|
||||
};
|
||||
}
|
||||
|
|
@ -258,7 +260,8 @@ namespace ServiceLib.Handler
|
|||
await Task.Delay(10);
|
||||
await proc.StandardInput.WriteLineAsync(pwd);
|
||||
}
|
||||
if (isNeedSudo) _linuxSudoPid = proc.Id;
|
||||
if (isNeedSudo)
|
||||
_linuxSudoPid = proc.Id;
|
||||
|
||||
if (displayLog)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Handler
|
||||
namespace ServiceLib.Handler
|
||||
{
|
||||
public sealed class CoreInfoHandler
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections.Specialized;
|
||||
using System.Collections.Specialized;
|
||||
|
||||
namespace ServiceLib.Handler.Fmt
|
||||
{
|
||||
|
|
@ -214,7 +214,8 @@ namespace ServiceLib.Handler.Fmt
|
|||
{
|
||||
foreach (var item in s)
|
||||
{
|
||||
if (str.Contains(item, StringComparison.OrdinalIgnoreCase)) return true;
|
||||
if (str.Contains(item, StringComparison.OrdinalIgnoreCase))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Handler.Fmt
|
||||
namespace ServiceLib.Handler.Fmt
|
||||
{
|
||||
public class ClashFmt : BaseFmt
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Handler.Fmt
|
||||
namespace ServiceLib.Handler.Fmt
|
||||
{
|
||||
public class FmtHandler
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Handler.Fmt
|
||||
namespace ServiceLib.Handler.Fmt
|
||||
{
|
||||
public class Hysteria2Fmt : BaseFmt
|
||||
{
|
||||
|
|
@ -11,7 +11,8 @@
|
|||
};
|
||||
|
||||
var url = Utils.TryUri(str);
|
||||
if (url == null) return null;
|
||||
if (url == null)
|
||||
return null;
|
||||
|
||||
item.Address = url.IdnHost;
|
||||
item.Port = url.Port;
|
||||
|
|
@ -28,7 +29,8 @@
|
|||
|
||||
public static string? ToUri(ProfileItem? item)
|
||||
{
|
||||
if (item == null) return null;
|
||||
if (item == null)
|
||||
return null;
|
||||
string url = string.Empty;
|
||||
|
||||
string remark = string.Empty;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Handler.Fmt
|
||||
namespace ServiceLib.Handler.Fmt
|
||||
{
|
||||
public class NaiveproxyFmt : BaseFmt
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Text.RegularExpressions;
|
||||
using System.Text.RegularExpressions;
|
||||
|
||||
namespace ServiceLib.Handler.Fmt
|
||||
{
|
||||
|
|
@ -26,7 +26,8 @@ namespace ServiceLib.Handler.Fmt
|
|||
|
||||
public static string? ToUri(ProfileItem? item)
|
||||
{
|
||||
if (item == null) return null;
|
||||
if (item == null)
|
||||
return null;
|
||||
string url = string.Empty;
|
||||
|
||||
string remark = string.Empty;
|
||||
|
|
@ -82,7 +83,8 @@ namespace ServiceLib.Handler.Fmt
|
|||
private static ProfileItem? ResolveSip002(string result)
|
||||
{
|
||||
var parsedUrl = Utils.TryUri(result);
|
||||
if (parsedUrl == null) return null;
|
||||
if (parsedUrl == null)
|
||||
return null;
|
||||
|
||||
ProfileItem item = new()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Handler.Fmt
|
||||
namespace ServiceLib.Handler.Fmt
|
||||
{
|
||||
public class SingboxFmt : BaseFmt
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Handler.Fmt
|
||||
namespace ServiceLib.Handler.Fmt
|
||||
{
|
||||
public class SocksFmt : BaseFmt
|
||||
{
|
||||
|
|
@ -23,7 +23,8 @@
|
|||
|
||||
public static string? ToUri(ProfileItem? item)
|
||||
{
|
||||
if (item == null) return null;
|
||||
if (item == null)
|
||||
return null;
|
||||
var url = string.Empty;
|
||||
|
||||
var remark = string.Empty;
|
||||
|
|
@ -86,7 +87,8 @@
|
|||
private static ProfileItem? ResolveSocksNew(string result)
|
||||
{
|
||||
var parsedUrl = Utils.TryUri(result);
|
||||
if (parsedUrl == null) return null;
|
||||
if (parsedUrl == null)
|
||||
return null;
|
||||
|
||||
ProfileItem item = new()
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Handler.Fmt
|
||||
namespace ServiceLib.Handler.Fmt
|
||||
{
|
||||
public class TrojanFmt : BaseFmt
|
||||
{
|
||||
|
|
@ -12,7 +12,8 @@
|
|||
};
|
||||
|
||||
var url = Utils.TryUri(str);
|
||||
if (url == null) return null;
|
||||
if (url == null)
|
||||
return null;
|
||||
|
||||
item.Address = url.IdnHost;
|
||||
item.Port = url.Port;
|
||||
|
|
@ -27,7 +28,8 @@
|
|||
|
||||
public static string? ToUri(ProfileItem? item)
|
||||
{
|
||||
if (item == null) return null;
|
||||
if (item == null)
|
||||
return null;
|
||||
string url = string.Empty;
|
||||
|
||||
string remark = string.Empty;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Handler.Fmt
|
||||
namespace ServiceLib.Handler.Fmt
|
||||
{
|
||||
public class TuicFmt : BaseFmt
|
||||
{
|
||||
|
|
@ -12,7 +12,8 @@
|
|||
};
|
||||
|
||||
var url = Utils.TryUri(str);
|
||||
if (url == null) return null;
|
||||
if (url == null)
|
||||
return null;
|
||||
|
||||
item.Address = url.IdnHost;
|
||||
item.Port = url.Port;
|
||||
|
|
@ -34,7 +35,8 @@
|
|||
|
||||
public static string? ToUri(ProfileItem? item)
|
||||
{
|
||||
if (item == null) return null;
|
||||
if (item == null)
|
||||
return null;
|
||||
string url = string.Empty;
|
||||
|
||||
string remark = string.Empty;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Handler.Fmt
|
||||
namespace ServiceLib.Handler.Fmt
|
||||
{
|
||||
public class V2rayFmt : BaseFmt
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Handler.Fmt
|
||||
namespace ServiceLib.Handler.Fmt
|
||||
{
|
||||
public class VLESSFmt : BaseFmt
|
||||
{
|
||||
|
|
@ -13,7 +13,8 @@
|
|||
};
|
||||
|
||||
var url = Utils.TryUri(str);
|
||||
if (url == null) return null;
|
||||
if (url == null)
|
||||
return null;
|
||||
|
||||
item.Address = url.IdnHost;
|
||||
item.Port = url.Port;
|
||||
|
|
@ -30,7 +31,8 @@
|
|||
|
||||
public static string? ToUri(ProfileItem? item)
|
||||
{
|
||||
if (item == null) return null;
|
||||
if (item == null)
|
||||
return null;
|
||||
string url = string.Empty;
|
||||
|
||||
string remark = string.Empty;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Handler.Fmt
|
||||
namespace ServiceLib.Handler.Fmt
|
||||
{
|
||||
public class VmessFmt : BaseFmt
|
||||
{
|
||||
|
|
@ -19,7 +19,8 @@
|
|||
|
||||
public static string? ToUri(ProfileItem? item)
|
||||
{
|
||||
if (item == null) return null;
|
||||
if (item == null)
|
||||
return null;
|
||||
string url = string.Empty;
|
||||
|
||||
VmessQRCode vmessQRCode = new()
|
||||
|
|
@ -106,7 +107,8 @@
|
|||
};
|
||||
|
||||
var url = Utils.TryUri(str);
|
||||
if (url == null) return null;
|
||||
if (url == null)
|
||||
return null;
|
||||
|
||||
item.Address = url.IdnHost;
|
||||
item.Port = url.Port;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Handler.Fmt
|
||||
namespace ServiceLib.Handler.Fmt
|
||||
{
|
||||
public class WireguardFmt : BaseFmt
|
||||
{
|
||||
|
|
@ -12,7 +12,8 @@
|
|||
};
|
||||
|
||||
var url = Utils.TryUri(str);
|
||||
if (url == null) return null;
|
||||
if (url == null)
|
||||
return null;
|
||||
|
||||
item.Address = url.IdnHost;
|
||||
item.Port = url.Port;
|
||||
|
|
@ -31,7 +32,8 @@
|
|||
|
||||
public static string? ToUri(ProfileItem? item)
|
||||
{
|
||||
if (item == null) return null;
|
||||
if (item == null)
|
||||
return null;
|
||||
string url = string.Empty;
|
||||
|
||||
string remark = string.Empty;
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using ReactiveUI;
|
||||
using ReactiveUI;
|
||||
|
||||
namespace ServiceLib.Handler
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Net.Sockets;
|
||||
using System.Net.Sockets;
|
||||
using System.Text;
|
||||
|
||||
namespace ServiceLib.Handler
|
||||
|
|
@ -89,7 +89,8 @@ namespace ServiceLib.Handler
|
|||
|
||||
public static void Stop()
|
||||
{
|
||||
if (_tcpListener == null) return;
|
||||
if (_tcpListener == null)
|
||||
return;
|
||||
try
|
||||
{
|
||||
_isRunning = false;
|
||||
|
|
|
|||
|
|
@ -1,6 +1,4 @@
|
|||
using System.Collections.Concurrent;
|
||||
|
||||
//using System.Reactive.Linq;
|
||||
using System.Collections.Concurrent;
|
||||
|
||||
namespace ServiceLib.Handler
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Handler
|
||||
namespace ServiceLib.Handler
|
||||
{
|
||||
public class StatisticsHandler
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Handler.SysProxy
|
||||
namespace ServiceLib.Handler.SysProxy
|
||||
{
|
||||
public class ProxySettingLinux
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Handler.SysProxy
|
||||
namespace ServiceLib.Handler.SysProxy
|
||||
{
|
||||
public class ProxySettingOSX
|
||||
{
|
||||
|
|
|
|||
|
|
@ -176,7 +176,8 @@ namespace ServiceLib.Handler.SysProxy
|
|||
}
|
||||
|
||||
// FREE the data ASAP
|
||||
if (list.szConnection != nint.Zero) Marshal.FreeHGlobal(list.szConnection); // release mem 3
|
||||
if (list.szConnection != nint.Zero)
|
||||
Marshal.FreeHGlobal(list.szConnection); // release mem 3
|
||||
if (optionCount > 1)
|
||||
{
|
||||
Marshal.FreeHGlobal(options[1].m_Value.m_StringPtr); // release mem 1
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Handler.SysProxy
|
||||
namespace ServiceLib.Handler.SysProxy
|
||||
{
|
||||
public static class SysProxyHandler
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Handler
|
||||
namespace ServiceLib.Handler
|
||||
{
|
||||
public class TaskHandler
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Net;
|
||||
using System.Net;
|
||||
using WebDav;
|
||||
|
||||
namespace ServiceLib.Handler
|
||||
|
|
@ -61,7 +61,8 @@ namespace ServiceLib.Handler
|
|||
|
||||
private async Task<bool> TryCreateDir()
|
||||
{
|
||||
if (_client is null) return false;
|
||||
if (_client is null)
|
||||
return false;
|
||||
try
|
||||
{
|
||||
var result2 = await _client.Mkcol(_webDir);
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
public class CheckUpdateModel
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
public class ClashConnectionModel
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
public class ClashConnections
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using static ServiceLib.Models.ClashProxies;
|
||||
using static ServiceLib.Models.ClashProxies;
|
||||
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
public class ClashProxies
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
[Serializable]
|
||||
public class ClashProxyModel
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
public class CmdItem
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
public class ComboItem
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// 本软件配置文件实体类
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
[Serializable]
|
||||
public class CoreBasicItem
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
[Serializable]
|
||||
public class CoreInfo
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using SQLite;
|
||||
using SQLite;
|
||||
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Text.Json.Serialization;
|
||||
using System.Text.Json.Serialization;
|
||||
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
internal class IPAPIInfo
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using SQLite;
|
||||
using SQLite;
|
||||
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using SQLite;
|
||||
using SQLite;
|
||||
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
|
|
@ -30,7 +30,7 @@ namespace ServiceLib.Models
|
|||
|
||||
public string GetSummary()
|
||||
{
|
||||
var summary = $"[{(ConfigType).ToString()}] ";
|
||||
var summary = $"[{ConfigType.ToString()}] ";
|
||||
var arrAddr = Address.Split('.');
|
||||
var addr = arrAddr.Length switch
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
[Serializable]
|
||||
public class ProfileItemModel : ProfileItem
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
public class RetResult
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using SQLite;
|
||||
using SQLite;
|
||||
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
[Serializable]
|
||||
public class RoutingItemModel : RoutingItem
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
[Serializable]
|
||||
public class RoutingTemplate
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
[Serializable]
|
||||
public class RulesItem
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
[Serializable]
|
||||
public class RulesItemModel : RulesItem
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
[Serializable]
|
||||
public class ServerSpeedItem : ServerStatItem
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using SQLite;
|
||||
using SQLite;
|
||||
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
[Serializable]
|
||||
public class ServerTestItem
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
public class SingboxConfig
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
[Serializable]
|
||||
public class SpeedTestResult
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
public class SsSIP008
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using SQLite;
|
||||
using SQLite;
|
||||
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Collections;
|
||||
using System.Collections;
|
||||
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
namespace ServiceLib.Models
|
||||
namespace ServiceLib.Models
|
||||
{
|
||||
/// <summary>
|
||||
/// Tcp伪装http的Request,只要Host
|
||||
|
|
|
|||
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue