Code clean

This commit is contained in:
2dust
2023-04-14 17:03:30 +08:00
parent 9956182f86
commit ab6afa3b1a

View File

@@ -258,7 +258,7 @@ namespace ClashN
if (plainText.Length % 4 > 0) if (plainText.Length % 4 > 0)
{ {
plainText = plainText.PadRight(plainText.Length + 4 - plainText.Length % 4, '='); plainText = plainText.PadRight(plainText.Length + 4 - (plainText.Length % 4), '=');
} }
byte[] data = Convert.FromBase64String(plainText); byte[] data = Convert.FromBase64String(plainText);
@@ -337,23 +337,22 @@ namespace ClashN
if (GBs > 0) if (GBs > 0)
{ {
// multi GB // multi GB
/*ulong TBs = GBs / factor; ulong TBs = GBs / factor;
if (TBs > 0) if (TBs > 0)
{ {
// 你是魔鬼吗? 用这么多流量 result = TBs + (GBs % factor / (factor + 0.0));
result = TBs + GBs % factor / (factor + 0.0);
unit = "TB"; unit = "TB";
return; return;
}*/ }
result = GBs + MBs % factor / (factor + 0.0); result = GBs + (MBs % factor / (factor + 0.0));
unit = "GB"; unit = "GB";
return; return;
} }
result = MBs + KBs % factor / (factor + 0.0); result = MBs + (KBs % factor / (factor + 0.0));
unit = "MB"; unit = "MB";
return; return;
} }
result = KBs + amount % factor / (factor + 0.0); result = KBs + (amount % factor / (factor + 0.0));
unit = "KB"; unit = "KB";
return; return;
} }
@@ -1186,7 +1185,7 @@ namespace ClashN
{ {
int marginLeft = (int)((double)fullImage.Width * i / 2.5 / maxTry); int marginLeft = (int)((double)fullImage.Width * i / 2.5 / maxTry);
int marginTop = (int)((double)fullImage.Height * i / 2.5 / maxTry); int marginTop = (int)((double)fullImage.Height * i / 2.5 / maxTry);
Rectangle cropRect = new Rectangle(marginLeft, marginTop, fullImage.Width - marginLeft * 2, fullImage.Height - marginTop * 2); Rectangle cropRect = new Rectangle(marginLeft, marginTop, fullImage.Width - (marginLeft * 2), fullImage.Height - (marginTop * 2));
Bitmap target = new Bitmap(screen.Bounds.Width, screen.Bounds.Height); Bitmap target = new Bitmap(screen.Bounds.Width, screen.Bounds.Height);
double imageScale = (double)screen.Bounds.Width / (double)cropRect.Width; double imageScale = (double)screen.Bounds.Width / (double)cropRect.Width;