internal static string GetName(NsTarget t) { FieldInfo f = typeof(NsTarget).GetField(Enum.GetName(typeof(NsTarget), t)); TargetNameAttribute n = (TargetNameAttribute)Attribute.GetCustomAttribute(f, typeof(TargetNameAttribute)); return(n == null ? null : n.Value); }
private RegistryKey OpenTarget() { if (Config.Target == NsTarget.None) { throw new InvalidOperationException("No target namespace"); } return(RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, Environment.Is64BitOperatingSystem ? RegistryView.Registry64 : RegistryView.Registry32).OpenSubKey(string.Format(CultureInfo.InvariantCulture, @"Software\Microsoft\Windows\CurrentVersion\Explorer\{0}\Namespace", TargetNameAttribute.GetName(Config.Target)), true)); }