private Process StartMinerProcess(string arguments, bool redirectOutput, bool ensureProcessStarts = false, string reason = "") { ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.FileName = minerConfiguration.ExecutablePath; startInfo.WindowStyle = ProcessWindowStyle.Hidden; startInfo.CreateNoWindow = true; startInfo.Arguments = arguments; if (minerConfiguration.DisableGpu) { startInfo.Arguments = startInfo.Arguments + " --disable-gpu"; if (minerConfiguration.MinerBackend == MinerBackend.Cgminer) { //otherwise it still requires OpenCL.dll - not an issue with bfgminer if (OSVersionPlatform.GetConcretePlatform() == PlatformID.Unix) { startInfo.FileName = startInfo.FileName + "-nogpu"; } else { startInfo.FileName = minerConfiguration.ExecutablePath.Replace("cgminer.exe", "cgminer-nogpu.exe"); } } } startInfo.UseShellExecute = false; startInfo.RedirectStandardOutput = redirectOutput; if (LogLaunch != null) { LogLaunchArgs args = new LogLaunchArgs(); args.DateTime = DateTime.Now; args.ExecutablePath = startInfo.FileName; args.Arguments = startInfo.Arguments; args.Reason = reason; args.CoinName = minerConfiguration.CoinName; LogLaunch(this, args); } Process process = StartProcessAndCheckResponse(startInfo); if (ensureProcessStarts) { //store the returned process process = EnsureProcessStarts(process, startInfo); } if (!process.HasExited) { process.PriorityClass = minerConfiguration.Priority; } return(process); }
private Process StartMinerProcess(string arguments, bool redirectOutput, bool ensureProcessStarts = false, string reason = "", bool startProcess = true) { ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.FileName = minerConfiguration.ExecutablePath; startInfo.WorkingDirectory = Path.GetDirectoryName(startInfo.FileName); //so miners can find kernels startInfo.WindowStyle = ProcessWindowStyle.Hidden; startInfo.CreateNoWindow = true; startInfo.Arguments = arguments.Trim(); if (minerConfiguration.DisableGpu) { startInfo.Arguments = String.Format("{0} {1}", startInfo.Arguments, MinerParameter.ScanSerialOpenCLNoAuto); } startInfo.UseShellExecute = false; startInfo.RedirectStandardOutput = redirectOutput; if (LogLaunch != null) { LogLaunchArgs args = new LogLaunchArgs(); args.DateTime = DateTime.Now; args.ExecutablePath = startInfo.FileName; args.Arguments = startInfo.Arguments; args.Reason = reason; args.CoinName = minerConfiguration.CoinName; LogLaunch(this, args); } //requiest UTF-8 encoding so that characters from bfgminer are read startInfo.StandardOutputEncoding = System.Text.Encoding.UTF8; Process process = StartProcessAndCheckResponse(startInfo, startProcess); if (startProcess) { if (ensureProcessStarts) { //store the returned process process = EnsureProcessStarts(process, startInfo); } if (!process.HasExited) { process.PriorityClass = minerConfiguration.Priority; } } return(process); }
private Process StartMinerProcess(string arguments, bool redirectOutput, bool ensureProcessStarts = false, string reason = "", bool startProcess = true) { ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.FileName = minerConfiguration.ExecutablePath; startInfo.WindowStyle = ProcessWindowStyle.Hidden; startInfo.CreateNoWindow = true; startInfo.Arguments = arguments.Trim(); if (minerConfiguration.DisableGpu) { startInfo.Arguments = String.Format("{0} {1}", startInfo.Arguments, MinerParameter.ScanSerialOpenCLNoAuto); } startInfo.UseShellExecute = false; startInfo.RedirectStandardOutput = redirectOutput; if (LogLaunch != null) { LogLaunchArgs args = new LogLaunchArgs(); args.DateTime = DateTime.Now; args.ExecutablePath = startInfo.FileName; args.Arguments = startInfo.Arguments; args.Reason = reason; args.CoinName = minerConfiguration.CoinName; LogLaunch(this, args); } //requiest UTF-8 encoding so that characters from bfgminer are read startInfo.StandardOutputEncoding = System.Text.Encoding.UTF8; Process process = StartProcessAndCheckResponse(startInfo, startProcess); if (startProcess) { if (ensureProcessStarts) //store the returned process process = EnsureProcessStarts(process, startInfo); if (!process.HasExited) process.PriorityClass = minerConfiguration.Priority; } return process; }
private Process StartMinerProcess(string arguments, bool redirectOutput, bool ensureProcessStarts = false, string reason = "", bool startProcess = true) { ProcessStartInfo startInfo = new ProcessStartInfo(); startInfo.FileName = minerConfiguration.ExecutablePath; startInfo.WindowStyle = ProcessWindowStyle.Hidden; startInfo.CreateNoWindow = true; startInfo.Arguments = arguments.Trim(); if (minerConfiguration.DisableGpu) { startInfo.Arguments = startInfo.Arguments + " --disable-gpu"; if (minerConfiguration.MinerBackend == MinerBackend.Cgminer) { //otherwise it still requires OpenCL.dll - not an issue with bfgminer if (OSVersionPlatform.GetConcretePlatform() == PlatformID.Unix) startInfo.FileName = startInfo.FileName + "-nogpu"; else startInfo.FileName = minerConfiguration.ExecutablePath.Replace("cgminer.exe", "cgminer-nogpu.exe"); } } startInfo.UseShellExecute = false; startInfo.RedirectStandardOutput = redirectOutput; if (LogLaunch != null) { LogLaunchArgs args = new LogLaunchArgs(); args.DateTime = DateTime.Now; args.ExecutablePath = startInfo.FileName; args.Arguments = startInfo.Arguments; args.Reason = reason; args.CoinName = minerConfiguration.CoinName; LogLaunch(this, args); } Process process = StartProcessAndCheckResponse(startInfo, startProcess); if (startProcess) { if (ensureProcessStarts) //store the returned process process = EnsureProcessStarts(process, startInfo); if (!process.HasExited) process.PriorityClass = minerConfiguration.Priority; } return process; }
private void LogProcessLaunchToFile(LogLaunchArgs ea) { const string logFileName = "ProcessLog.json"; LogObjectToFile(ea, logFileName); }
private void LogProcessLaunch(object sender, LogLaunchArgs ea) { logLaunchArgsBindingSource.Position = logLaunchArgsBindingSource.Add(ea); while (logLaunchArgsBindingSource.Count > 1000) logLaunchArgsBindingSource.RemoveAt(0); LogProcessLaunchToFile(ea); }
private void LogProcessLaunch(object sender, LogLaunchArgs ea) { //remove then add so BindingList position is on latest entry while (LogLaunchEntries.Count > MaxLogEntriesOnScreen) LogLaunchEntries.RemoveAt(0); LogLaunchEntries.Add(ea); LogProcessLaunchToFile(ea); }
private static void LaunchLoggedMiner(LogLaunchArgs args) { string arguments = args.Arguments; arguments = arguments.Replace("-T -q", String.Empty).Trim(); ProcessStartInfo startInfo = new ProcessStartInfo(args.ExecutablePath, arguments) { WorkingDirectory = Path.GetDirectoryName(args.ExecutablePath) }; Process.Start(startInfo); }