diff --git a/bin/setup/PostInstallTasks.bat b/bin/setup/PostInstallTasks.bat index 24a1f23756..ec8c54957f 100644 --- a/bin/setup/PostInstallTasks.bat +++ b/bin/setup/PostInstallTasks.bat @@ -10,7 +10,7 @@ echo. echo ICSharpCode.SharpZipLib.dll ..\tools\gacutil2.exe /i ..\ICSharpCode.SharpZipLib.dll echo. -rem echo Installing and configuring help system -rem cd help -rem call register.bat +echo Installing and configuring help system +cd help +call register.bat @IF %ERRORLEVEL% NEQ 0 PAUSE \ No newline at end of file diff --git a/bin/setup/PreUninstallTasks.bat b/bin/setup/PreUninstallTasks.bat index c9e1662b39..a142785bd7 100644 --- a/bin/setup/PreUninstallTasks.bat +++ b/bin/setup/PreUninstallTasks.bat @@ -6,6 +6,6 @@ echo. ..\tools\gacutil2.exe /u ..\nunit.framework.dll echo. ..\tools\gacutil2.exe /u ..\ICSharpCode.SharpZipLib.dll -rem cd help -rem call unregister.bat +cd help +call unregister.bat @IF %ERRORLEVEL% NEQ 0 PAUSE \ No newline at end of file diff --git a/src/AddIns/Misc/HtmlHelp2/Project/src/Service/HtmlHelp2Options.cs b/src/AddIns/Misc/HtmlHelp2/Project/src/Service/HtmlHelp2Options.cs index 3f491bf235..fe7c6803b2 100644 --- a/src/AddIns/Misc/HtmlHelp2/Project/src/Service/HtmlHelp2Options.cs +++ b/src/AddIns/Misc/HtmlHelp2/Project/src/Service/HtmlHelp2Options.cs @@ -23,7 +23,7 @@ namespace HtmlHelp2Service static string help2EnvironmentFile = "help2environment.xml"; bool Help2EnvIsReady = false; ComboBox help2Collections = null; - string selectedHelp2Collection = "Fidalgo"; + string selectedHelp2Collection = "Corsavy"; public override void LoadPanelContents() { diff --git a/src/AddIns/Misc/HtmlHelp2/Project/src/Service/HtmlHelp2Service.cs b/src/AddIns/Misc/HtmlHelp2/Project/src/Service/HtmlHelp2Service.cs index 2661e376b1..fe5c86eb0d 100644 --- a/src/AddIns/Misc/HtmlHelp2/Project/src/Service/HtmlHelp2Service.cs +++ b/src/AddIns/Misc/HtmlHelp2/Project/src/Service/HtmlHelp2Service.cs @@ -26,7 +26,7 @@ namespace HtmlHelp2Service static IHxRegFilterList namespaceFilters = null; static IHxQuery fulltextSearch = null; static IHxQuery dynamicHelp = null; - static string fidalgoNamespaceName = "Fidalgo"; + static string corsavyNamespaceName = "Corsavy"; static string currentSelectedFilterQuery = ""; static string currentSelectedFilterName = ""; static string defaultPage = "about:blank"; @@ -36,8 +36,8 @@ namespace HtmlHelp2Service static HtmlHelp2Environment() { LoadHelp2Config(); - fidalgoNamespaceName = Help2RegistryWalker.GetFirstNamespace(fidalgoNamespaceName); - InitializeNamespace(fidalgoNamespaceName); + corsavyNamespaceName = Help2RegistryWalker.GetFirstNamespace(corsavyNamespaceName); + InitializeNamespace(corsavyNamespaceName); } #region Properties @@ -51,7 +51,7 @@ namespace HtmlHelp2Service public static string CurrentSelectedNamespace { get { - return fidalgoNamespaceName; + return corsavyNamespaceName; } } @@ -106,7 +106,7 @@ namespace HtmlHelp2Service xmldoc.Load(PropertyService.ConfigDirectory + help2EnvironmentFile); XmlNode node = xmldoc.SelectSingleNode("/help2environment/collection"); - if(node != null) fidalgoNamespaceName = node.InnerText; + if(node != null) corsavyNamespaceName = node.InnerText; } catch { } @@ -115,8 +115,8 @@ namespace HtmlHelp2Service public static void ReloadNamespace() { LoadHelp2Config(); - fidalgoNamespaceName = Help2RegistryWalker.GetFirstNamespace(fidalgoNamespaceName); - InitializeNamespace(fidalgoNamespaceName); + corsavyNamespaceName = Help2RegistryWalker.GetFirstNamespace(corsavyNamespaceName); + InitializeNamespace(corsavyNamespaceName); OnNamespaceReloaded(EventArgs.Empty); } diff --git a/src/SharpDevelop.sln b/src/SharpDevelop.sln index c855e0067f..3f1f59bba9 100644 --- a/src/SharpDevelop.sln +++ b/src/SharpDevelop.sln @@ -1,5 +1,5 @@ Microsoft Visual Studio Solution File, Format Version 9.00 -# SharpDevelop 2.0.0.315 +# SharpDevelop 2.0.0.326 Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AddIns", "AddIns", "{14A277EE-7DF1-4529-B639-7D1EF334C1C5}" ProjectSection(SolutionItems) = postProject EndProjectSection @@ -84,6 +84,8 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ICSharpCode.Core", "Main\Co EndProject Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "StartUp", "Main\StartUp\Project\StartUp.csproj", "{1152B71B-3C05-4598-B20D-823B5D40559E}" EndProject +Project("{00000000-0000-0000-0000-000000000000}") = "Tools", "Tools\Tools.build", "{970116b0-f96b-4257-8579-986b9cf086f5}" +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU diff --git a/src/Tools/BuildHelpIndex/AssemblyInfo.cs b/src/Tools/BuildHelpIndex/AssemblyInfo.cs deleted file mode 100644 index 205aa8a9ad..0000000000 --- a/src/Tools/BuildHelpIndex/AssemblyInfo.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; - -// Information about this assembly is defined by the following -// attributes. -// -// change them to the information which is associated with the assembly -// you compile. - -[assembly: AssemblyTitle("")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// The assembly version has following format : -// -// Major.Minor.Build.Revision -// -// You can specify all values by your own or you can build default build and revision -// numbers with the '*' character (the default): - -[assembly: AssemblyVersion("2.0.0.1")] - -// The following attributes specify the key for the sign of your assembly. See the -// .NET Framework documentation for more information about signing. -// This is not required, if you don't want signing let these attributes like they're. -[assembly: AssemblyDelaySign(false)] -[assembly: AssemblyKeyFile("")] diff --git a/src/Tools/BuildHelpIndex/BuildHelpIndex.csproj b/src/Tools/BuildHelpIndex/BuildHelpIndex.csproj deleted file mode 100644 index 3c5ca8a233..0000000000 --- a/src/Tools/BuildHelpIndex/BuildHelpIndex.csproj +++ /dev/null @@ -1,45 +0,0 @@ - - - Debug - AnyCPU - 8.0.40607 - 2.0 - {861c68ac-5e3c-410b-942c-f813593c10ef} - NewProject - BuildHelpIndex - Exe - 4 - False - False - OnSuccessfulBuild - - - True - True - False - True - ..\..\..\bin\setup\ - False - - - True - True - False - True - ..\..\..\bin\ - False - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Tools/BuildHelpIndex/BuildHelpIndex.csproj.user b/src/Tools/BuildHelpIndex/BuildHelpIndex.csproj.user deleted file mode 100644 index c818d818c8..0000000000 --- a/src/Tools/BuildHelpIndex/BuildHelpIndex.csproj.user +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/Tools/BuildHelpIndex/HelperFunctions.cs b/src/Tools/BuildHelpIndex/HelperFunctions.cs deleted file mode 100644 index cfce3a3dc9..0000000000 --- a/src/Tools/BuildHelpIndex/HelperFunctions.cs +++ /dev/null @@ -1,96 +0,0 @@ -using System; -using System.Collections; -using System.CodeDom.Compiler; -using System.Text; -using System.IO; -using System.Windows.Forms; -using System.Xml; - -public class HelperFunctions -{ - public static string ExecuteCmdLineApp(string strCmd) - { - string output = ""; - string error = ""; - - TempFileCollection tf = new TempFileCollection(); - Executor.ExecWaitWithCapture(strCmd, tf, ref output, ref error); - - StreamReader sr = File.OpenText(output); - StringBuilder strBuilder = new StringBuilder(); - string strLine = null; - - while (null != (strLine = sr.ReadLine())) { - if ("" != strLine) { - strBuilder.Append(strLine); - strBuilder.Append("\r\n"); - } - } - sr.Close(); - - File.Delete(output); - File.Delete(error); - - return strBuilder.ToString(); - } - - public static bool GetHelpUpToDate() - { - DateTime sourceDate, targetDate; - string basePath = Application.StartupPath + Path.DirectorySeparatorChar + - ".." + Path.DirectorySeparatorChar + - ".." + Path.DirectorySeparatorChar + - "doc" + Path.DirectorySeparatorChar + - "help"; - string filename = basePath + Path.DirectorySeparatorChar + "HelpDescription.xml"; - string targetname = basePath + Path.DirectorySeparatorChar + "SharpDevelopHelp.zip"; - if (!File.Exists(targetname)) return false; - if (!File.Exists(filename)) { - Console.WriteLine("HelpDescription.xml not found!"); - return false; - } - try { - sourceDate = File.GetLastWriteTime(filename); - targetDate = File.GetLastWriteTime(targetname); - if (sourceDate > targetDate) return false; - XmlDocument doc = new XmlDocument(); - doc.Load(filename); - return ParseTree(doc.DocumentElement, targetDate, basePath); - } catch (Exception ex) { - Console.WriteLine("Error checking if the help is up to date:"); - Console.WriteLine(ex.ToString()); - return false; - } - } - - /// - /// Parses the xml tree and returns false if the target is out of date. - /// - static bool ParseTree(XmlNode parentNode, DateTime targetDate, string basePath) - { - try { - foreach (XmlNode node in parentNode.ChildNodes) { - switch (node.Name) { - case "Condition": // condition is always true... - case "HelpFolder": - if (!ParseTree(node, targetDate, basePath)) - return false; - break; - case "HelpFile": - string filename = basePath + Path.DirectorySeparatorChar + node.Attributes["hhc"].InnerText; - if (File.Exists(filename)) { - if (File.GetLastWriteTime(filename) > targetDate) - return false; - } - break; - case "HelpAssemblies": - // ignore assemblies... they should be up to date - break; - } - } - } catch (Exception e) { - Console.Error.WriteLine("unexpected exception : " + e.ToString()); - } - return true; - } -} diff --git a/src/Tools/BuildHelpIndex/Main.cs b/src/Tools/BuildHelpIndex/Main.cs deleted file mode 100644 index 1d89b6923e..0000000000 --- a/src/Tools/BuildHelpIndex/Main.cs +++ /dev/null @@ -1,36 +0,0 @@ -using System; -using System.Text; -using System.Reflection; -using System.IO; - -class MainClass -{ - public static void Main(string[] args) - { - StringBuilder strOutput = new StringBuilder(); - - // find the current directory; note that we assume to be located in the \bin directory of - // the SharpDevelop installation - string strCurrentDirectory = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); - - // generate our help system - we can do that only on the target system - string strHelpGenApp = Path.Combine(strCurrentDirectory, @"..\tools\HelpConverter.exe"); - Console.WriteLine("Building SharpDevelop help index...\r\n"); - if (HelperFunctions.GetHelpUpToDate()) { - strOutput.Append("Help is already up to date.\r\n"); - Console.WriteLine("Help is already up to date.\r\n"); - } else { - Console.WriteLine("This might take a minute or two, please be patient\r\n\r\n\r\n"); - Console.WriteLine("Building SharpDevelop help index"); - Console.WriteLine("Building .NET Framework Reference help index"); - Console.WriteLine("Building DirectX 9 help index (if installed)"); - strOutput.Append(HelperFunctions.ExecuteCmdLineApp(strHelpGenApp)); - } - // write a setup log so the SharpDevelop team can investigate setup failures - StreamWriter sw = File.CreateText("BuildHelpIndex.log"); - sw.Write(strOutput.ToString()); - sw.Flush(); - sw.Close(); - Console.WriteLine("\r\nHelp index has been built - details have been logged to BuildHelpIndex.log"); - } -} diff --git a/src/Tools/Help/Help2Register.exe b/src/Tools/Help/Help2Register.exe new file mode 100644 index 0000000000..756b61bebe Binary files /dev/null and b/src/Tools/Help/Help2Register.exe differ diff --git a/src/Tools/Help/MSHelpServices.dll b/src/Tools/Help/MSHelpServices.dll new file mode 100644 index 0000000000..97a6d34705 Binary files /dev/null and b/src/Tools/Help/MSHelpServices.dll differ diff --git a/src/Tools/Help/plugins.xml b/src/Tools/Help/plugins.xml new file mode 100644 index 0000000000..6c42f0052e --- /dev/null +++ b/src/Tools/Help/plugins.xml @@ -0,0 +1,6 @@ + + + + + + \ No newline at end of file diff --git a/src/Tools/Help/register.bat b/src/Tools/Help/register.bat new file mode 100644 index 0000000000..17ec95358e --- /dev/null +++ b/src/Tools/Help/register.bat @@ -0,0 +1 @@ +@"Help2Register.exe" /r register.xml \ No newline at end of file diff --git a/src/Tools/Help/register.xml b/src/Tools/Help/register.xml new file mode 100644 index 0000000000..f2e5732da0 --- /dev/null +++ b/src/Tools/Help/register.xml @@ -0,0 +1,11 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/src/Tools/Help/register.xsd b/src/Tools/Help/register.xsd new file mode 100644 index 0000000000..bc7179d9cf --- /dev/null +++ b/src/Tools/Help/register.xsd @@ -0,0 +1,295 @@ + + + + + Help 2.0 Registration Validation Schema + Copyright (c) 2005 Mathias Simmack + + + + + This is the main node. You have to use this node! The node can include + a namespace registration, a plug-in registration, or both. But it must + not be empty. + + + + + + + + + + + + + + This node is required to register Help 2.0 documents and filters. The + node can include a Help document registration, a filter registration, + or both. But it must not be empty. + + + + + + + + + This is a special node to register plug-ins. But it + just supports the child node (s. below). + + + + + + + + + + + + The internal Namespace name of the Help 2.0 collection. This + attribute is required. + + + + + The description of the Help 2.0 collection, you want to register. + This attribute is required. + + + + + The collection file (*.HxC/*.HxS) of the Help 2.0 collection, + you want to register. This attribute is required. + + + + + + + + + + Set this attribute to "no" if you do not want to merge the collection + after registering it. The default value is "yes". The attribute is + optional. + + + + + Use this attribute if you want to add new files or filters to an + existing Help 2.0 namespace. The default value is "no". It means, + if the namespace does exist, it will be removed first and then it + will be re-registered. If you do not want to remove the namespace, + set the attribute to "yes". The attribute is optional. + + + + + Use this attribute if you want to remove files or filters without + removing the whole namespace. The default value is "no". It means, + if you are about to unregister, it will remove all files and filters, + listed in your XML file, and then it will also remove the namespace. + The attribute is optional. + + + + + + + + This node is required to register a Help 2.0 document. + + + + + The Help 2.0 document's internal name. This name is required to + identify the document. You can use the same name in different + namespaces, but the name has to be unique in a single namespace. + The attribute is required. + + + + + The document's language id. Typical values are 1033, 1031, ... + The attribute is required. + + + + + This attribute is required because it is the main Help document + (*.HxS). It's not possible to register a Help document without + this file. + + + + + + + + + + This attribute is optional. You need it if your index is in a + separate file (*.HxI). + + + + + + + + + + This attribute is optional. You just need it if you have a + combined full-text search file (*.HxQ) installed with your + Help 2.0 collection. + + + + + + + + + + This attribute is optional. You just need it if you have a combined + attributes file (*.HxR) installed with your Help 2.0 collection. + + + + + + + + + + Because the Help 2.0 API is not documented, there is no real + explanation of this attribute. Sorry. My guess is that this + attribute specifies the ID of the disk medium (CD, Floppy, or + whatever) if the file is on a removable medium. So, if you try + to open the document, the viewer asks for the valid medium and + checks its ID with this given value. + + + + + Because the Help 2.0 API is not documented, there is no real + explanation of this attribute. Sorry. My guess is that this + attribute specifies the ID of the disk medium (CD, Floppy, or + whatever) if the file is on a removable medium. So, if you try + to open the document, the viewer asks for the valid medium and + checks its ID with this given value. + + + + + Because the Help 2.0 API is not documented, there is no real + explanation of this attribute. Sorry. My guess is that this + attribute specifies the ID of the disk medium (CD, Floppy, or + whatever) if the file is on a removable medium. So, if you try + to open the document, the viewer asks for the valid medium and + checks its ID with this given value. + + + + + Because the Help 2.0 API is not documented, there is no real + explanation of this attribute. Sorry. My guess is that this + attribute specifies the ID of the disk medium (CD, Floppy, or + whatever) if the file is on a removable medium. So, if you try + to open the document, the viewer asks for the valid medium and + checks its ID with this given value. + + + + + + + + This node is required to register a filter. + + + + + The content of this node is the filter query string. Please use + a CDATA block. If there is no content, an empty filter will be + created. + + + + + This attribute specifies the filter name, you will see + in the viewer's combobox. Use a descriptive name here. + The attribute is required. + + + + + + + + + + This node is required to register a Help 2.0 plug-in. A plug-in + connects two different Help 2.0 namespaces together. But you can + connect real collections (registered *.HxC files) only! + + + + + + + + This attribute specifies the parent namespace. The attribute + is required. The namespace must exist, of course. + + + + + This attribute specifies the child namespace. The attribute + is required. The namespace must exist, of course. + + + + + Set this attribute to "no" if you do not want to merge the collection + after registering it. The default value is "yes". The attribute is + optional. + + + + + + + + This node specifies a lower plug-in node. It's useful if you want to + register more than one plug-in for the same namespace. You can reduce + the time to merge the namespace using this way. + + + + + + + + + + + Values of this type are languages identifiers. + + + + + + + + + Values of this type will either be "yes" or "no". + + + + + + + \ No newline at end of file diff --git a/src/Tools/Help/unregister.bat b/src/Tools/Help/unregister.bat new file mode 100644 index 0000000000..202f2892cc --- /dev/null +++ b/src/Tools/Help/unregister.bat @@ -0,0 +1 @@ +@"Help2Register.exe" /u register.xml diff --git a/src/Tools/HelpConverter/AssemblyInfo.cs b/src/Tools/HelpConverter/AssemblyInfo.cs deleted file mode 100644 index 205aa8a9ad..0000000000 --- a/src/Tools/HelpConverter/AssemblyInfo.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; - -// Information about this assembly is defined by the following -// attributes. -// -// change them to the information which is associated with the assembly -// you compile. - -[assembly: AssemblyTitle("")] -[assembly: AssemblyDescription("")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// The assembly version has following format : -// -// Major.Minor.Build.Revision -// -// You can specify all values by your own or you can build default build and revision -// numbers with the '*' character (the default): - -[assembly: AssemblyVersion("2.0.0.1")] - -// The following attributes specify the key for the sign of your assembly. See the -// .NET Framework documentation for more information about signing. -// This is not required, if you don't want signing let these attributes like they're. -[assembly: AssemblyDelaySign(false)] -[assembly: AssemblyKeyFile("")] diff --git a/src/Tools/HelpConverter/HelpConverter.csproj b/src/Tools/HelpConverter/HelpConverter.csproj deleted file mode 100644 index b2ba8deda9..0000000000 --- a/src/Tools/HelpConverter/HelpConverter.csproj +++ /dev/null @@ -1,61 +0,0 @@ - - - Debug - AnyCPU - 8.0.40607 - 2.0 - {75dd61c0-b2a8-4232-bf99-8e86c484d5e7} - NewProject - HelpBrowserApp - Exe - 4 - False - False - OnSuccessfulBuild - - - True - True - False - True - ..\..\..\bin\ - False - - - True - True - False - True - ..\..\..\bin\ - False - - - - - - - - - ..\..\..\bin\ICSharpCode.SharpZipLib.dll - True - - - - - - - - - - - - - - - - - - - - - \ No newline at end of file diff --git a/src/Tools/HelpConverter/HelpConverter.csproj.user b/src/Tools/HelpConverter/HelpConverter.csproj.user deleted file mode 100644 index c818d818c8..0000000000 --- a/src/Tools/HelpConverter/HelpConverter.csproj.user +++ /dev/null @@ -1,4 +0,0 @@ - - - - \ No newline at end of file diff --git a/src/Tools/HelpConverter/HelpTreeBuilder/AssemblyLoader.cs b/src/Tools/HelpConverter/HelpTreeBuilder/AssemblyLoader.cs deleted file mode 100644 index 8a8c855623..0000000000 --- a/src/Tools/HelpConverter/HelpTreeBuilder/AssemblyLoader.cs +++ /dev/null @@ -1,37 +0,0 @@ -using System; -using System.Reflection; - -namespace ICSharpCode.HelpConverter.HelpTreeBuilder -{ - public class AssemblyLoader - { -// public AssemblyLoader() -// { -// AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(resolve); -// } -// -// Assembly resolve(object sender, ResolveEventArgs e) -// { -// System.Console.WriteLine("warning: assembly " + e.Name + " couln't be loaded."); -// return null; -// } -// - public Assembly[] LoadAssemblies(string[] names) - { - Assembly[] assemblies = new Assembly[names.Length]; - int count = 0; - - foreach(string name in names) { - Console.WriteLine("Load assembly : >" + name + "<"); - Assembly assembly = Assembly.Load(name); - if(assembly != null) { - assemblies[count] = Assembly.Load(name); - count++; - } else { - throw new Exception("Unable to load assembly " + name + "."); - } - } - return assemblies; - } - } -} diff --git a/src/Tools/HelpConverter/HelpTreeBuilder/ClassNodeBuilder.cs b/src/Tools/HelpConverter/HelpTreeBuilder/ClassNodeBuilder.cs deleted file mode 100644 index c18f4cb1f7..0000000000 --- a/src/Tools/HelpConverter/HelpTreeBuilder/ClassNodeBuilder.cs +++ /dev/null @@ -1,415 +0,0 @@ -using System; -using System.Text.RegularExpressions; -using System.Xml; -using System.Threading; -using System.Reflection; -using System.Windows.Forms; -using Microsoft.Win32; - -// TODO: handle overloading (links) - -namespace ICSharpCode.HelpConverter.HelpTreeBuilder -{ - public interface IHelpFileFormat - { - bool NumerateConstructor { - get; - } - string NamespaceFormat { - get; - } - string ClassTopic { - get; - } - string MembersTopic { - get; - } - string MethodsTopic { - get; - } - string PropertiesTopic { - get; - } - string FieldsTopic { - get; - } - string EventsTopic { - get; - } - - string MemberFormat { - get; - } - } - - public class SDKHelpFileFormat : IHelpFileFormat - { - string prefix = "ms-help://MS.NETFrameworkSDK"; - - public bool NumerateConstructor { - get { - return false; - } - } - - string Prefix { - get { - return prefix; - } - } - - public string NamespaceFormat { - get { - return String.Concat(Prefix, "/cpref/html/frlrf%NAMESPACEFLAT%.htm"); - } - } - - public string ClassTopic { - get { - return String.Concat(Prefix, "/cpref/html/frlrf%FULLFLATTYPENAME%ClassTopic.htm"); - } - } - - public string MembersTopic { - get { - return String.Concat(Prefix, "/cpref/html/frlrf%FULLFLATTYPENAME%MembersTopic.htm"); - } - } - - public string MethodsTopic { - get { - return String.Concat(Prefix, "/cpref/html/frlrf%FULLFLATTYPENAME%MethodsTopic.htm"); - } - } - - public string PropertiesTopic { - get { - return String.Concat(Prefix, "/cpref/html/frlrf%FULLFLATTYPENAME%PropertiesTopic.htm"); - } - } - public string FieldsTopic { - get { - return String.Concat(Prefix, "/cpref/html/frlrf%FULLFLATTYPENAME%FieldsTopic.htm"); - } - } - public string EventsTopic { - get { - return String.Concat(Prefix, "/cpref/html/frlrf%FULLFLATTYPENAME%EventsTopic.htm"); - } - } - - public string MemberFormat { - get { - return String.Concat(Prefix, "/cpref/html/frlrf%FULLFLATTYPENAME%class%MEMBERNAME%Topic%NUM%.htm"); - } - } - - string ScanSubKeys(RegistryKey key) - { - string[] subKeys = key.GetSubKeyNames(); - foreach (string subKey in subKeys) { - RegistryKey sub = key.OpenSubKey(subKey); - if (sub.GetValue(null).ToString().StartsWith("Microsoft .NET Framework SDK")) { - return sub.GetValue("Filename").ToString(); - } - } - return null; - } - - public SDKHelpFileFormat() - { - string localHelp = "0x" + Thread.CurrentThread.CurrentCulture.LCID.ToString("X4"); - RegistryKey helpKey = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\Microsoft\MSDN\7.0\Help"); - - RegistryKey k = helpKey.OpenSubKey(localHelp); - bool found = false; - if (k != null) { - string v = ScanSubKeys(k); - if (v != null) { - prefix = v; - found = true; - } - } - if (!found) { - // use default english subkey - k = helpKey.OpenSubKey("0x0409"); - string v = k != null ? ScanSubKeys(k) : null; - if (v != null) { - prefix = v; - } else { - string[] subKeys = helpKey.GetSubKeyNames(); - foreach (string subKey in subKeys) { - if (subKey.StartsWith("0x")) { - prefix = ScanSubKeys(helpKey.OpenSubKey(subKey)); - break; - } - } - } - } - } - } - - public class DirectX9HelpFileFormat : IHelpFileFormat - { - public bool NumerateConstructor { - get { - return true; - } - } - - public string NamespaceFormat { - get { - return "ms-help://MS.DirectX9.1033/DirectX9_m/directx/ref/ns/%NAMESPACE%.htm"; - } - } - - public string ClassTopic { - get { - return "ms-help://MS.DirectX9.1033/DirectX9_m/directx/ref/ns/%NAMESPACE%/%TYPESHORT%/%TYPENAME%/%TYPENAME%.htm"; - } - } - - public string MembersTopic { - get { - return "ms-help://MS.DirectX9.1033/DirectX9_m/directx/ref/ns/%NAMESPACE%/%TYPESHORT%/%TYPENAME%/%TYPENAME%.htm"; - } - } - public string MethodsTopic { - get { - return null; - } - } - public string PropertiesTopic { - get { - return null; - } - } - public string FieldsTopic { - get { - return null; - } - } - public string EventsTopic { - get { - return null; - } - } - - public string MemberFormat { - get { - return "ms-help://MS.DirectX9.1033/DirectX9_m/directx/ref/ns/%NAMESPACE%/%TYPESHORT%/%TYPENAME%/%MEMBERSHORT%/%MEMBERNAME%%NUM%.htm"; - } - } - } - - - public class classNodeBuilder : ITypeNodeBuilder - { - BindingFlags flags = BindingFlags.Instance | - BindingFlags.DeclaredOnly | - BindingFlags.Static | - BindingFlags.Public; - - public static IHelpFileFormat helpFileFormat = new SDKHelpFileFormat(); - - public virtual string Postfix { - get { - return " class"; - } - } - - public virtual string ShortType { - get { - return "c"; - } - } - - public void SetLink(XmlDocument doc, XmlNode node, string link) - { - if (link != null) { - XmlAttribute attrib = doc.CreateAttribute("link"); - attrib.Value = link; - node.Attributes.Append(attrib); - - attrib = doc.CreateAttribute("ismsdn"); - attrib.Value = "true"; - node.Attributes.Append(attrib); - } - } - - - - public XmlNode createLinkNode(XmlDocument doc, string name, string link) - { - XmlNode node = doc.CreateElement("HelpTopic"); - XmlAttribute attrib = doc.CreateAttribute("name"); - attrib.Value = name; - node.Attributes.Append(attrib); - SetLink(doc, node, link); - return node; - } - - public XmlNode createFolderNode(XmlDocument doc, string name) - { - XmlNode node = doc.CreateElement("HelpFolder"); - XmlAttribute attrib = doc.CreateAttribute("name"); - attrib.Value = name; - node.Attributes.Append(attrib); - - return node; - } - - public string ConvertLink(string format, Type type) - { - if (format == null) { - return null; - } - string output = Regex.Replace(format, "%FULLFLATTYPENAME%", (type.Namespace + type.Name).Replace(".", "").ToLower(), RegexOptions.None); - output = Regex.Replace(output, "%NAMESPACE%", type.Namespace, RegexOptions.None); - output = Regex.Replace(output, "%NAMESPACEFLAT%", type.Namespace.Replace(".", ""), RegexOptions.None); - output = Regex.Replace(output, "%TYPENAME%", type.Name, RegexOptions.None); - output = Regex.Replace(output, "%TYPESHORT%", ShortType, RegexOptions.None); - return output; - } - - public string ConvertLink(string format, Type type, string memberName, string memberShort, string memberNum) - { - string output = ConvertLink(format, type); - - output = Regex.Replace(output, "%MEMBERNAME%", memberName, RegexOptions.None); - output = Regex.Replace(output, "%MEMBERSHORT%", memberShort, RegexOptions.None); - output = Regex.Replace(output, "%NUM%", memberNum, RegexOptions.None); - - return output; - } - - public virtual XmlNode buildNode(XmlDocument doc, Type type) - { - XmlNode rootnode = createFolderNode(doc, type.Name + Postfix); - SetLink(doc, rootnode, ConvertLink(helpFileFormat.ClassTopic, type)); - - rootnode.AppendChild(createLinkNode(doc, type.Name + " members", ConvertLink(helpFileFormat.MembersTopic, type))); - - // search for constructors - XmlNode constructorsNode = createFolderNode(doc, "Constructors"); - int constructorNum = 0; - ConstructorInfo[] constructorInfo = type.GetConstructors(flags); - if (constructorInfo.Length > 0) { - SetLink(doc, constructorsNode, ConvertLink(helpFileFormat.MemberFormat, type, "ctor", "m", "")); - } - foreach(ConstructorInfo constructor in constructorInfo) { - if(constructor.DeclaringType == type) { - string memberFormat = null; - if (constructorInfo.Length > 1) { - memberFormat = ConvertLink(helpFileFormat.MemberFormat, type, "ctor", "m", constructorNum == 0 && !helpFileFormat.NumerateConstructor ? (constructorNum + 1).ToString() : constructorNum.ToString()); - ++constructorNum; - } else { - memberFormat = ConvertLink(helpFileFormat.MemberFormat, type, "ctor", "m", ""); - } - - constructorsNode.AppendChild(createLinkNode(doc, - constructor.Name + "(" + getMethodSignature(constructor) + ")", - memberFormat)); - } - } - if(constructorsNode.ChildNodes.Count > 0) { - rootnode.AppendChild(constructorsNode); - } - - // search for fields - XmlNode fieldsNode = createFolderNode(doc, "Fields"); - SetLink(doc, fieldsNode, ConvertLink(helpFileFormat.FieldsTopic, type)); - - foreach(FieldInfo field in type.GetFields(flags)) { - if(field.DeclaringType == type) { - string memberFormat = ConvertLink(helpFileFormat.MemberFormat, type, field.Name, "f", ""); - fieldsNode.AppendChild(createLinkNode(doc, field.Name, memberFormat)); - } - } - if(fieldsNode.ChildNodes.Count > 0) { - rootnode.AppendChild(fieldsNode); - } - - - // search for methods - XmlNode methodsNode = createFolderNode(doc, "Methods"); - SetLink(doc, methodsNode, ConvertLink(helpFileFormat.MethodsTopic, type)); - MethodInfo[] methodInfos = type.GetMethods(flags); - int methodNum = 0; - for (int i = 0; i < methodInfos.Length; ++i) { - MethodInfo method = methodInfos[i]; - if (!method.IsSpecialName && method.DeclaringType == type) { - // HACK: BUGFIX FOR DirectX.Direct3D.Device and other directx classes ... - // for unknown reason add and remove methods are added to the non special name, public space - // maybe because the directx assemblies are generated by a buggy internal MS compiler :) - if (method.Name.StartsWith("add_") || method.Name.StartsWith("remove_")) { - continue; - } - string number = ""; - if (i > 0 && methodInfos[i - 1].Name != method.Name) { - methodNum = helpFileFormat.NumerateConstructor ? 0 : 1; - } - if (i > 0 && methodInfos[i - 1].Name == method.Name) { - number = methodNum++.ToString(); - } else if (i + 1 < methodInfos.Length && methodInfos[i + 1].Name == method.Name) { - number = methodNum++.ToString(); - } - - string memberFormat = ConvertLink(helpFileFormat.MemberFormat, type, method.Name, "m", number); - methodsNode.AppendChild(createLinkNode(doc, - method.Name + "(" + getMethodSignature(method) + ")", - memberFormat)); - } - } - - if(methodsNode.ChildNodes.Count > 0) { - rootnode.AppendChild(methodsNode); - } - - // search for properties - XmlNode propertiesNode = createFolderNode(doc, "Properties"); - SetLink(doc, propertiesNode, ConvertLink(helpFileFormat.PropertiesTopic, type)); - - foreach(PropertyInfo property in type.GetProperties(flags)) - { - if (property.DeclaringType == type) { - string memberFormat = ConvertLink(helpFileFormat.MemberFormat, type, property.Name, "p", ""); - propertiesNode.AppendChild(createLinkNode(doc, property.Name, memberFormat)); - } - } - - if(propertiesNode.ChildNodes.Count > 0) { - rootnode.AppendChild(propertiesNode); - } - - // search for events - XmlNode eventsNode = createFolderNode(doc, "Events"); - SetLink(doc, eventsNode, ConvertLink(helpFileFormat.EventsTopic, type)); - - foreach(EventInfo ev in type.GetEvents(flags)) - { - if(ev.DeclaringType == type) { - string memberFormat = ConvertLink(helpFileFormat.MemberFormat, type, ev.Name, "e", ""); - eventsNode.AppendChild(createLinkNode(doc, ev.Name, memberFormat)); - } - } - - if(eventsNode.ChildNodes.Count > 0) { - rootnode.AppendChild(eventsNode); - } - - return rootnode; - } - - string getMethodSignature(MethodBase method) - { - string signature = ""; - foreach(ParameterInfo param in method.GetParameters()) - { - if(signature != "") signature += ", "; - signature += param.ParameterType; - } - return signature; - } - } -} diff --git a/src/Tools/HelpConverter/HelpTreeBuilder/DelegateNodeBuilder.cs b/src/Tools/HelpConverter/HelpTreeBuilder/DelegateNodeBuilder.cs deleted file mode 100644 index 05a3c18d3b..0000000000 --- a/src/Tools/HelpConverter/HelpTreeBuilder/DelegateNodeBuilder.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Xml; -using System.Reflection; - -namespace ICSharpCode.HelpConverter.HelpTreeBuilder -{ - class delegateNodeBuilder : classNodeBuilder - { - public override string Postfix { - get { - return " delegate"; - } - } - - public override string ShortType { - get { - return "d"; - } - } - - public override XmlNode buildNode(XmlDocument doc, Type type) - { - return createLinkNode(doc, type.Name + Postfix, ConvertLink(helpFileFormat.ClassTopic, type)); - } - } -} diff --git a/src/Tools/HelpConverter/HelpTreeBuilder/EnumNodeBuilder.cs b/src/Tools/HelpConverter/HelpTreeBuilder/EnumNodeBuilder.cs deleted file mode 100644 index 728939d6d4..0000000000 --- a/src/Tools/HelpConverter/HelpTreeBuilder/EnumNodeBuilder.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Xml; -using System.Reflection; - -namespace ICSharpCode.HelpConverter.HelpTreeBuilder -{ - public class enumNodeBuilder : classNodeBuilder - { - public override string Postfix { - get { - return " enumeration"; - } - } - - public override string ShortType { - get { - return "e"; - } - } - - public override XmlNode buildNode(XmlDocument doc, Type type) - { - return createLinkNode(doc, type.Name + Postfix, ConvertLink(helpFileFormat.ClassTopic, type)); - } - } -} diff --git a/src/Tools/HelpConverter/HelpTreeBuilder/Generator.cs b/src/Tools/HelpConverter/HelpTreeBuilder/Generator.cs deleted file mode 100644 index 7989708de3..0000000000 --- a/src/Tools/HelpConverter/HelpTreeBuilder/Generator.cs +++ /dev/null @@ -1,111 +0,0 @@ -using System; -using System.IO; -using System.Collections; -using System.Reflection; -using System.Windows.Forms; -using System.Xml; - -namespace ICSharpCode.HelpConverter.HelpTreeBuilder -{ - public class Generator - { - public Generator(XmlDocument doc, XmlNode rootNode, string[] args) - { - AssemblyLoader loader = new AssemblyLoader(); - Assembly[] assemblies; - - try { - assemblies = loader.LoadAssemblies(args); - } catch(Exception e) { - throw e; - } - - Hashtable typesByNamespace = loadTypesByNamespace(assemblies); - - string[] namespacesSorted = new string[typesByNamespace.Keys.Count]; - int count = 0; - - foreach(string nspace in typesByNamespace.Keys) { - namespacesSorted[count] = nspace; - count++; - } - - Array.Sort(namespacesSorted); - - foreach(string nspace in namespacesSorted) { - // create folder node for namespace - XmlNode namespaceNode = doc.CreateElement("HelpFolder"); - XmlAttribute attrib = doc.CreateAttribute("name"); - attrib.Value = nspace; - - - namespaceNode.Attributes.Append(attrib); - - string[] typesSorted = new string[((Hashtable)typesByNamespace[nspace]).Count]; - count = 0; - - foreach(string typeName in ((Hashtable)typesByNamespace[nspace]).Keys) { - typesSorted[count] = typeName; - count++; - } - - Array.Sort(typesSorted); - - // put the namespace in a separate file - XmlDocument newDoc = new XmlDocument(); - newDoc.LoadXml(""); - bool setNamespaceLink = false; - foreach(string typeName in typesSorted) { - Type type = (Type)((Hashtable)typesByNamespace[nspace])[typeName]; - try { - newDoc.DocumentElement.AppendChild(TypeNodeFactory.CreateNode(type, newDoc)); - // set link to namespace description - if (!setNamespaceLink) { - classNodeBuilder cbn = new classNodeBuilder(); - cbn.SetLink(doc, namespaceNode, cbn.ConvertLink(classNodeBuilder.helpFileFormat.NamespaceFormat,type )); - setNamespaceLink = true; - } - } catch(Exception e) { - System.Console.WriteLine(e.Message); - } - } - string helpFileName = Application.StartupPath + Path.DirectorySeparatorChar + nspace + "Help.xml"; - HelpBrowserApp.HelpFiles.Add(helpFileName); - newDoc.Save(helpFileName); - - // create help reference - XmlElement referenceNode = doc.CreateElement("HelpReference"); - attrib = doc.CreateAttribute("reference"); - attrib.Value = nspace + "Help.xml"; - referenceNode.Attributes.Append(attrib); - namespaceNode.AppendChild(referenceNode); - - // add the namespace + reference node to the document - rootNode.AppendChild(namespaceNode); - } - } - - Hashtable loadTypesByNamespace(Assembly[] assemblies) - { - Hashtable namespaces = new Hashtable(); - - foreach(Assembly assembly in assemblies) { - - foreach(Type type in assembly.GetTypes()) { - if(type.Namespace != null && type.IsPublic) { - - if(namespaces.Contains(type.Namespace) == false) { - namespaces.Add(type.Namespace, new Hashtable()); - } - - ((Hashtable)namespaces[type.Namespace]).Add(type.Name, type); - - } else { - System.Console.WriteLine("no namespace, ignoring: " + type.Name); - } - } - } - return namespaces; - } - } -} diff --git a/src/Tools/HelpConverter/HelpTreeBuilder/ITypeNodeBuilder.cs b/src/Tools/HelpConverter/HelpTreeBuilder/ITypeNodeBuilder.cs deleted file mode 100644 index 538db27a13..0000000000 --- a/src/Tools/HelpConverter/HelpTreeBuilder/ITypeNodeBuilder.cs +++ /dev/null @@ -1,10 +0,0 @@ -using System; -using System.Xml; - -namespace ICSharpCode.HelpConverter.HelpTreeBuilder -{ - public interface ITypeNodeBuilder - { - XmlNode buildNode(XmlDocument doc, Type type); - } -} diff --git a/src/Tools/HelpConverter/HelpTreeBuilder/InterfaceNodeBuilder.cs b/src/Tools/HelpConverter/HelpTreeBuilder/InterfaceNodeBuilder.cs deleted file mode 100644 index c7ed8ea4c4..0000000000 --- a/src/Tools/HelpConverter/HelpTreeBuilder/InterfaceNodeBuilder.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Xml; -using System.Reflection; - -namespace ICSharpCode.HelpConverter.HelpTreeBuilder -{ - class interfaceNodeBuilder : classNodeBuilder - { - public override string ShortType { - get { - return "i"; - } - } - - public override string Postfix - { - get { - return " interface"; - } - } - } -} diff --git a/src/Tools/HelpConverter/HelpTreeBuilder/StructNodeBuilder.cs b/src/Tools/HelpConverter/HelpTreeBuilder/StructNodeBuilder.cs deleted file mode 100644 index 5c6593b2d4..0000000000 --- a/src/Tools/HelpConverter/HelpTreeBuilder/StructNodeBuilder.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System; -using System.Xml; -using System.Reflection; - -namespace ICSharpCode.HelpConverter.HelpTreeBuilder -{ - class structNodeBuilder : classNodeBuilder - { - public override string ShortType { - get { - return "s"; - } - } - - public override string Postfix - { - get { - return " structure"; - } - } - } -} diff --git a/src/Tools/HelpConverter/HelpTreeBuilder/TypeNodeFactory.cs b/src/Tools/HelpConverter/HelpTreeBuilder/TypeNodeFactory.cs deleted file mode 100644 index 748f8487e0..0000000000 --- a/src/Tools/HelpConverter/HelpTreeBuilder/TypeNodeFactory.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using System.Xml; - -namespace ICSharpCode.HelpConverter.HelpTreeBuilder -{ - public class TypeNodeFactory - { - public static XmlNode CreateNode(Type type, XmlDocument doc) - { - ITypeNodeBuilder builder; - - if(type.IsClass == true && type.IsSubclassOf(typeof(MulticastDelegate)) == false) { - builder = new classNodeBuilder(); - } else if(type.IsClass == true && type.IsSubclassOf(typeof(MulticastDelegate)) == true) { - builder = new delegateNodeBuilder(); - } else if(type.IsEnum) { - builder = new enumNodeBuilder(); - } else if(type.IsInterface) { - builder = new interfaceNodeBuilder(); - } else if(type.IsValueType == true) { - builder = new structNodeBuilder(); - } else { - throw new Exception("Generation for this type is currently not supported: " + type.Name); - } - - return builder.buildNode(doc, type); - } - } -} diff --git a/src/Tools/HelpConverter/HhcFileParser.cs b/src/Tools/HelpConverter/HhcFileParser.cs deleted file mode 100644 index 81b815747b..0000000000 --- a/src/Tools/HelpConverter/HhcFileParser.cs +++ /dev/null @@ -1,197 +0,0 @@ -// -// -// -// -// -// - -using System; -using System.IO; -using System.Text; -using System.Text.RegularExpressions; -using System.Collections; -using System.Windows.Forms; -using System.Xml; - -namespace ICSharpCode.HelpConverter -{ - public class HhcFileParser - { - string hhcFileContents; - string chmName; - string basePath; - - ArrayList rootTreeNodes = new ArrayList(); - XmlNode currentNode = null; - - public HhcFileParser(string basePath) - { - this.basePath = basePath; - } - - void LoadHhcFile(string fileName) - { - FileInfo fi = new FileInfo(basePath + Path.DirectorySeparatorChar + fileName); - StreamReader sr = fi.OpenText(); - hhcFileContents = sr.ReadToEnd(); - sr.Close(); - } - - void MakeXmlCompliant() - { - StringBuilder strFixup = - new StringBuilder(Regex.Replace(hhcFileContents, - "(?'start']*)(?'end'\"/?>)", - "${start}\"/>")); - - strFixup.Replace("", ""); - strFixup.Replace("
  • ", "
  • "); - strFixup.Replace("
    • ", "
      • "); - hhcFileContents = strFixup.ToString(); - } - - void Load(string fileName) - { - LoadHhcFile(fileName); - MakeXmlCompliant(); - } - - public void Parse(XmlDocument helpFileDocument, XmlNode currentNode, string hhcFileName, string chmName) - { - this.chmName = chmName; - - Load(hhcFileName); - - XmlDocument doc = new XmlDocument(); - doc.LoadXml(hhcFileContents); - - XmlNode root = doc.ChildNodes[0]; - XmlNode outermostList = null; - - switch (root.Name.ToLower()) { - case "ul": - outermostList = root; - break; - case "html": // this would be well-formed HTML - outermostList = root["BODY"]["UL"]; - break; - case "#comment": // this is NDoc malformed HTML - outermostList = doc.ChildNodes[1]; - break; - default: - // this is nothing we can read; please send us the .hhc file - break; - } - - if (null == outermostList) { - Console.WriteLine("Format of file not valid, cannot find root
          node"); - return; - } - - this.currentNode = currentNode; - EvaluateLevel(helpFileDocument, outermostList); - - // quick & dirty overview of the structure - // Console.WriteLine("---------------------------"); - // DumpElement(root, 0); - } - - void EvaluateLevel(XmlDocument helpFileDocument, XmlNode currentLevel) - { - for (int i = 0; i < currentLevel.ChildNodes.Count; i++) { - XmlNode currentElement = currentLevel.ChildNodes[i]; - - // we need a lookup on the next node - is it a UL, then the current node - // node needs to be displayed as a folder, otherwise it is a non-expandable - // leaf node in our tree - bool bIsFolderNode = false; - if (i < (currentLevel.ChildNodes.Count - 1)) { - XmlNode nextElement = currentLevel.ChildNodes[i + 1]; - if ("UL" == nextElement.Name) bIsFolderNode = true; - } - - string strNodeName, strNodeUrl; - if (bIsFolderNode) { - GetNodeInformation(currentElement["OBJECT"], out strNodeName, out strNodeUrl); - - // we need to create a folder and continue traversing - XmlElement folderElement = helpFileDocument.CreateElement("HelpFolder"); - - XmlAttribute attrib = helpFileDocument.CreateAttribute("name"); - attrib.InnerText = strNodeName; - folderElement.Attributes.Append(attrib); - currentNode.AppendChild(folderElement); - - - XmlNode savedNode = currentNode; - currentNode = folderElement; - EvaluateLevel(helpFileDocument, currentLevel.ChildNodes[i + 1]); - currentNode = savedNode; - } else { - // we have a leaf node here, but we need to ignore UL's, those are handled by - // their parents above - if ("UL" == currentElement.Name) { - // we do nothing with this element - } else { - GetNodeInformation(currentElement["OBJECT"], out strNodeName, out strNodeUrl); - - XmlElement helpTopic = helpFileDocument.CreateElement("HelpTopic"); - - XmlAttribute attrib = helpFileDocument.CreateAttribute("name"); - attrib.InnerText = strNodeName; - helpTopic.Attributes.Append(attrib); - attrib = helpFileDocument.CreateAttribute("link"); - attrib.InnerText = chmName + "::/" + strNodeUrl; - helpTopic.Attributes.Append(attrib); - currentNode.AppendChild(helpTopic); - - } - } - } - } - - void GetNodeInformation(XmlNode theNode, out string NodeName, out string NodeUrl) - { - // and url are read from OBJECT node - string strParamType, strParamValue; - strParamType = strParamValue = NodeName = NodeUrl = ""; - - for (int i = 0; i < theNode.ChildNodes.Count; i++) { - XmlNode currentParam = theNode.ChildNodes[i]; - // we work with param nodes only, anything else cannot be handled here - if ("param" != currentParam.Name) { - return; - } - - // if any of the below two XmlAttribute objects is not available, - // we will get a null ref exception - try { - strParamType = currentParam.Attributes["name"].Value; - strParamValue = currentParam.Attributes["value"].Value; - } catch { - strParamType = ""; // because of the switch statement, we need a default value when it fails - } - - switch (strParamType) { - case "Name": - NodeName = strParamValue; - break; - case "Local": - NodeUrl = strParamValue; - break; - } - } - } - - // for internal use only - dump entire structure to the console. - void DumpElement(XmlNode el, int nDepth) - { - string strTree = new String(' ', nDepth); - - foreach(XmlNode subEl in el.ChildNodes) { - Console.WriteLine(strTree + subEl.Name); - DumpElement(subEl, nDepth+1); - } - } - } -} diff --git a/src/Tools/HelpConverter/Main.cs b/src/Tools/HelpConverter/Main.cs deleted file mode 100644 index 09d7b182c4..0000000000 --- a/src/Tools/HelpConverter/Main.cs +++ /dev/null @@ -1,168 +0,0 @@ -// -// -// -// -// -// - -using System; -using System.Collections; -using System.Windows.Forms; -using System.Drawing; -using System.CodeDom.Compiler; -using System.IO; -using System.Reflection; -using System.Diagnostics; -using System.Xml; -using ICSharpCode.HelpConverter.HelpTreeBuilder; - -using ICSharpCode.SharpZipLib.Checksums; -using ICSharpCode.SharpZipLib.Zip; -using ICSharpCode.SharpZipLib.GZip; - -namespace ICSharpCode.HelpConverter -{ - public class HelpBrowserApp - { - HhcFileParser hhcFileParser; - public static ArrayList HelpFiles = new ArrayList(); - - /// - /// Parses the xml tree and generates a TreeNode tree out of it. - /// - void ParseTree(XmlDocument doc, XmlNode docParent, XmlNode parentNode) - { - try { - foreach (XmlNode node in parentNode.ChildNodes) { - XmlNode importNode = doc.ImportNode(node, true); - switch (node.Name) { - case "Condition": - Console.WriteLine("trying to load : " + node.Attributes["canload"].InnerText); - Assembly assembly = Assembly.Load(node.Attributes["canload"].InnerText); - if(assembly != null) { - Console.WriteLine("Success"); - ParseTree(doc, docParent, node); - } else { - Console.WriteLine("Failure"); - } - break; - case "HelpFolder": - docParent.AppendChild(importNode); - ParseTree(doc, importNode, node); - break; - case "HelpFile": - Console.WriteLine("Parse hhc : " + node.Attributes["hhc"].InnerText); - hhcFileParser.Parse(doc, - docParent, - node.Attributes["hhc"].InnerText, - node.Attributes["chm"].InnerText); - break; - case "HelpAssemblies": - ArrayList assemblies = new ArrayList(); - foreach (XmlNode childNode in node.ChildNodes) { - assemblies.Add(childNode.InnerText); - } - if (node.Attributes["helpformat"].InnerText == "SDK") { - classNodeBuilder.helpFileFormat = new SDKHelpFileFormat(); - } else { - classNodeBuilder.helpFileFormat = new DirectX9HelpFileFormat(); - } - new Generator(doc, docParent, (string[])assemblies.ToArray(typeof(string))); - break; - } - } - } catch (Exception e) { - Console.Error.WriteLine("unexpected exception : " + e.ToString()); - } - } - - void ConvertHelpfile() - { - string basePath = Application.StartupPath + Path.DirectorySeparatorChar + - ".." + Path.DirectorySeparatorChar + - ".." + Path.DirectorySeparatorChar + - "doc" + Path.DirectorySeparatorChar + - "help"; - - if (!File.Exists(basePath + Path.DirectorySeparatorChar + @"HelpDescription.xml")) { - Console.WriteLine("HelpDescription.xml not found!"); - return; - } - - XmlDocument doc = new XmlDocument(); - doc.Load(basePath + Path.DirectorySeparatorChar + @"HelpDescription.xml"); - - XmlDocument newDoc = new XmlDocument(); - newDoc.LoadXml(""); - hhcFileParser = new HhcFileParser(basePath); - ParseTree(newDoc, newDoc.DocumentElement, doc.DocumentElement); - - try { - newDoc.Save(basePath + Path.DirectorySeparatorChar + "HelpConv.xml"); - } catch (Exception e) { - Console.Error.WriteLine("Can't save HelpConv.xml (No write permission?) : " + e.ToString()); - } - - try { - ZipHelpFile(basePath); - } catch (Exception e) { - Console.Error.WriteLine("Error while zipping helpfile : " + e.ToString()); - } - } - - void ZipHelpFile(string basePath) - { - Console.WriteLine("ZIP Help Contents"); - HelpFiles.Insert(0, basePath + Path.DirectorySeparatorChar + "HelpConv.xml"); - ZipOutputStream s = new ZipOutputStream(File.Create(basePath + Path.DirectorySeparatorChar + "SharpDevelopHelp.zip")); - try { - s.SetLevel(6); - Crc32 crc = new Crc32(); - foreach (string file in HelpFiles) { - Console.WriteLine("zip " + file); - - FileStream fs = null; - ZipEntry entry; - byte[] buffer; - - try { - fs = File.OpenRead(file); - buffer = new byte[fs.Length]; - fs.Read(buffer, 0, buffer.Length); - - entry = new ZipEntry(Path.GetFileName(file)); - entry.DateTime = DateTime.Now; - entry.Size = fs.Length; - crc.Reset(); - crc.Update(buffer); - entry.Crc = crc.Value; - } catch (Exception e) { - Console.Error.WriteLine("Error reading temp xml file : " + e.ToString()); - continue; - } finally { - if (fs != null) { - fs.Close(); - } - } - - s.PutNextEntry(entry); - s.Write(buffer, 0, buffer.Length); - - Console.WriteLine("remove " + file + " from disk"); - File.Delete(file); - } - } catch (Exception e) { - Console.Error.WriteLine("Error while zipping helpfile : " + e.ToString()); - } finally { - s.Finish(); - s.Close(); - Console.WriteLine("finished"); - } - } - - public static void Main(String[] args) - { - new HelpBrowserApp().ConvertHelpfile(); - } - } -} diff --git a/src/Tools/ResAsmTask/AssemblyInfo.cs b/src/Tools/ResAsmTask/AssemblyInfo.cs deleted file mode 100644 index f29a251f89..0000000000 --- a/src/Tools/ResAsmTask/AssemblyInfo.cs +++ /dev/null @@ -1,32 +0,0 @@ -using System.Reflection; -using System.Runtime.CompilerServices; - -// Information about this assembly is defined by the following -// attributes. -// -// change them to the information which is associated with the assembly -// you compile. - -[assembly: AssemblyTitle("ResAsmTask")] -[assembly: AssemblyDescription("A nanttask for easy resource generation.")] -[assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("www.icsharpcode.net")] -[assembly: AssemblyProduct("")] -[assembly: AssemblyCopyright("(c) 2004 by Mike Krueger")] -[assembly: AssemblyTrademark("")] -[assembly: AssemblyCulture("")] - -// The assembly version has following format : -// -// Major.Minor.Build.Revision -// -// You can specify all values by your own or you can build default build and revision -// numbers with the '*' character (the default): - -[assembly: AssemblyVersion("2.0.0.1")] - -// The following attributes specify the key for the sign of your assembly. See the -// .NET Framework documentation for more information about signing. -// This is not required, if you don't want signing let these attributes like they're. -[assembly: AssemblyDelaySign(false)] -[assembly: AssemblyKeyFile("")] diff --git a/src/Tools/ResAsmTask/Main.cs b/src/Tools/ResAsmTask/Main.cs deleted file mode 100644 index a79cdcc05d..0000000000 --- a/src/Tools/ResAsmTask/Main.cs +++ /dev/null @@ -1,81 +0,0 @@ -using System; -using System.Drawing; -using System.IO; -using System.Resources; - -using NAnt.Core; -using NAnt.Core.Attributes; -using NAnt.Core.Tasks; -using NAnt.Core.Types; -using NAnt.Core.Util; - -namespace ResAsmTask -{ - [TaskName("resasm")] - public class ResAsmTask : Task - { - string output; - string input = null; - FileSet files = new FileSet(); - - [TaskAttribute("output", Required=true)] - public string Output { - get { - return output; - } - set { - output = value; - } - } - - [TaskAttribute("input")] - public string Input { - get { - return input; - } - set { - input = value; - } - } - - [BuildElement("files")] - public FileSet Files { - get { - return files; - } - set { - files = value; - } - } - - protected override void ExecuteTask() - { - if (Files.BaseDirectory == null) { - Files.BaseDirectory = new DirectoryInfo(Project.BaseDirectory); - } - - if (Files.FileNames.Count > 0) { - string outputDirectory; - if (Path.IsPathRooted(Output)) { - outputDirectory = Output; - } else { - outputDirectory = Path.Combine(Project.BaseDirectory, Output); - } - - if (!Directory.Exists(Path.GetDirectoryName(outputDirectory))) { - Directory.CreateDirectory(Path.GetDirectoryName(outputDirectory)); - } - - ResourceWriter rw = new ResourceWriter(outputDirectory); - foreach (string fileName in Files.FileNames) { - Bitmap bitmap = new Bitmap(Path.Combine(Files.BaseDirectory.FullName, fileName)); - rw.AddResource(Path.GetFileNameWithoutExtension(fileName), bitmap); - } - rw.Generate(); - rw.Close(); - } else if (Input != null) { - ResAsm.Assemble(Input, Output); - } - } - } -} diff --git a/src/Tools/ResAsmTask/ResAsm.cs b/src/Tools/ResAsmTask/ResAsm.cs deleted file mode 100644 index b397891a0a..0000000000 --- a/src/Tools/ResAsmTask/ResAsm.cs +++ /dev/null @@ -1,178 +0,0 @@ -// ResAsm.cs -// Copyright (c) 2001 Mike Krueger -// -// This program is free software; you can redistribute it and/or modify -// it under the terms of the GNU General Public License as published by -// the Free Software Foundation; either version 2 of the License, or -// (at your option) any later version. -// -// This program is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -// GNU General Public License for more details. -// -// You should have received a copy of the GNU General Public License -// along with this program; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA - -using System; -using System.Collections; -using System.Drawing; -using System.Resources; -using System.IO; -using System.Text; -using System.Drawing.Imaging; -using System.Windows.Forms; -using System.Runtime.Serialization.Formatters.Binary; - -namespace ResAsmTask -{ - public class ResAsm - { - static string ConvertIllegalChars(string str) - { - StringBuilder newString = new StringBuilder(); - for (int i = 0; i < str.Length; ++i) { - switch (str[i]) { - case '\r': - break; - case '\n': - newString.Append("\\n"); - break; - case '"': - newString.Append("\\\""); - break; - case '\\': - newString.Append("\\\\"); - break; - default: - newString.Append(str[i]); - break; - } - } - return newString.ToString(); - } - - /// - /// Builds resource files out of the ResAsm format - /// - public static void Assemble(string inputFileName, string outputFileName) - { - int linenr = 0; - try { - StreamReader reader = new StreamReader(inputFileName, new UTF8Encoding()); - - ResourceWriter rw = new ResourceWriter(outputFileName); - linenr = 0; - while (true) { - string line = reader.ReadLine(); - linenr++; - if (line == null) { - break; - } - line = line.Trim(); - // skip empty or comment lines - if (line.Length == 0 || line[0] == '#') { - continue; - } - - // search for a = char - int idx = line.IndexOf('='); - if (idx < 0) { - Console.WriteLine("error in file " + inputFileName + " at line " + linenr); - continue; - } - string key = line.Substring(0, idx).Trim(); - string val = line.Substring(idx + 1).Trim(); - object entryval = null; - - if (val[0] == '"') { // case 1 : string value - val = val.Trim(new char[] {'"'}); - StringBuilder tmp = new StringBuilder(); - for (int i = 0; i < val.Length; ++i) { - switch (val[i]) { // handle the \ char - case '\\': - ++i; - if (i < val.Length) - switch (val[i]) { - case '\\': - tmp.Append('\\'); - break; - case 'n': - tmp.Append('\n'); - break; - case '\"': - tmp.Append('\"'); - break; - } - break; - default: - tmp.Append(val[i]); - break; - } - } - entryval = tmp.ToString(); - } else { // case 2 : no string value -> load resource - entryval = LoadResource(val); - } - rw.AddResource(key, entryval); - - } - rw.Generate(); - rw.Close(); - reader.Close(); - } catch (Exception e) { - Console.WriteLine("Error in line " + linenr); - Console.WriteLine("Error while processing " + inputFileName + " :"); - Console.WriteLine(e.ToString()); - } - } - - /// - /// Loads a file. - /// - /// - /// An object representation of the file (for a bitmap a Bitmap, - /// for a Icon an Icon and so on), the fall back is a byte array - /// - static object LoadResource(string name) - { - switch (Path.GetExtension(name).ToUpper()) { - case ".CUR": - return new Cursor(name); - case ".ICO": - return new Icon(name); - default: - // try to read a bitmap - try { - return new Bitmap(name); - } catch {} - - // try to read a serialized object - try { - Stream r = File.Open(name, FileMode.Open); - try { - BinaryFormatter c = new BinaryFormatter(); - object o = c.Deserialize(r); - r.Close(); - return o; - } catch { r.Close(); } - } catch { } - - // finally try to read a byte array - try { - FileStream s = new FileStream(name, FileMode.Open); - BinaryReader r = new BinaryReader(s); - Byte[] d = new Byte[(int) s.Length]; - d = r.ReadBytes((int) s.Length); - s.Close(); - return d; - } catch (Exception e) { - MessageBox.Show(e.Message, "Can't load resource", MessageBoxButtons.OK); - } - break; - } - return null; - } - } -} diff --git a/src/Tools/Tools.build b/src/Tools/Tools.build new file mode 100644 index 0000000000..15e4fdac71 --- /dev/null +++ b/src/Tools/Tools.build @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +