Пример #1
0
 public static void StartEngine(ILazyEngine engine)
 {
     _engine = engine;
     Clear();
     foreach (MainState mainState in _engine.States)
     {
         AddState(mainState);
     }
     lock (States)
     {
         States.Add(new StateIdle());
         LastState = States[States.Count() - 1]; //Set the last state to StateIdle
     }
     States.Sort();
     Logging.Write("[Engine]Initializing");
     Paused  = false;
     Running = true;
     // Leave it as a background thread.
     _workerThread = new Thread(Run)
     {
         IsBackground = true
     };
     _workerThread.Name = "Engine";
     _workerThread.SetApartmentState(ApartmentState.STA);
     _workerThread.Start();
     Logging.Write("[Engine]Started bot thread");
 }
Пример #2
0
 private void SelectEngineSelectedIndexChanged(object sender, EventArgs e)
 {
     if (SelectEngine.SelectedIndex != -1)
     {
         var cs = (CustomEngine)SelectEngine.SelectedItem;
         LazySettings.SelectedEngine = SelectEngine.Text;
         LazySettings.SaveSettings();
         EngineHandler = EngineCompiler.Assemblys[cs.AssemblyName];
         EngineHandler.Load();
         if (_radar != null && !_radar.IsDisposed)
         {
             OpenRadar();
         }
     }
 }
Пример #3
0
 public static void StopEngine()
 {
     if (!Running)
     {
         return;
     }
     Running = false;
     if (_workerThread.IsAlive)
     {
         _workerThread.Abort();
     }
     // Clear out the thread object and let the garbage collector get it
     _workerThread = null;
     States        = null;
     LastState     = null;
     _engine       = null;
     GC.Collect();
 }
Пример #4
0
 public static void StartEngine(ILazyEngine engine)
 {
     _engine = engine;
     Clear();
     foreach (MainState mainState in _engine.States)
     {
         AddState(mainState);
     }
     lock (States)
     {
         States.Add(new StateIdle());
         LastState = States[States.Count() - 1]; //Set the last state to StateIdle
     }
     States.Sort();
     Logging.Write("[Engine]Initializing");
     Paused = false;
     Running = true;
     // Leave it as a background thread.
     _workerThread = new Thread(Run) {IsBackground = true};
     _workerThread.Name = "Engine";
     _workerThread.SetApartmentState(ApartmentState.STA);
     _workerThread.Start();
     Logging.Write("[Engine]Started bot thread");          
 }
Пример #5
0
 private void SelectEngineSelectedIndexChanged(object sender, EventArgs e)
 {
     if (SelectEngine.SelectedIndex != -1)
     {
         var cs = (CustomEngine)SelectEngine.SelectedItem;
         LazySettings.SelectedEngine = SelectEngine.Text;
         LazySettings.SaveSettings();
         EngineHandler = EngineCompiler.Assemblys[cs.AssemblyName];
         EngineHandler.Load();
         if (_radar != null && !_radar.IsDisposed)
         {
             OpenRadar();
         }
     }
 }
Пример #6
0
 public static void StopEngine()
 {
     if (!Running)
     {
         return;
     }
     Running = false;
     if (_workerThread.IsAlive)
     {
         _workerThread.Abort();
     }
     // Clear out the thread object and let the garbage collector get it
     _workerThread = null;
     States = null;
     LastState = null;
     _engine = null;
     GC.Collect();
 }