예제 #1
0
        private static void DisplayFanScreen(FanType fan)
        {
            var    fanInfo = SensorController.GetFanInfo(fan);
            string fanName;

            switch (fan)
            {
            case FanType.Front1:
                fanName = "First front";
                break;

            case FanType.Front2:
                fanName = "Second front";
                break;

            case FanType.Front3:
                fanName = "Third front";
                break;

            default:
                fanName = fan.ToString();
                break;
            }

            fanName += " fan";

            Display(
                fanName,
                $"{GetString(fanInfo.RPM, "0", "RPM")} | P:{GetString(fanInfo.Percentage, "0", "%")}"
                );
        }
예제 #2
0
 public int GetFanRPM(FanType fanType)
 {
     using (var handler = new HardwareHandler())
     {
         var rpm = default(int);
         WDHWLib.HWGetFanRPM(handler.Handle, 0, (WDHWLib.FAN_TYPE)fanType, ref rpm);
         return(rpm);
     }
 }
        public AdvancedModeModel(FanType type)
        {
            _propertyName = type == FanType.cpu ? "CPU" : "VGA";
            _tableName    = type == FanType.cpu ? "MSI_CPU" : "MSI_VGA";
            _fanType      = type;

            _searcher = new ManagementObjectSearcher("root\\WMI", "SELECT * FROM " + _tableName);

            RefreshFromDb();
        }
        public static void applyProfile(FanType type, int[] values)
        {
            AdvancedModeModel model = new AdvancedModeModel(type);

            foreach (var item in model.Enumerate().Select((value, i) => new { i, value }))
            {
                item.value.Value = (uint)values[item.i];
            }

            model.Commit();
        }
예제 #5
0
        public IFan CreateFan(FanType type)
        {
            switch (type)
            {
            case FanType.CeilingFan:
                return(new CeilingFan());

            case FanType.ExhaustFan:
                return(new ExhaustFan());

            default:
                return(new TableFan());
            }
        }
예제 #6
0
        public IFan CreateFan(FanType type)
        {
            switch (type)
            {
            case FanType.TableFan:
                return(new TableFan());

            case FanType.CeilingFan:
                return(new CeilingFan());

            default:
                throw new ArgumentException();
            }
        }
예제 #7
0
        public void SetFanPWM(FanType fanType, int pwm)
        {
            if (pwm < 35 || pwm > 100)
            {
                throw new ArgumentException($"Fan PWM '{pwm}' for fan type '{fanType}' is outside of the allowed range [35-100]");
            }

            using (var handler = new HardwareHandler())
            {
                var status = WDHWLib.HWSetFanSpeed(handler.Handle, 0, (WDHWLib.FAN_TYPE)fanType, (byte)pwm);
                if (status != WDHWLib.HWStatus.HW_STATUS_OK)
                {
                    throw new InvalidOperationException($"Failed to set fan '{fanType}' speed to '{pwm}' with error code '{status}'");
                }
            }
        }
        public IFan CreateFan(FanType fantype)
        {
            switch (fantype)
            {
            case FanType.BasicFan:
                return(new BasicFan());

            case FanType.ModernFan:
                return(new ModernFan());

            case FanType.UltraFan:
                return(new UltraFan());

            default:
                return(new BasicFan());
            }
        }
예제 #9
0
 public FanItem(FanType fan) => Fan = fan;