예제 #1
0
        private static void UnzipFileToFolder(string zipFilePath, string destionationFolder)
        {
            Directory.CreateDirectory(destionationFolder);

            if (OSVersionPlatform.GetGenericPlatform() == PlatformID.Unix)
            {
                UnzipFileToFolderUnix(zipFilePath, destionationFolder);
            }
            else
            {
                UnzipFileToFolderWindows(zipFilePath, destionationFolder);
            }
        }
예제 #2
0
 public static string GetMinerDownloadRoot(MinerBackend minerBackend)
 {
     if (OSVersionPlatform.GetConcretePlatform() == PlatformID.MacOSX)
     {
         return("http://github.com/nwoolls/xgminer-osx");
     }
     else
     {
         if (minerBackend == MinerBackend.Bfgminer)
         {
             return("http://luke.dashjr.org");
         }
         else
         {
             return("http://ck.kolivas.org");
         }
     }
 }
예제 #3
0
        public static string GetInstalledMinerVersion(MinerBackend minerBackend, string executablePath)
        {
            string version = String.Empty;

            ProcessStartInfo startInfo = new ProcessStartInfo(executablePath, "--version");

            startInfo.UseShellExecute        = false;
            startInfo.WindowStyle            = ProcessWindowStyle.Hidden;
            startInfo.CreateNoWindow         = true;
            startInfo.RedirectStandardOutput = true;

            startInfo.Arguments = startInfo.Arguments + " --disable-gpu";

            if (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 = executablePath.Replace("cgminer.exe", "cgminer-nogpu.exe");
                }
            }

            Process process = Process.Start(startInfo);

            string processOutput = process.StandardOutput.ReadToEnd();

            string pattern = String.Format(@"^.+ (.+\..+){0}", Environment.NewLine);
            Match  match   = Regex.Match(processOutput, pattern);

            if (match.Success)
            {
                version = match.Groups[1].Value;
            }

            return(version);
        }
예제 #4
0
파일: Miner.cs 프로젝트: denned/MultiMiner
        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);
        }