本文整理汇总了C#中Microsoft.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# Microsoft.GetValue方法的具体用法?C# Microsoft.GetValue怎么用?C# Microsoft.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft
的用法示例。
在下文中一共展示了Microsoft.GetValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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( Microsoft.Win32.RegistryKey key, int descriptorIndex )
{
try {
// get the name.
var name = (string)key.GetValue ( ATASettings.Keys.AttachDescriptorName.With ( descriptorIndex ) );
var processGroup = ATASettings.Keys.AttachDescriptorProcessNames.With ( descriptorIndex );
var allProcesses = ( (string)key.GetValue ( processGroup ) )
.Split ( new char[] { ';' }, StringSplitOptions.RemoveEmptyEntries );
// does it have the fucked up process name?
var hasWp3 = allProcesses.Any ( s => string.Compare ( s, "wp3.exe", true ) == 0 );
// if it is iis, and it has the wrong process, fix that shit.
if ( string.Compare ( name, "iis", true ) == 0 && hasWp3 ) {
var newList = allProcesses.Where ( s => string.Compare ( s, "wp3.exe", true ) != 0 ).Concat ( new string[] { "w3wp.exe" } );
key.SetValue ( processGroup, string.Join ( ";", newList ) );
}
} catch ( Exception ) {
// if we dont have access to write, there is a problem.
}
}
示例2: EnsureAppInitSet
public void EnsureAppInitSet(Microsoft.Win32.RegistryKey key, String szDllName)
{
key = Microsoft.Win32.Registry.LocalMachine.OpenSubKey(szAppInitKey, true);
// Set the relevant values
// TODO MAYBE record what these were set to and set them back if we uninstall?
String LoadAppInit_DLLs = "LoadAppInit_DLLs";
if (key.GetValue(LoadAppInit_DLLs, null) != null)
{
key.SetValue(LoadAppInit_DLLs, 1);
}
String RequireSignedAppInit_DLLs = "RequireSignedAppInit_DLLs";
if (key.GetValue(RequireSignedAppInit_DLLs, null) != null)
{
key.SetValue(RequireSignedAppInit_DLLs, 1);
}
// Set the AppInit_Dlls value to include our DLL
String value = key.GetValue(szAppInitValue).ToString();
if (value.ToLower().Contains(GetDllPath(szDllName).ToLower()))
{
// Value already contains our DLL, so return
return;
}
// Sanity check so I don't accidentally repeatedly add to this buffer
if (value.Length > 1024)
{
// TODO Record an error
return;
}
// Append a space if something is already there
if (value.Length != 0)
{
value += " ";
}
// Append our DLL path
value += GetDllPath(szDllName);
// Set registry value
key.SetValue(szAppInitValue, value);
}
示例3: LoadSettings
/// ------------------------------------------------------------------------------------
/// <summary>
/// Tells the adapter to load it's settings from the specified keys.
/// </summary>
/// <param name="key"></param>
/// ------------------------------------------------------------------------------------
public void LoadSettings(Microsoft.Win32.RegistryKey key)
{
// Set the sidebar's width
if (m_navPane.Parent != null)
m_navPane.Parent.Width = (int)key.GetValue("SideBarWidth", m_navPane.Parent.Width);
// Restore the active tab and active tab item.
string tabName = key.GetValue("ActiveTab") as string;
if (tabName != null)
{
// First set the current tab without causing events.
SetCurrentTab(tabName, false);
string itemName = key.GetValue("ActiveTabItem") as string;
if (itemName != null)
SetCurrentTabItem(tabName, itemName, true);
else
{
// At this point, the registry didn't contain an active tab item, so
// we'll set the current tab again, but this time generate events on
// the assumption that when the application gets the event, it will
// set a default tab item for the tab.
SetCurrentTab(tabName, true);
}
}
}
示例4: getRegValue
private string getRegValue(Microsoft.Win32.RegistryKey key, string keyName)
{
try
{
return key.GetValue(keyName).ToString();
}
catch
{
return null;
}
}
示例5: GetApplicationBar
public static DeepForest.Phone.Assets.Shell.ApplicationBar GetApplicationBar(Microsoft.Phone.Controls.PhoneApplicationPage obj)
{
return (DeepForest.Phone.Assets.Shell.ApplicationBar)obj.GetValue(ApplicationBarProperty);
}
示例6: CopyKeyRecursive
private static void CopyKeyRecursive(Microsoft.Win32.RegistryKey sourceKey, Microsoft.Win32.RegistryKey destKey)
{
foreach (string ValueName in sourceKey.GetValueNames()) {
object Val = sourceKey.GetValue(ValueName);
destKey.SetValue(ValueName, Val, sourceKey.GetValueKind(ValueName));
}
foreach (string SubKeyName in sourceKey.GetSubKeyNames()) {
using (Microsoft.Win32.RegistryKey sourceSubKey = sourceKey.OpenSubKey(SubKeyName, false))
using (Microsoft.Win32.RegistryKey destSubKey = destKey.CreateSubKey(SubKeyName)) {
CopyKeyRecursive(sourceSubKey, destSubKey);
}
}
}
示例7: GetApplicationBar
public static ApplicationBar GetApplicationBar(Microsoft.Phone.Controls.PhoneApplicationPage obj)
{
return (ApplicationBar)obj.GetValue(ApplicationBarProperty);
}
示例8: GetCommand
public static ICommand GetCommand(Microsoft.Phone.Controls.PhoneApplicationPage buttonBase)
{
return buttonBase.GetValue(CommandProperty) as ICommand;
}
示例9: VsPackageInfo
public VsPackageInfo(Microsoft.Win32.RegistryKey packageKey)
{
DefaultName = packageKey.GetValue(System.String.Empty) as string;
Class = packageKey.GetValue("Class") as string;
}
示例10: LoadSettings
/// ------------------------------------------------------------------------------------
/// <summary>
/// Load the active tab's settings.
/// </summary>
///
/// <param name='key'>The Registry Key.</param>
/// ------------------------------------------------------------------------------------
private void LoadSettings(Microsoft.Win32.RegistryKey key)
{
SuspendLayout();
try
{
IRegistryKeyNameModifier modifier = Parent.Parent as IRegistryKeyNameModifier;
key = modifier.ModifyKey(key, true);
}
catch
{}
m_nPressedButtonsStartup = (int)key.GetValue(Name + "State", -1);
if (m_nPressedButtonsStartup != -1 && Buttons.Count > 0)
{
// note: In TE, there are no buttons created yet when settings are loaded.
// So this section of code is probably never used.
// Instead, the ResumeLayout() method takes care of the initial pressing of
//buttons later, when the tab is redrawn after the buttons are created.
for (int i = 0; i < Buttons.Count; i++)
{
bool fPress = (m_nPressedButtonsStartup & (1 << i)) != 0;
Buttons[i].PressButton(fPress);
// Also visually click only if not suspended (we are suspended at least once, because we
// call SuspendLayout() above!)
if (fPress && m_nSuspendedLayout < 2)
{
// Also click a pressed button if appropriate
if (fPress && OkToClickAButtonInThisTab)
Buttons[i].PerformClick();
}
}
// Clear the startup button states, now that we have used them
m_nPressedButtonsStartup = -1;
}
int nDefault = LargeIconsShowing ? 1 : 0;
LargeIconsShowing = ((int)key.GetValue(Name + "LargeIcons", nDefault) == 1)
? true : false;
ResumeLayout();
}
示例11: getSmtpQSetting
private string getSmtpQSetting(Microsoft.Win32.RegistryKey kSmtpQ,
string name, string defaultVal)
{
string s;
Object objVal;
s = null;
objVal = null;
objVal = kSmtpQ.GetValue(name);
if (objVal != null) s = objVal.ToString();
if (s == null)
{
kSmtpQ.SetValue(name, defaultVal, Microsoft.Win32.RegistryValueKind.String);
objVal = kSmtpQ.GetValue(name);
if (objVal != null) s = objVal.ToString();
}
return s;
}
示例12: GetVsPackages
public void GetVsPackages(Microsoft.Win32.RegistryKey hiveRoot, Microsoft.Win32.RegistryKey editorKey, string editorExt)
{
if ((extension == null) || (System.StringComparer.OrdinalIgnoreCase.Compare(editorExt, extension) == 0))
{
string s = editorKey.GetValue("Package") as string;
if (!System.String.IsNullOrEmpty(s))
{
using (Microsoft.Win32.RegistryKey registryKey = hiveRoot.OpenSubKey("Packages\\" + s))
{
if ((registryKey != null) && !editors.ContainsKey(registryKey.Name))
editors.Add(registryKey.Name, new VsPackageInfo(registryKey));
}
}
}
}
示例13: GetCommandParameter
public static object GetCommandParameter(Microsoft.Phone.Controls.PhoneApplicationPage buttonBase)
{
return buttonBase.GetValue(CommandParameterProperty);
}
示例14: OnLoadSettings
/// ------------------------------------------------------------------------------------
/// <summary>
///
/// </summary>
/// ------------------------------------------------------------------------------------
protected override void OnLoadSettings(Microsoft.Win32.RegistryKey key)
{
base.OnLoadSettings(key);
if (m_list == null || key == null)
return;
string value = key.GetValue("SelectedCheckingError", null) as string;
if (value != null)
{
Guid guid = new Guid(value);
SelectCheckingError(guid);
}
}
示例15: LoadSettings
/// ------------------------------------------------------------------------------------
/// <summary>
/// Tells the adapter to load it's settings from the specified keys.
/// </summary>
/// <param name="key"></param>
/// ------------------------------------------------------------------------------------
public void LoadSettings(Microsoft.Win32.RegistryKey key)
{
// TODO for SilSidePane: some functionality here about setting items and tabs is irrelevant with SilSidePane, so identify and remove it.
// Set the sidebar's width
if (m_sidePane.ContainingControl != null)
m_sidePane.ContainingControl.Width = (int)key.GetValue("SideBarWidth", m_sidePane.ContainingControl.Width);
// Restore the active tab and active tab item.
string tabName = key.GetValue("ActiveTab") as string;
if (tabName != null)
{
// First set the current tab without causing events.
SetCurrentTab(tabName, false);
string itemName = key.GetValue("ActiveTabItem") as string;
if (itemName != null)
SetCurrentTabItem(tabName, itemName, true);
else
{
// At this point, the registry didn't contain an active tab item, so
// we'll set the current tab again, but this time generate events on
// the assumption that when the application gets the event, it will
// set a default tab item for the tab.
SetCurrentTab(tabName, true);
}
}
else
{
// Set to a default tab and tab item.
// Use the first item on the first tab, rather than kScrSBTabName, kScrDraftViewSBItemName, since
// this library shouldn't have to know what buttons the application uses.
var tab = m_tabProps[0];
if (null != tab)
{
SetCurrentTab(tab.Name, true);
// Setting first item on tab should happen automatically.
}
}
}