Пример #1
0
        public Control(ISensor sensor, ISettings settings, float minSoftwareValue,
            float maxSoftwareValue)
        {
            this.identifier = new Identifier(sensor.Identifier, "control");
              this.settings = settings;
              this.minSoftwareValue = minSoftwareValue;
              this.maxSoftwareValue = maxSoftwareValue;
              //fan add
              this.sensorType = sensor.SensorType;

              float softValue = 0;
              if (!float.TryParse(settings.GetValue(
              new Identifier(identifier, "value").ToString(), "-a"),
            NumberStyles.Float, CultureInfo.InvariantCulture,
            out softValue)){
              this.softwareValue = 0;
              if (this.sensorType.Equals(SensorType.TinyFanControl))
              this.SoftwareValue = 50; //init value(when .config was not exist)
              }
              else
              this.softwareValue = softValue;
              int mode;
              if (!int.TryParse(settings.GetValue(
              new Identifier(identifier, "mode").ToString(),
              ((int)ControlMode.Default).ToString(CultureInfo.InvariantCulture)),
            NumberStyles.Integer, CultureInfo.InvariantCulture,
            out mode))
              {
            this.mode = ControlMode.Default;
              } else {
            this.mode = (ControlMode)mode;
              }
              int fanMode;
              if (!int.TryParse(settings.GetValue(
              new Identifier(identifier, "fanMode").ToString(),
              ((int)FanMode.Pin4).ToString(CultureInfo.InvariantCulture)),
            NumberStyles.Integer, CultureInfo.InvariantCulture,
            out fanMode))
              {
              this.fanMode = FanMode.Pin4;
              }
              else
              {
              this.fanMode = (FanMode)fanMode;
              }
              int fanFollow;//again
              if (!int.TryParse(settings.GetValue(
              new Identifier(identifier, "fanFollow").ToString(),
              ((int)FanFollow.NONE).ToString(CultureInfo.InvariantCulture)),
            NumberStyles.Integer, CultureInfo.InvariantCulture,
            out fanFollow))
              {
              this.fanFollow = FanFollow.NONE;
              }
              else
              {
              this.fanFollow = (FanFollow)fanFollow;
              }
        }
Пример #2
0
        public Control(ISensor sensor, ISettings settings, float minSoftwareValue,
                       float maxSoftwareValue)
        {
            this.identifier       = new Identifier(sensor.Identifier, "control");
            this.settings         = settings;
            this.minSoftwareValue = minSoftwareValue;
            this.maxSoftwareValue = maxSoftwareValue;
            //fan add
            this.sensorType = sensor.SensorType;

            float softValue = 0;

            if (!float.TryParse(settings.GetValue(
                                    new Identifier(identifier, "value").ToString(), "-a"),
                                NumberStyles.Float, CultureInfo.InvariantCulture,
                                out softValue))
            {
                this.softwareValue = 0;
                if (this.sensorType.Equals(SensorType.TinyFanControl))
                {
                    this.SoftwareValue = 50; //init value(when .config was not exist)
                }
            }
            else
            {
                this.softwareValue = softValue;
            }
            int mode;

            if (!int.TryParse(settings.GetValue(
                                  new Identifier(identifier, "mode").ToString(),
                                  ((int)ControlMode.Default).ToString(CultureInfo.InvariantCulture)),
                              NumberStyles.Integer, CultureInfo.InvariantCulture,
                              out mode))
            {
                this.mode = ControlMode.Default;
            }
            else
            {
                this.mode = (ControlMode)mode;
            }
            int fanMode;

            if (!int.TryParse(settings.GetValue(
                                  new Identifier(identifier, "fanMode").ToString(),
                                  ((int)FanMode.Pin4).ToString(CultureInfo.InvariantCulture)),
                              NumberStyles.Integer, CultureInfo.InvariantCulture,
                              out fanMode))
            {
                this.fanMode = FanMode.Pin4;
            }
            else
            {
                this.fanMode = (FanMode)fanMode;
            }
            int fanFollow;//again

            if (!int.TryParse(settings.GetValue(
                                  new Identifier(identifier, "fanFollow").ToString(),
                                  ((int)FanFollow.NONE).ToString(CultureInfo.InvariantCulture)),
                              NumberStyles.Integer, CultureInfo.InvariantCulture,
                              out fanFollow))
            {
                this.fanFollow = FanFollow.NONE;
            }
            else
            {
                this.fanFollow = (FanFollow)fanFollow;
            }
        }
Пример #3
0
 public void SetTheFanFollow(FanFollow ff)
 {
     FanFollow = ff;
 }
Пример #4
0
 public void SetTheFanFollow(FanFollow ff)
 {
     FanFollow = ff;
 }