Browse Source

see last commit, here are the missing pieces

pull/74/head
mathiassimmack 12 years ago
parent
commit
757391035b
  1. 38
      src/AddIns/Misc/HelpViewer/HelpViewer.addin
  2. 8
      src/AddIns/Misc/HelpViewer/HelpViewer.csproj
  3. 28
      src/AddIns/Misc/HelpViewer/Source/Commands.cs
  4. 7
      src/AddIns/Misc/HelpViewer/Source/Controls/SearchPadControl.xaml
  5. 15
      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. 23
      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. 35
      src/AddIns/Misc/HelpViewer/Source/Helper/ProjectLanguages.cs
  16. 4
      src/AddIns/Misc/HelpViewer/Source/MSHelp3Provider.cs

38
src/AddIns/Misc/HelpViewer/HelpViewer.addin

@ -20,30 +20,34 @@ @@ -20,30 +20,34 @@
<BrowserSchemeExtension id = "http" class = "MSHelpSystem.BrowserScheme"/>
</Path>
<Path name="/SharpDevelop/Pads/ErrorList/TaskContextMenu">
<MenuItem id = "Help3ShowErrorHelp" label = "${res:AddIns.HelpViewer.ShowErrorHelpTitle}" class = "MSHelpSystem.Commands.ShowErrorHelpCommand" />
<Path name = "/SharpDevelop/Pads/ErrorList/TaskContextMenu">
<MenuItem id = "Help3ShowErrorHelp"
label = "${res:AddIns.HelpViewer.ShowErrorHelpTitle}"
class = "MSHelpSystem.Commands.ShowErrorHelpCommand" />
</Path>
<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 name = "/SharpDevelop/Workbench/Pads">
<Pad id = "Help3TocPad"
category = "Help3"
title = "${res:AddIns.HelpViewer.ContentsPadTitle}"
icon = "HtmlHelp2.16x16.Toc"
class = "MSHelpSystem.Controls.Help3TocPad"
defaultPosition = "Right, Hidden" />
<Pad id = "Help3TocPad"
category = "Help3"
title = "${res:AddIns.HelpViewer.SearchPadTitle}"
icon = "HtmlHelp2.16x16.Search"
class = "MSHelpSystem.Controls.Help3SearchPad"
defaultPosition = "Right, Hidden" />
<Path name = "/SharpDevelop/Workbench/Pads">
<Pad id = "Help3TocPad"
category = "Help3"
title = "${res:AddIns.HelpViewer.ContentsPadTitle}"
icon = "HtmlHelp2.16x16.Toc"
class = "MSHelpSystem.Controls.Help3TocPad"
defaultPosition = "Right, Hidden" />
<Pad id = "Help3SearchPad"
category = "Help3"
title = "${res:AddIns.HelpViewer.SearchPadTitle}"
icon = "HtmlHelp2.16x16.Search"
class = "MSHelpSystem.Controls.Help3SearchPad"
defaultPosition = "Right, Hidden" />
</Path>
<Path name = "/SharpDevelop/Workbench/MainMenu/Help">
<Path name = "/SharpDevelop/Workbench/MainMenu/Help">
<MenuItem id = "Help3DisplayContentCommand"
class = "MSHelpSystem.Commands.DisplayContent"
label = "${res:AddIns.HelpViewer.DisplayContentsCommand}"

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

@ -67,6 +67,7 @@ @@ -67,6 +67,7 @@
</Compile>
<Compile Include="Configuration\AssemblyInfo.cs" />
<Compile Include="Source\BrowserScheme.cs" />
<Compile Include="Source\Controls\HelpLibraryManagerNotFound.cs" />
<Compile Include="Source\Controls\Pads.cs" />
<Compile Include="Source\Controls\SearchPadControl.xaml.cs">
<DependentUpon>SearchPadControl.xaml</DependentUpon>
@ -81,7 +82,7 @@ @@ -81,7 +82,7 @@
<Compile Include="Source\Core\Help3Catalog.cs" />
<Compile Include="Source\Core\Help3Environment.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\Help3OptionsPanel.xaml.cs">
<DependentUpon>Help3OptionsPanel.xaml</DependentUpon>
@ -121,6 +122,11 @@ @@ -121,6 +122,11 @@
<Name>ICSharpCode.Core.Presentation</Name>
<Private>False</Private>
</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>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.Targets" />
</Project>

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

@ -6,12 +6,11 @@ using System.Collections.Generic; @@ -6,12 +6,11 @@ using System.Collections.Generic;
using System.Diagnostics;
using System.Globalization;
using System.IO;
using Microsoft.Win32;
using MSHelpSystem.Core;
using MSHelpSystem.Controls;
using ICSharpCode.Core;
using ICSharpCode.SharpDevelop;
using ICSharpCode.SharpDevelop.Gui;
using MSHelpSystem.Controls;
using MSHelpSystem.Core;
namespace MSHelpSystem.Commands
{
@ -30,13 +29,13 @@ namespace MSHelpSystem.Commands @@ -30,13 +29,13 @@ namespace MSHelpSystem.Commands
return;
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)
DisplayHelp.Keywords(code);
else
DisplayHelp.ContextualHelp(code);
} 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 @@ -67,22 +66,13 @@ namespace MSHelpSystem.Commands
{
public override void Run()
{
string path;
if (!RegistryService.GetRegistryValue(RegistryHive.LocalMachine, @"SOFTWARE\Microsoft\Help\v1.0",
"AppRoot", RegistryValueKind.String, out path)) {
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}");
if (string.IsNullOrEmpty(HelpLibraryManager.Manager)) {
using (HelpLibraryManagerNotFoundForm form = new HelpLibraryManagerNotFoundForm()) {
form.ShowDialog(WorkbenchSingleton.MainWin32Window);
}
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 @@ @@ -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: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>
<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" />

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

@ -9,6 +9,7 @@ using System.Linq; @@ -9,6 +9,7 @@ using System.Linq;
using System.Net;
using System.Reflection;
using System.Runtime.InteropServices;
using System.Web;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
@ -35,14 +36,14 @@ namespace MSHelpSystem.Controls @@ -35,14 +36,14 @@ namespace MSHelpSystem.Controls
client.DownloadStringCompleted += (_, e) =>
{
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);
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();
} catch (TargetInvocationException ex) {
// Exception when fetching e.Result:
LoggingService.Warn(ex);
LoggingService.Error(ex.ToString());
this.children = defaultChild;
}
client.Dispose();
@ -58,8 +59,7 @@ namespace MSHelpSystem.Controls @@ -58,8 +59,7 @@ namespace MSHelpSystem.Controls
public IEnumerable Children
{
get
{
get {
if (Help3Service.ActiveCatalog != null) {
if (children == null && !client.IsBusy && HelpLibraryAgent.PortIsReady) {
client.DownloadStringAsync(new Uri(Help3Environment.GetHttpFromMsXHelp(string.Format(url, Help3Service.ActiveCatalog.AsMsXHelpParam, id))));
@ -67,8 +67,7 @@ namespace MSHelpSystem.Controls @@ -67,8 +67,7 @@ namespace MSHelpSystem.Controls
}
return children ?? defaultChild;
}
private set
{
private set {
children = value;
RaisePropertyChanged("Children");
}
@ -81,5 +80,5 @@ namespace MSHelpSystem.Controls @@ -81,5 +80,5 @@ namespace MSHelpSystem.Controls
System.ComponentModel.PropertyChangedEventHandler handler = PropertyChanged;
if (handler != null) handler(this, new System.ComponentModel.PropertyChangedEventArgs(name));
}
}
}
}

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

@ -1,6 +1,8 @@ @@ -1,6 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<UserControl
x:Class="MSHelpSystem.Controls.TocPadControl" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<UserControl x:Class="MSHelpSystem.Controls.TocPadControl"
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>
<TreeView
Name="tocTreeView"

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

@ -35,7 +35,7 @@ namespace MSHelpSystem.Controls @@ -35,7 +35,7 @@ namespace MSHelpSystem.Controls
{
string topicId = (string)tocTreeView.SelectedValue;
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);
}
}

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

@ -33,7 +33,6 @@ namespace MSHelpSystem.Core @@ -33,7 +33,6 @@ namespace MSHelpSystem.Core
return false;
}
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);
return true;
}
@ -54,7 +53,6 @@ namespace MSHelpSystem.Core @@ -54,7 +53,6 @@ namespace MSHelpSystem.Core
return false;
}
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);
return true;
}
@ -72,7 +70,6 @@ namespace MSHelpSystem.Core @@ -72,7 +70,6 @@ namespace MSHelpSystem.Core
return false;
}
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);
return true;
}
@ -90,7 +87,6 @@ namespace MSHelpSystem.Core @@ -90,7 +87,6 @@ namespace MSHelpSystem.Core
return false;
}
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);
return true;
}
@ -111,7 +107,6 @@ namespace MSHelpSystem.Core @@ -111,7 +107,6 @@ namespace MSHelpSystem.Core
return false;
}
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);
return true;
}
@ -133,7 +128,9 @@ namespace MSHelpSystem.Core @@ -133,7 +128,9 @@ namespace MSHelpSystem.Core
Thread.Sleep(0x3e8);
}
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) {
DisplayHelpWithShellExecute(helpUrl);
@ -141,7 +138,7 @@ namespace MSHelpSystem.Core @@ -141,7 +138,7 @@ namespace MSHelpSystem.Core
}
BrowserPane browser = ActiveHelp3Browser();
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.WorkbenchWindow.SelectWindow();
}
@ -161,7 +158,7 @@ namespace MSHelpSystem.Core @@ -161,7 +158,7 @@ namespace MSHelpSystem.Core
p.WaitForInputIdle();
}
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 @@ -178,7 +175,7 @@ namespace MSHelpSystem.Core
}
BrowserPane browser = ActiveHelp3Browser();
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.WorkbenchWindow.SelectWindow();
}
@ -192,7 +189,7 @@ namespace MSHelpSystem.Core @@ -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(" ", "+"));
BrowserPane browser = ActiveHelp3Browser();
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.WorkbenchWindow.SelectWindow();
}

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

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

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

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

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

@ -19,29 +19,26 @@ namespace MSHelpSystem.Core @@ -19,29 +19,26 @@ namespace MSHelpSystem.Core
public static bool IsRunning
{
get
{
get {
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;
}
}
public static string Agent
{
get
{
get {
if (string.IsNullOrEmpty(Help3Environment.AppRoot)) return string.Empty;
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;
}
}
public static int PortNumber
{
get
{
get {
try {
RegistryKey hklm = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64).OpenSubKey(@"SOFTWARE\Microsoft\Help\v1.0", false);
string port = (string)hklm.GetValue("AgentPort", "47873");
@ -49,7 +46,7 @@ namespace MSHelpSystem.Core @@ -49,7 +46,7 @@ namespace MSHelpSystem.Core
return Convert.ToInt32(port);
}
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!
}
@ -57,8 +54,7 @@ namespace MSHelpSystem.Core @@ -57,8 +54,7 @@ namespace MSHelpSystem.Core
public static bool PortIsReady
{
get
{
get {
try {
Socket socket = new Socket(AddressFamily.InterNetwork, SocketType.Stream, ProtocolType.Tcp);
socket.Connect(IPAddress.Parse("127.0.0.1"), PortNumber);
@ -68,10 +64,10 @@ namespace MSHelpSystem.Core @@ -68,10 +64,10 @@ namespace MSHelpSystem.Core
}
catch (SocketException ex) {
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;
}
LoggingService.Error(string.Format("Help 3.0: {0}", ex.ToString()));
LoggingService.Error(string.Format("HelpViewer: {0}", ex.ToString()));
}
return false;
}
@ -79,19 +75,17 @@ namespace MSHelpSystem.Core @@ -79,19 +75,17 @@ namespace MSHelpSystem.Core
public static int ProcessId
{
get
{
get {
Process[] agents = Process.GetProcessesByName("HelpLibAgent");
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;
}
}
public static string CurrentViewer
{
get
{
get {
string viewer = string.Empty;
try {
RegistryKey hklm = RegistryKey.OpenBaseKey(RegistryHive.LocalMachine, RegistryView.Registry64).OpenSubKey(@"SOFTWARE\Microsoft\Help\v1.0", false);
@ -107,9 +101,9 @@ namespace MSHelpSystem.Core @@ -107,9 +101,9 @@ namespace MSHelpSystem.Core
}
}
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;
}
}
@ -121,11 +115,11 @@ namespace MSHelpSystem.Core @@ -121,11 +115,11 @@ namespace MSHelpSystem.Core
try {
Process p = Process.Start(Agent);
p.WaitForInputIdle();
LoggingService.Info("Help 3.0: Help library agent started");
LoggingService.Info("HelpViewer: HelpLibraryAgent started");
return IsRunning;
}
catch (Exception ex) {
LoggingService.Error(string.Format("Help 3.0: {0}", ex.ToString()));
LoggingService.Error(string.Format("HelpViewer: {0}", ex.ToString()));
}
return false;
}
@ -144,10 +138,10 @@ namespace MSHelpSystem.Core @@ -144,10 +138,10 @@ namespace MSHelpSystem.Core
agent.Kill();
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) {
LoggingService.Error(string.Format("Help 3.0: {0}", ex.ToString()));
LoggingService.Error(string.Format("HelpViewer: {0}", ex.ToString()));
}
return true;
}

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

@ -18,21 +18,19 @@ namespace MSHelpSystem.Core @@ -18,21 +18,19 @@ namespace MSHelpSystem.Core
public static bool IsRunning
{
get
{
get {
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;
}
}
public static string Manager
{
get
{
get {
if (string.IsNullOrEmpty(Help3Environment.AppRoot)) return string.Empty;
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;
}
}
@ -61,7 +59,7 @@ namespace MSHelpSystem.Core @@ -61,7 +59,7 @@ namespace MSHelpSystem.Core
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);
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);
}
@ -88,7 +86,7 @@ namespace MSHelpSystem.Core @@ -88,7 +86,7 @@ namespace MSHelpSystem.Core
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);
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);
}
@ -114,7 +112,7 @@ namespace MSHelpSystem.Core @@ -114,7 +112,7 @@ namespace MSHelpSystem.Core
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);
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);
}
@ -136,7 +134,7 @@ namespace MSHelpSystem.Core @@ -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);
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);
}
@ -166,13 +164,17 @@ namespace MSHelpSystem.Core @@ -166,13 +164,17 @@ namespace MSHelpSystem.Core
return p.ExitCode;
}
catch (Exception ex) {
LoggingService.Error(string.Format("Help 3.0: {0}", ex.ToString()));
LoggingService.Error(string.Format("HelpViewer: {0}", ex.ToString()));
}
return -1;
}
public static bool Start()
{
return Start(false);
}
public static bool Start(bool runPrivileged)
{
if (IsRunning) return true;
if (string.IsNullOrEmpty(Manager)) {
@ -186,16 +188,16 @@ namespace MSHelpSystem.Core @@ -186,16 +188,16 @@ namespace MSHelpSystem.Core
psi.WorkingDirectory = Help3Environment.AppRoot;
psi.Arguments = Help3Service.ActiveCatalog.AsCmdLineParam;
psi.UseShellExecute = true;
psi.Verb = "runas";
if (runPrivileged) psi.Verb = "runas";
psi.WindowStyle = ProcessWindowStyle.Normal;
try {
Process p = Process.Start(psi);
p.WaitForInputIdle();
LoggingService.Info("Help 3.0: Help library manager started");
LoggingService.Info("HelpViewer: HelpLibraryManager started");
return IsRunning;
}
catch (Exception ex) {
LoggingService.Error(string.Format("Help 3.0: {0}", ex.ToString()));
LoggingService.Error(string.Format("HelpViewer: {0}", ex.ToString()));
}
return false;
}
@ -214,10 +216,10 @@ namespace MSHelpSystem.Core @@ -214,10 +216,10 @@ namespace MSHelpSystem.Core
manager.Kill();
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) {
LoggingService.Error(string.Format("Help 3.0: {0}", ex.ToString()));
LoggingService.Error(string.Format("HelpViewer: {0}", ex.ToString()));
}
return true;
}

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

@ -49,22 +49,22 @@ namespace MSHelpSystem @@ -49,22 +49,22 @@ namespace MSHelpSystem
void Help3OfflineModeClicked(object sender, RoutedEventArgs e)
{
LoggingService.Info("Help 3.0: Setting help mode to \"offline\"");
Help3Service.Config.OfflineMode = true;
help3Catalogs.IsEnabled = (help3Catalogs.Items.Count > 1 && Help3Service.Config.OfflineMode);
LoggingService.Info("HelpViewer: Help mode set to \"offline\"");
}
void Help3OnlineModeClicked(object sender, RoutedEventArgs e)
{
LoggingService.Info("Help 3.0: Setting help mode to \"online\"");
Help3Service.Config.OfflineMode = false;
help3Catalogs.IsEnabled = false;
LoggingService.Info("HelpViewer: Help mode set to \"online\"");
}
void Help3UseExternalHelpClicked(object sender, RoutedEventArgs e)
{
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()

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

@ -97,7 +97,7 @@ namespace MSHelpSystem.Helper @@ -97,7 +97,7 @@ namespace MSHelpSystem.Helper
}
}
catch (Exception ex) {
LoggingService.Error(string.Format("Help 3.0: {0}", ex.ToString()));
LoggingService.Error(string.Format("HelpViewer: {0}", ex.ToString()));
}
return "offline";
}
@ -105,7 +105,7 @@ namespace MSHelpSystem.Helper @@ -105,7 +105,7 @@ namespace MSHelpSystem.Helper
static void SetHelpMode()
{
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;
try {
@ -136,7 +136,7 @@ namespace MSHelpSystem.Helper @@ -136,7 +136,7 @@ namespace MSHelpSystem.Helper
}
}
catch (Exception ex) {
LoggingService.Error(string.Format("Help 3.0: {0}", ex.ToString()));
LoggingService.Error(string.Format("HelpViewer: {0}", ex.ToString()));
}
clientFileChanged.EnableRaisingEvents = true;
}

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

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

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

@ -15,7 +15,7 @@ namespace MSHelpSystem @@ -15,7 +15,7 @@ namespace MSHelpSystem
if (string.IsNullOrEmpty(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);
}
@ -24,7 +24,7 @@ namespace MSHelpSystem @@ -24,7 +24,7 @@ namespace MSHelpSystem
if (string.IsNullOrEmpty(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);
return true;
}

Loading…
Cancel
Save