Skip to content

Commit

Permalink
Code clean
Browse files Browse the repository at this point in the history
  • Loading branch information
2dust committed Apr 14, 2023
1 parent 9956182 commit ab6afa3
Showing 1 changed file with 8 additions and 9 deletions.
17 changes: 8 additions & 9 deletions clashN/clashN/Tool/Utils.cs
Original file line number Diff line number Diff line change
Expand Up @@ -258,7 +258,7 @@ public static string Base64Decode(string plainText)

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);
Expand Down Expand Up @@ -337,23 +337,22 @@ public static void ToHumanReadable(ulong amount, out double result, out string u
if (GBs > 0)
{
// multi GB
/*ulong TBs = GBs / factor;
ulong 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;
}
Expand Down Expand Up @@ -1186,7 +1185,7 @@ public static string ScanScreen()
{
int marginLeft = (int)((double)fullImage.Width * 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);

double imageScale = (double)screen.Bounds.Width / (double)cropRect.Width;
Expand Down

0 comments on commit ab6afa3

Please sign in to comment.