当前位置: 首页>>代码示例>>C#>>正文


C# ISettings.GetValue方法代码示例

本文整理汇总了C#中ISettings.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# ISettings.GetValue方法的具体用法?C# ISettings.GetValue怎么用?C# ISettings.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ISettings的用法示例。


在下文中一共展示了ISettings.GetValue方法的12个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Control

        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;

              if (!float.TryParse(settings.GetValue(
              new Identifier(identifier, "value").ToString(), "0"),
            NumberStyles.Float, CultureInfo.InvariantCulture,
            out this.softwareValue))
              {
            this.softwareValue = 0;
              }
              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;
              }
        }
开发者ID:Ryks,项目名称:open-hardware-monitor,代码行数:27,代码来源:Control.cs

示例2: Hardware

 public Hardware(string name, Identifier identifier, ISettings settings) {
   this.settings = settings;
   this.identifier = identifier;
   this.name = name;
   this.customName = settings.GetValue(
     new Identifier(Identifier, "name").ToString(), name);
 }
开发者ID:sakisds,项目名称:Icy-Monitor,代码行数:7,代码来源:Hardware.cs

示例3: Sensor

        public Sensor(string name, int index, bool defaultHidden, 
            SensorType sensorType, Hardware hardware,
            ParameterDescription[] parameterDescriptions, ISettings settings)
        {
            this.index = index;
              this.defaultHidden = defaultHidden;
              this.sensorType = sensorType;
              this.hardware = hardware;
              Parameter[] parameters = new Parameter[parameterDescriptions == null ?
            0 : parameterDescriptions.Length];
              for (int i = 0; i < parameters.Length; i++ )
            parameters[i] = new Parameter(parameterDescriptions[i], this, settings);
              this.parameters = parameters;

              this.settings = settings;
              this.defaultName = name;
              this.name = settings.GetValue(
            new Identifier(Identifier, "name").ToString(), name);

              GetSensorValuesFromSettings();

              hardware.Closing += delegate(IHardware h) {
            SetSensorValuesToSettings();
              };
        }
开发者ID:AlexVallat,项目名称:openhardwaremonitor,代码行数:25,代码来源:Sensor.cs

示例4: Control

        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;
              }
        }
开发者ID:fkpwolf,项目名称:tinyFan,代码行数:59,代码来源:Control.cs

示例5: Initialize

		public static void Initialize(IMainForm mainForm)
		{
			Settings.mainForm = mainForm;
			Settings.settings = mainForm.MainSettings;

			string excludedDirs = string.Join(",",ProjectTreeView.ExcludedDirectories);
			string excludedFileTypes = string.Join(",",ProjectTreeView.ExcludedFileTypes);

			// create keys if necessary with default values

			if (!settings.HasKey(SETTING_RECENTPROJECTS))
				settings.AddValue(SETTING_RECENTPROJECTS, "");

			if (!settings.HasKey(SETTING_MAXRECENTPROJECTS))
				settings.AddValue(SETTING_MAXRECENTPROJECTS,"7");

			if (!settings.HasKey(SETTING_LASTOPENPROJECT))
				settings.AddValue(SETTING_LASTOPENPROJECT, "");

			if (!settings.HasKey(SETTING_EXCLUDEDDIRECTORIES))
				settings.AddValue(SETTING_EXCLUDEDDIRECTORIES, excludedDirs);

			if (!settings.HasKey(SETTING_EXCLUDEDFILETYPES))
				settings.AddValue(SETTING_EXCLUDEDFILETYPES, excludedFileTypes);

			if (!settings.HasKey(SETTING_CREATEPROJECTDIR))
				settings.AddValue(SETTING_CREATEPROJECTDIR,"true");

			if (!settings.HasKey(SETTING_NEWPROJECTDEFAULTDIR))
				settings.AddValue(SETTING_NEWPROJECTDEFAULTDIR,PathHelper.ProjectsDirectory);

			if (!settings.HasKey(SETTING_SHOWPROJECTCLASSPATHS))
				settings.AddValue(SETTING_SHOWPROJECTCLASSPATHS,"true");

			if (!settings.HasKey(SETTING_SHOWGLOBALCLASSPATHS))
				settings.AddValue(SETTING_SHOWGLOBALCLASSPATHS,"false");
			
			if (!settings.HasKey(SETTING_RESTORETREESTATE))
				settings.AddValue(SETTING_RESTORETREESTATE,"true");

			excludedDirs = settings.GetValue(SETTING_EXCLUDEDDIRECTORIES);
			excludedFileTypes = settings.GetValue(SETTING_EXCLUDEDFILETYPES);
			ProjectTreeView.ExcludedDirectories = excludedDirs.Split(',');
			ProjectTreeView.ExcludedFileTypes = excludedFileTypes.Split(',');
		}
开发者ID:heon21st,项目名称:flashdevelop,代码行数:45,代码来源:Settings.cs

示例6: GetRepositoryPath

 public static string GetRepositoryPath(ISettings settings)
 {
     string path = settings.GetValue(ConfigSection, "repositoryPath", isPath: true);
     if (!String.IsNullOrEmpty(path))
     {
         path = path.Replace('/', System.IO.Path.DirectorySeparatorChar);
     }
     return path;
 }
开发者ID:michaelstaib,项目名称:NuGet.Configuration,代码行数:9,代码来源:SettingsUtility.cs

示例7: SignalRClient

        protected SignalRClient(ISettings settings)
        {
            _settings = settings;
            _WhiteBrandSignalRHostUrl = "WhiteBrandSignalRHostUrl";
            _connection = new HubConnection(_settings.GetValue(_WhiteBrandSignalRHostUrl));

            Proxy = _connection.CreateHubProxy("MeetingHub");
            Proxy.Observe<DateTimeOffset>("onHeartbeat").Log(this, "Heartbeat").Subscribe(_heartbeatSubject);
            Proxy.Observe<string>("onPdfAvailable").Log(this, "PDF Available ").Subscribe(_pdfAvailableSubject);
        }
开发者ID:reactiveui-forks,项目名称:VirtualSales,代码行数:10,代码来源:SignalRClient.cs

示例8: Parameter

 public Parameter(ParameterDescription description, ISensor sensor, 
   ISettings settings) 
 {
   this.sensor = sensor;
   this.description = description;
   this.settings = settings;
   this.isDefault = !settings.Contains(Identifier.ToString());
   this.value = description.DefaultValue;
   if (!this.isDefault) {
     if (!float.TryParse(settings.GetValue(Identifier.ToString(), "0"),
       NumberStyles.Float,
       CultureInfo.InvariantCulture,
       out this.value))
       this.value = description.DefaultValue;
   }
 }
开发者ID:jwolfm98,项目名称:HardwareMonitor,代码行数:16,代码来源:Parameter.cs

示例9: Mainboard

    public Mainboard(SMBIOS smbios, ISettings settings) {
      this.settings = settings;
      this.smbios = smbios;

      Manufacturer manufacturer = smbios.Board == null ? Manufacturer.Unknown :
        Identification.GetManufacturer(smbios.Board.ManufacturerName);

      Model model = smbios.Board == null ? Model.Unknown : 
        Identification.GetModel(smbios.Board.ProductName);

      if (smbios.Board != null) {
        if (!string.IsNullOrEmpty(smbios.Board.ProductName)) {
          if (manufacturer == Manufacturer.Unknown)
            this.name = smbios.Board.ProductName;
          else
            this.name = manufacturer + " " +
              smbios.Board.ProductName;
        } else {
          this.name = manufacturer.ToString();
        }
      } else {
        this.name = Manufacturer.Unknown.ToString();
      }

      this.customName = settings.GetValue(
        new Identifier(Identifier, "name").ToString(), name);

      ISuperIO[] superIO;
      int p = (int)Environment.OSVersion.Platform;
      if ((p == 4) || (p == 128)) {
        this.lmSensors = new LMSensors();
        superIO = lmSensors.SuperIO;
      } else {
        this.lpcio = new LPCIO();       
        superIO = lpcio.SuperIO;
      }
      
      superIOHardware = new Hardware[superIO.Length];
      for (int i = 0; i < superIO.Length; i++)
        superIOHardware[i] = new SuperIOHardware(this, superIO[i],
          manufacturer, model, settings);
    }
开发者ID:jwolfm98,项目名称:HardwareMonitor,代码行数:42,代码来源:Mainboard.cs

示例10: GetDecryptedValue

        public static string GetDecryptedValue(ISettings settings, string section, string key, bool isPath = false)
        {
            if (String.IsNullOrEmpty(section))
            {
                throw new ArgumentException(Resources.Argument_Cannot_Be_Null_Or_Empty, "section");
            }

            if (String.IsNullOrEmpty(key))
            {
                throw new ArgumentException(Resources.Argument_Cannot_Be_Null_Or_Empty, "key");
            }

            var encryptedString = settings.GetValue(section, key, isPath);
            if (encryptedString == null)
            {
                return null;
            }
            if (String.IsNullOrEmpty(encryptedString))
            {
                return String.Empty;
            }
            return EncryptionUtility.DecryptString(encryptedString);
        }
开发者ID:michaelstaib,项目名称:NuGet.Configuration,代码行数:23,代码来源:SettingsUtility.cs

示例11: GetConfigValue

 /// <summary>
 /// Retrieves a config value for the specified key
 /// </summary>
 /// <param name="settings">The settings instance to retrieve </param>
 /// <param name="key">The key to look up</param>
 /// <param name="decrypt">Determines if the retrieved value needs to be decrypted.</param>
 /// <param name="isPath">Determines if the retrieved value is returned as a path.</param>
 /// <returns>Null if the key was not found, value from config otherwise.</returns>
 public static string GetConfigValue(ISettings settings, string key, bool decrypt = false, bool isPath = false)
 {
     return decrypt ?
         GetDecryptedValue(settings, ConfigSection, key, isPath) :
         settings.GetValue(ConfigSection, key, isPath);
 }
开发者ID:michaelstaib,项目名称:NuGet.Configuration,代码行数:14,代码来源:SettingsUtility.cs

示例12: IsSourceControlDisabled

 public static bool IsSourceControlDisabled(ISettings settings)
 {
     var value = settings.GetValue(SolutionSection, DisableSourceControlIntegerationKey);
     bool disableSourceControlIntegration;
     return !String.IsNullOrEmpty(value) && Boolean.TryParse(value, out disableSourceControlIntegration) && disableSourceControlIntegration;
 }
开发者ID:pabomex,项目名称:NuGet.PackageManagement,代码行数:6,代码来源:SourceControlUtility.cs


注:本文中的ISettings.GetValue方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。