コード例 #1
0
        /// <summary>
        /// The DeviceStatus_Tick
        /// </summary>
        /// <param name="state">The <see cref="object"/></param>
        public static void DeviceStatus_Tick(object state)
        {
            var devices    = ComputeDeviceManager.Avaliable.AllAvaliableDevices;
            var deviceList = new List <JArray>();
            var activeIDs  = MinersManager.GetActiveMinersIndexes();

            foreach (var device in devices)
            {
                try
                {
                    var array = new JArray
                    {
                        device.Index,
                        device.Name
                    };
                    int status = Convert.ToInt32(activeIDs.Contains(device.Index)) + (((int)device.DeviceType + 1) * 2);
                    array.Add(status);
                    array.Add((uint)device.Load);
                    array.Add((uint)device.Temp);
                    array.Add((uint)device.FanSpeed);

                    deviceList.Add(array);
                }
                catch (Exception e) { Helpers.ConsolePrint("SOCKET", e.ToString()); }
            }
            var data = new Nicehash_device_status
            {
                devices = deviceList
            };
            var sendData = JsonConvert.SerializeObject(data);
        }
コード例 #2
0
        public static void DeviceStatus_Tick(object state)
        {
            var devices    = ComputeDeviceManager.Avaliable.AllAvaliableDevices;
            var deviceList = new List <JArray>();
            var activeIDs  = MinersManager.GetActiveMinersIndexes();

            foreach (var device in devices)
            {
                try
                {
                    var array = new JArray
                    {
                        device.Index,
                        device.Name
                    };
                    int status = Convert.ToInt32(activeIDs.Contains(device.Index)) + (((int)device.DeviceType + 1) * 2);
                    array.Add(status);
                    array.Add((uint)device.Load);
                    array.Add((uint)device.Temp);
                    array.Add((uint)device.FanSpeed);

                    deviceList.Add(array);
                }
                catch (Exception e) { Helpers.ConsolePrint("SOCKET", e.ToString()); }
            }
            var data = new Nicehash_device_status
            {
                devices = deviceList
            };
            var sendData = JsonConvert.SerializeObject(data);
            // This function is run every minute and sends data every run which has two auxiliary effects
            // Keeps connection alive and attempts reconnection if internet was dropped
            //NiceHashConnection.SendData(sendData);
        }