优化, 改成使用语法糖

pull/3305/head
小仙女 2023-02-17 14:36:28 +08:00
parent 6d4cbacd50
commit 1321037c52
8 changed files with 281 additions and 352 deletions

View File

@ -13,7 +13,7 @@ namespace v2rayN.Base
{ {
} }
public async Task<string> DownloadStringAsync(IWebProxy webProxy, string url, string? userAgent, int timeout) public async Task<string?> DownloadStringAsync(IWebProxy webProxy, string url, string? userAgent, int timeout)
{ {
if (string.IsNullOrEmpty(url)) if (string.IsNullOrEmpty(url))
{ {
@ -23,7 +23,7 @@ namespace v2rayN.Base
var cancellationToken = new CancellationTokenSource(); var cancellationToken = new CancellationTokenSource();
cancellationToken.CancelAfter(timeout * 1000); cancellationToken.CancelAfter(timeout * 1000);
Uri uri = new Uri(url); Uri uri = new(url);
//Authorization Header //Authorization Header
var headers = new WebHeaderCollection(); var headers = new WebHeaderCollection();
if (!Utils.IsNullOrEmpty(uri.UserInfo)) if (!Utils.IsNullOrEmpty(uri.UserInfo))
@ -45,8 +45,7 @@ namespace v2rayN.Base
}; };
string text = string.Empty; string text = string.Empty;
using (var downloader = new DownloadService(downloadOpt)) using var downloader = new DownloadService(downloadOpt);
{
downloader.DownloadFileCompleted += (sender, value) => downloader.DownloadFileCompleted += (sender, value) =>
{ {
if (value.Error != null) if (value.Error != null)
@ -54,14 +53,9 @@ namespace v2rayN.Base
throw new Exception(string.Format("{0}", value.Error.Message)); throw new Exception(string.Format("{0}", value.Error.Message));
} }
}; };
using (var stream = await downloader.DownloadFileTaskAsync(address: url, cancellationToken: cancellationToken.Token)) using var stream = await downloader.DownloadFileTaskAsync(address: url, cancellationToken: cancellationToken.Token);
{ using StreamReader reader = new(stream);
using (StreamReader reader = new StreamReader(stream))
{
text = reader.ReadToEnd(); text = reader.ReadToEnd();
}
}
}
downloadOpt = null; downloadOpt = null;
@ -73,7 +67,7 @@ namespace v2rayN.Base
{ {
if (string.IsNullOrEmpty(url)) if (string.IsNullOrEmpty(url))
{ {
throw new ArgumentNullException("url"); throw new ArgumentNullException(nameof(url));
} }
var cancellationToken = new CancellationTokenSource(); var cancellationToken = new CancellationTokenSource();
@ -94,8 +88,7 @@ namespace v2rayN.Base
int totalSecond = 0; int totalSecond = 0;
var hasValue = false; var hasValue = false;
double maxSpeed = 0; double maxSpeed = 0;
using (var downloader = new DownloadService(downloadOpt)) using var downloader = new DownloadService(downloadOpt);
{
//downloader.DownloadStarted += (sender, value) => //downloader.DownloadStarted += (sender, value) =>
//{ //{
// if (progress != null) // if (progress != null)
@ -131,7 +124,6 @@ namespace v2rayN.Base
progress.Report("......"); progress.Report("......");
await downloader.DownloadFileTaskAsync(address: url, cancellationToken: cancellationToken.Token); await downloader.DownloadFileTaskAsync(address: url, cancellationToken: cancellationToken.Token);
}
downloadOpt = null; downloadOpt = null;
} }
@ -167,14 +159,10 @@ namespace v2rayN.Base
var progressPercentage = 0; var progressPercentage = 0;
var hasValue = false; var hasValue = false;
using (var downloader = new DownloadService(downloadOpt)) using var downloader = new DownloadService(downloadOpt);
{
downloader.DownloadStarted += (sender, value) => downloader.DownloadStarted += (sender, value) =>
{ {
if (progress != null) progress?.Report(0);
{
progress.Report(0);
}
}; };
downloader.DownloadProgressChanged += (sender, value) => downloader.DownloadProgressChanged += (sender, value) =>
{ {
@ -198,7 +186,6 @@ namespace v2rayN.Base
}; };
await downloader.DownloadFileTaskAsync(url, fileName, cancellationToken: cancellationToken.Token); await downloader.DownloadFileTaskAsync(url, fileName, cancellationToken: cancellationToken.Token);
}
downloadOpt = null; downloadOpt = null;
} }

View File

@ -33,7 +33,7 @@ namespace v2rayN.Base
return httpClientHelper; return httpClientHelper;
} }
} }
public async Task<string> GetAsync(string url) public async Task<string?> GetAsync(string url)
{ {
if (string.IsNullOrEmpty(url)) if (string.IsNullOrEmpty(url))
{ {
@ -43,7 +43,7 @@ namespace v2rayN.Base
return await response.Content.ReadAsStringAsync(); return await response.Content.ReadAsStringAsync();
} }
public async Task<string> GetAsync(HttpClient client, string url, CancellationToken token) public async Task<string?> GetAsync(HttpClient client, string url, CancellationToken token)
{ {
if (string.IsNullOrEmpty(url)) if (string.IsNullOrEmpty(url))
{ {
@ -54,7 +54,7 @@ namespace v2rayN.Base
{ {
throw new Exception(string.Format("{0}", response.StatusCode)); throw new Exception(string.Format("{0}", response.StatusCode));
} }
return await response.Content.ReadAsStringAsync(); return await response.Content.ReadAsStringAsync(token);
} }
public async Task PutAsync(string url, Dictionary<string, string> headers) public async Task PutAsync(string url, Dictionary<string, string> headers)
@ -92,10 +92,8 @@ namespace v2rayN.Base
var total = response.Content.Headers.ContentLength.HasValue ? response.Content.Headers.ContentLength.Value : -1L; var total = response.Content.Headers.ContentLength.HasValue ? response.Content.Headers.ContentLength.Value : -1L;
var canReportProgress = total != -1 && progress != null; var canReportProgress = total != -1 && progress != null;
using (var stream = await response.Content.ReadAsStreamAsync()) using var stream = await response.Content.ReadAsStreamAsync();
{ using var file = File.Create(fileName);
using (var file = File.Create(fileName))
{
var totalRead = 0L; var totalRead = 0L;
var buffer = new byte[1024 * 1024]; var buffer = new byte[1024 * 1024];
var isMoreToRead = true; var isMoreToRead = true;
@ -132,21 +130,18 @@ namespace v2rayN.Base
} }
} }
} while (isMoreToRead); } while (isMoreToRead);
file.Close();
if (canReportProgress) if (canReportProgress)
{ {
progress.Report(101); progress.Report(101);
} }
} }
}
}
public async Task DownloadDataAsync4Speed(HttpClient client, string url, IProgress<string> progress, CancellationToken token) public async Task DownloadDataAsync4Speed(HttpClient client, string url, IProgress<string> progress, CancellationToken token)
{ {
if (string.IsNullOrEmpty(url)) if (string.IsNullOrEmpty(url))
{ {
throw new ArgumentNullException("url"); throw new ArgumentNullException(nameof(url));
} }
var response = await client.GetAsync(url, HttpCompletionOption.ResponseHeadersRead, token); var response = await client.GetAsync(url, HttpCompletionOption.ResponseHeadersRead, token);
@ -159,8 +154,7 @@ namespace v2rayN.Base
//var total = response.Content.Headers.ContentLength.HasValue ? response.Content.Headers.ContentLength.Value : -1L; //var total = response.Content.Headers.ContentLength.HasValue ? response.Content.Headers.ContentLength.Value : -1L;
//var canReportProgress = total != -1 && progress != null; //var canReportProgress = total != -1 && progress != null;
using (var stream = await response.Content.ReadAsStreamAsync()) using var stream = await response.Content.ReadAsStreamAsync(token);
{
var totalRead = 0L; var totalRead = 0L;
var buffer = new byte[1024 * 64]; var buffer = new byte[1024 * 64];
var isMoreToRead = true; var isMoreToRead = true;
@ -210,7 +204,6 @@ namespace v2rayN.Base
} }
} while (isMoreToRead); } while (isMoreToRead);
} }
}
} }
} }

View File

@ -34,7 +34,7 @@ namespace v2rayN.Base
public static IEnumerable<string> NonWhiteSpaceLines(this TextReader reader) public static IEnumerable<string> NonWhiteSpaceLines(this TextReader reader)
{ {
string line; string? line;
while ((line = reader.ReadLine()) != null) while ((line = reader.ReadLine()) != null)
{ {
if (line.IsWhiteSpace()) continue; if (line.IsWhiteSpace()) continue;

View File

@ -1021,7 +1021,17 @@ namespace v2rayN.Handler
return -1; return -1;
} }
ProfileItem profileItem = new ProfileItem(); //判断str是否包含s的任意一个字符串
static bool Containss(string str, params string[] s)
{
foreach (var item in s)
{
if (str.Contains(item, StringComparison.OrdinalIgnoreCase)) return true;
}
return false;
}
ProfileItem profileItem = new();
//Is v2ray configuration //Is v2ray configuration
V2rayConfig v2rayConfig = Utils.FromJson<V2rayConfig>(clipboardData); V2rayConfig v2rayConfig = Utils.FromJson<V2rayConfig>(clipboardData);
if (v2rayConfig != null if (v2rayConfig != null
@ -1038,9 +1048,7 @@ namespace v2rayN.Handler
profileItem.remarks = "v2ray_custom"; profileItem.remarks = "v2ray_custom";
} }
//Is Clash configuration //Is Clash configuration
else if (clipboardData.IndexOf("port") >= 0 else if (Containss(clipboardData, "port", "socks-port", "proxies"))
&& clipboardData.IndexOf("socks-port") >= 0
&& clipboardData.IndexOf("proxies") >= 0)
{ {
var fileName = Utils.GetTempPath($"{Utils.GetGUID(false)}.yaml"); var fileName = Utils.GetTempPath($"{Utils.GetGUID(false)}.yaml");
File.WriteAllText(fileName, clipboardData); File.WriteAllText(fileName, clipboardData);
@ -1050,12 +1058,7 @@ namespace v2rayN.Handler
profileItem.remarks = "clash_custom"; profileItem.remarks = "clash_custom";
} }
//Is hysteria configuration //Is hysteria configuration
else if (clipboardData.IndexOf("server") >= 0 else if (Containss(clipboardData, "server", "up", "down", "listen", "<html>", "<body>"))
&& clipboardData.IndexOf("up") >= 0
&& clipboardData.IndexOf("down") >= 0
&& clipboardData.IndexOf("listen") >= 0
&& clipboardData.IndexOf("<html>") < 0
&& clipboardData.IndexOf("<body>") < 0)
{ {
var fileName = Utils.GetTempPath($"{Utils.GetGUID(false)}.json"); var fileName = Utils.GetTempPath($"{Utils.GetGUID(false)}.json");
File.WriteAllText(fileName, clipboardData); File.WriteAllText(fileName, clipboardData);
@ -1065,10 +1068,7 @@ namespace v2rayN.Handler
profileItem.remarks = "hysteria_custom"; profileItem.remarks = "hysteria_custom";
} }
//Is naiveproxy configuration //Is naiveproxy configuration
else if (clipboardData.IndexOf("listen") >= 0 else if (Containss(clipboardData, "listen", "proxy", "<html>", "<body>"))
&& clipboardData.IndexOf("proxy") >= 0
&& clipboardData.IndexOf("<html>") < 0
&& clipboardData.IndexOf("<body>") < 0)
{ {
var fileName = Utils.GetTempPath($"{Utils.GetGUID(false)}.json"); var fileName = Utils.GetTempPath($"{Utils.GetGUID(false)}.json");
File.WriteAllText(fileName, clipboardData); File.WriteAllText(fileName, clipboardData);

View File

@ -189,24 +189,21 @@ namespace v2rayN.Handler
//判断是否使用代理 //判断是否使用代理
public static bool UsedProxy() public static bool UsedProxy()
{ {
RegistryKey rk = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Internet Settings", true); using RegistryKey rk = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Internet Settings", true);
if (rk.GetValue("ProxyEnable").ToString() == "1") if (rk.GetValue("ProxyEnable").ToString() == "1")
{ {
rk.Close();
return true; return true;
} }
else else
{ {
rk.Close();
return false; return false;
} }
} }
//获得代理的IP和端口 //获得代理的IP和端口
public static string GetProxyProxyServer() public static string GetProxyProxyServer()
{ {
RegistryKey rk = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Internet Settings", true); using RegistryKey rk = Registry.CurrentUser.OpenSubKey(@"Software\Microsoft\Windows\CurrentVersion\Internet Settings", true);
string ProxyServer = rk.GetValue("ProxyServer").ToString(); string ProxyServer = rk.GetValue("ProxyServer").ToString();
rk.Close();
return ProxyServer; return ProxyServer;
} }

View File

@ -21,28 +21,18 @@ namespace v2rayN.Handler
{ {
try try
{ {
string url = string.Empty; string? url = string.Empty;
switch (item.configType) url = item.configType switch
{ {
case EConfigType.VMess: EConfigType.VMess => ShareVmess(item),
url = ShareVmess(item); EConfigType.Shadowsocks => ShareShadowsocks(item),
break; EConfigType.Socks => ShareSocks(item),
case EConfigType.Shadowsocks: EConfigType.Trojan => ShareTrojan(item),
url = ShareShadowsocks(item); EConfigType.VLESS => ShareVLESS(item),
break; _ => null,
case EConfigType.Socks: };
url = ShareSocks(item);
break;
case EConfigType.Trojan:
url = ShareTrojan(item);
break;
case EConfigType.VLESS:
url = ShareVLESS(item);
break;
default:
break;
}
return url; return url;
} }
catch (Exception ex) catch (Exception ex)

View File

@ -10,8 +10,8 @@ namespace v2rayN.Tool
{ {
try try
{ {
using (FileStream fs = new FileStream(fileName, FileMode.Create, FileAccess.Write)) using FileStream fs = new(fileName, FileMode.Create, FileAccess.Write);
fs.Write(content, 0, content.Length); fs.Write(content);
return true; return true;
} }
catch (Exception ex) catch (Exception ex)
@ -25,20 +25,9 @@ namespace v2rayN.Tool
{ {
try try
{ {
// Because the uncompressed size of the file is unknown, using FileStream fs = File.Create(fileName);
// we are using an arbitrary buffer size. using GZipStream input = new(new MemoryStream(content), CompressionMode.Decompress, false);
byte[] buffer = new byte[4096]; input.CopyTo(fs);
int n;
using (FileStream fs = File.Create(fileName))
using (GZipStream input = new GZipStream(new MemoryStream(content),
CompressionMode.Decompress, false))
{
while ((n = input.Read(buffer, 0, buffer.Length)) > 0)
{
fs.Write(buffer, 0, n);
}
}
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -55,12 +44,10 @@ namespace v2rayN.Tool
{ {
try try
{ {
using (FileStream fs = new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite)) using FileStream fs = new(path, FileMode.Open, FileAccess.Read, FileShare.ReadWrite);
using (StreamReader sr = new StreamReader(fs, encoding)) using StreamReader sr = new(fs, encoding);
{
return sr.ReadToEnd(); return sr.ReadToEnd();
} }
}
catch (Exception ex) catch (Exception ex)
{ {
Utils.SaveLog(ex.Message, ex); Utils.SaveLog(ex.Message, ex);
@ -71,8 +58,7 @@ namespace v2rayN.Tool
{ {
try try
{ {
using (ZipArchive archive = ZipFile.OpenRead(fileName)) using ZipArchive archive = ZipFile.OpenRead(fileName);
{
foreach (ZipArchiveEntry entry in archive.Entries) foreach (ZipArchiveEntry entry in archive.Entries)
{ {
if (entry.Length == 0) if (entry.Length == 0)
@ -93,7 +79,6 @@ namespace v2rayN.Tool
} }
} }
} }
}
catch (Exception ex) catch (Exception ex)
{ {
Utils.SaveLog(ex.Message, ex); Utils.SaveLog(ex.Message, ex);

View File

@ -48,12 +48,10 @@ namespace v2rayN
try try
{ {
Assembly assembly = Assembly.GetExecutingAssembly(); Assembly assembly = Assembly.GetExecutingAssembly();
using (Stream stream = assembly.GetManifestResourceStream(res)) using Stream stream = assembly.GetManifestResourceStream(res);
using (StreamReader reader = new StreamReader(stream)) using StreamReader reader = new(stream);
{
result = reader.ReadToEnd(); result = reader.ReadToEnd();
} }
}
catch (Exception ex) catch (Exception ex)
{ {
SaveLog(ex.Message, ex); SaveLog(ex.Message, ex);
@ -76,11 +74,9 @@ namespace v2rayN
{ {
return result; return result;
} }
using (StreamReader reader = new StreamReader(res)) using StreamReader reader = new(res);
{
result = reader.ReadToEnd(); result = reader.ReadToEnd();
} }
}
catch (Exception ex) catch (Exception ex)
{ {
SaveLog(ex.Message, ex); SaveLog(ex.Message, ex);
@ -150,8 +146,7 @@ namespace v2rayN
int result; int result;
try try
{ {
using (StreamWriter file = File.CreateText(filePath)) using StreamWriter file = File.CreateText(filePath);
{
JsonSerializer serializer; JsonSerializer serializer;
if (nullValue) if (nullValue)
{ {
@ -163,7 +158,6 @@ namespace v2rayN
} }
serializer.Serialize(file, obj); serializer.Serialize(file, obj);
}
result = 0; result = 0;
} }
catch (Exception ex) catch (Exception ex)
@ -248,7 +242,7 @@ namespace v2rayN
try try
{ {
str = str.Replace(Environment.NewLine, ""); str = str.Replace(Environment.NewLine, "");
List<string> list = new List<string>(str.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries)); List<string> list = new(str.Split(new string[] { "," }, StringSplitOptions.RemoveEmptyEntries));
return list.OrderBy(x => x).ToList(); return list.OrderBy(x => x).ToList();
} }
catch (Exception ex) catch (Exception ex)
@ -341,7 +335,7 @@ namespace v2rayN
{ {
try try
{ {
return (obj == null ? string.Empty : obj.ToString()); return obj?.ToString() ?? string.Empty;
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -418,10 +412,9 @@ namespace v2rayN
public static string GetMD5(string str) public static string GetMD5(string str)
{ {
var md5 = MD5.Create();
byte[] byteOld = Encoding.UTF8.GetBytes(str); byte[] byteOld = Encoding.UTF8.GetBytes(str);
byte[] byteNew = md5.ComputeHash(byteOld); byte[] byteNew = MD5.HashData(byteOld);
StringBuilder sb = new StringBuilder(); StringBuilder sb = new(32);
foreach (byte b in byteNew) foreach (byte b in byteNew)
{ {
sb.Append(b.ToString("x2")); sb.Append(b.ToString("x2"));
@ -444,7 +437,7 @@ namespace v2rayN
} }
try try
{ {
Uri uri = new Uri(url); Uri uri = new(url);
if (uri.Host == uri.IdnHost) if (uri.Host == uri.IdnHost)
{ {
return url; return url;
@ -572,18 +565,14 @@ namespace v2rayN
public static bool IsIpv6(string ip) public static bool IsIpv6(string ip)
{ {
IPAddress address; if (IPAddress.TryParse(ip, out IPAddress? address))
if (IPAddress.TryParse(ip, out address))
{ {
switch (address.AddressFamily) return address.AddressFamily switch
{ {
case AddressFamily.InterNetwork: AddressFamily.InterNetwork => false,
return false; AddressFamily.InterNetworkV6 => true,
case AddressFamily.InterNetworkV6: _ => false,
return true; };
default:
return false;
}
} }
return false; return false;
} }
@ -688,11 +677,11 @@ namespace v2rayN
public static string RegReadValue(string path, string name, string def) public static string RegReadValue(string path, string name, string def)
{ {
RegistryKey regKey = null; RegistryKey? regKey = null;
try try
{ {
regKey = Registry.CurrentUser.OpenSubKey(path, false); regKey = Registry.CurrentUser.OpenSubKey(path, false);
string value = regKey?.GetValue(name) as string; string? value = regKey?.GetValue(name) as string;
if (IsNullOrEmpty(value)) if (IsNullOrEmpty(value))
{ {
return def; return def;
@ -715,7 +704,7 @@ namespace v2rayN
public static void RegWriteValue(string path, string name, object value) public static void RegWriteValue(string path, string name, object value)
{ {
RegistryKey regKey = null; RegistryKey? regKey = null;
try try
{ {
regKey = Registry.CurrentUser.CreateSubKey(path); regKey = Registry.CurrentUser.CreateSubKey(path);
@ -747,15 +736,13 @@ namespace v2rayN
public static bool CheckForDotNetVersion(int release = 528040) public static bool CheckForDotNetVersion(int release = 528040)
{ {
const string subkey = @"SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\"; const string subkey = @"SOFTWARE\Microsoft\NET Framework Setup\NDP\v4\Full\";
using (RegistryKey ndpKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32).OpenSubKey(subkey)) using RegistryKey ndpKey = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry32).OpenSubKey(subkey);
{
if (ndpKey != null && ndpKey.GetValue("Release") != null) if (ndpKey != null && ndpKey.GetValue("Release") != null)
{ {
return (int)ndpKey.GetValue("Release") >= release ? true : false; return (int)ndpKey.GetValue("Release") >= release ? true : false;
} }
return false; return false;
} }
}
/// <summary> /// <summary>
/// Auto Start via TaskService /// Auto Start via TaskService
@ -775,8 +762,7 @@ namespace v2rayN
string taskDescription = description; string taskDescription = description;
string deamonFileName = fileName; string deamonFileName = fileName;
using (var taskService = new TaskService()) using var taskService = new TaskService();
{
var tasks = taskService.RootFolder.GetTasks(new Regex(TaskName)); var tasks = taskService.RootFolder.GetTasks(new Regex(TaskName));
foreach (var t in tasks) foreach (var t in tasks)
{ {
@ -800,7 +786,6 @@ namespace v2rayN
taskService.RootFolder.RegisterTaskDefinition(TaskName, task); taskService.RootFolder.RegisterTaskDefinition(TaskName, task);
} }
}
#endregion #endregion
@ -908,16 +893,13 @@ namespace v2rayN
public static T DeepCopy<T>(T obj) public static T DeepCopy<T>(T obj)
{ {
object retval; object retval;
using (MemoryStream ms = new MemoryStream()) MemoryStream ms = new MemoryStream();
{
BinaryFormatter bf = new BinaryFormatter(); BinaryFormatter bf = new BinaryFormatter();
//序列化成流 //序列化成流
bf.Serialize(ms, obj); bf.Serialize(ms, obj);
ms.Seek(0, SeekOrigin.Begin); ms.Seek(0, SeekOrigin.Begin);
//反序列化成对象 //反序列化成对象
retval = bf.Deserialize(ms); retval = bf.Deserialize(ms);
ms.Close();
}
return (T)retval; return (T)retval;
} }
@ -1075,14 +1057,11 @@ namespace v2rayN
public static string UnGzip(byte[] buf) public static string UnGzip(byte[] buf)
{ {
MemoryStream sb = new MemoryStream(); using MemoryStream sb = new();
using (GZipStream input = new GZipStream(new MemoryStream(buf), using GZipStream input = new(new MemoryStream(buf), CompressionMode.Decompress, false);
CompressionMode.Decompress,
false))
{
input.CopyTo(sb); input.CopyTo(sb);
} sb.Position = 0;
return Encoding.UTF8.GetString(sb.ToArray()); return new StreamReader(sb, Encoding.UTF8).ReadToEnd();
} }
public static string GetBackupPath(string filename) public static string GetBackupPath(string filename)
@ -1198,9 +1177,8 @@ namespace v2rayN
{ {
foreach (Screen screen in Screen.AllScreens) foreach (Screen screen in Screen.AllScreens)
{ {
using (Bitmap fullImage = new Bitmap(screen.Bounds.Width, using Bitmap fullImage = new Bitmap(screen.Bounds.Width,
screen.Bounds.Height)) screen.Bounds.Height);
{
using (Graphics g = Graphics.FromImage(fullImage)) using (Graphics g = Graphics.FromImage(fullImage))
{ {
g.CopyFromScreen(screen.Bounds.X, g.CopyFromScreen(screen.Bounds.X,
@ -1237,7 +1215,6 @@ namespace v2rayN
} }
} }
} }
}
catch (Exception ex) catch (Exception ex)
{ {
SaveLog(ex.Message, ex); SaveLog(ex.Message, ex);