mirror of
https://github.com/MCCTeam/Minecraft-Console-Client
synced 2025-10-14 21:22:49 +00:00
Fix all warnings & Trim (#2226)
* Fix AutoFishing crash * Fix all warnings * Remove DotNetZip. * Fix the usage of HttpClient.
This commit is contained in:
parent
4aa6c1c99f
commit
1d52d1eadd
227 changed files with 2201 additions and 43564 deletions
|
|
@ -1,7 +1,5 @@
|
|||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace MinecraftClient
|
||||
{
|
||||
|
|
@ -30,14 +28,15 @@ namespace MinecraftClient
|
|||
/// <param name="action">Action to run</param>
|
||||
/// <param name="timeout">Maximum timeout</param>
|
||||
/// <returns>True if the action finished whithout timing out</returns>
|
||||
public static bool Perform(Action action, TimeSpan timeout) {
|
||||
Thread thread = new Thread(new ThreadStart(action));
|
||||
public static bool Perform(Action action, TimeSpan timeout)
|
||||
{
|
||||
Thread thread = new(new ThreadStart(action));
|
||||
thread.Start();
|
||||
|
||||
bool success = thread.Join(timeout);
|
||||
if (!success)
|
||||
thread.Interrupt();
|
||||
|
||||
thread = null;
|
||||
return success;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue