예제 #1
0
        public void LoadConfig()
        {
            string mhsSecondsValue = string.Empty;

            try
            {
                mhsSecondsValue = ConfigurationManager.AppSettings["MHSSeconds"];
                int v = 0;
                if (Int32.TryParse(mhsSecondsValue, out v))
                {
                    switch (v)
                    {
                        case 20:
                            _MHSSeconds = v;
                            break;
                        case 300:
                            _MHSSeconds = v;
                            break;
                    }
                }

                string debug = ConfigurationManager.AppSettings["DebugData"];
                if (debug == "true")
                {
                    _DebugData = true;
                }
            }
            catch { }

            for (int i = 0; i < _minerInfo.PoolInfos.Length; i++)
            {
                PoolInfo pi = new PoolInfo();
                string section = string.Format("{0}{1}", PoolSectionHead, i + 1);
                string v = _iniWrapper.ReadValue(section, PoolURLKey);
                if (!string.IsNullOrEmpty(v))
                {
                    pi.PoolURL = v;
                }

                v = _iniWrapper.ReadValue(section, PoolPortKey);
                if (!string.IsNullOrEmpty(v))
                {
                    pi.PoolPort = v;
                }

                v = _iniWrapper.ReadValue(section, PoolWorkerNameKey);
                if (!string.IsNullOrEmpty(v))
                {
                    pi.WorkerName = v;
                }

                v = _iniWrapper.ReadValue(section, PoolWorkerPasswordKey);
                if (!string.IsNullOrEmpty(v))
                {
                    pi.WorkerPassword = v;
                }

                _minerInfo.PoolInfos[i] = pi;
            }

            AvalonInfo ai = new AvalonInfo();
            string v2 = _iniWrapper.ReadValue(AvalonSectionName, LogKey);
            if (!string.IsNullOrEmpty(v2))
            {
                ai.Log = v2;
            }

            v2 = _iniWrapper.ReadValue(AvalonSectionName, ParametersKey);
            if (!string.IsNullOrEmpty(v2))
            {
                ai.Parameters = v2;
            }

            _minerInfo.AvalonInfo = ai;
        }
예제 #2
0
        public void LoadConfig()
        {
            string mhsSecondsValue = string.Empty;

            try
            {
                mhsSecondsValue = ConfigurationManager.AppSettings["MHSSeconds"];
                int v = 0;
                if (Int32.TryParse(mhsSecondsValue, out v))
                {
                    switch (v)
                    {
                    case 20:
                        _MHSSeconds = v;
                        break;

                    case 300:
                        _MHSSeconds = v;
                        break;
                    }
                }

                string debug = ConfigurationManager.AppSettings["DebugData"];
                if (debug == "true")
                {
                    _DebugData = true;
                }
            }
            catch { }

            for (int i = 0; i < _minerInfo.PoolInfos.Length; i++)
            {
                PoolInfo pi      = new PoolInfo();
                string   section = string.Format("{0}{1}", PoolSectionHead, i + 1);
                string   v       = _iniWrapper.ReadValue(section, PoolURLKey);
                if (!string.IsNullOrEmpty(v))
                {
                    pi.PoolURL = v;
                }

                v = _iniWrapper.ReadValue(section, PoolPortKey);
                if (!string.IsNullOrEmpty(v))
                {
                    pi.PoolPort = v;
                }

                v = _iniWrapper.ReadValue(section, PoolWorkerNameKey);
                if (!string.IsNullOrEmpty(v))
                {
                    pi.WorkerName = v;
                }

                v = _iniWrapper.ReadValue(section, PoolWorkerPasswordKey);
                if (!string.IsNullOrEmpty(v))
                {
                    pi.WorkerPassword = v;
                }

                _minerInfo.PoolInfos[i] = pi;
            }

            AvalonInfo ai = new AvalonInfo();
            string     v2 = _iniWrapper.ReadValue(AvalonSectionName, LogKey);

            if (!string.IsNullOrEmpty(v2))
            {
                ai.Log = v2;
            }

            v2 = _iniWrapper.ReadValue(AvalonSectionName, ParametersKey);
            if (!string.IsNullOrEmpty(v2))
            {
                ai.Parameters = v2;
            }

            _minerInfo.AvalonInfo = ai;
        }