private static RegistryView mRegistryView = RegistryView.Registry32; //32bit or 64 bit area of the registry? public static void Initialize() { if (String.IsNullOrEmpty(mAppRootDir)) //not yet initialized (or maybe HV2 is not installed) { HV2RegInfo regInfo = new HV2RegInfo(); //Populate local members mAppRootDir = regInfo.AppRoot; mDefaultHelpViewerCLSID = regInfo.DefaultHelpViewerCLSID; mContentStore = regInfo.ContentStore; mRegistryView = regInfo.RegistryView; } }
public static void Initialize() { if (String.IsNullOrEmpty(mAppRootDir)) //not yet initialized (or maybe HV2 is not installed) { HV2RegInfo regInfo = new HV2RegInfo(); //Populate local members mAppRootDir = regInfo.AppRoot; mDefaultHelpViewerCLSID = regInfo.DefaultHelpViewerCLSID; mContentStore = regInfo.ContentStore; mRegistryView = regInfo.RegistryView; } }
public static List<CatalogItem> GetCatalogs() { List<CatalogItem> resultList = new List<CatalogItem>(); CatalogItem catalogItem; HV2RegInfo hv2RegInfo = new HV2RegInfo(); RegistryKey baseKeyName = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, hv2RegInfo.RegistryView); if (baseKeyName != null) { //[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Help\v2.0\Catalogs] RegistryKey subkey = baseKeyName.OpenSubKey(hv2RegInfo.KEY_Help_v20_Catalogs); if (subkey != null) { //[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Help\v2.0\Catalogs\*] String[] catList = subkey.GetSubKeyNames(); subkey.Close(); foreach (String catalogID in catList) { //eg. [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Help\v2.0\Catalogs\VisualStudio11] String key = hv2RegInfo.KEY_Help_v20_Catalogs + @"\" + catalogID; subkey = baseKeyName.OpenSubKey(key); if (subkey != null) { //eg. LocationPath=C:\ProgramData\Microsoft\HelpLibrary2\Catalogs\VisualStudio11\ String LocationPath = (string)subkey.GetValue("LocationPath"); //Create new recort catalogItem = new CatalogItem(true, catalogID, LocationPath); //true = valud is from the registry //[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Help\v2.0\Catalogs\VisualStudio11\*] String[] localeList = subkey.GetSubKeyNames(); subkey.Close(); //[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Help\v2.0\Catalogs\VisualStudio11\en-US] foreach (String locale in localeList) { String localeKey = hv2RegInfo.KEY_Help_v20_Catalogs + @"\" + catalogID + @"\" + locale; subkey = baseKeyName.OpenSubKey(localeKey); if (subkey != null) { //eg. catalogName=Visual Studio 2011 Help Documentation String catalogName = (string)subkey.GetValue("catalogName"); //eg. SeedFilePath=C:\Program Files\Microsoft Help Viewer\v2.0\CatalogInfo\VS11_en-us.cab String SeedFilePath = (string)subkey.GetValue("SeedFilePath"); //Add to results catalogItem.AddLocaleItem(locale, catalogName, SeedFilePath); subkey.Close(); } } //Add to result list resultList.Add(catalogItem); } } } baseKeyName.Close(); } return (resultList); }
// HV2 registry info --> Debug window private void RegistryDumpToDebug() { DebugForm.Clear(); HV2RegInfo regInfo = new HV2RegInfo(); Color textColor = Color.DarkCyan; DebugForm.rtf.WriteLine("RegistryView: " + regInfo.RegistryView.ToString(), textColor); DebugForm.rtf.WriteLine(@"[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Help\v2.0]"); DebugForm.rtf.WriteLine("AppRoot: " + regInfo.AppRoot, textColor); DebugForm.rtf.WriteLine("DefaultHelpViewerCLSID = " + regInfo.DefaultHelpViewerCLSID, textColor); DebugForm.rtf.WriteLine(@"[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Help\v2.0\Catalogs]"); DebugForm.rtf.WriteLine("ContentStore = " + regInfo.ContentStore, textColor); DebugForm.rtf.WriteLine(""); List<CatalogItem> catalogList = CatalogList.GetCatalogs(); catalogList.ForEach(delegate(CatalogItem catalog) { DebugForm.rtf.WriteLine(@"[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Help\v2.0\Catalogs\" + catalog.CatalogID + "]"); DebugForm.rtf.WriteLine(" LocationPath = " + catalog.LocationPath, textColor); catalog.Locales.ForEach(delegate(CatalogLocaleItem catlocale) { DebugForm.rtf.WriteLine(@" [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Help\v2.0\Catalogs\" + catalog.CatalogID + "\\" + catlocale.Locale + "]"); DebugForm.rtf.WriteLine(" CatalogName = " + catlocale.CatalogName, textColor); DebugForm.rtf.WriteLine(" SeedFilePath = " + catlocale.SeedFilePath, textColor); }); }); }
public static List <CatalogItem> GetCatalogs() { List <CatalogItem> resultList = new List <CatalogItem>(); CatalogItem catalogItem; HV2RegInfo hv2RegInfo = new HV2RegInfo(); RegistryKey baseKeyName = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, hv2RegInfo.RegistryView); if (baseKeyName != null) { //[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Help\v2.0\Catalogs] RegistryKey subkey = baseKeyName.OpenSubKey(hv2RegInfo.KEY_Help_v20_Catalogs); if (subkey != null) { //[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Help\v2.0\Catalogs\*] String[] catList = subkey.GetSubKeyNames(); subkey.Close(); foreach (String catalogID in catList) { //eg. [HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Help\v2.0\Catalogs\VisualStudio11] String key = hv2RegInfo.KEY_Help_v20_Catalogs + @"\" + catalogID; subkey = baseKeyName.OpenSubKey(key); if (subkey != null) { //eg. LocationPath=C:\ProgramData\Microsoft\HelpLibrary2\Catalogs\VisualStudio11\ String LocationPath = (string)subkey.GetValue("LocationPath"); //Create new recort catalogItem = new CatalogItem(true, catalogID, LocationPath); //true = valud is from the registry //[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Help\v2.0\Catalogs\VisualStudio11\*] String[] localeList = subkey.GetSubKeyNames(); subkey.Close(); //[HKEY_LOCAL_MACHINE\SOFTWARE\Microsoft\Help\v2.0\Catalogs\VisualStudio11\en-US] foreach (String locale in localeList) { String localeKey = hv2RegInfo.KEY_Help_v20_Catalogs + @"\" + catalogID + @"\" + locale; subkey = baseKeyName.OpenSubKey(localeKey); if (subkey != null) { //eg. catalogName=Visual Studio 2011 Help Documentation String catalogName = (string)subkey.GetValue("catalogName"); //eg. SeedFilePath=C:\Program Files\Microsoft Help Viewer\v2.0\CatalogInfo\VS11_en-us.cab String SeedFilePath = (string)subkey.GetValue("SeedFilePath"); //Add to results catalogItem.AddLocaleItem(locale, catalogName, SeedFilePath); subkey.Close(); } } //Add to result list resultList.Add(catalogItem); } } } baseKeyName.Close(); } return(resultList); }