Compare commits

..

No commits in common. "3db1dd7bbbd9ee61c85321c131c740c3576fad77" and "02a13ce028a278cdab5fe1d2e8727c169178fdd3" have entirely different histories.

29 changed files with 123 additions and 169 deletions

View file

@ -10,7 +10,7 @@ namespace AmazTool
{
Console.WriteLine($"{Resx.Resource.StartUnzipping}\n{fileName}");
Waiting(3);
Waiting(8);
if (!File.Exists(fileName))
{
@ -91,7 +91,7 @@ namespace AmazTool
}
Console.WriteLine(Resx.Resource.Restartv2rayN);
Waiting(2);
Waiting(3);
Process process = new()
{
StartInfo = new()

View file

@ -6,8 +6,6 @@ namespace ServiceLib.Common
{
public static class FileManager
{
private static readonly string _tag = "FileManager";
public static bool ByteArrayToFile(string fileName, byte[] content)
{
try
@ -17,7 +15,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
return false;
}
@ -32,7 +30,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
}
@ -48,7 +46,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
}
@ -62,7 +60,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
}
@ -81,7 +79,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
throw;
}
}
@ -107,13 +105,13 @@ namespace ServiceLib.Common
}
catch (IOException ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
}
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
return false;
}
return true;
@ -132,7 +130,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
return null;
}
}
@ -150,7 +148,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
return false;
}
return true;

View file

@ -6,8 +6,6 @@ namespace ServiceLib.Common
{
public class JsonUtils
{
private static readonly string _tag = "JsonUtils";
/// <summary>
/// DeepCopy
/// </summary>
@ -92,7 +90,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
return result;
}

View file

@ -15,8 +15,6 @@ namespace ServiceLib.Common
{
public class Utils
{
private static readonly string _tag = "Utils";
#region
/// <summary>
@ -38,7 +36,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
return result;
@ -59,7 +57,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
return null;
@ -94,7 +92,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
return string.Empty;
@ -119,7 +117,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
return null;
@ -141,7 +139,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
return null;
@ -161,7 +159,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog("Base64Encode", ex);
}
return string.Empty;
@ -195,7 +193,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog("Base64Decode", ex);
}
return string.Empty;
@ -485,7 +483,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
return false;
@ -537,7 +535,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
return Global.AppName;
@ -551,7 +549,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
return "0.0";
}
}
@ -580,7 +578,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
return string.Empty;
@ -607,7 +605,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
}
@ -633,7 +631,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
return systemHosts;

View file

@ -4,7 +4,6 @@ namespace ServiceLib.Common
{
internal static class WindowsUtils
{
private static readonly string _tag = "WindowsUtils";
public static string? RegReadValue(string path, string name, string def)
{
RegistryKey? regKey = null;
@ -16,7 +15,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
finally
{
@ -42,7 +41,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
finally
{

View file

@ -6,8 +6,6 @@ namespace ServiceLib.Common
{
public class YamlUtils
{
private static readonly string _tag = "YamlUtils";
#region YAML
/// <summary>
@ -28,7 +26,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog("FromYaml", ex);
return deserializer.Deserialize<T>("");
}
}
@ -55,7 +53,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
return result;
}
@ -73,7 +71,7 @@ namespace ServiceLib.Common
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog("PreprocessYaml", ex);
return null;
}
}

View file

@ -5,8 +5,6 @@ namespace ServiceLib.Handler
{
public static class AutoStartupHandler
{
private static readonly string _tag = "AutoStartupHandler";
public static async Task<bool> UpdateTask(Config config)
{
if (Utils.IsWindows())
@ -64,7 +62,7 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
}
@ -125,7 +123,7 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
}
@ -145,7 +143,7 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
}

View file

@ -9,7 +9,6 @@ namespace ServiceLib.Handler
private Dictionary<string, ProxiesItem>? _proxies;
public Dictionary<string, object> ProfileContent { get; set; }
private static readonly string _tag = "ClashApiHandler";
public async Task<Tuple<ClashProxies, ClashProviders>?> GetClashProxiesAsync(Config config)
{
@ -110,7 +109,7 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog("GetClashProxyGroups", ex);
return null;
}
}
@ -126,7 +125,7 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
}
@ -154,7 +153,7 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
}
@ -170,7 +169,7 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
return null;
@ -185,7 +184,7 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
}

View file

@ -9,7 +9,6 @@ namespace ServiceLib.Handler
public class ConfigHandler
{
private static readonly string _configRes = Global.ConfigFileName;
private static readonly string _tag = "ConfigHandler";
#region ConfigHandler
@ -195,7 +194,7 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog("ToJsonFile", ex);
return -1;
}
@ -501,7 +500,7 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
return -1;
}
@ -988,7 +987,7 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog("Remove Item", ex);
}
return 0;

View file

@ -1,14 +1,10 @@
using YamlDotNet.Core.Tokens;
namespace ServiceLib.Handler
namespace ServiceLib.Handler
{
/// <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)
{
var config = AppHandler.Instance.Config;
@ -86,7 +82,7 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog("GenerateClientCustomConfig", ex);
ret.Msg = ResUI.FailedGenDefaultConfiguration;
return ret;
}

View file

@ -15,7 +15,6 @@ namespace ServiceLib.Handler
private Process? _processPre;
private int _linuxSudoPid = -1;
private Action<bool, string>? _updateFunc;
private const string _tag = "CoreHandler";
public async Task Init(Config config, Action<bool, string> updateFunc)
{
@ -98,14 +97,12 @@ namespace ServiceLib.Handler
{
if (_process != null)
{
await KillProcess(_process, true);
_process = null;
_process = await KillProcess(_process);
}
if (_processPre != null)
{
await KillProcess(_processPre, true);
_processPre = null;
_processPre = await KillProcess(_processPre);
}
if (_linuxSudoPid > 0)
@ -116,7 +113,7 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
}
@ -124,11 +121,11 @@ namespace ServiceLib.Handler
{
try
{
await KillProcess(Process.GetProcessById(pid), false);
await KillProcess(Process.GetProcessById(pid));
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
}
@ -209,7 +206,7 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
ShowMsg(false, ex.Message);
return -1;
}
@ -318,39 +315,25 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
ShowMsg(true, ex.Message);
return null;
}
}
private async Task KillProcess(Process? proc, bool review)
private async Task<Process?> KillProcess(Process? proc)
{
if (proc is null)
{
return;
return null;
}
try { proc?.Kill(true); } catch (Exception ex) { Logging.SaveLog(ex.Message, ex); }
try { proc?.Kill(); } catch (Exception ex) { Logging.SaveLog(ex.Message, ex); }
try { proc?.Close(); } catch (Exception ex) { Logging.SaveLog(ex.Message, ex); }
try { proc?.Dispose(); } catch (Exception ex) { Logging.SaveLog(ex.Message, ex); }
var fileName = proc?.MainModule?.FileName;
var processName = proc?.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); }
await Task.Delay(500);
if (review)
{
var proc2 = Process.GetProcessesByName(processName)
.FirstOrDefault(t => t.MainModule?.FileName == fileName);
if (proc2 != null)
{
Logging.SaveLog($"{_tag}, KillProcess not completing the job");
await KillProcess(proc2, false);
proc2 = null;
}
}
await Task.Delay(100);
return null;
}
#endregion Process

View file

@ -2,8 +2,6 @@
{
public class FmtHandler
{
private static readonly string _tag = "FmtHandler";
public static string? GetShareUri(ProfileItem item)
{
try
@ -25,7 +23,7 @@
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
return "";
}
}
@ -83,7 +81,7 @@
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
msg = ResUI.Incorrectconfiguration;
return null;
}

View file

@ -10,7 +10,6 @@ namespace ServiceLib.Handler
private ConcurrentBag<ProfileExItem> _lstProfileEx = [];
private Queue<string> _queIndexIds = new();
public static ProfileExHandler Instance => _instance.Value;
private static readonly string _tag = "ProfileExHandler";
public ProfileExHandler()
{
@ -88,7 +87,7 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog("ProfileExHandler", ex);
}
}
}
@ -120,7 +119,7 @@ namespace ServiceLib.Handler
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
}

View file

@ -12,7 +12,7 @@
private StatisticsXrayService? _statisticsXray;
private StatisticsSingboxService? _statisticsSingbox;
private static readonly string _tag = "StatisticsHandler";
public List<ServerStatItem> ServerStat => _lstServerStat;
public async Task Init(Config config, Action<ServerSpeedItem> updateFunc)
@ -39,7 +39,7 @@
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
}
@ -61,7 +61,7 @@
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
}

View file

@ -72,6 +72,7 @@ namespace ServiceLib.Handler.SysProxy
catch (Exception ex)
{
SetProxyFallback(strProxy, exceptions, type);
//Logging.SaveLog(ex.Message, ex);
return false;
}
}

View file

@ -2,7 +2,6 @@
{
public static class SysProxyHandler
{
private static readonly string _tag = "SysProxyHandler";
public static async Task<bool> UpdateSysProxy(Config config, bool forceDisable)
{
var type = config.SystemProxyItem.SysProxyType;
@ -60,7 +59,7 @@
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
return true;
}

View file

@ -13,8 +13,7 @@ namespace ServiceLib.Handler
private string? _lastDescription;
private string _webDir = Global.AppName + "_backup";
private readonly string _webFileName = "backup.zip";
private readonly string _tag = "WebDav--";
private string _logTitle = "WebDav--";
public WebDavHandler()
{
@ -82,13 +81,13 @@ namespace ServiceLib.Handler
private void SaveLog(string desc)
{
_lastDescription = desc;
Logging.SaveLog(_tag + desc);
Logging.SaveLog(_logTitle + desc);
}
private void SaveLog(Exception ex)
{
_lastDescription = ex.Message;
Logging.SaveLog(_tag, ex);
Logging.SaveLog(_logTitle, ex);
}
public async Task<bool> CheckConnection()

View file

@ -6,7 +6,6 @@ namespace ServiceLib.Services.CoreConfig
public class CoreConfigClashService
{
private Config _config;
private static readonly string _tag = "CoreConfigClashService";
public CoreConfigClashService(Config config)
{
@ -132,7 +131,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog($"{_tag}-Mixin", ex);
Logging.SaveLog("GenerateClientConfigClash-Mixin", ex);
}
var txtFileNew = YamlUtils.ToYaml(fileContent).Replace(tagYamlStr2, tagYamlStr3);
@ -152,7 +151,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog("GenerateClientConfigClash", ex);
ret.Msg = ResUI.FailedGenDefaultConfiguration;
return ret;
}

View file

@ -7,7 +7,6 @@ namespace ServiceLib.Services.CoreConfig
public class CoreConfigSingboxService
{
private Config _config;
private static readonly string _tag = "CoreConfigSingboxService";
public CoreConfigSingboxService(Config config)
{
@ -72,7 +71,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog("GenerateClientConfig4Singbox", ex);
ret.Msg = ResUI.FailedGenDefaultConfiguration;
return ret;
}
@ -115,7 +114,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
await GenLog(singboxConfig);
@ -236,7 +235,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
ret.Msg = ResUI.FailedGenDefaultConfiguration;
return ret;
}
@ -352,7 +351,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
ret.Msg = ResUI.FailedGenDefaultConfiguration;
return ret;
}
@ -433,7 +432,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
ret.Msg = ResUI.FailedGenDefaultConfiguration;
return ret;
}
@ -474,7 +473,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
return 0;
}
@ -563,7 +562,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
return 0;
}
@ -696,7 +695,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
return 0;
}
@ -719,7 +718,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
return 0;
}
@ -769,7 +768,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
return 0;
}
@ -846,7 +845,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
return 0;
}
@ -898,7 +897,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
return 0;
@ -970,7 +969,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
return 0;
}
@ -1086,7 +1085,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
return 0;
}
@ -1185,7 +1184,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
return 0;
}

View file

@ -7,7 +7,6 @@ namespace ServiceLib.Services.CoreConfig
public class CoreConfigV2rayService
{
private Config _config;
private static readonly string _tag = "CoreConfigV2rayService";
public CoreConfigV2rayService(Config config)
{
@ -71,7 +70,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog("GenerateClientConfig4V2ray", ex);
ret.Msg = ResUI.FailedGenDefaultConfiguration;
return ret;
}
@ -198,7 +197,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
ret.Msg = ResUI.FailedGenDefaultConfiguration;
return ret;
}
@ -241,7 +240,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
await GenLog(v2rayConfig);
@ -350,7 +349,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
ret.Msg = ResUI.FailedGenDefaultConfiguration;
return ret;
}
@ -380,7 +379,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
return 0;
}
@ -424,7 +423,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
return 0;
}
@ -483,7 +482,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
return 0;
}
@ -561,7 +560,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
return 0;
}
@ -755,7 +754,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
return 0;
}
@ -779,7 +778,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
return 0;
}
@ -1021,7 +1020,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
return 0;
}
@ -1084,7 +1083,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
return 0;
}
@ -1242,7 +1241,7 @@ namespace ServiceLib.Services.CoreConfig
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
return 0;

View file

@ -13,7 +13,6 @@ namespace ServiceLib.Services
public event EventHandler<RetResult>? UpdateCompleted;
public event ErrorEventHandler? Error;
private static readonly string _tag = "DownloadService";
public async Task<int> DownloadDataAsync(string url, WebProxy webProxy, int downloadTimeout, Action<bool, string> updateFunc)
{
@ -69,7 +68,7 @@ namespace ServiceLib.Services
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
Error?.Invoke(this, new ErrorEventArgs(ex));
if (ex.InnerException != null)
@ -114,7 +113,7 @@ namespace ServiceLib.Services
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
Error?.Invoke(this, new ErrorEventArgs(ex));
if (ex.InnerException != null)
{
@ -132,7 +131,7 @@ namespace ServiceLib.Services
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
Error?.Invoke(this, new ErrorEventArgs(ex));
if (ex.InnerException != null)
{
@ -178,7 +177,7 @@ namespace ServiceLib.Services
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
Error?.Invoke(this, new ErrorEventArgs(ex));
if (ex.InnerException != null)
{
@ -209,7 +208,7 @@ namespace ServiceLib.Services
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
Error?.Invoke(this, new ErrorEventArgs(ex));
if (ex.InnerException != null)
{
@ -233,13 +232,13 @@ namespace ServiceLib.Services
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
return -1;
}
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
return -1;
}
}

View file

@ -11,7 +11,6 @@ namespace ServiceLib.Services
private Action<SpeedTestResult>? _updateFunc;
private bool _exitLoop = false;
private static readonly string _tag = "SpeedtestService";
public SpeedtestService(Config config, List<ProfileItem> selecteds, ESpeedActionType actionType, Action<SpeedTestResult> updateFunc)
{
@ -147,7 +146,7 @@ namespace ServiceLib.Services
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
}));
}
@ -155,7 +154,7 @@ namespace ServiceLib.Services
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
finally
{
@ -202,7 +201,7 @@ namespace ServiceLib.Services
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
}));
}
@ -210,7 +209,7 @@ namespace ServiceLib.Services
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
finally
{
@ -390,7 +389,7 @@ namespace ServiceLib.Services
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
return responseTime;
}

View file

@ -10,7 +10,6 @@ namespace ServiceLib.Services.Statistics
private ClientWebSocket? webSocket;
private Action<ServerSpeedItem>? _updateFunc;
private string Url => $"ws://{Global.Loopback}:{AppHandler.Instance.StatePort2}/traffic";
private static readonly string _tag = "StatisticsSingboxService";
public StatisticsSingboxService(Config config, Action<ServerSpeedItem> updateFunc)
{
@ -49,7 +48,7 @@ namespace ServiceLib.Services.Statistics
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
}

View file

@ -7,7 +7,6 @@ namespace ServiceLib.Services
{
private Action<bool, string>? _updateFunc;
private int _timeout = 30;
private static readonly string _tag = "UpdateService";
public async Task CheckUpdateGuiN(Config config, Action<bool, string> updateFunc, bool preRelease)
{
@ -273,7 +272,7 @@ namespace ServiceLib.Services
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
_updateFunc?.Invoke(false, ex.Message);
return new RetResult(false, ex.Message);
}
@ -357,7 +356,7 @@ namespace ServiceLib.Services
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
_updateFunc?.Invoke(false, ex.Message);
return new SemanticVersion("");
}
@ -416,7 +415,7 @@ namespace ServiceLib.Services
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
_updateFunc?.Invoke(false, ex.Message);
return new RetResult(false, ex.Message);
}

View file

@ -279,8 +279,9 @@ namespace ServiceLib.ViewModels
Locator.Current.GetService<ProfilesViewModel>()?.UpdateStatistics(update);
}
}
catch
catch (Exception ex)
{
Logging.SaveLog(ex.Message, ex);
}
}

View file

@ -235,7 +235,7 @@ namespace v2rayN.Desktop.Views
}
catch (Exception ex)
{
Logging.SaveLog("GetFonts", ex);
Logging.SaveLog("fill fonts error", ex);
}
return lstFonts;
}

View file

@ -13,7 +13,6 @@ namespace v2rayN
{
internal static class WindowsUtils
{
private static readonly string _tag = "WindowsUtils";
/// <summary>
/// 获取剪贴板数
/// </summary>
@ -32,7 +31,7 @@ namespace v2rayN
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
}
return strData;
}

View file

@ -8,7 +8,6 @@ namespace v2rayN.Handler
{
private static readonly Lazy<WindowsHandler> instance = new(() => new());
public static WindowsHandler Instance => instance.Value;
private static readonly string _tag = "WindowsHandler";
public async Task<Icon> GetNotifyIcon(Config config)
{
@ -40,7 +39,7 @@ namespace v2rayN.Handler
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
return Properties.Resources.NotifyIcon1;
}
}
@ -90,7 +89,7 @@ namespace v2rayN.Handler
}
catch (Exception ex)
{
Logging.SaveLog(_tag, ex);
Logging.SaveLog(ex.Message, ex);
return null;
}
}

View file

@ -246,7 +246,7 @@ namespace v2rayN.Views
}
catch (Exception ex)
{
Logging.SaveLog("GetFonts", ex);
Logging.SaveLog("fill fonts error", ex);
}
return lstFonts.OrderBy(t => t).ToList();
}