private static int CheckCount() { lock (syncRoot) { if (runningCounter > 5) { string message = "Preventing " + HiddenAccessN.GetRobotName() + "from thread creation. You may only create 5 threads at same time."; LoggerN.logError(message); LoggerN.WriteLineToRobotsConsole(message); throw new AccessViolationException(message); } runningCounter++; return(runningCounter); } }
public static void ForceStopThread() { try { LoggerN.logMessage(HiddenAccessN.GetRobotName() + " is not stopping. Forcing a stop."); robotThread.Priority = ThreadPriority.Lowest; robotThread.Abort(); robotThread.Interrupt(); } catch (Exception ex) { LoggerN.logError(ex); throw; } }