mirror of
https://github.com/2dust/v2rayN.git
synced 2025-12-10 05:19:42 +05:00
Code clean
This commit is contained in:
@@ -374,11 +374,15 @@ public class CertPemManager
|
|||||||
{
|
{
|
||||||
var beginIndex = pemChain.IndexOf(beginMarker, index, StringComparison.Ordinal);
|
var beginIndex = pemChain.IndexOf(beginMarker, index, StringComparison.Ordinal);
|
||||||
if (beginIndex == -1)
|
if (beginIndex == -1)
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
var endIndex = pemChain.IndexOf(endMarker, beginIndex, StringComparison.Ordinal);
|
var endIndex = pemChain.IndexOf(endMarker, beginIndex, StringComparison.Ordinal);
|
||||||
if (endIndex == -1)
|
if (endIndex == -1)
|
||||||
|
{
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
// Extract certificate content
|
// Extract certificate content
|
||||||
var base64Start = beginIndex + beginMarker.Length;
|
var base64Start = beginIndex + beginMarker.Length;
|
||||||
|
|||||||
@@ -17,17 +17,17 @@ public class UpdateService(Config config, Func<bool, string, Task> updateFunc)
|
|||||||
{
|
{
|
||||||
if (args.Success)
|
if (args.Success)
|
||||||
{
|
{
|
||||||
UpdateFunc(false, ResUI.MsgDownloadV2rayCoreSuccessfully);
|
_ = UpdateFunc(false, ResUI.MsgDownloadV2rayCoreSuccessfully);
|
||||||
UpdateFunc(true, Utils.UrlEncode(fileName));
|
_ = UpdateFunc(true, Utils.UrlEncode(fileName));
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UpdateFunc(false, args.Msg);
|
_ = UpdateFunc(false, args.Msg);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
downloadHandle.Error += (sender2, args) =>
|
downloadHandle.Error += (sender2, args) =>
|
||||||
{
|
{
|
||||||
UpdateFunc(false, args.GetException().Message);
|
_ = UpdateFunc(false, args.GetException().Message);
|
||||||
};
|
};
|
||||||
|
|
||||||
await UpdateFunc(false, string.Format(ResUI.MsgStartUpdating, ECoreType.v2rayN));
|
await UpdateFunc(false, string.Format(ResUI.MsgStartUpdating, ECoreType.v2rayN));
|
||||||
@@ -57,26 +57,26 @@ public class UpdateService(Config config, Func<bool, string, Task> updateFunc)
|
|||||||
{
|
{
|
||||||
if (args.Success)
|
if (args.Success)
|
||||||
{
|
{
|
||||||
UpdateFunc(false, ResUI.MsgDownloadV2rayCoreSuccessfully);
|
_ = UpdateFunc(false, ResUI.MsgDownloadV2rayCoreSuccessfully);
|
||||||
UpdateFunc(false, ResUI.MsgUnpacking);
|
_ = UpdateFunc(false, ResUI.MsgUnpacking);
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
UpdateFunc(true, fileName);
|
_ = UpdateFunc(true, fileName);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
UpdateFunc(false, ex.Message);
|
_ = UpdateFunc(false, ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UpdateFunc(false, args.Msg);
|
_ = UpdateFunc(false, args.Msg);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
downloadHandle.Error += (sender2, args) =>
|
downloadHandle.Error += (sender2, args) =>
|
||||||
{
|
{
|
||||||
UpdateFunc(false, args.GetException().Message);
|
_ = UpdateFunc(false, args.GetException().Message);
|
||||||
};
|
};
|
||||||
|
|
||||||
await UpdateFunc(false, string.Format(ResUI.MsgStartUpdating, type));
|
await UpdateFunc(false, string.Format(ResUI.MsgStartUpdating, type));
|
||||||
@@ -439,7 +439,7 @@ public class UpdateService(Config config, Func<bool, string, Task> updateFunc)
|
|||||||
{
|
{
|
||||||
if (args.Success)
|
if (args.Success)
|
||||||
{
|
{
|
||||||
UpdateFunc(false, string.Format(ResUI.MsgDownloadGeoFileSuccessfully, fileName));
|
_ = UpdateFunc(false, string.Format(ResUI.MsgDownloadGeoFileSuccessfully, fileName));
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
@@ -453,17 +453,17 @@ public class UpdateService(Config config, Func<bool, string, Task> updateFunc)
|
|||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
{
|
{
|
||||||
UpdateFunc(false, ex.Message);
|
_ = UpdateFunc(false, ex.Message);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
UpdateFunc(false, args.Msg);
|
_ = UpdateFunc(false, args.Msg);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
downloadHandle.Error += (sender2, args) =>
|
downloadHandle.Error += (sender2, args) =>
|
||||||
{
|
{
|
||||||
UpdateFunc(false, args.GetException().Message);
|
_ = UpdateFunc(false, args.GetException().Message);
|
||||||
};
|
};
|
||||||
|
|
||||||
await downloadHandle.DownloadFileAsync(url, tmpFileName, true, _timeout);
|
await downloadHandle.DownloadFileAsync(url, tmpFileName, true, _timeout);
|
||||||
|
|||||||
Reference in New Issue
Block a user