本文整理汇总了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;
}
}
示例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);
}
示例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();
};
}
示例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;
}
}
示例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(',');
}
示例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;
}
示例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);
}
示例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;
}
}
示例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);
}
示例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);
}
示例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);
}
示例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;
}