Skip to content

Commit

Permalink
v241126
Browse files Browse the repository at this point in the history
1. Refine codes
  • Loading branch information
tonyhsie committed Nov 25, 2024
1 parent 4bcc88f commit d6fdf1f
Showing 1 changed file with 13 additions and 11 deletions.
24 changes: 13 additions & 11 deletions qBittorrentBlockXunlei/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -64,10 +64,10 @@ static void CCEHandler(object sender, ConsoleCancelEventArgs args)

static async Task Main(string[] args)
{
bool runInTerminal = Environment.UserInteractive && !Console.IsOutputRedirected;
if (runInTerminal)
bool bRunInTerminal = Environment.UserInteractive && !Console.IsOutputRedirected;
if (bRunInTerminal)
{
Console.Title = "qBittorrentBlockXunlei v241008";
Console.Title = "qBittorrentBlockXunlei v241126";
Console.OutputEncoding = Encoding.UTF8;
}
Console.CancelKeyPress += new ConsoleCancelEventHandler(CCEHandler);
Expand Down Expand Up @@ -145,7 +145,7 @@ static async Task Main(string[] args)
}
}

if (runInTerminal)
if (bRunInTerminal)
{
Console.Title += " " + sTargetServer;
}
Expand Down Expand Up @@ -393,15 +393,17 @@ static async Task Main(string[] args)
}
}

for (int i = 0; i < sClient.Length; ++i)
// 客戶端名稱只允許 ASCII 可顯示字元、'µ'、'μ'
if (!bBanPeer)
{
// 客戶端名稱只允許 ASCII 可顯示字元、'µ'、'μ'
char c = sClient[i];
if ((c < 0x20) || ((c > 0x7E) && (c != 0xB5) && (c != 0x03BC)))
foreach (char c in sClient)
{
Console.WriteLine("Banned - Weird Client: " + sClient.Substring(0, i) + "*, " + sPeer);
bBanPeer = true;
break;
if ((c < 0x20) || ((c > 0x7E) && (c != 0xB5) && (c != 0x03BC)))
{
Console.WriteLine("Banned - Weird Client: " + sClient + ", " + sPeer);
bBanPeer = true;
break;
}
}
}

Expand Down

0 comments on commit d6fdf1f

Please sign in to comment.