public ClaymorMinerPresenter(IClaymorMinerView _view, ClaymorMinerModel _model)
        {
            this._view  = _view;
            this._model = _model;


            _params = new ClaymorParams();

            // Here wi should load saved settings
            _params.RestoreDefaults();
            LoadSavedParams();


            _view.clParams = _params;

            PopulatePools();

            // this._model.OnStartProcess += _model_OnStartProcess;
            // this._model.OnKillProcess += _model_OnKillProcess;
            this._model.OnOutputUpdate += _model_OnOutputUpdate;
            //this._model.OnTimeUpdate += _model_OnTimeUpdate;

            this._view.Run             += _view_Run;
            this._view.Stop            += _view_Stop;
            this._view.Config          += _view_Config;
            this._view.CreateWallet    += _view_CreateWallet;
            this._view.PropertyChanged += _view_PropertyChanged;

            _view_PropertyChanged(null, new System.ComponentModel.PropertyChangedEventArgs("params"));
        }
        public void RestoreDefaults()
        {
            ClaymorParams _prm = new ClaymorParams
            {
                CalymoreAppPath = Utils.GetAppPath() + @"\Claymore\EthDcrMiner64.exe",
                EthPsw          = "x",
                EthPool         = "eu1.ethermine.org:4444",
                EthWallet       = "0x1770Ed0d79eDf091a7521C5Ee82212EFf308C933",
                Allcoins        = "1"
            };

            CopyFrom(_prm);
        }
        void LoadSavedParams()
        {
            try
            {
                if (!File.Exists(sSettingsFileName))
                {
                    return;
                }

                using (var stream = System.IO.File.OpenRead(sSettingsFileName))
                {
                    var serializer = new XmlSerializer(typeof(ClaymorParams));
                    _params = serializer.Deserialize(stream) as ClaymorParams;
                }
            }
            catch (Exception ex)
            {
                UIHelper.ShowError(new Exception("Error while loading miner settings from file", ex));
            }
        }
        public void StartProcess(ClaymorParams _clParams)
        {
            try
            {
                this.clParams = _clParams;

                ProcessParams _params = new ProcessParams(_clParams.CalymoreAppPath, _clParams.ClaymorParmsString(false));
                _params.ShowWindow = _clParams.ShowWindow;
                _params.listEnv.AddRange(_clParams.ListEnv());

                _processHelper = new ClaymorProcessHelper(_params);
                _processHelper.Launch();

                //NotifyStartProcess();


                watcher      = new FileSystemWatcher();
                watcher.Path = _params.DirectoryName;

                /* Watch for changes in LastAccess and LastWrite times, and
                 * the renaming of files or directories. */
                watcher.NotifyFilter = NotifyFilters.LastAccess | NotifyFilters.LastWrite
                                       | NotifyFilters.FileName | NotifyFilters.DirectoryName;
                // Only watch text files.
                watcher.Filter = _clParams.EthLog;

                // Add event handlers.
                watcher.Changed += new FileSystemEventHandler(OnChanged);
                watcher.Created += new FileSystemEventHandler(OnChanged);



                // Begin watching.
                watcher.EnableRaisingEvents = true;
            }
            catch (Exception ex)
            {
                throw new Exception("Error during starting process " + _processHelper._params.AppName, ex);
            }
        }
        public void CopyFrom(ClaymorParams _params)
        {
            this.EthLog          = _params.EthLog;
            this.EthPool         = _params.EthPool;
            this.EthPsw          = _params.EthPsw;
            this.EthWallet       = _params.EthWallet;
            this.EthWorker       = _params.EthWorker;
            this.CustomParams    = _params.CustomParams;
            this.CalymoreAppPath = _params.CalymoreAppPath;
            this.ShowWindow      = _params.ShowWindow;
            this.Restart         = _params.Restart;

            this.Allcoins = _params.Allcoins;
            this.Allpools = _params.Allpools;
            this.Erate    = _params.Erate;
            this.Esm      = _params.Esm;
            this.Estale   = _params.Estale;
            this.Etha     = _params.Etha;
            this.Ethi     = _params.Ethi;
            this.Etht     = _params.Etht;
            this.Solo     = _params.Solo;

            this.Mode  = _params.Mode;
            this.Dcoin = _params.Dcoin;
            this.Dcri  = _params.Dcri;
            this.Dcrt  = _params.Dcrt;
            this.Dpool = _params.Dpool;
            this.Dpsw  = _params.Dpsw;
            this.Dwal  = _params.Dwal;

            this.GPU_FORCE_64BIT_PTR0     = _params.GPU_FORCE_64BIT_PTR0;
            this.GPU_MAX_ALLOC_PERCENT    = _params.GPU_MAX_ALLOC_PERCENT;
            this.GPU_MAX_HEAP_SIZE100     = _params.GPU_MAX_HEAP_SIZE100;
            this.GPU_SINGLE_ALLOC_PERCENT = _params.GPU_SINGLE_ALLOC_PERCENT;
            this.GPU_USE_SYNC_OBJECTS     = _params.GPU_USE_SYNC_OBJECTS;
        }
Beispiel #6
0
        public ClaymorConfigPresenter(IClaymorConfigView _view, ClaymorParams _params) : base()
        {
            this._view   = _view;
            this._params = _params;

            _params_clone = _params.DeepClone();

            this._view.PropertyChanged += _view_PropertyChanged;
            this._view.Ok              += _view_Ok;
            this._view.Default         += _view_Default;
            this._view.GenerateCommand += _view_GenerateCommand;



            bLoad = true;

            _view.PopulateEsmList(ClaymorParams.ListEsm());
            _view.PopulateEPools(ClaymorParams.ListEPools());
            _view.PopulateDPools(ClaymorParams.ListDPools());
            _view.PopulateDCoins(ClaymorParams.ListDcoins());

            DisplayParams();
            bLoad = false;
        }
 void PopulatePools()
 {
     _view.PopulateEthPools(ClaymorParams.ListEPools());
 }