Browse Source

see last commit, here are the missing pieces

pull/74/head
mathiassimmack 12 years ago
parent
commit
757391035b
  1. 10
      src/AddIns/Misc/HelpViewer/HelpViewer.addin
  2. 8
      src/AddIns/Misc/HelpViewer/HelpViewer.csproj
  3. 26
      src/AddIns/Misc/HelpViewer/Source/Commands.cs
  4. 7
      src/AddIns/Misc/HelpViewer/Source/Controls/SearchPadControl.xaml
  5. 13
      src/AddIns/Misc/HelpViewer/Source/Controls/TocEntry.cs
  6. 6
      src/AddIns/Misc/HelpViewer/Source/Controls/TocPadControl.xaml
  7. 2
      src/AddIns/Misc/HelpViewer/Source/Controls/TocPadControl.xaml.cs
  8. 17
      src/AddIns/Misc/HelpViewer/Source/Core/DisplayHelp.cs
  9. 21
      src/AddIns/Misc/HelpViewer/Source/Core/Help3Environment.cs
  10. 30
      src/AddIns/Misc/HelpViewer/Source/Core/Help3Service.cs
  11. 42
      src/AddIns/Misc/HelpViewer/Source/Core/HelpLibraryAgent.cs
  12. 36
      src/AddIns/Misc/HelpViewer/Source/Core/HelpLibraryManager.cs
  13. 6
      src/AddIns/Misc/HelpViewer/Source/Help3OptionsPanel.xaml.cs
  14. 6
      src/AddIns/Misc/HelpViewer/Source/Helper/HelpClientWatcher.cs
  15. 19
      src/AddIns/Misc/HelpViewer/Source/Helper/ProjectLanguages.cs
  16. 4
      src/AddIns/Misc/HelpViewer/Source/MSHelp3Provider.cs

10
src/AddIns/Misc/HelpViewer/HelpViewer.addin

@ -21,11 +21,15 @@
</Path> </Path>
<Path name = "/SharpDevelop/Pads/ErrorList/TaskContextMenu"> <Path name = "/SharpDevelop/Pads/ErrorList/TaskContextMenu">
<MenuItem id = "Help3ShowErrorHelp" label = "${res:AddIns.HelpViewer.ShowErrorHelpTitle}" class = "MSHelpSystem.Commands.ShowErrorHelpCommand" /> <MenuItem id = "Help3ShowErrorHelp"
label = "${res:AddIns.HelpViewer.ShowErrorHelpTitle}"
class = "MSHelpSystem.Commands.ShowErrorHelpCommand" />
</Path> </Path>
<Path name = "/SharpDevelop/Dialogs/OptionsDialog/ToolsOptions"> <Path name = "/SharpDevelop/Dialogs/OptionsDialog/ToolsOptions">
<OptionPanel id = "Help3Options" label = "${res:AddIns.HelpViewer.MicrosoftHelpViewerTitle}" class = "MSHelpSystem.Help3OptionsPanel" /> <OptionPanel id = "Help3Options"
label = "${res:AddIns.HelpViewer.MicrosoftHelpViewerTitle}"
class = "MSHelpSystem.Help3OptionsPanel" />
</Path> </Path>
<Path name = "/SharpDevelop/Workbench/Pads"> <Path name = "/SharpDevelop/Workbench/Pads">
@ -35,7 +39,7 @@
icon = "HtmlHelp2.16x16.Toc" icon = "HtmlHelp2.16x16.Toc"
class = "MSHelpSystem.Controls.Help3TocPad" class = "MSHelpSystem.Controls.Help3TocPad"
defaultPosition = "Right, Hidden" /> defaultPosition = "Right, Hidden" />
<Pad id = "Help3TocPad" <Pad id = "Help3SearchPad"
category = "Help3" category = "Help3"
title = "${res:AddIns.HelpViewer.SearchPadTitle}" title = "${res:AddIns.HelpViewer.SearchPadTitle}"
icon = "HtmlHelp2.16x16.Search" icon = "HtmlHelp2.16x16.Search"

8
src/AddIns/Misc/HelpViewer/HelpViewer.csproj

@ -67,6 +67,7 @@
</Compile> </Compile>
<Compile Include="Configuration\AssemblyInfo.cs" /> <Compile Include="Configuration\AssemblyInfo.cs" />
<Compile Include="Source\BrowserScheme.cs" /> <Compile Include="Source\BrowserScheme.cs" />
<Compile Include="Source\Controls\HelpLibraryManagerNotFound.cs" />
<Compile Include="Source\Controls\Pads.cs" /> <Compile Include="Source\Controls\Pads.cs" />
<Compile Include="Source\Controls\SearchPadControl.xaml.cs"> <Compile Include="Source\Controls\SearchPadControl.xaml.cs">
<DependentUpon>SearchPadControl.xaml</DependentUpon> <DependentUpon>SearchPadControl.xaml</DependentUpon>
@ -81,7 +82,7 @@
<Compile Include="Source\Core\Help3Catalog.cs" /> <Compile Include="Source\Core\Help3Catalog.cs" />
<Compile Include="Source\Core\Help3Environment.cs" /> <Compile Include="Source\Core\Help3Environment.cs" />
<Compile Include="Source\Core\Help3Service.cs" /> <Compile Include="Source\Core\Help3Service.cs" />
<None Include="Source\Core\HelpLibraryManager.cs" /> <Compile Include="Source\Core\HelpLibraryManager.cs" />
<Compile Include="Source\Core\HelpLibraryAgent.cs" /> <Compile Include="Source\Core\HelpLibraryAgent.cs" />
<Compile Include="Source\Help3OptionsPanel.xaml.cs"> <Compile Include="Source\Help3OptionsPanel.xaml.cs">
<DependentUpon>Help3OptionsPanel.xaml</DependentUpon> <DependentUpon>Help3OptionsPanel.xaml</DependentUpon>
@ -121,6 +122,11 @@
<Name>ICSharpCode.Core.Presentation</Name> <Name>ICSharpCode.Core.Presentation</Name>
<Private>False</Private> <Private>False</Private>
</ProjectReference> </ProjectReference>
<ProjectReference Include="..\..\..\Main\ICSharpCode.Core.WinForms\ICSharpCode.Core.WinForms.csproj">
<Project>{857CA1A3-FC88-4BE0-AB6A-D1EE772AB288}</Project>
<Name>ICSharpCode.Core.WinForms</Name>
<Private>False</Private>
</ProjectReference>
</ItemGroup> </ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" /> <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project> </Project>

26
src/AddIns/Misc/HelpViewer/Source/Commands.cs

@ -6,12 +6,11 @@ using System.Collections.Generic;
using System.Diagnostics; using System.Diagnostics;
using System.Globalization; using System.Globalization;
using System.IO; using System.IO;
using Microsoft.Win32;
using MSHelpSystem.Core;
using MSHelpSystem.Controls;
using ICSharpCode.Core; using ICSharpCode.Core;
using ICSharpCode.SharpDevelop; using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui; using ICSharpCode.SharpDevelop.Gui;
using MSHelpSystem.Controls;
using MSHelpSystem.Core;
namespace MSHelpSystem.Commands namespace MSHelpSystem.Commands
{ {
@ -30,13 +29,13 @@ namespace MSHelpSystem.Commands
return; return;
if (Help3Environment.IsHelp3ProtocolRegistered) { if (Help3Environment.IsHelp3ProtocolRegistered) {
LoggingService.Debug(string.Format("Help 3.0: Getting description of \"{0}\"", code)); LoggingService.Debug(string.Format("HelpViewer: Getting description of \"{0}\"", code));
if (Help3Environment.IsLocalHelp) if (Help3Environment.IsLocalHelp)
DisplayHelp.Keywords(code); DisplayHelp.Keywords(code);
else else
DisplayHelp.ContextualHelp(code); DisplayHelp.ContextualHelp(code);
} else { } else {
LoggingService.Error("Help 3.0: Help system ist not initialized"); LoggingService.Error("HelpViewer: Help system ist not initialized");
} }
} }
} }
@ -67,22 +66,13 @@ namespace MSHelpSystem.Commands
{ {
public override void Run() public override void Run()
{ {
string path; if (string.IsNullOrEmpty(HelpLibraryManager.Manager)) {
if (!RegistryService.GetRegistryValue(RegistryHive.LocalMachine, @"SOFTWARE\Microsoft\Help\v1.0", using (HelpLibraryManagerNotFoundForm form = new HelpLibraryManagerNotFoundForm()) {
"AppRoot", RegistryValueKind.String, out path)) { form.ShowDialog(WorkbenchSingleton.MainWin32Window);
MessageService.ShowError("${res:AddIns.HelpViewer.HLMNotFound}");
return;
}
path = Path.Combine(path, "HelpLibManager.exe");
if (!File.Exists(path)) {
MessageService.ShowError("${res:AddIns.HelpViewer.HLMNotFound}");
return;
} }
if (string.IsNullOrEmpty(Help3Service.Config.ActiveCatalogId)) {
MessageService.ShowError("${res:AddIns.HelpViewer.HLMNoActiveCatalogError}");
return; return;
} }
Process.Start(path, string.Format("/product {0} /version {1} /locale {2}", Help3Service.Config.ActiveCatalogId.Split('/'))); HelpLibraryManager.Start();
} }
} }
} }

7
src/AddIns/Misc/HelpViewer/Source/Controls/SearchPadControl.xaml

@ -1,7 +1,8 @@
<UserControl x:Class="MSHelpSystem.Controls.SearchPadControl" <?xml version="1.0" encoding="utf-8"?>
<UserControl x:Class="MSHelpSystem.Controls.SearchPadControl"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:core="http://icsharpcode.net/sharpdevelop/core" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> xmlns:core="http://icsharpcode.net/sharpdevelop/core">
<StackPanel> <StackPanel>
<TextBlock Text="{core:Localize AddIns.HelpViewer.SearchLookForLabel}" Margin="5,2,5,1" /> <TextBlock Text="{core:Localize AddIns.HelpViewer.SearchLookForLabel}" Margin="5,2,5,1" />
<ComboBox Name="searchCB" Margin="5,2,5,5" Padding="1" IsEnabled="False" IsEditable="True" PreviewKeyUp="SearchCBPreviewKeyUp" /> <ComboBox Name="searchCB" Margin="5,2,5,5" Padding="1" IsEnabled="False" IsEditable="True" PreviewKeyUp="SearchCBPreviewKeyUp" />

13
src/AddIns/Misc/HelpViewer/Source/Controls/TocEntry.cs

@ -9,6 +9,7 @@ using System.Linq;
using System.Net; using System.Net;
using System.Reflection; using System.Reflection;
using System.Runtime.InteropServices; using System.Runtime.InteropServices;
using System.Web;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Data; using System.Windows.Data;
@ -35,14 +36,14 @@ namespace MSHelpSystem.Controls
client.DownloadStringCompleted += (_, e) => client.DownloadStringCompleted += (_, e) =>
{ {
try { try {
LoggingService.Debug(string.Format("Help 3.0: title \"{0}\"", Title)); LoggingService.Debug(string.Format("HelpViewer: TocEntry \"{0}\" found", Title));
var children = XElement.Parse(e.Result); var children = XElement.Parse(e.Result);
Children = children.Elements("topic") Children = children.Elements("topic")
.Select(link => new TocEntry(link.Attribute("id").Value) { Title = link.Element("title").Value }) .Select(link => new TocEntry(link.Attribute("id").Value) { Title = WebUtility.HtmlDecode(link.Element("title").Value) })
.ToArray(); .ToArray();
} catch (TargetInvocationException ex) { } catch (TargetInvocationException ex) {
// Exception when fetching e.Result: // Exception when fetching e.Result:
LoggingService.Warn(ex); LoggingService.Error(ex.ToString());
this.children = defaultChild; this.children = defaultChild;
} }
client.Dispose(); client.Dispose();
@ -58,8 +59,7 @@ namespace MSHelpSystem.Controls
public IEnumerable Children public IEnumerable Children
{ {
get get {
{
if (Help3Service.ActiveCatalog != null) { if (Help3Service.ActiveCatalog != null) {
if (children == null && !client.IsBusy && HelpLibraryAgent.PortIsReady) { if (children == null && !client.IsBusy && HelpLibraryAgent.PortIsReady) {
client.DownloadStringAsync(new Uri(Help3Environment.GetHttpFromMsXHelp(string.Format(url, Help3Service.ActiveCatalog.AsMsXHelpParam, id)))); client.DownloadStringAsync(new Uri(Help3Environment.GetHttpFromMsXHelp(string.Format(url, Help3Service.ActiveCatalog.AsMsXHelpParam, id))));
@ -67,8 +67,7 @@ namespace MSHelpSystem.Controls
} }
return children ?? defaultChild; return children ?? defaultChild;
} }
private set private set {
{
children = value; children = value;
RaisePropertyChanged("Children"); RaisePropertyChanged("Children");
} }

6
src/AddIns/Misc/HelpViewer/Source/Controls/TocPadControl.xaml

@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<UserControl <UserControl x:Class="MSHelpSystem.Controls.TocPadControl"
x:Class="MSHelpSystem.Controls.TocPadControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"> xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:core="http://icsharpcode.net/sharpdevelop/core">
<Grid> <Grid>
<TreeView <TreeView
Name="tocTreeView" Name="tocTreeView"

2
src/AddIns/Misc/HelpViewer/Source/Controls/TocPadControl.xaml.cs

@ -35,7 +35,7 @@ namespace MSHelpSystem.Controls
{ {
string topicId = (string)tocTreeView.SelectedValue; string topicId = (string)tocTreeView.SelectedValue;
if (!string.IsNullOrEmpty(topicId)) { if (!string.IsNullOrEmpty(topicId)) {
LoggingService.Debug(string.Format("Help 3.0: [TOC] Calling page with Id \"{0}\"", topicId)); LoggingService.Debug(string.Format("HelpViewer: TocItemChanged to ID \"{0}\"", topicId));
DisplayHelp.Page(topicId); DisplayHelp.Page(topicId);
} }
} }

17
src/AddIns/Misc/HelpViewer/Source/Core/DisplayHelp.cs

@ -33,7 +33,6 @@ namespace MSHelpSystem.Core
return false; return false;
} }
string helpCatalogUrl = string.Format(@"ms-xhelp://?method=page&id=-1&{0}", Help3Service.ActiveCatalog.AsMsXHelpParam); string helpCatalogUrl = string.Format(@"ms-xhelp://?method=page&id=-1&{0}", Help3Service.ActiveCatalog.AsMsXHelpParam);
LoggingService.Debug(string.Format("Help 3.0: {0}", helpCatalogUrl));
DisplayLocalHelp(helpCatalogUrl); DisplayLocalHelp(helpCatalogUrl);
return true; return true;
} }
@ -54,7 +53,6 @@ namespace MSHelpSystem.Core
return false; return false;
} }
string helpPageUrl = string.Format(@"ms-xhelp://?method=page&id={1}&{0}", Help3Service.ActiveCatalog.AsMsXHelpParam, pageId); string helpPageUrl = string.Format(@"ms-xhelp://?method=page&id={1}&{0}", Help3Service.ActiveCatalog.AsMsXHelpParam, pageId);
LoggingService.Debug(string.Format("Help 3.0: {0}", helpPageUrl));
DisplayLocalHelp(helpPageUrl); DisplayLocalHelp(helpPageUrl);
return true; return true;
} }
@ -72,7 +70,6 @@ namespace MSHelpSystem.Core
return false; return false;
} }
string helpContextualUrl = string.Format(@"ms-xhelp://?method=f1&query={1}&{0}", Help3Service.ActiveCatalog.AsMsXHelpParam, contextual); string helpContextualUrl = string.Format(@"ms-xhelp://?method=f1&query={1}&{0}", Help3Service.ActiveCatalog.AsMsXHelpParam, contextual);
LoggingService.Debug(string.Format("Help 3.0: {0}", helpContextualUrl));
DisplayLocalHelp(helpContextualUrl); DisplayLocalHelp(helpContextualUrl);
return true; return true;
} }
@ -90,7 +87,6 @@ namespace MSHelpSystem.Core
return false; return false;
} }
string helpSearchUrl = string.Format(@"ms-xhelp://?method=search&query={1}&{0}", Help3Service.ActiveCatalog.AsMsXHelpParam, searchWords.Replace(" ", "+")); string helpSearchUrl = string.Format(@"ms-xhelp://?method=search&query={1}&{0}", Help3Service.ActiveCatalog.AsMsXHelpParam, searchWords.Replace(" ", "+"));
LoggingService.Debug(string.Format("Help 3.0: {0}", helpSearchUrl));
DisplayLocalHelp(helpSearchUrl); DisplayLocalHelp(helpSearchUrl);
return true; return true;
} }
@ -111,7 +107,6 @@ namespace MSHelpSystem.Core
return false; return false;
} }
string helpKeywordsUrl = string.Format(@"ms-xhelp://?method=keywords&query={1}&{0}", Help3Service.ActiveCatalog.AsMsXHelpParam, keywords.Replace(" ", "+")); string helpKeywordsUrl = string.Format(@"ms-xhelp://?method=keywords&query={1}&{0}", Help3Service.ActiveCatalog.AsMsXHelpParam, keywords.Replace(" ", "+"));
LoggingService.Debug(string.Format("Help 3.0: {0}", helpKeywordsUrl));
DisplayLocalHelp(helpKeywordsUrl); DisplayLocalHelp(helpKeywordsUrl);
return true; return true;
} }
@ -133,7 +128,9 @@ namespace MSHelpSystem.Core
Thread.Sleep(0x3e8); Thread.Sleep(0x3e8);
} }
string helpUrl = string.Format(@"{0}{1}{2}", string helpUrl = string.Format(@"{0}{1}{2}",
arguments, ProjectLanguages.GetCurrentLanguageAsHttpParam(), (embedded)?"&embedded=true":string.Empty); arguments,
ProjectLanguages.CurrentLanguageAsHttpParam,
(embedded)?"&embedded=true":string.Empty);
if (Help3Service.Config.ExternalHelp) { if (Help3Service.Config.ExternalHelp) {
DisplayHelpWithShellExecute(helpUrl); DisplayHelpWithShellExecute(helpUrl);
@ -141,7 +138,7 @@ namespace MSHelpSystem.Core
} }
BrowserPane browser = ActiveHelp3Browser(); BrowserPane browser = ActiveHelp3Browser();
if (browser != null) { if (browser != null) {
LoggingService.Info(string.Format("Help 3.0: Navigating to {0}", helpUrl)); LoggingService.Info(string.Format("HelpViewer: DisplayLocalHelp calls \"{0}\"", helpUrl));
browser.Navigate(Help3Environment.GetHttpFromMsXHelp(helpUrl)); browser.Navigate(Help3Environment.GetHttpFromMsXHelp(helpUrl));
browser.WorkbenchWindow.SelectWindow(); browser.WorkbenchWindow.SelectWindow();
} }
@ -161,7 +158,7 @@ namespace MSHelpSystem.Core
p.WaitForInputIdle(); p.WaitForInputIdle();
} }
catch (Exception ex) { catch (Exception ex) {
LoggingService.Error(string.Format("Help 3.0: {0}", ex.ToString())); LoggingService.Error(string.Format("HelpViewer: {0}", ex.ToString()));
} }
} }
@ -178,7 +175,7 @@ namespace MSHelpSystem.Core
} }
BrowserPane browser = ActiveHelp3Browser(); BrowserPane browser = ActiveHelp3Browser();
if (browser != null) { if (browser != null) {
LoggingService.Info(string.Format("Help 3.0: Navigating to {0}", msdnUrl)); LoggingService.Info(string.Format("HelpViewer: DisplayHelpOnMSDN calls \"{0}\"", msdnUrl));
browser.Navigate(msdnUrl); browser.Navigate(msdnUrl);
browser.WorkbenchWindow.SelectWindow(); browser.WorkbenchWindow.SelectWindow();
} }
@ -192,7 +189,7 @@ namespace MSHelpSystem.Core
string msdnUrl = string.Format(@"http://social.msdn.microsoft.com/Search/{0}/?query={1}&ac=3", CultureInfo.CurrentUICulture.ToString(), searchWords.Replace(" ", "+")); string msdnUrl = string.Format(@"http://social.msdn.microsoft.com/Search/{0}/?query={1}&ac=3", CultureInfo.CurrentUICulture.ToString(), searchWords.Replace(" ", "+"));
BrowserPane browser = ActiveHelp3Browser(); BrowserPane browser = ActiveHelp3Browser();
if (browser != null) { if (browser != null) {
LoggingService.Info(string.Format("Help 3.0: Navigating to {0}", msdnUrl)); LoggingService.Info(string.Format("HelpViewer: DisplaySearchOnMSDN calls \"{0}\"", msdnUrl));
browser.Navigate(msdnUrl); browser.Navigate(msdnUrl);
browser.WorkbenchWindow.SelectWindow(); browser.WorkbenchWindow.SelectWindow();
} }

21
src/AddIns/Misc/HelpViewer/Source/Core/Help3Environment.cs

@ -18,8 +18,7 @@ namespace MSHelpSystem.Core
public static bool IsHelp3ProtocolRegistered public static bool IsHelp3ProtocolRegistered
{ {
get get {
{
try { try {
RegistryKey hkcr = RegistryKey.OpenBaseKey(RegistryHive.ClassesRoot, RegistryView.Registry64).OpenSubKey(@"MS-XHelp\shell\open\command", false); RegistryKey hkcr = RegistryKey.OpenBaseKey(RegistryHive.ClassesRoot, RegistryView.Registry64).OpenSubKey(@"MS-XHelp\shell\open\command", false);
string helpLibAgent = (string)hkcr.GetValue("", string.Empty); string helpLibAgent = (string)hkcr.GetValue("", string.Empty);
@ -27,7 +26,7 @@ namespace MSHelpSystem.Core
return (!string.IsNullOrEmpty(helpLibAgent)); return (!string.IsNullOrEmpty(helpLibAgent));
} }
catch (Exception ex) { catch (Exception ex) {
LoggingService.Error(string.Format("Help 3.0: {0}", ex.ToString())); LoggingService.Error(string.Format("HelpViewer: {0}", ex.ToString()));
} }
return false; return false;
} }
@ -35,8 +34,7 @@ namespace MSHelpSystem.Core
public static bool IsLocalStoreInitialized public static bool IsLocalStoreInitialized
{ {
get get {
{
string localStore = LocalStore; string localStore = LocalStore;
return (!string.IsNullOrEmpty(localStore) && Directory.Exists(localStore)); return (!string.IsNullOrEmpty(localStore) && Directory.Exists(localStore));
} }
@ -44,8 +42,7 @@ namespace MSHelpSystem.Core
public static string LocalStore public static string LocalStore
{ {
get get {
{
try { try {
RegistryKey hklm = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64).OpenSubKey(@"SOFTWARE\Microsoft\Help\v1.0", false); RegistryKey hklm = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64).OpenSubKey(@"SOFTWARE\Microsoft\Help\v1.0", false);
string localStore = (string)hklm.GetValue("LocalStore", string.Empty); string localStore = (string)hklm.GetValue("LocalStore", string.Empty);
@ -53,7 +50,7 @@ namespace MSHelpSystem.Core
return localStore; return localStore;
} }
catch (Exception ex) { catch (Exception ex) {
LoggingService.Error(string.Format("Help 3.0: {0}", ex.ToString())); LoggingService.Error(string.Format("HelpViewer: {0}", ex.ToString()));
} }
return string.Empty; return string.Empty;
} }
@ -66,8 +63,7 @@ namespace MSHelpSystem.Core
public static string AppRoot public static string AppRoot
{ {
get get {
{
try { try {
RegistryKey hklm = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64).OpenSubKey(@"SOFTWARE\Microsoft\Help\v1.0", false); RegistryKey hklm = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64).OpenSubKey(@"SOFTWARE\Microsoft\Help\v1.0", false);
string appRoot = (string)hklm.GetValue("AppRoot", string.Empty); string appRoot = (string)hklm.GetValue("AppRoot", string.Empty);
@ -75,7 +71,7 @@ namespace MSHelpSystem.Core
return appRoot; return appRoot;
} }
catch (Exception ex) { catch (Exception ex) {
LoggingService.Error(string.Format("Help 3.0: {0}", ex.ToString())); LoggingService.Error(string.Format("HelpViewer: {0}", ex.ToString()));
} }
return string.Empty; return string.Empty;
} }
@ -83,8 +79,7 @@ namespace MSHelpSystem.Core
public static string ManifestFolder public static string ManifestFolder
{ {
get get {
{
string manifestFolder = LocalStore; string manifestFolder = LocalStore;
if (string.IsNullOrEmpty(manifestFolder)) return string.Empty; if (string.IsNullOrEmpty(manifestFolder)) return string.Empty;
manifestFolder = System.IO.Path.Combine(manifestFolder, "manifest"); manifestFolder = System.IO.Path.Combine(manifestFolder, "manifest");

30
src/AddIns/Misc/HelpViewer/Source/Core/Help3Service.cs

@ -37,8 +37,7 @@ namespace MSHelpSystem.Core
static void UpdateCatalogs() static void UpdateCatalogs()
{ {
catalogs.Clear(); catalogs.Clear();
if (Help3Environment.IsHelp3ProtocolRegistered && !string.IsNullOrEmpty(Help3Environment.ManifestFolder)) if (Help3Environment.IsHelp3ProtocolRegistered && !string.IsNullOrEmpty(Help3Environment.ManifestFolder)) {
{
try { try {
DirectoryInfo folder = new DirectoryInfo(Help3Environment.ManifestFolder); DirectoryInfo folder = new DirectoryInfo(Help3Environment.ManifestFolder);
FileInfo[] files = folder.GetFiles(@"queryManifest*.xml"); FileInfo[] files = folder.GetFiles(@"queryManifest*.xml");
@ -58,10 +57,10 @@ namespace MSHelpSystem.Core
); );
} }
} }
LoggingService.Debug(string.Format("Help 3.0: {0} {1} loaded", catalogs.Count, (catalogs.Count == 1)?"catalog":"catalogs")); LoggingService.Debug(string.Format("HelpViewer: {0} {1} loaded", catalogs.Count, (catalogs.Count == 1)?"catalog":"catalogs"));
} }
catch (Exception ex) { catch (Exception ex) {
LoggingService.Error(string.Format("Help 3.0: {0}", ex.ToString())); LoggingService.Error(string.Format("HelpViewer: {0}", ex.ToString()));
} }
} }
OnCatalogsUpdated(EventArgs.Empty); OnCatalogsUpdated(EventArgs.Empty);
@ -94,8 +93,7 @@ namespace MSHelpSystem.Core
public static ReadOnlyCollection<Help3Catalog> Items public static ReadOnlyCollection<Help3Catalog> Items
{ {
get get {
{
ReadOnlyCollection<Help3Catalog> c = new ReadOnlyCollection<Help3Catalog>(catalogs); ReadOnlyCollection<Help3Catalog> c = new ReadOnlyCollection<Help3Catalog>(catalogs);
return c; return c;
} }
@ -133,12 +131,10 @@ namespace MSHelpSystem.Core
public static string ActiveCatalogId public static string ActiveCatalogId
{ {
get get {
{
return config.ActiveCatalogId; return config.ActiveCatalogId;
} }
set set {
{
config.ActiveCatalogId = value; config.ActiveCatalogId = value;
OnCatalogChanged(EventArgs.Empty); OnCatalogChanged(EventArgs.Empty);
} }
@ -167,10 +163,10 @@ namespace MSHelpSystem.Core
TextReader file = new StreamReader(configFile); TextReader file = new StreamReader(configFile);
config = (Help3Configuration)serialize.Deserialize(file); config = (Help3Configuration)serialize.Deserialize(file);
file.Close(); file.Close();
LoggingService.Info("Help 3.0: Configuration successfully loaded"); LoggingService.Info("HelpViewer: Configuration successfully loaded");
} }
catch (Exception ex) { catch (Exception ex) {
LoggingService.Error(string.Format("Help 3.0: {0}", ex.ToString())); LoggingService.Error(string.Format("HelpViewer: {0}", ex.ToString()));
} }
OnConfigurationUpdated(EventArgs.Empty); OnConfigurationUpdated(EventArgs.Empty);
} }
@ -183,10 +179,10 @@ namespace MSHelpSystem.Core
TextWriter file = new StreamWriter(configFile); TextWriter file = new StreamWriter(configFile);
serialize.Serialize(file, config); serialize.Serialize(file, config);
file.Close(); file.Close();
LoggingService.Info("Help 3.0: Configuration successfully saved"); LoggingService.Info("HelpViewer: Configuration successfully saved");
} }
catch (Exception ex) { catch (Exception ex) {
LoggingService.Error(string.Format("Help 3.0: {0}", ex.ToString())); LoggingService.Error(string.Format("HelpViewer: {0}", ex.ToString()));
} }
OnConfigurationUpdated(EventArgs.Empty); OnConfigurationUpdated(EventArgs.Empty);
} }
@ -201,19 +197,19 @@ namespace MSHelpSystem.Core
static void OnCatalogsUpdated(EventArgs e) static void OnCatalogsUpdated(EventArgs e)
{ {
LoggingService.Debug("Help 3.0: \"OnCatalogsUpdated\" event raised"); LoggingService.Debug("HelpViewer: OnCatalogsUpdated event raised");
if (CatalogsUpdated != null) CatalogsUpdated(null, e); if (CatalogsUpdated != null) CatalogsUpdated(null, e);
} }
static void OnCatalogChanged(EventArgs e) static void OnCatalogChanged(EventArgs e)
{ {
LoggingService.Debug("Help 3.0: \"OnCatalogChanged\" event raised"); LoggingService.Debug("HelpViewer: OnCatalogChanged event raised");
if (CatalogChanged != null) CatalogChanged(null, e); if (CatalogChanged != null) CatalogChanged(null, e);
} }
static void OnConfigurationUpdated(EventArgs e) static void OnConfigurationUpdated(EventArgs e)
{ {
LoggingService.Debug("Help 3.0: \"OnConfigurationUpdated\" event raised"); LoggingService.Debug("HelpViewer: OnConfigurationUpdated event raised");
if (ConfigurationUpdated != null) ConfigurationUpdated(null, e); if (ConfigurationUpdated != null) ConfigurationUpdated(null, e);
} }

42
src/AddIns/Misc/HelpViewer/Source/Core/HelpLibraryAgent.cs

@ -19,29 +19,26 @@ namespace MSHelpSystem.Core
public static bool IsRunning public static bool IsRunning
{ {
get get {
{
Process[] agents = Process.GetProcessesByName("HelpLibAgent"); Process[] agents = Process.GetProcessesByName("HelpLibAgent");
LoggingService.Debug(string.Format("Help 3.0: {0} {1} of HelpLibraryAgent.exe found", agents.Length, (agents.Length == 1)?"process":"processes")); LoggingService.Debug(string.Format("HelpViewer: {0} HelpLibraryAgent {1} found", agents.Length, (agents.Length == 1)?"process":"processes"));
return agents.Length > 0; return agents.Length > 0;
} }
} }
public static string Agent public static string Agent
{ {
get get {
{
if (string.IsNullOrEmpty(Help3Environment.AppRoot)) return string.Empty; if (string.IsNullOrEmpty(Help3Environment.AppRoot)) return string.Empty;
string agent = Path.Combine(Help3Environment.AppRoot, "HelpLibAgent.exe"); string agent = Path.Combine(Help3Environment.AppRoot, "HelpLibAgent.exe");
LoggingService.Debug(string.Format("Help 3.0: Help library agent is \"{0}\"", agent)); LoggingService.Debug(string.Format("HelpViewer: HelpLibraryAgent is \"{0}\"", agent));
return (File.Exists(agent)) ? agent : string.Empty; return (File.Exists(agent)) ? agent : string.Empty;
} }
} }
public static int PortNumber public static int PortNumber
{ {
get get {
{
try { try {
RegistryKey hklm = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64).OpenSubKey(@"SOFTWARE\Microsoft\Help\v1.0", false); RegistryKey hklm = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64).OpenSubKey(@"SOFTWARE\Microsoft\Help\v1.0", false);
string port = (string)hklm.GetValue("AgentPort", "47873"); string port = (string)hklm.GetValue("AgentPort", "47873");
@ -49,7 +46,7 @@ namespace MSHelpSystem.Core
return Convert.ToInt32(port); return Convert.ToInt32(port);
} }
catch (Exception ex) { catch (Exception ex) {
LoggingService.Error(string.Format("Help 3.0: {0}", ex.ToString())); LoggingService.Error(string.Format("HelpViewer: {0}", ex.ToString()));
} }
return 47873; // This is the DEFAULT port number! return 47873; // This is the DEFAULT port number!
} }
@ -57,8 +54,7 @@ namespace MSHelpSystem.Core
public static bool PortIsReady public static bool PortIsReady
{ {
get get {
{
try { try {
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp); Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
socket.Connect(IPAddress.Parse("127.0.0.1"), PortNumber); socket.Connect(IPAddress.Parse("127.0.0.1"), PortNumber);
@ -68,10 +64,10 @@ namespace MSHelpSystem.Core
} }
catch (SocketException ex) { catch (SocketException ex) {
if (ex.ErrorCode == 10061) { if (ex.ErrorCode == 10061) {
LoggingService.Debug("Help 3.0: Port is available but not ready"); LoggingService.Debug("HelpViewer: Port is available but not ready");
return true; return true;
} }
LoggingService.Error(string.Format("Help 3.0: {0}", ex.ToString())); LoggingService.Error(string.Format("HelpViewer: {0}", ex.ToString()));
} }
return false; return false;
} }
@ -79,19 +75,17 @@ namespace MSHelpSystem.Core
public static int ProcessId public static int ProcessId
{ {
get get {
{
Process[] agents = Process.GetProcessesByName("HelpLibAgent"); Process[] agents = Process.GetProcessesByName("HelpLibAgent");
int processId = (agents.Length > 0) ? agents[0].Id:0; int processId = (agents.Length > 0) ? agents[0].Id:0;
LoggingService.Debug(string.Format("Help 3.0: Help library agent has the process ID \"{0}\"", processId)); LoggingService.Debug(string.Format("HelpViewer: HelpLibraryAgent has process ID \"{0}\"", processId));
return processId; return processId;
} }
} }
public static string CurrentViewer public static string CurrentViewer
{ {
get get {
{
string viewer = string.Empty; string viewer = string.Empty;
try { try {
RegistryKey hklm = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64).OpenSubKey(@"SOFTWARE\Microsoft\Help\v1.0", false); RegistryKey hklm = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64).OpenSubKey(@"SOFTWARE\Microsoft\Help\v1.0", false);
@ -107,9 +101,9 @@ namespace MSHelpSystem.Core
} }
} }
catch (Exception ex) { catch (Exception ex) {
LoggingService.Error(string.Format("Help 3.0: {0}", ex.ToString())); LoggingService.Error(string.Format("HelpViewer: {0}", ex.ToString()));
} }
LoggingService.Debug(string.Format("Help 3.0: Default viewer is \"{0}\"", viewer)); LoggingService.Debug(string.Format("HelpViewer: Default viewer is \"{0}\"", viewer));
return viewer; return viewer;
} }
} }
@ -121,11 +115,11 @@ namespace MSHelpSystem.Core
try { try {
Process p = Process.Start(Agent); Process p = Process.Start(Agent);
p.WaitForInputIdle(); p.WaitForInputIdle();
LoggingService.Info("Help 3.0: Help library agent started"); LoggingService.Info("HelpViewer: HelpLibraryAgent started");
return IsRunning; return IsRunning;
} }
catch (Exception ex) { catch (Exception ex) {
LoggingService.Error(string.Format("Help 3.0: {0}", ex.ToString())); LoggingService.Error(string.Format("HelpViewer: {0}", ex.ToString()));
} }
return false; return false;
} }
@ -144,10 +138,10 @@ namespace MSHelpSystem.Core
agent.Kill(); agent.Kill();
if (waitForExit) agent.WaitForExit(); if (waitForExit) agent.WaitForExit();
} }
LoggingService.Debug(string.Format("Help 3.0: {0} {1} of HelpLibraryAgent.exe stopped", agents.Length, (agents.Length == 1)?"process":"processes")); LoggingService.Debug(string.Format("HelpViewer: {0} HelpLibraryAgent {1} stopped", agents.Length, (agents.Length == 1)?"process":"processes"));
} }
catch (Exception ex) { catch (Exception ex) {
LoggingService.Error(string.Format("Help 3.0: {0}", ex.ToString())); LoggingService.Error(string.Format("HelpViewer: {0}", ex.ToString()));
} }
return true; return true;
} }

36
src/AddIns/Misc/HelpViewer/Source/Core/HelpLibraryManager.cs

@ -18,21 +18,19 @@ namespace MSHelpSystem.Core
public static bool IsRunning public static bool IsRunning
{ {
get get {
{
Process[] managers = Process.GetProcessesByName("HelpLibManager"); Process[] managers = Process.GetProcessesByName("HelpLibManager");
LoggingService.Debug(string.Format("Help 3.0: {0} {1} of HelpLibraryManager.exe found", managers.Length, (managers.Length == 1)?"process":"processes")); LoggingService.Debug(string.Format("HelpViewer: {0} HelpLibraryManager {1} found", managers.Length, (managers.Length == 1)?"process":"processes"));
return managers.Length > 0; return managers.Length > 0;
} }
} }
public static string Manager public static string Manager
{ {
get get {
{
if (string.IsNullOrEmpty(Help3Environment.AppRoot)) return string.Empty; if (string.IsNullOrEmpty(Help3Environment.AppRoot)) return string.Empty;
string manager = Path.Combine(Help3Environment.AppRoot, "HelpLibManager.exe"); string manager = Path.Combine(Help3Environment.AppRoot, "HelpLibManager.exe");
LoggingService.Debug(string.Format("Help 3.0: Help library manager is \"{0}\"", manager)); LoggingService.Debug(string.Format("HelpViewer: HelpLibraryManager is \"{0}\"", manager));
return (File.Exists(manager)) ? manager : string.Empty; return (File.Exists(manager)) ? manager : string.Empty;
} }
} }
@ -61,7 +59,7 @@ namespace MSHelpSystem.Core
string brandingSwitch = (!string.IsNullOrEmpty(brandingPackage)) ? string.Format("/brandingPackage \"{0}\"", brandingPackage):""; string brandingSwitch = (!string.IsNullOrEmpty(brandingPackage)) ? string.Format("/brandingPackage \"{0}\"", brandingPackage):"";
string arguments = string.Format("/product {0} /version {1} /locale {2} /content \"{3}\" {4}", productCode, productVersion, locale, Help3Environment.BuildLocalStoreFolder, brandingSwitch); string arguments = string.Format("/product {0} /version {1} /locale {2} /content \"{3}\" {4}", productCode, productVersion, locale, Help3Environment.BuildLocalStoreFolder, brandingSwitch);
LoggingService.Debug(string.Format("Help 3.0: Initializing local store with \"{0}\"", arguments)); LoggingService.Debug(string.Format("HelpViewer: Initializing local store with \"{0}\"", arguments));
HelpLibManagerProcessRunner(arguments); HelpLibManagerProcessRunner(arguments);
} }
@ -88,7 +86,7 @@ namespace MSHelpSystem.Core
string brandingSwitch = (!string.IsNullOrEmpty(brandingPackage)) ? string.Format("/brandingPackage \"{0}\"", brandingPackage):""; string brandingSwitch = (!string.IsNullOrEmpty(brandingPackage)) ? string.Format("/brandingPackage \"{0}\"", brandingPackage):"";
string arguments = string.Format("/product {0} /version {1} /locale {2} /sourceMedia \"{3}\" {4} {5}", productCode, productVersion, locale, sourceMedia, initLS, brandingSwitch); string arguments = string.Format("/product {0} /version {1} /locale {2} /sourceMedia \"{3}\" {4} {5}", productCode, productVersion, locale, sourceMedia, initLS, brandingSwitch);
LoggingService.Debug(string.Format("Help 3.0: Installing local help documents with \"{0}\"", arguments)); LoggingService.Debug(string.Format("HelpViewer: Installing local help documents with \"{0}\"", arguments));
HelpLibManagerProcessRunner(arguments); HelpLibManagerProcessRunner(arguments);
} }
@ -114,7 +112,7 @@ namespace MSHelpSystem.Core
string brandingSwitch = (!string.IsNullOrEmpty(brandingPackage)) ? string.Format("/brandingPackage \"{0}\"", brandingPackage):""; string brandingSwitch = (!string.IsNullOrEmpty(brandingPackage)) ? string.Format("/brandingPackage \"{0}\"", brandingPackage):"";
string arguments = string.Format("/product {0} /version {1} /locale {2} /sourceWeb \"{3}\" {4} {5}", productCode, productVersion, locale, sourceWeb, initLS, brandingSwitch); string arguments = string.Format("/product {0} /version {1} /locale {2} /sourceWeb \"{3}\" {4} {5}", productCode, productVersion, locale, sourceWeb, initLS, brandingSwitch);
LoggingService.Debug(string.Format("Help 3.0: Installing help documents from web with \"{0}\"", arguments)); LoggingService.Debug(string.Format("HelpViewer: Installing help documents from web with \"{0}\"", arguments));
HelpLibManagerProcessRunner(arguments); HelpLibManagerProcessRunner(arguments);
} }
@ -136,7 +134,7 @@ namespace MSHelpSystem.Core
string arguments = string.Format("/product {0} /version {1} /locale {2} /vendor \"{3}\" /productName \"{4}\" /mediaBookList {5} /uninstall", productCode, productVersion, locale, vendor, productName, mediaBookList); string arguments = string.Format("/product {0} /version {1} /locale {2} /vendor \"{3}\" /productName \"{4}\" /mediaBookList {5} /uninstall", productCode, productVersion, locale, vendor, productName, mediaBookList);
LoggingService.Debug(string.Format("Help 3.0: Uninstalling help documents with \"{0}\"", arguments)); LoggingService.Debug(string.Format("HelpViewer: Uninstalling help documents with \"{0}\"", arguments));
HelpLibManagerProcessRunner(arguments); HelpLibManagerProcessRunner(arguments);
} }
@ -166,13 +164,17 @@ namespace MSHelpSystem.Core
return p.ExitCode; return p.ExitCode;
} }
catch (Exception ex) { catch (Exception ex) {
LoggingService.Error(string.Format("Help 3.0: {0}", ex.ToString())); LoggingService.Error(string.Format("HelpViewer: {0}", ex.ToString()));
} }
return -1; return -1;
} }
public static bool Start() public static bool Start()
{
return Start(false);
}
public static bool Start(bool runPrivileged)
{ {
if (IsRunning) return true; if (IsRunning) return true;
if (string.IsNullOrEmpty(Manager)) { if (string.IsNullOrEmpty(Manager)) {
@ -186,16 +188,16 @@ namespace MSHelpSystem.Core
psi.WorkingDirectory = Help3Environment.AppRoot; psi.WorkingDirectory = Help3Environment.AppRoot;
psi.Arguments = Help3Service.ActiveCatalog.AsCmdLineParam; psi.Arguments = Help3Service.ActiveCatalog.AsCmdLineParam;
psi.UseShellExecute = true; psi.UseShellExecute = true;
psi.Verb = "runas"; if (runPrivileged) psi.Verb = "runas";
psi.WindowStyle = ProcessWindowStyle.Normal; psi.WindowStyle = ProcessWindowStyle.Normal;
try { try {
Process p = Process.Start(psi); Process p = Process.Start(psi);
p.WaitForInputIdle(); p.WaitForInputIdle();
LoggingService.Info("Help 3.0: Help library manager started"); LoggingService.Info("HelpViewer: HelpLibraryManager started");
return IsRunning; return IsRunning;
} }
catch (Exception ex) { catch (Exception ex) {
LoggingService.Error(string.Format("Help 3.0: {0}", ex.ToString())); LoggingService.Error(string.Format("HelpViewer: {0}", ex.ToString()));
} }
return false; return false;
} }
@ -214,10 +216,10 @@ namespace MSHelpSystem.Core
manager.Kill(); manager.Kill();
if (waitForExit) manager.WaitForExit(); if (waitForExit) manager.WaitForExit();
} }
LoggingService.Debug(string.Format("Help 3.0: {0} {1} of HelpLibraryManager.exe stopped", managers.Length, (managers.Length == 1)?"process":"processes")); LoggingService.Debug(string.Format("HelpViewer: {0} HelpLibraryManager {1} stopped", managers.Length, (managers.Length == 1)?"process":"processes"));
} }
catch (Exception ex) { catch (Exception ex) {
LoggingService.Error(string.Format("Help 3.0: {0}", ex.ToString())); LoggingService.Error(string.Format("HelpViewer: {0}", ex.ToString()));
} }
return true; return true;
} }

6
src/AddIns/Misc/HelpViewer/Source/Help3OptionsPanel.xaml.cs

@ -49,22 +49,22 @@ namespace MSHelpSystem
void Help3OfflineModeClicked(object sender, RoutedEventArgs e) void Help3OfflineModeClicked(object sender, RoutedEventArgs e)
{ {
LoggingService.Info("Help 3.0: Setting help mode to \"offline\"");
Help3Service.Config.OfflineMode = true; Help3Service.Config.OfflineMode = true;
help3Catalogs.IsEnabled = (help3Catalogs.Items.Count > 1 && Help3Service.Config.OfflineMode); help3Catalogs.IsEnabled = (help3Catalogs.Items.Count > 1 && Help3Service.Config.OfflineMode);
LoggingService.Info("HelpViewer: Help mode set to \"offline\"");
} }
void Help3OnlineModeClicked(object sender, RoutedEventArgs e) void Help3OnlineModeClicked(object sender, RoutedEventArgs e)
{ {
LoggingService.Info("Help 3.0: Setting help mode to \"online\"");
Help3Service.Config.OfflineMode = false; Help3Service.Config.OfflineMode = false;
help3Catalogs.IsEnabled = false; help3Catalogs.IsEnabled = false;
LoggingService.Info("HelpViewer: Help mode set to \"online\"");
} }
void Help3UseExternalHelpClicked(object sender, RoutedEventArgs e) void Help3UseExternalHelpClicked(object sender, RoutedEventArgs e)
{ {
Help3Service.Config.ExternalHelp = (bool)externalHelp.IsChecked; Help3Service.Config.ExternalHelp = (bool)externalHelp.IsChecked;
LoggingService.Info(string.Format("Help 3.0: {0} external help", (Help3Service.Config.ExternalHelp)?"Enabling":"Disabling")); LoggingService.Info(string.Format("HelpViewer: External help viewer {0}", (Help3Service.Config.ExternalHelp)?"enabled":"disabled"));
} }
public override bool SaveOptions() public override bool SaveOptions()

6
src/AddIns/Misc/HelpViewer/Source/Helper/HelpClientWatcher.cs

@ -97,7 +97,7 @@ namespace MSHelpSystem.Helper
} }
} }
catch (Exception ex) { catch (Exception ex) {
LoggingService.Error(string.Format("Help 3.0: {0}", ex.ToString())); LoggingService.Error(string.Format("HelpViewer: {0}", ex.ToString()));
} }
return "offline"; return "offline";
} }
@ -105,7 +105,7 @@ namespace MSHelpSystem.Helper
static void SetHelpMode() static void SetHelpMode()
{ {
clientFileChanged.EnableRaisingEvents = false; clientFileChanged.EnableRaisingEvents = false;
LoggingService.Info(string.Format("Help 3.0: Trying to set Help mode to \"{0}\"", helpMode)); LoggingService.Info(string.Format("HelpViewer: Trying to set help mode to \"{0}\"", helpMode));
Configuration config = null; Configuration config = null;
try { try {
@ -136,7 +136,7 @@ namespace MSHelpSystem.Helper
} }
} }
catch (Exception ex) { catch (Exception ex) {
LoggingService.Error(string.Format("Help 3.0: {0}", ex.ToString())); LoggingService.Error(string.Format("HelpViewer: {0}", ex.ToString()));
} }
clientFileChanged.EnableRaisingEvents = true; clientFileChanged.EnableRaisingEvents = true;
} }

19
src/AddIns/Misc/HelpViewer/Source/Helper/ProjectLanguages.cs

@ -29,27 +29,32 @@ namespace MSHelpSystem.Helper
#endregion #endregion
public static string GetCurrentLanguage() public static string CurrentLanguage
{ {
get {
string output = string.Empty; string output = string.Empty;
if (ProjectService.CurrentProject != null) { if (ProjectService.CurrentProject != null) {
string devLang = ProjectService.CurrentProject.Language; string devLang = ProjectService.CurrentProject.Language;
if (string.IsNullOrEmpty(devLang)) { throw new ArgumentNullException("devLang"); } if (string.IsNullOrEmpty(devLang)) {
output = devLang; throw new ArgumentNullException("devLang");
}
if (!languages.ContainsKey(devLang) || !languages.TryGetValue(devLang, out output)) { if (!languages.ContainsKey(devLang) || !languages.TryGetValue(devLang, out output)) {
output = devLang; output = devLang;
} }
LoggingService.Debug(string.Format("Help 3.0: Project language \"{0}\" formatted to \"{1}\"", devLang, output)); LoggingService.Debug(string.Format("HelpViewer: Project language \"{0}\" formatted to \"{1}\"", devLang, output));
} }
return output.ToLower(); return output.ToLower();
} }
}
public static string GetCurrentLanguageAsHttpParam() public static string CurrentLanguageAsHttpParam
{ {
string devLang = GetCurrentLanguage(); get {
string devLang = CurrentLanguage;
if (string.IsNullOrEmpty(devLang)) return string.Empty; if (string.IsNullOrEmpty(devLang)) return string.Empty;
else return string.Format("&category=DevLang%3a{0}", devLang); else return string.Format("&category=DevLang%3a{0}", devLang);
} }
} }
} }
}

4
src/AddIns/Misc/HelpViewer/Source/MSHelp3Provider.cs

@ -15,7 +15,7 @@ namespace MSHelpSystem
if (string.IsNullOrEmpty(fullTypeName)) { if (string.IsNullOrEmpty(fullTypeName)) {
throw new ArgumentNullException("fullTypeName"); throw new ArgumentNullException("fullTypeName");
} }
LoggingService.Info(string.Format("Help 3.0: Calling \"TryShowHelp\" with {0}", fullTypeName)); LoggingService.Info(string.Format("HelpViewer: TryShowHelp calls \"{0}\"", fullTypeName));
return DisplayHelp.ContextualHelp(fullTypeName); return DisplayHelp.ContextualHelp(fullTypeName);
} }
@ -24,7 +24,7 @@ namespace MSHelpSystem
if (string.IsNullOrEmpty(keyword)) { if (string.IsNullOrEmpty(keyword)) {
throw new ArgumentNullException("keyword"); throw new ArgumentNullException("keyword");
} }
LoggingService.Info(string.Format("Help 3.0: Calling \"TryShowHelpByKeyword\" with {0}", keyword)); LoggingService.Info(string.Format("HelpViewer: TryShowHelpByKeyword calls \"{0}\"", keyword));
DisplayHelp.Keywords(keyword); DisplayHelp.Keywords(keyword);
return true; return true;
} }

Loading…
Cancel
Save