Ejemplo n.º 1
0
 public void InitializePrograms()
 {
     try
     {
         DB        db   = Factory.Instance.Model.Data;
         MinerAlgo algo = null;
         foreach (MinerAlgo item in db.MinerAlgos)
         {
             if (item.Name == MainCoin.Algorithm.Name)
             {
                 //found the algo. check to see alredy configured miners
                 algo = item;
                 break;
             }
         }
         if (algo != null)
         {
             List <MinerProgram> programs = algo.MinerPrograms;
             //if (programs != null && programs.Count > 0)
             //{
             //at least 1 program is there
             Hashtable progs   = new Hashtable();
             Hashtable scripts = new Hashtable();
             foreach (MinerProgram item in programs)
             {
                 progs.Add(item.ProgramType, item);
             }
             foreach (MinerScript item in MinerData.MinerScripts)
             {
                 scripts.Add(item.ProgramType, item);
             }
             foreach (IMinerProgram item in MinerPrograms)
             {
                 MinerProgram p   = progs[item.Type] as MinerProgram;
                 MinerScript  scr = scripts[item.Type] as MinerScript;
                 if (p != null)
                 {
                     item.MinerEXE    = p.Exepath;
                     item.MinerFolder = p.ExeFolder;
                 }
                 if (scr != null)
                 {
                     item.BATFILE   = scr.BATfile;
                     item.BATCopied = scr.BATCopied;
                     item.AutomaticScriptGeneration = scr.AutomaticScriptGeneration;
                     if (scr.MiningIntensity != 0)
                     {
                         item.MiningIntensity = scr.MiningIntensity;
                     }
                     item.LoadScript();
                 }
             }
             //}
         }
     }
     catch (Exception e)
     {
     }
 }
Ejemplo n.º 2
0
        public Miner(int Device, int framerate, bool vectors, int work, string Nickname, Pool p, MinerProgram mp, string PoolUser, string PoolPass, string host)
        {
            #region pools
            if (p == Pool.DeepBit)
            {
                pool = p;
                pURI = "pit.deepbit.net";
                pPort = 8332;
                pUser = PoolUser;
                pPass = PoolPass;
            }

            if (p == Pool.Slush)
            {
                pool = p;
                pURI = "mining.bitcoin.cz";
                pPort = 8332;
                pUser = PoolUser;
                pPass = PoolPass;
            }

            if (p == Pool.BTCMine)
            {
                pool = p;
                pURI = "btcmine.com";
                pPort = 8332;
                pUser = PoolUser;
                pPass = PoolPass;
            }
            if (p == Pool.Eligius)
            {
                pool = p;
                pURI = "mining.eligius.st";
                pPort = 8337;
                StreamReader sr = new StreamReader("settings.txt");
                string lol = sr.ReadLine();
                sr.Close();
                if (lol != string.Empty)
                {
                    pUser = lol;
                }
                pPass = "******";
            }
            if (p == Pool.BTCGuild)
            {
                pool = p;
                pURI = "btcguild.com";
                pPort = 8332;
                pUser = PoolUser;
                pPass = PoolPass;
            }
            if (p == Pool.Ozco)
            {
                pool = p;
                pURI = "ozco.in";
                pPort = 8332;
                pUser = PoolUser;
                pPass = PoolPass;
            }
            if (p == Pool.Custom)
            {
                pool = p;
                string[] s = host.Split(':');
                pURI = s[0];
                int t;
                bool b = int.TryParse(s[1], out t);
                pPort = t;
                pUser = PoolUser;
                pPass = PoolPass;
            }

            #endregion
            #region miners
            if (mp == MinerProgram.poclbm)
            {
                program = MinerProgram.poclbm;

                string pocstring = "-d" + DeviceID;

                pocstring += " --host=" + pURI;

                pocstring += " --port=" + pPort.ToString();

                pocstring += " --user="******" --pass="******" -f " + framerate.ToString();

                pocstring += " -w " + work.ToString();

                if (vectors)
                {
                    pocstring += " --vectors";
                }

                arguments = pocstring;
            }
            #endregion
            #region args
            nickname = Nickname;
            pool = p;
            program = mp;
            DeviceID = Device;
            f = framerate;
            d = Device;
            w = work;
            v = vectors;
            pu = PoolUser;
            pp = PoolPass;
            ph = host;
            #endregion
        }