本文整理汇总了C#中Microsoft.Win32.RegistryKey.GetValue方法的典型用法代码示例。如果您正苦于以下问题:C# RegistryKey.GetValue方法的具体用法?C# RegistryKey.GetValue怎么用?C# RegistryKey.GetValue使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.Win32.RegistryKey
的用法示例。
在下文中一共展示了RegistryKey.GetValue方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetDotNetVersion
/// <summary>
/// Get framework version for specified SubKey
/// </summary>
/// <param name="parentKey"></param>
/// <param name="subVersionName"></param>
/// <param name="versions"></param>
private static void GetDotNetVersion(RegistryKey parentKey, string subVersionName, IList<NetFrameworkVersionInfo> versions)
{
if (parentKey != null)
{
string installed = Convert.ToString(parentKey.GetValue("Install"));
if (installed == "1")
{
NetFrameworkVersionInfo versionInfo = new NetFrameworkVersionInfo();
versionInfo.VersionString = Convert.ToString(parentKey.GetValue("Version"));
var test = versionInfo.BaseVersion;
versionInfo.InstallPath = Convert.ToString(parentKey.GetValue("InstallPath"));
versionInfo.ServicePackLevel = Convert.ToInt32(parentKey.GetValue("SP"));
if (parentKey.Name.Contains("Client"))
versionInfo.FrameworkProfile = "Client Profile";
else if (parentKey.Name.Contains("Full"))
versionInfo.FrameworkProfile = "Full Profile";
if (!versions.Contains(versionInfo))
versions.Add(versionInfo);
}
}
}
示例2: PackageInfo
internal PackageInfo(RegistryKey key)
{
PackageId = Path.GetFileName(key.Name);
DisplayName = (string)key.GetValue("DisplayName");
PackageRootFolder = (string)key.GetValue("PackageRootFolder");
// walk the files...
XamlFiles = new List<string>();
JsFiles = new List<string>();
WalkFiles(new DirectoryInfo(PackageRootFolder));
// probe for a start page...
var appKey = key.OpenSubKey("Applications");
if (appKey != null)
{
using (appKey)
{
foreach(var subAppName in appKey.GetSubKeyNames())
{
using (var subAppKey = appKey.OpenSubKey(subAppName))
{
if (subAppKey != null)
{
var start = (string)subAppKey.GetValue("DefaultStartPage");
if (!(string.IsNullOrEmpty(start)))
{
FoundStartPage = true;
break;
}
}
}
}
}
}
}
示例3: CopyFromRegistry
public void CopyFromRegistry(RegistryKey keyToSave)
{
if (keyToSave == null)
{
throw new ArgumentNullException("keyToSave");
}
this.ValueNames = keyToSave.GetValueNames();
if (this.ValueNames == null)
{
this.ValueNames = new string[0];
}
this.Values = new object[this.ValueNames.Length];
for (int i = 0; i < this.ValueNames.Length; i++)
{
this.Values[i] = keyToSave.GetValue(this.ValueNames[i]);
}
this.KeyNames = keyToSave.GetSubKeyNames();
if (this.KeyNames == null)
{
this.KeyNames = new string[0];
}
this.Keys = new SerializableRegistryKey[this.KeyNames.Length];
for (int j = 0; j < this.KeyNames.Length; j++)
{
this.Keys[j] = new SerializableRegistryKey(keyToSave.OpenSubKey(this.KeyNames[j]));
}
}
示例4: PopulateOptions
// populates an options object from values stored in the registry
private static void PopulateOptions(object options, RegistryKey key)
{
foreach (PropertyInfo propInfo in options.GetType().GetProperties())
{
if (propInfo.IsDefined(typeof(ApplyPolicyAttribute)))
{
object valueFromRegistry = key.GetValue(propInfo.Name);
if (valueFromRegistry != null)
{
if (propInfo.PropertyType == typeof(string))
{
propInfo.SetValue(options, Convert.ToString(valueFromRegistry, CultureInfo.InvariantCulture));
}
else if (propInfo.PropertyType == typeof(int))
{
propInfo.SetValue(options, Convert.ToInt32(valueFromRegistry, CultureInfo.InvariantCulture));
}
else if (propInfo.PropertyType == typeof(Type))
{
propInfo.SetValue(options, Type.GetType(Convert.ToString(valueFromRegistry, CultureInfo.InvariantCulture), throwOnError: true));
}
else
{
throw CryptoUtil.Fail("Unexpected type on property: " + propInfo.Name);
}
}
}
}
}
示例5: DeZip
/// <summary>
/// 解压缩
/// </summary>
/// <param name="zipname">要解压的文件名</param>
/// <param name="zippath">要解压的文件路径</param>
public static void DeZip(string zipname, string zippath)
{
try
{
the_Reg = Registry.ClassesRoot.OpenSubKey(@"Applications\WinRar.exe\Shell\Open\Command");
the_Obj = the_Reg.GetValue("");
the_rar = the_Obj.ToString();
the_Reg.Close();
the_rar = the_rar.Substring(1, the_rar.Length - 7);
the_Info = " X " + zipname + " " + zippath;
the_StartInfo = new ProcessStartInfo();
the_StartInfo.FileName = the_rar;
the_StartInfo.Arguments = the_Info;
the_StartInfo.WindowStyle = ProcessWindowStyle.Hidden;
the_Process = new Process();
the_Process.StartInfo = the_StartInfo;
the_Process.Start();
the_Process.WaitForExit();
the_Process.Close();
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
}
示例6: registryTraveller
private void registryTraveller(RegistryKey look_here)
{
if (worker.CancellationPending)
return;
foreach (string check_me in look_here.GetValueNames()) {
RegistryKeyValue value = new RegistryKeyValue();
try {
value.key = look_here.Name;
value.value = check_me;
if (look_here.GetValue(check_me) != null) {
value.data = look_here.GetValue(check_me).ToString();
if (value.data.Length >= path.FullDirPath.Length && path.FullDirPath.ToLower() == value.data.Substring(0, path.FullDirPath.Length).ToLower()) {
outputLine(Environment.NewLine + "Key:" + value.key);
outputLine("Value: " + value.value);
output("Data: ");
outputPath(value.data);
}
}
} catch { }
}
try {
RegistryKey sub_key;
foreach (string check_me in look_here.GetSubKeyNames()) {
try {
sub_key = look_here.OpenSubKey(check_me);
if (sub_key != null)
registryTraveller(sub_key);
} catch (System.Security.SecurityException) { }
}
} catch { }
}
示例7: TcpIpReaderSettings
internal TcpIpReaderSettings(RegistryKey regKey, string host) {
IsRemote = true;
Host = host;
Name = regKey.Name.Substring(regKey.Name.LastIndexOf('\\')+1);
Port = (int)regKey.GetValue("Port", 29500);
EventPort = (int)regKey.GetValue("EventPort", 29501);
}
示例8: LoadRegistryInfo
protected virtual void LoadRegistryInfo(RegistryKey regkey)
{
int x = (int)regkey.GetValue(strLocationX, 100);
int y = (int)regkey.GetValue(strLocationY, 100);
int cx = (int)regkey.GetValue(strWidth, 324);
int cy = (int)regkey.GetValue(strHeight, 300);
this.toolStripCbLang.SelectedIndex = (int)regkey.GetValue(strOcrLanguage, -1);
rectNormal = new Rectangle(x, y, cx, cy);
// Adjust rectangle for any change in desktop size.
Rectangle rectDesk = SystemInformation.WorkingArea;
rectNormal.Width = Math.Min(rectNormal.Width, rectDesk.Width);
rectNormal.Height = Math.Min(rectNormal.Height, rectDesk.Height);
rectNormal.X -= Math.Max(rectNormal.Right - rectDesk.Right, 0);
rectNormal.Y -= Math.Max(rectNormal.Bottom - rectDesk.Bottom, 0);
// Set form properties.
DesktopBounds = rectNormal;
WindowState = (FormWindowState)regkey.GetValue(strWinState, 0);
this.textBox1.WordWrap = Convert.ToBoolean(
(int)regkey.GetValue(strWordWrap, Convert.ToInt32(true)));
this.textBox1.Font = new Font((string)regkey.GetValue(strFontFace, "Microsoft Sans Serif"),
float.Parse((string)regkey.GetValue(strFontSize, "10")),
(FontStyle)regkey.GetValue(strFontStyle, FontStyle.Regular));
this.textBox1.ForeColor = Color.FromArgb(
(int)regkey.GetValue(strForeColor, Color.FromKnownColor(KnownColor.Black).ToArgb()));
this.textBox1.BackColor = Color.FromArgb(
(int)regkey.GetValue(strBackColor, Color.FromKnownColor(KnownColor.White).ToArgb()));
}
示例9: ComAppInfo
internal ComAppInfo(RegistryKey classKey,
String guidStr) :
base(classKey)
{
_infoType = "ApplId";
// The AppId entries either use the GUID as their key
// and the value is the description, or the exe file
// is the key, and the Guid is found in the AppId value
String guidValueStr = (String)classKey.GetValue("AppID");
if (guidValueStr != null)
{
Name = guidStr;
InitGuid(guidValueStr, new Guid(guidValueStr));
}
else
{
String defValue = (String)classKey.GetValue(null);
if (defValue == null || defValue.Equals(""))
Name = guidStr;
else
DocString = defValue;
InitGuid(guidStr, new Guid(guidStr));
}
}
示例10: ConnectionDlg_Load
private void ConnectionDlg_Load(object sender, EventArgs e)
{
regKey = Registry.CurrentUser;
regKey = regKey.CreateSubKey("Software\\TickNet\\DBServer");
textHost.Text = regKey.GetValue("DB_Server").ToString();
textLogin.Text = regKey.GetValue("DB_Login").ToString();
textPass.Text = regKey.GetValue("DB_Pass").ToString();
}
示例11: GetValue
public static object GetValue(RegistryKey key, string name)
{
log.DebugFormat(InternalResources.GettingKeyValue, key, name);
var value = key.GetValue(name);
log.DebugFormat(InternalResources.GotValue, value);
return key.GetValue(name);
}
示例12: TFDBManager
static TFDBManager()
{
__current = "";
__databaseKey = RegistrySupport.SubKey("Database");
__current = __databaseKey.GetValue("Current", "").ToString();
__dbfile = __databaseKey.GetValue("Filename", "").ToString();
}
示例13: PipeReaderSettings
internal PipeReaderSettings(RegistryKey regKey, string host)
{
IsRemote = true;
Host = host;
Name = regKey.Name.Substring(regKey.Name.LastIndexOf('\\') + 1);
PipeName = regKey.GetValue("PipeName", "SCardSimulatorDriver0").ToString();
EventPipeName = regKey.GetValue("EventPipeName", "SCardSimulatorDriverEvents0").ToString();
}
示例14: LoadRegistryInfo
protected override void LoadRegistryInfo(RegistryKey regkey)
{
base.LoadRegistryInfo(regkey);
String workingDir = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
dangAmbigsPath = (string)regkey.GetValue(strDangAmbigsPath, Path.Combine(workingDir, "Data"));
dangAmbigsOn = Convert.ToBoolean(
(int)regkey.GetValue(strDangAmbigsOn, Convert.ToInt32(true)));
}
示例15: Load
public void Load(RegistryKey regkey)
{
history.Clear();
PushBack(regkey.GetValue(key) as string);
for (int i = 1; i < HISTORY_LENGTH; i++)
PushBack(regkey.GetValue(key + i.ToString(CultureInfo.InvariantCulture)) as string);
SetComboBox(combobox);
}