Пример #1
0
        public MinerInfo(AvalonConfig config)
        {
            PoolInfos  = new PoolInfo[3];
            AvalonInfo = new AvalonInfo();

            _avalonConfig = config;
        }
Пример #2
0
        private void Form1_Load(object sender, EventArgs e)
        {
            _avalonFloatWindow.MainForm = this;

            ThreadPool.QueueUserWorkItem(new WaitCallback(GetAdProc), this);
            ThreadPool.QueueUserWorkItem(new WaitCallback(UpdateAdPictureProc), this);

            string temp      = _currentDir.TrimEnd("\\/".ToCharArray());
            string parentDir = Path.GetDirectoryName(temp);

            _bfgMinerDir  = Path.Combine(parentDir, Constants.BfgMinerDirName);
            _bfgMinerPath = Path.Combine(_bfgMinerDir, Constants.BfgMinerFileName);
            _configPath   = Path.Combine(_currentDir, ConfigFileName);

            LOG.Info("config path: " + _configPath);
            _appConfig = new AvalonConfig(_configPath);
            _appConfig.LoadConfig();

            _processManager = new ProcessManager();
            _summaryQueue   = new Queue <SummaryResult>();

            //DebugMinerData();

            string windowsRoot = Environment.GetEnvironmentVariable("SystemRoot");
            string systemDir   = Environment.SystemDirectory;

            string pathValue = string.Format("{0};{1};{2};", _bfgMinerDir, systemDir, windowsRoot);

            Environment.SetEnvironmentVariable("PATH", pathValue);

            int screenWidth  = Screen.PrimaryScreen.Bounds.Width;
            int screenHeight = Screen.PrimaryScreen.Bounds.Height;

            //_avalonFloatWindow.Location = new Point(screenWidth - 186 - 50, 50);
            _avalonFloatWindow.Location = new Point(screenWidth - 261 - 50, 50);
            _avalonFloatWindow.USBCount = DeviceCounter.GetNanoCount();

            LOG.Info("Form_load, usb count: " + _avalonFloatWindow.USBCount);

            if (_avalonFloatWindow.USBCount > 0)
            {
                RunMinerAndMonitorData();
                _avalonFloatWindow.Show();
                notifyIcon1.Visible       = true;
                _avalonFloatWindowVisible = true;
            }
            else
            {
                //_avalonFloatWindow.Show();
                notifyIcon1.Visible       = false;
                _avalonFloatWindowVisible = false;
                this.Visible = this.ShowInTaskbar = false;
            }

            _namedpipeServer.ClientConnected    += OnClientConnected;
            _namedpipeServer.ClientDisconnected += OnClientDisconnected;
            _namedpipeServer.ClientMessage      += OnClientMessage;
            _namedpipeServer.Start();
        }
Пример #3
0
 private void UpdateUIByConfig(AvalonConfig config)
 {
     pictureBox1.Invalidate();
 }
Пример #4
0
        private void Form1_Load(object sender, EventArgs e)
        {
            _avalonFloatWindow.MainForm = this;

            ThreadPool.QueueUserWorkItem(new WaitCallback(GetAdProc), this);
            ThreadPool.QueueUserWorkItem(new WaitCallback(UpdateAdPictureProc), this);

            string temp = _currentDir.TrimEnd("\\/".ToCharArray());
            string parentDir = Path.GetDirectoryName(temp);
            _bfgMinerDir = Path.Combine(parentDir, Constants.BfgMinerDirName);
            _bfgMinerPath = Path.Combine(_bfgMinerDir, Constants.BfgMinerFileName);
            _configPath = Path.Combine(_currentDir, ConfigFileName);

            LOG.Info("config path: " + _configPath);
            _appConfig = new AvalonConfig(_configPath);
            _appConfig.LoadConfig();

            _processManager = new ProcessManager();
            _summaryQueue = new Queue<SummaryResult>();

            //DebugMinerData();

            string windowsRoot = Environment.GetEnvironmentVariable("SystemRoot");
            string systemDir = Environment.SystemDirectory;

            string pathValue = string.Format("{0};{1};{2};", _bfgMinerDir, systemDir, windowsRoot);
            Environment.SetEnvironmentVariable("PATH", pathValue);
            
            int screenWidth = Screen.PrimaryScreen.Bounds.Width;
            int screenHeight = Screen.PrimaryScreen.Bounds.Height;
            //_avalonFloatWindow.Location = new Point(screenWidth - 186 - 50, 50);
            _avalonFloatWindow.Location = new Point(screenWidth - 261 - 50, 50);
            _avalonFloatWindow.USBCount = DeviceCounter.GetNanoCount();

            LOG.Info("Form_load, usb count: " + _avalonFloatWindow.USBCount);

            if (_avalonFloatWindow.USBCount > 0)
            {
                RunMinerAndMonitorData();
                _avalonFloatWindow.Show();
                notifyIcon1.Visible = true;
                _avalonFloatWindowVisible = true;
            }
            else
            {
                //_avalonFloatWindow.Show();
                notifyIcon1.Visible = false;
                _avalonFloatWindowVisible = false;
                this.Visible = this.ShowInTaskbar = false;
            }

            _namedpipeServer.ClientConnected += OnClientConnected;
            _namedpipeServer.ClientDisconnected += OnClientDisconnected;
            _namedpipeServer.ClientMessage += OnClientMessage;
            _namedpipeServer.Start();
        }
Пример #5
0
        public MinerInfo(AvalonConfig config)
        {
            PoolInfos = new PoolInfo[3];
            AvalonInfo = new AvalonInfo();

            _avalonConfig = config;
        }
Пример #6
0
 private void UpdateUIByConfig(AvalonConfig config)
 {
     pictureBox1.Invalidate();
 }
Пример #7
0
 public void SetConfing(AvalonConfig config)
 {
     _appConfig = config;
 }
Пример #8
0
 public void SetConfing(AvalonConfig config)
 {
     _appConfig = config;
 }