📄 help2registrywalker.cs
字号:
/* ***********************************************************
*
* Help 2.0 Environment for SharpDevelop
* Help 2.0 Registry Walker
* Copyright (c) 2005, Mathias Simmack. All rights reserved.
*
* ********************************************************* */
//#define Description_UseCollectionDescription
namespace HtmlHelp2Service
{
using System;
using System.Windows.Forms;
using MSHelpServices;
public sealed class Help2RegistryWalker
{
public static void BuildNamespacesList(ComboBox help2Collections, string selectedHelp2Collection)
{
if(help2Collections == null)
return;
help2Collections.Items.Clear();
help2Collections.BeginUpdate();
try
{
string currentDescription = "";
HxRegistryWalker regWalker = new HxRegistryWalker();
IHxRegNamespaceList namespaces = regWalker.get_RegisteredNamespaceList("");
foreach(IHxRegNamespace currentNamespace in namespaces)
{
#if Description_UseCollectionDescription
help2Collections.Items.Add((string)CollectionInfoClass.GetCollectionTitle(currentNamespace.Name));
if(selectedHelp2Collection != "" &&
String.Compare(selectedHelp2Collection, currentNamespace.Name) == 0)
{
currentDescription = CollectionInfoClass.GetCollectionTitle(currentNamespace.Name);
}
#else
help2Collections.Items.Add((string)currentNamespace.GetProperty(HxRegNamespacePropId.HxRegNamespaceDescription));
if(selectedHelp2Collection != "" &&
String.Compare(selectedHelp2Collection, currentNamespace.Name) == 0)
{
currentDescription = (string)currentNamespace.GetProperty(HxRegNamespacePropId.HxRegNamespaceDescription);
}
#endif
}
if(currentDescription != "") help2Collections.SelectedIndex = help2Collections.Items.IndexOf(currentDescription);
else help2Collections.SelectedIndex = 0;
}
catch {}
help2Collections.EndUpdate();
}
public static string GetNamespaceName(string namespaceDescription)
{
try
{
HxRegistryWalker regWalker = new HxRegistryWalker();
IHxRegNamespaceList namespaces = regWalker.get_RegisteredNamespaceList("");
foreach(IHxRegNamespace currentNamespace in namespaces)
{
#if Description_UseCollectionDescription
if(String.Compare(namespaceDescription, CollectionInfoClass.GetCollectionTitle(currentNamespace.Name)) == 0)
{
return currentNamespace.Name;
}
#else
if(String.Compare(namespaceDescription, (string)currentNamespace.GetProperty(HxRegNamespacePropId.HxRegNamespaceDescription)) == 0)
{
return currentNamespace.Name;
}
#endif
}
return "";
}
catch
{
return "";
}
}
public static string GetFirstNamespace(string defaultNamespaceName)
{
try
{
HxRegistryWalker regWalker = new HxRegistryWalker();
IHxRegNamespaceList namespaces = regWalker.get_RegisteredNamespaceList("");
foreach(IHxRegNamespace currentNamespace in namespaces)
{
if(String.Compare(defaultNamespaceName, currentNamespace.Name) == 0)
{
return defaultNamespaceName;
}
}
return namespaces.ItemAt(1).Name;
}
catch
{
return "";
}
}
public Help2RegistryWalker()
{
}
}
#if Description_UseCollectionDescription
public sealed class CollectionInfoClass
{
public CollectionInfoClass()
{
}
public static string GetCollectionTitle(string namespaceName)
{
try
{
HxSession session = new HxSession();
session.Initialize(String.Format("ms-help://{0}", namespaceName), 0);
IHxCollection collection = session.Collection;
return collection.Title;
}
catch
{
return "";
}
}
}
#endif
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -