async public void miningStart() { mining.benchmark = "NO"; Program.SyncStatus = false; Program.NewMessage("USER => Mining start", "INFO"); if (File.Exists(@Program.currentDir + "/benchmark.txt")) { mining.killAll(); Program.watchDogs.Stop(); Program.syncLoop.Stop(); Program.NewMessage("BENCHMARK => Continue in 2 seconds", ""); await System.Threading.Tasks.Task.Delay(2000); BenchMark.Start(); } else { if (!File.Exists(Program.minerstatDir + "/buffer.txt")) { Program.syncLoop.Stop(); mining.killAll(); } Program.offlineLoop.Start(); await System.Threading.Tasks.Task.Delay(200); mining.Start(); //Program.syncLoop.Start(); } }
async public static void RemoteCommand(string command) { if (command.Equals("BENCHMARK")) { mining.killAll(); Program.watchDogs.Stop(); Program.syncLoop.Stop(); Program.NewMessage("BENCHMARK => Starts in 2 second", ""); await Task.Delay(2000); try { if (!File.Exists(Program.currentDir + "/benchmark.txt")) { File.WriteAllText(Program.currentDir + "/benchmark.txt", ""); } } catch (Exception) { } BenchMark.Start(); } if (command.Equals("STOP")) { mining.killAll(); Program.watchDogs.Stop(); //Program.syncLoop.Stop(); Program.NewMessage("MINING => STOP", ""); } if (command.Equals("RESTARTNODE") || command.Equals("RESTART") || command.Equals("START")) { mining.killAll(); Program.watchDogs.Stop(); Program.syncLoop.Stop(); await Task.Delay(1500); mining.Start(); } if (command.Equals("REBOOT")) { mining.killAll(); Program.watchDogs.Stop(); Program.syncLoop.Stop(); Program.NewMessage("SYSTEM => REBOOT in 1 sec", ""); await Task.Delay(1500); var psi = new ProcessStartInfo("shutdown", "/r /f /t 0"); psi.CreateNoWindow = true; psi.UseShellExecute = false; Process.Start(psi); } if (command.Equals("SHUTDOWN")) { mining.killAll(); Program.watchDogs.Stop(); Program.syncLoop.Stop(); Program.NewMessage("SYSTEM => SHUTDOWN in 1 sec", ""); await Task.Delay(1500); var psi = new ProcessStartInfo("shutdown", "/s /f /t 0"); psi.CreateNoWindow = true; psi.UseShellExecute = false; Process.Start(psi); } if (command.Equals("DOWNLOADWATTS")) { mining.downloadConfig(Program.token, Program.worker); } if (command.Equals("RESTARTWATTS")) { mining.killAll(); Program.watchDogs.Stop(); Program.syncLoop.Stop(); await Task.Delay(1500); mining.downloadConfig(Program.token, Program.worker); await Task.Delay(1000); mining.Start(); } }