本文整理汇总了C#中Microsoft.Win32.RegistryKey.GetStringValue方法的典型用法代码示例。如果您正苦于以下问题:C# RegistryKey.GetStringValue方法的具体用法?C# RegistryKey.GetStringValue怎么用?C# RegistryKey.GetStringValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Win32.RegistryKey
的用法示例。
在下文中一共展示了RegistryKey.GetStringValue方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: IISFix
/// <summary>
/// This fixes my mistake for naming IIS process "wp3.exe" and not "w3wp.exe" like it should be.
/// </summary>
/// <param name="key"></param>
/// <param name="descriptorIndex"></param>
internal static void IISFix(RegistryKey key, int descriptorIndex)
{
try
{
// get the name.
var name = key.GetStringValue(ATASettings.Keys.AttachDescriptorName, descriptorIndex);
var processGroup = key.GetStringValue(ATASettings.Keys.AttachDescriptorProcessNames, descriptorIndex);
var allProcesses = ((string) key.GetValue(processGroup)).Split(new[] {ATAConstants.ProcessNamesSeparator[0]}, StringSplitOptions.RemoveEmptyEntries);
const string badProcessName = "wp3.exe";
// does it have the fouled-up process name?
var hasWp3 = allProcesses.Any(s => string.Compare(s, badProcessName, StringComparison.OrdinalIgnoreCase) == 0);
// if it is iis, and it has the wrong process, fix that shit.
if (string.Compare(name, "iis", StringComparison.OrdinalIgnoreCase) != 0 || !hasWp3)
{
return;
}
var newList = allProcesses.Where(s => string.Compare(s, badProcessName, StringComparison.OrdinalIgnoreCase) != 0).Concat(new[] {ATAConstants.ProcessNames.IISWorkerProcessName});
key.SetValue(processGroup, string.Join(ATAConstants.ProcessNamesSeparator, newList));
}
catch (Exception)
{
// if we dont have access to write, there is a problem.
}
}