internal IReadOnlyList<INamedItemInfo> LoadFunctionInfoFromPackageHelpIndex() {
List<INamedItemInfo> functions = new List<INamedItemInfo>();
string content = null;
try {
string htmlFile = Path.Combine(this.InstallPath, this.Name, "html", "00index.html");
if (File.Exists(htmlFile)) {
using (StreamReader sr = new StreamReader(htmlFile, Encoding.UTF8)) {
content = sr.ReadToEnd();
}
}
} catch (IOException) { }
if (!string.IsNullOrEmpty(content)) {
HtmlTree tree = new HtmlTree(new Microsoft.Web.Core.Text.TextStream(content));
tree.Build();
FunctionSearch functionSearch = new FunctionSearch(functions);
tree.Accept(functionSearch, null);
}
Dictionary<string, INamedItemInfo> functionIndex = new Dictionary<string, INamedItemInfo>();
foreach (INamedItemInfo ni in functions) {
functionIndex[ni.Name] = ni;
}
IReadOnlyDictionary<string, string> mappedNames = GetMappedNames();
foreach (string mappedName in mappedNames.Keys) {
INamedItemInfo ni;
string actualName = mappedNames[mappedName];
if (functionIndex.TryGetValue(actualName, out ni)) {
INamedItemInfo niAlias = new NamedItemInfo() {
Name = mappedName,
Description = ni.Description,
ItemType = ni.ItemType
};
functions.Add(niAlias);
}
}
return functions;
}