diff options
Diffstat (limited to 'tools/Sandcastle/Source/BuildAssembler/BuildAssemblerLibrary')
12 files changed, 1412 insertions, 0 deletions
diff --git a/tools/Sandcastle/Source/BuildAssembler/BuildAssemblerLibrary/BuildAssembler.cs b/tools/Sandcastle/Source/BuildAssembler/BuildAssemblerLibrary/BuildAssembler.cs new file mode 100644 index 0000000..fb7fd47 --- /dev/null +++ b/tools/Sandcastle/Source/BuildAssembler/BuildAssemblerLibrary/BuildAssembler.cs @@ -0,0 +1,316 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// +using System; +using System.Collections.Generic; +using System.Configuration; +using System.IO; +using System.Reflection; +using System.Xml; +using System.Xml.XPath; + +using Microsoft.Ddue.Tools.CommandLine; + +namespace Microsoft.Ddue.Tools { + + public class BuildAssembler : IDisposable { + + // the built context + public BuildAssembler() + { + this.handler = BuildAssembler.ConsoleMessageHandler; + + } + + // the built context + public BuildAssembler(MessageHandler messageHandler) + { + if (messageHandler == null) throw new ArgumentNullException("messageHandler"); + this.handler = messageHandler; + + } + + // private data + + private BuildContext context = new BuildContext(); + + public List<BuildComponent> components = new List<BuildComponent>(); + + private MessageHandler handler; + + // data accessors + + public BuildContext Context { + get { + return (context); + } + } + + public BuildComponent[] BuildComponents { + get { + return (components.ToArray()); + } + } + + public MessageHandler MessageHandler { + get { + return (handler); + } + } + + // component communication mechanism + + public event EventHandler ComponentEvent; + + internal void OnComponentEvent (Object o, EventArgs e) { + if (ComponentEvent != null) ComponentEvent(o, e); + } + + // operations + + public int Apply(IEnumerable<string> topics) + { + int count = 0; + + foreach (string topic in topics) + { + + // create the document + XmlDocument document = new XmlDocument(); + document.PreserveWhitespace = true; + + // write a log message + WriteMessage(MessageLevel.Info, String.Format("Building topic {0}", topic)); + + // apply the component stack + foreach (BuildComponent component in components) + { + + component.Apply(document, topic); + } + + count++; + } + + return (count); + } + + public int Apply (string manifestFile) { + return (Apply(new TopicManifest(manifestFile))); + } + + public virtual void Dispose () { + foreach (BuildComponent component in components) { + ((IDisposable) component).Dispose(); + } + } + + private class TopicManifest : IEnumerable<string> { + + public TopicManifest (string manifest) { + this.manifest = manifest; + } + + private string manifest; + + public IEnumerator<string> GetEnumerator () { + return (new TopicEnumerator(manifest)); + } + + System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator () { + return (GetEnumerator()); + } + + } + + private class TopicEnumerator : IEnumerator<string> { + + public TopicEnumerator (string manifest) { + reader = XmlReader.Create(manifest); + reader.MoveToContent(); + } + + private XmlReader reader; + + public bool MoveNext () { + while (reader.Read()) { + if ((reader.NodeType == XmlNodeType.Element) && (reader.LocalName == "topic")) return (true); + } + return (false); + } + + public string Current { + get { + string id = reader.GetAttribute("id"); + return(id); + } + } + + Object System.Collections.IEnumerator.Current { + get { + return (Current); + } + } + + public void Reset () { + throw new InvalidOperationException(); + } + + public virtual void Dispose () { + reader.Close(); + } + + } + + public IEnumerable<BuildContext> GetFileManifestBuildContextEnumerator(string manifestFilename) + { + using (XmlReader reader = XmlReader.Create(manifestFilename)) + { + reader.MoveToContent(); + while (reader.Read()) + { + if ((reader.NodeType == XmlNodeType.Element) && (reader.LocalName == "topic")) + { + BuildContext thisContext = new BuildContext(); + + try + { + string id = reader.GetAttribute("id"); + + while (reader.MoveToNextAttribute()) + { + string name = reader.Name; + string value = reader.Value; + thisContext.AddVariable(name, value); + } + } + catch (XmlException e) + { + throw new XmlException(String.Format("The manifest file: '{0}' is not well-formed. The error message is: {1}", manifestFilename, e.Message), e); + } + + yield return thisContext; + } + } + } + } + + public BuildComponent LoadComponent (XPathNavigator configuration) { + + if (configuration == null) throw new ArgumentNullException("configuration"); + + // get the component infomation + string assemblyName = configuration.GetAttribute("assembly", String.Empty); + if (String.IsNullOrEmpty(assemblyName)) { + WriteMessage(MessageLevel.Error, "Each component element must have an assembly attribute that specifys a path to the component assembly."); + } + + string typeName = configuration.GetAttribute("type", String.Empty); + if (String.IsNullOrEmpty(typeName)) { + WriteMessage(MessageLevel.Error, "Each component element must have a type attribute that specifys the fully qualified name of a component type."); + } + + // expand environmet variables in path of assembly name + assemblyName = Environment.ExpandEnvironmentVariables(assemblyName); + + // load and instantiate the component + BuildComponent component = null; + try { + + Assembly assembly = Assembly.LoadFrom(assemblyName); + component = (BuildComponent) assembly.CreateInstance(typeName, false, BindingFlags.Public | BindingFlags.Instance, null, new Object[2] { this, configuration }, null, null); + + } catch (IOException e) { + WriteMessage(MessageLevel.Error, String.Format("A file access error occured while attempting to load the build component assembly '{0}'. The error message is: {1}", assemblyName, e.Message)); + } catch (BadImageFormatException e) { + WriteMessage(MessageLevel.Error, String.Format("The build component assembly '{0}' is not a valid managed assembly. The error message is: {1}", assemblyName, e.Message)); + } catch (TypeLoadException) { + WriteMessage(MessageLevel.Error, String.Format("The build component '{0}' was not found in the assembly '{1}'.", typeName, assemblyName)); + } catch (MissingMethodException e) { + WriteMessage(MessageLevel.Error, String.Format("No appropriate constructor exists for the build component '{0}' in the component assembly '{1}'. The error message is: {1}", typeName, assemblyName, e.Message)); + } catch (TargetInvocationException e) { + WriteMessage(MessageLevel.Error, String.Format("An error occured while initializing the build component '{0}' in the component assembly '{1}'. The error message and stack trace follows: {2}", typeName, assemblyName, e.InnerException.ToString())); + } catch (InvalidCastException) { + WriteMessage(MessageLevel.Error, String.Format("The type '{0}' in the component assembly '{1}' is not a build component.", typeName, assemblyName)); + } + + if (component == null) { + WriteMessage(MessageLevel.Error, String.Format("The type '{0}' was not found in the component assembly '{1}'.", typeName, assemblyName)); + } + + return (component); + + + } + + public BuildComponent[] LoadComponents (XPathNavigator configuration) { + + XPathNodeIterator componentNodes = configuration.Select("component"); + + List<BuildComponent> components = new List<BuildComponent>(); + + foreach (XPathNavigator componentNode in componentNodes) { + components.Add(LoadComponent(componentNode)); + } + + return(components.ToArray()); + + } + + // routines to add and remove components from the + + public void AddComponents (XPathNavigator configuration) { + BuildComponent[] componentsToAdd = LoadComponents(configuration); + foreach (BuildComponent componentToAdd in componentsToAdd) { + components.Add(componentToAdd); + } + } + + public void ClearComponents () { + components.Clear(); + } + private void WriteMessage(MessageLevel level, string message) + { + handler(this.GetType(), level, message); + } + + // the default message handler + + public static MessageHandler ConsoleMessageHandler { + get { + return (new MessageHandler(WriteComponentMessageToConsole)); + } + } + + private static void WriteComponentMessageToConsole(Type type, MessageLevel level, string message) + { + string text = String.Format("{0}: {1}", type.Name, message); + switch (level) + { + case MessageLevel.Info: + ConsoleApplication.WriteMessage(LogLevel.Info, text); + break; + case MessageLevel.Warn: + ConsoleApplication.WriteMessage(LogLevel.Warn, text); + break; + case MessageLevel.Error: + ConsoleApplication.WriteMessage(LogLevel.Error, text); + Environment.Exit(1); + break; + } + } + + private void SetupContextFromConfiguration(XPathDocument configuration) + { + // Load namespaces into context + XPathNodeIterator namespace_nodes = configuration.CreateNavigator().Select("/configuration/dduetools/builder/context/namespace"); + foreach (XPathNavigator namespace_node in namespace_nodes) + { + string prefix = namespace_node.GetAttribute("prefix", String.Empty); + string uri = namespace_node.GetAttribute("uri", String.Empty); + context.AddNamespace(prefix, uri); + } + } + + } + +} diff --git a/tools/Sandcastle/Source/BuildAssembler/BuildAssemblerLibrary/BuildAssemblerLibrary.csproj b/tools/Sandcastle/Source/BuildAssembler/BuildAssemblerLibrary/BuildAssemblerLibrary.csproj new file mode 100644 index 0000000..8a54605 --- /dev/null +++ b/tools/Sandcastle/Source/BuildAssembler/BuildAssemblerLibrary/BuildAssemblerLibrary.csproj @@ -0,0 +1,92 @@ +<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="3.5"> + <PropertyGroup> + <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration> + <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform> + <ProductVersion>9.0.30729</ProductVersion> + <SchemaVersion>2.0</SchemaVersion> + <ProjectGuid>{399E78F8-4954-409E-991A-37DA9D0579CC}</ProjectGuid> + <OutputType>Library</OutputType> + <AppDesignerFolder>Properties</AppDesignerFolder> + <RootNamespace>BuildAssemblerLibrary</RootNamespace> + <AssemblyName>BuildAssemblerLibrary</AssemblyName> + <SccProjectName> + </SccProjectName> + <SccLocalPath> + </SccLocalPath> + <SccAuxPath> + </SccAuxPath> + <SccProvider> + </SccProvider> + <SignAssembly>false</SignAssembly> + <AssemblyOriginatorKeyFile>../../../key.snk</AssemblyOriginatorKeyFile> + <FileUpgradeFlags> + </FileUpgradeFlags> + <OldToolsVersion>2.0</OldToolsVersion> + <UpgradeBackupLocation> + </UpgradeBackupLocation> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <DebugType>full</DebugType> + <Optimize>false</Optimize> + <OutputPath>bin\Debug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' "> + <DebugType>pdbonly</DebugType> + <Optimize>true</Optimize> + <OutputPath>bin\Release\</OutputPath> + <DefineConstants>TRACE</DefineConstants> + <ErrorReport>prompt</ErrorReport> + <WarningLevel>4</WarningLevel> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'WebDocsDebug|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <OutputPath>bin\WebDocsDebug\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <DebugType>full</DebugType> + <PlatformTarget>AnyCPU</PlatformTarget> + <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression> + <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile> + <ErrorReport>prompt</ErrorReport> + </PropertyGroup> + <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Sandcastle|AnyCPU' "> + <DebugSymbols>true</DebugSymbols> + <OutputPath>bin\Sandcastle\</OutputPath> + <DefineConstants>DEBUG;TRACE</DefineConstants> + <DebugType>full</DebugType> + <PlatformTarget>AnyCPU</PlatformTarget> + <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression> + <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile> + <ErrorReport>prompt</ErrorReport> + </PropertyGroup> + <ItemGroup> + <Reference Include="System" /> + <Reference Include="System.configuration" /> + <Reference Include="System.Data" /> + <Reference Include="System.Xml" /> + </ItemGroup> + <ItemGroup> + <Compile Include="BuildAssembler.cs" /> + <Compile Include="BuildComponent.cs" /> + <Compile Include="BuildComponentUtilities.cs" /> + <Compile Include="BuildContext.cs" /> + <Compile Include="Properties\AssemblyInfo.cs" /> + </ItemGroup> + <ItemGroup> + <ProjectReference Include="..\..\CommandLine\CommandLine.csproj"> + <Project>{6CF7CA42-3706-4F6B-A2B4-10EF3F511888}</Project> + <Name>CommandLine</Name> + </ProjectReference> + </ItemGroup> + <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> + <!-- Copy the output assemblies to a common binaries directory (ProductionTools). --> + <Target Name="AfterBuild"> + <CreateItem Include="$(OutputPath)\$(AssemblyName).*"> + <Output TaskParameter="Include" ItemName="ProductionFiles" /> + </CreateItem> + <Copy SourceFiles="@(ProductionFiles)" DestinationFolder="..\..\..\ProductionTools" /> + </Target> +</Project>
\ No newline at end of file diff --git a/tools/Sandcastle/Source/BuildAssembler/BuildAssemblerLibrary/BuildAssemblerLibrary.csproj.vspscc b/tools/Sandcastle/Source/BuildAssembler/BuildAssemblerLibrary/BuildAssemblerLibrary.csproj.vspscc new file mode 100644 index 0000000..b6d3289 --- /dev/null +++ b/tools/Sandcastle/Source/BuildAssembler/BuildAssemblerLibrary/BuildAssemblerLibrary.csproj.vspscc @@ -0,0 +1,10 @@ +"" +{ +"FILE_VERSION" = "9237" +"ENLISTMENT_CHOICE" = "NEVER" +"PROJECT_FILE_RELATIVE_PATH" = "" +"NUMBER_OF_EXCLUDED_FILES" = "0" +"ORIGINAL_PROJECT_FILE_PATH" = "" +"NUMBER_OF_NESTED_PROJECTS" = "0" +"SOURCE_CONTROL_SETTINGS_PROVIDER" = "PROVIDER" +} diff --git a/tools/Sandcastle/Source/BuildAssembler/BuildAssemblerLibrary/BuildComponent.cs b/tools/Sandcastle/Source/BuildAssembler/BuildAssemblerLibrary/BuildComponent.cs new file mode 100644 index 0000000..bb211b9 --- /dev/null +++ b/tools/Sandcastle/Source/BuildAssembler/BuildAssemblerLibrary/BuildComponent.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// +using System; +using System.Collections.Generic; +using System.Configuration; +using System.IO; +using System.Reflection; +using System.Xml; +using System.Xml.XPath; + +namespace Microsoft.Ddue.Tools { + + public abstract class BuildComponent : IDisposable { + + protected BuildComponent (BuildAssembler assembler, XPathNavigator configuration) { + this.assembler = assembler; + WriteMessage(MessageLevel.Info, "Instantiating component."); + } + + public abstract void Apply (XmlDocument document, string key); + + public virtual void Apply (XmlDocument document) { + Apply(document, null); + } + + public virtual void Dispose () { + // override to do something + } + + // shared data + + private BuildAssembler assembler; + + public BuildAssembler BuildAssembler { + get { + return(assembler); + } + } + + //private MessageHandler handler; + + private static Dictionary<string,object> data = new Dictionary<string,object>(); + + protected static Dictionary<string,object> Data { + get { + return(data); + } + } + + // component messaging facility + + protected void OnComponentEvent (EventArgs e) { + assembler.OnComponentEvent(this.GetType(), e); + } + + protected void WriteMessage (MessageLevel level, string message) { + if (level == MessageLevel.Ignore) return; + MessageHandler handler = assembler.MessageHandler; + if (handler != null) handler(this.GetType(), level, message); + } + + } + + public enum MessageLevel { + Ignore, // don't show at all + Info, // informational message + Warn, // a minor problem occured + Error // a major problem occured + } + + + public delegate void MessageHandler (Type component, MessageLevel level, string message); + + +} diff --git a/tools/Sandcastle/Source/BuildAssembler/BuildAssemblerLibrary/BuildComponentUtilities.cs b/tools/Sandcastle/Source/BuildAssembler/BuildAssemblerLibrary/BuildComponentUtilities.cs new file mode 100644 index 0000000..b64ae07 --- /dev/null +++ b/tools/Sandcastle/Source/BuildAssembler/BuildAssemblerLibrary/BuildComponentUtilities.cs @@ -0,0 +1,143 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// +using System; +using System.Text; +using System.Xml; +using System.Xml.Xsl; +using System.Xml.XPath; +using System.Diagnostics; +using System.Collections.Generic; + +namespace Microsoft.Ddue.Tools { + + public static class BuildComponentUtilities { + + // get the message strings from an exception + + public static string GetExceptionMessage (Exception e) { + if (e == null) throw new ArgumentNullException("e"); + + string message = e.Message; + + XmlException xmlE = e as XmlException; + if (xmlE != null) { + message = String.Format("{0} (LineNumber: {1}; LinePosition: {2}; SourceUri: '{3}')", message, xmlE.LineNumber, xmlE.LinePosition, xmlE.SourceUri); + } + + XsltException xslE = e as XsltException; + if (xslE != null) { + message = String.Format("{0} (LineNumber: {1}; LinePosition: {2}; SourceUri: '{3}')", message, xslE.LineNumber, xslE.LinePosition, xslE.SourceUri); + } + + if (e.InnerException != null) message = String.Format("{0} {1}", message, GetExceptionMessage(e.InnerException)); + + return (message); + } + + // get InnerXml without changing the spacing + + public static string GetInnerXml (XPathNavigator node) { + + // check for null argument, and clone so we don't change input + if (node == null) throw new ArgumentNullException("node"); + XPathNavigator current = node.Clone(); + + // create appropriate settings for the output writer + XmlWriterSettings settings = new XmlWriterSettings(); + settings.ConformanceLevel = ConformanceLevel.Fragment; + settings.OmitXmlDeclaration = true; + + // construct a writer for our output + StringBuilder builder = new StringBuilder(); + XmlWriter writer = XmlWriter.Create(builder, settings); + + // write the output + bool writing = current.MoveToFirstChild(); + while (writing) { + current.WriteSubtree(writer); + writing = current.MoveToNext(); + } + + // finish up and return the result + writer.Close(); + return(builder.ToString()); + + } + + // get an array of nodes matching an XPath expression + + public static XPathNavigator[] ConvertNodeIteratorToArray (XPathNodeIterator iterator) { + XPathNavigator[] result = new XPathNavigator[iterator.Count]; + for (int i = 0; i < result.Length; i++) { + iterator.MoveNext(); + result[i] = iterator.Current.Clone(); + // clone is required or all entries will equal Current! + } + return(result); + } + + + /// <summary> + /// Returns the string result from evaluating an xpath expression against the given document and context. + /// </summary> + public static string EvalXPathExpr(IXPathNavigable doc, XPathExpression xpe, CustomContext c) { + XPathExpression t = xpe.Clone(); + t.SetContext(c); + return doc.CreateNavigator().Evaluate(t).ToString(); + } + + + /// <summary> + /// Returns the string result from evaluating an xpath expression against the given document and + /// context created from key/value pairs. + /// </summary> + /// <example> + /// string result = BuildComponentUtilities.EvalXPathExpr(doc, "concat($key, '.htm')", "key", "file"); + /// </example> + public static string EvalXPathExpr(IXPathNavigable doc, XPathExpression xpe, params string[] keyValuePairs) { + Debug.Assert(keyValuePairs.Length % 2 == 0); + CustomContext cc = new CustomContext(); + for (int i = 0; i < keyValuePairs.Length; i += 2) + cc[keyValuePairs[i]] = keyValuePairs[i + 1]; + return EvalXPathExpr(doc, xpe, cc); + } + + /// <summary> + /// Returns the path argument adjusted to be relative to the base path. Absolute path names will + /// be returned unchanged. + /// </summary> + /// <example> + /// path: "xxx/aaa/target.html" + /// basePath: "xxx/bbb/source.html" + /// result: "../aaa/target.html" + /// </example> + public static string GetRelativePath(string path, string basePath) { + // ignore absolute path names and an empty basePath + if (!string.IsNullOrEmpty(path) && path[0] != '/' && !string.IsNullOrEmpty(basePath)) { + + List<string> pathParts = new List<string>(path.Split('/')); + List<string> basePathParts = new List<string>(basePath.Split('/')); + + // remove the base path file name + if (basePathParts.Count > 0) + basePathParts.RemoveAt(basePathParts.Count - 1); + + // strip common base path bits + while (pathParts.Count > 0 && basePathParts.Count > 0 && + string.Equals(pathParts[0], basePathParts[0], StringComparison.CurrentCultureIgnoreCase)) { + pathParts.RemoveAt(0); + basePathParts.RemoveAt(0); + } + + // move up one level for each remaining base path part + foreach (string s in basePathParts) + pathParts.Insert(0, ".."); + + path = string.Join("/", pathParts.ToArray()); + } + + return path; + } + } + +}
\ No newline at end of file diff --git a/tools/Sandcastle/Source/BuildAssembler/BuildAssemblerLibrary/BuildContext.cs b/tools/Sandcastle/Source/BuildAssembler/BuildAssemblerLibrary/BuildContext.cs new file mode 100644 index 0000000..02bed62 --- /dev/null +++ b/tools/Sandcastle/Source/BuildAssembler/BuildAssemblerLibrary/BuildContext.cs @@ -0,0 +1,173 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// +using System; +using System.Collections.Generic; +using System.Xml; +using System.Xml.XPath; +using System.Xml.Xsl; + +namespace Microsoft.Ddue.Tools { + + public class BuildContext { + + private CustomContext context = new CustomContext(); + + // Namespace control + + public void AddNamespace (string prefix, string uri) { + context.AddNamespace(prefix, uri); + } + + public string LookupNamespace (string prefix) { + return( context.LookupNamespace(prefix) ); + } + + public bool RemoveNamespace (string prefix) { + string uri = LookupNamespace(prefix); + if (uri == null) { + return(false); + } else { + context.RemoveNamespace(prefix, uri); + return(true); + } + } + + public void ClearNamespaces () { + } + + // Variable control + + public void AddVariable (string name, string value) { + context[name] = value; + } + + public string LookupVariable (string name) { + return( context[name] ); + } + + public bool RemoveVariable (string name) { + return( context.ClearVariable(name) ); + } + + public void ClearVariables () { + context.ClearVariables(); + } + + public string this [string name] { + get { + return(context[name]); + } + set { + context[name] = value; + } + } + + // Function control + + // The context for use in XPath queries + + public XsltContext XsltContext { + get { + return(context); + } + } + + // Load data from config + + public void Load (XPathNavigator configuration) { + XPathNodeIterator namespaceNodes = configuration.Select("namespace"); + foreach (XPathNavigator namespaceNode in namespaceNodes) { + string prefixValue = namespaceNode.GetAttribute("prefix", String.Empty); + string uriValue = namespaceNode.GetAttribute("uri", String.Empty); + AddNamespace(prefixValue, uriValue); + } + } + + } + + public class CustomContext : XsltContext { + + public CustomContext() : base() {} + + // variable control + + private Dictionary<string, IXsltContextVariable> variables = new Dictionary<string,IXsltContextVariable>(); + + public string this [string variable] { + get { + return(variables[variable].Evaluate(this).ToString()); + } + set { + variables[variable] = new CustomVariable(value); + } + } + + public bool ClearVariable (string name) { + return( variables.Remove(name) ); + } + + public void ClearVariables () { + variables.Clear(); + } + + // Implementation of XsltContext methods + + public override IXsltContextVariable ResolveVariable (string prefix, string name) { + return( variables[name] ); + } + + public override IXsltContextFunction ResolveFunction (string prefix, string name, XPathResultType[] argumentTypes) { + throw new NotImplementedException(); + } + + public override int CompareDocument (string baseUri, string nextBaseUri) { + return(0); + } + + public override bool Whitespace { + get { + return(true); + } + } + + public override bool PreserveWhitespace (XPathNavigator node) { + return(true); + } + + } + + + internal struct CustomVariable : IXsltContextVariable { + + public CustomVariable (string value) { + this.value = value; + } + + private string value; + + public bool IsLocal { + get { + return(false); + } + } + + public bool IsParam { + get { + return(false); + } + } + + public XPathResultType VariableType { + get { + return(XPathResultType.String); + } + } + + public Object Evaluate (XsltContext context) { + return(value); + } + + } + + +}
\ No newline at end of file diff --git a/tools/Sandcastle/Source/BuildAssembler/BuildAssemblerLibrary/Microsoft.Ddue.Tools.BuildAssembler.asmmeta b/tools/Sandcastle/Source/BuildAssembler/BuildAssemblerLibrary/Microsoft.Ddue.Tools.BuildAssembler.asmmeta new file mode 100644 index 0000000..c799064 --- /dev/null +++ b/tools/Sandcastle/Source/BuildAssembler/BuildAssemblerLibrary/Microsoft.Ddue.Tools.BuildAssembler.asmmeta @@ -0,0 +1,281 @@ +.assembly extern System.Xml +{ + .publickeytoken = (B7 7A 5C 56 19 34 E0 89) +} +.assembly extern mscorlib +{ + .publickeytoken = (B7 7A 5C 56 19 34 E0 89) +} +.assembly Microsoft.Ddue.Tools.BuildAssembler +{ + .custom instance void [mscorlib]System.CLSCompliantAttribute::.ctor(bool) = { bool(false) } + .custom instance void [mscorlib]System.Runtime.InteropServices.ComVisibleAttribute::.ctor(bool) = { bool(false) } + .publickey = (00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 00 24 00 00 52 53 41 31 00 04 00 00 01 00 01 00 EF 09 EE D7 93 0B 34 BA 88 83 E7 DB 9F 08 F5 DF A0 D9 F1 7A 97 8E 98 F3 99 03 36 B2 2A 75 D6 BB 2C 25 90 6C 4F 4E 5D 42 60 00 A9 22 00 A9 CE FE 3F 5E C4 22 BA 1E FF 47 7D C4 14 E7 52 C3 30 07 1C 66 1C 58 3F 28 48 0C 03 35 94 CE 5F A5 FC 44 94 D2 A4 42 95 E5 A3 3E AD B2 FD FF 45 13 77 FD BE 62 48 38 EF 02 BF 22 54 00 56 5D DB DA 10 D8 7E 77 F9 7F 9F 20 60 11 4B 49 3A 4D 62 FE C3 C3) + .hash algorithm 0x00008004 +} +.namespace Microsoft.Ddue.Tools +{ + .class public BuildAssembler + extends [mscorlib]System.Object + { + .method public hidebysig specialname + instance void .ctor() + { + ret + } + .method public hidebysig specialname + instance void .ctor(class Microsoft.Ddue.Tools.MessageHandler messageHandler) + { + ret + } + .method public hidebysig + instance int32 Apply(class [mscorlib]'System.Collections.Generic.IEnumerable`1'<class Microsoft.Ddue.Tools.BuildContext> manifest) + { + ret + } + .method public hidebysig + instance class [mscorlib]'System.Collections.Generic.IEnumerable`1'<class Microsoft.Ddue.Tools.BuildContext> GetFileManifestBuildContextEnumerator(string manifestFilename) + { + ret + } + .method public hidebysig + instance bool LoadComponentsFromConfiguration(class [System.Xml]System.Xml.XPath.XPathDocument configuration) + { + ret + } + .method public hidebysig + instance void WriteMessage(valuetype Microsoft.Ddue.Tools.MessageLevel level, string message) + { + ret + } + .method public static hidebysig + void WriteComponentMessageToConsole(class [mscorlib]System.Type 'type', valuetype Microsoft.Ddue.Tools.MessageLevel level, string message) + { + ret + } + .field public class [mscorlib]'System.Collections.Generic.List`1'<class Microsoft.Ddue.Tools.BuildComponent> components + } + .class public abstract BuildComponent + extends [mscorlib]System.Object + { + .method family hidebysig specialname + instance void .ctor(class [System.Xml]System.Xml.XPath.XPathNavigator configuration) + { + ret + } + .method public virtual hidebysig newslot abstract + instance void Apply(class [System.Xml]System.Xml.XmlDocument document, string key) + { + } + .method public virtual hidebysig newslot + instance void Apply(class [System.Xml]System.Xml.XmlDocument document) + { + ret + } + .method family static hidebysig specialname + class [mscorlib]'System.Collections.Generic.Dictionary`2'<string,object> get_Data() + { + ret + } + .method public static hidebysig specialname + class Microsoft.Ddue.Tools.MessageHandler get_MessageHandler() + { + ret + } + .method public static hidebysig specialname + void set_MessageHandler(class Microsoft.Ddue.Tools.MessageHandler 'value') + { + ret + } + .method family hidebysig + instance void WriteMessage(valuetype Microsoft.Ddue.Tools.MessageLevel level, string message) + { + ret + } + .method public static hidebysig + class [mscorlib]'System.Collections.Generic.List`1'<class Microsoft.Ddue.Tools.BuildComponent> LoadComponents(class [System.Xml]System.Xml.XPath.XPathNavigator configuration) + { + ret + } + .property class [mscorlib]'System.Collections.Generic.Dictionary`2'<string,object> Data() + { + .get class [mscorlib]'System.Collections.Generic.Dictionary`2'<string,object> Microsoft.Ddue.Tools.BuildComponent::get_Data() + } + .property class Microsoft.Ddue.Tools.MessageHandler MessageHandler() + { + .get class Microsoft.Ddue.Tools.MessageHandler Microsoft.Ddue.Tools.BuildComponent::get_MessageHandler() + .set void Microsoft.Ddue.Tools.BuildComponent::set_MessageHandler(class Microsoft.Ddue.Tools.MessageHandler) + } + } + .class public BuildContext + extends [mscorlib]System.Object + { + .custom instance void [mscorlib]System.Reflection.DefaultMemberAttribute::.ctor(string) = { string('Item') } + .method public hidebysig + instance void AddNamespace(string prefix, string uri) + { + ret + } + .method public hidebysig + instance string LookupNamespace(string prefix) + { + ret + } + .method public hidebysig + instance bool RemoveNamespace(string prefix) + { + ret + } + .method public hidebysig + instance void ClearNamespaces() + { + ret + } + .method public hidebysig + instance void AddVariable(string name, string 'value') + { + ret + } + .method public hidebysig + instance string LookupVariable(string name) + { + ret + } + .method public hidebysig + instance bool RemoveVariable(string name) + { + ret + } + .method public hidebysig + instance void ClearVariables() + { + ret + } + .method public hidebysig specialname + instance string get_Item(string name) + { + ret + } + .method public hidebysig specialname + instance void set_Item(string name, string 'value') + { + ret + } + .method public hidebysig specialname + instance class [System.Xml]System.Xml.Xsl.XsltContext get_QueryContext() + { + ret + } + .method public hidebysig specialname + instance void .ctor() + { + ret + } + .property instance string Item(string) + { + .get instance string Microsoft.Ddue.Tools.BuildContext::get_Item(string) + .set instance void Microsoft.Ddue.Tools.BuildContext::set_Item(string, string) + } + .property instance class [System.Xml]System.Xml.Xsl.XsltContext QueryContext() + { + .get instance class [System.Xml]System.Xml.Xsl.XsltContext Microsoft.Ddue.Tools.BuildContext::get_QueryContext() + } + } + .class public CustomContext + extends [System.Xml]System.Xml.Xsl.XsltContext + { + .custom instance void [mscorlib]System.Reflection.DefaultMemberAttribute::.ctor(string) = { string('Item') } + .method public hidebysig specialname + instance void .ctor() + { + ret + } + .method public hidebysig specialname + instance string get_Item(string variable) + { + ret + } + .method public hidebysig specialname + instance void set_Item(string variable, string 'value') + { + ret + } + .method public hidebysig + instance bool ClearVariable(string name) + { + ret + } + .method public hidebysig + instance void ClearVariables() + { + ret + } + .method public virtual hidebysig + instance class [System.Xml]System.Xml.Xsl.IXsltContextVariable ResolveVariable(string prefix, string name) + { + ret + } + .method public virtual hidebysig + instance class [System.Xml]System.Xml.Xsl.IXsltContextFunction ResolveFunction(string prefix, string name, valuetype [System.Xml]System.Xml.XPath.XPathResultType[] argumentTypes) + { + ret + } + .method public virtual hidebysig + instance int32 CompareDocument(string baseUri, string nextBaseUri) + { + ret + } + .method public virtual hidebysig specialname + instance bool get_Whitespace() + { + ret + } + .method public virtual hidebysig + instance bool PreserveWhitespace(class [System.Xml]System.Xml.XPath.XPathNavigator node) + { + ret + } + .property instance string Item(string) + { + .get instance string Microsoft.Ddue.Tools.CustomContext::get_Item(string) + .set instance void Microsoft.Ddue.Tools.CustomContext::set_Item(string, string) + } + .property instance bool Whitespace() + { + .get instance bool Microsoft.Ddue.Tools.CustomContext::get_Whitespace() + } + } + .class public sealed MessageHandler + extends [mscorlib]System.MulticastDelegate + { + .method public hidebysig specialname + instance void .ctor(object 'object', native int 'method') + runtime + { + } + .method public virtual hidebysig newslot + instance void Invoke(class [mscorlib]System.Type component, valuetype Microsoft.Ddue.Tools.MessageLevel level, string message) + runtime + { + } + .method public virtual hidebysig newslot + instance class [mscorlib]System.IAsyncResult BeginInvoke(class [mscorlib]System.Type component, valuetype Microsoft.Ddue.Tools.MessageLevel level, string message, class [mscorlib]System.AsyncCallback callback, object 'object') + runtime + { + } + .method public virtual hidebysig newslot + instance void EndInvoke(class [mscorlib]System.IAsyncResult result) + runtime + { + } + } + .class public sealed MessageLevel + extends [mscorlib]System.Enum + { + .field public rtspecialname specialname int32 value__ + .field static public literal valuetype Microsoft.Ddue.Tools.MessageLevel Error = int32(0x00000002) + .field static public literal valuetype Microsoft.Ddue.Tools.MessageLevel Info = int32(0x00000000) + .field static public literal valuetype Microsoft.Ddue.Tools.MessageLevel Warn = int32(0x00000001) + } +} + diff --git a/tools/Sandcastle/Source/BuildAssembler/BuildAssemblerLibrary/Microsoft.Ddue.Tools.BuildAssemblerLibrary.asmmeta b/tools/Sandcastle/Source/BuildAssembler/BuildAssemblerLibrary/Microsoft.Ddue.Tools.BuildAssemblerLibrary.asmmeta new file mode 100644 index 0000000..dbd4239 --- /dev/null +++ b/tools/Sandcastle/Source/BuildAssembler/BuildAssemblerLibrary/Microsoft.Ddue.Tools.BuildAssemblerLibrary.asmmeta @@ -0,0 +1,281 @@ +.assembly extern System.Xml +{ + .publickeytoken = (B7 7A 5C 56 19 34 E0 89) +} +.assembly extern mscorlib +{ + .publickeytoken = (B7 7A 5C 56 19 34 E0 89) +} +.assembly Microsoft.Ddue.Tools.BuildAssemblerLibrary +{ + .custom instance void [mscorlib]System.CLSCompliantAttribute::.ctor(bool) = { bool(false) } + .custom instance void [mscorlib]System.Runtime.InteropServices.ComVisibleAttribute::.ctor(bool) = { bool(false) } + .publickey = (00 24 00 00 04 80 00 00 94 00 00 00 06 02 00 00 00 24 00 00 52 53 41 31 00 04 00 00 01 00 01 00 EF 09 EE D7 93 0B 34 BA 88 83 E7 DB 9F 08 F5 DF A0 D9 F1 7A 97 8E 98 F3 99 03 36 B2 2A 75 D6 BB 2C 25 90 6C 4F 4E 5D 42 60 00 A9 22 00 A9 CE FE 3F 5E C4 22 BA 1E FF 47 7D C4 14 E7 52 C3 30 07 1C 66 1C 58 3F 28 48 0C 03 35 94 CE 5F A5 FC 44 94 D2 A4 42 95 E5 A3 3E AD B2 FD FF 45 13 77 FD BE 62 48 38 EF 02 BF 22 54 00 56 5D DB DA 10 D8 7E 77 F9 7F 9F 20 60 11 4B 49 3A 4D 62 FE C3 C3) + .hash algorithm 0x00008004 +} +.namespace Microsoft.Ddue.Tools +{ + .class public BuildAssembler + extends [mscorlib]System.Object + { + .method public hidebysig specialname + instance void .ctor() + { + ret + } + .method public hidebysig specialname + instance void .ctor(class Microsoft.Ddue.Tools.MessageHandler messageHandler) + { + ret + } + .method public hidebysig + instance int32 Apply(class [mscorlib]'System.Collections.Generic.IEnumerable`1'<class Microsoft.Ddue.Tools.BuildContext> manifest) + { + ret + } + .method public hidebysig + instance class [mscorlib]'System.Collections.Generic.IEnumerable`1'<class Microsoft.Ddue.Tools.BuildContext> GetFileManifestBuildContextEnumerator(string manifestFilename) + { + ret + } + .method public hidebysig + instance bool LoadComponentsFromConfiguration(class [System.Xml]System.Xml.XPath.XPathDocument configuration) + { + ret + } + .method public hidebysig + instance void WriteMessage(valuetype Microsoft.Ddue.Tools.MessageLevel level, string message) + { + ret + } + .method public static hidebysig + void WriteComponentMessageToConsole(class [mscorlib]System.Type 'type', valuetype Microsoft.Ddue.Tools.MessageLevel level, string message) + { + ret + } + .field public class [mscorlib]'System.Collections.Generic.List`1'<class Microsoft.Ddue.Tools.BuildComponent> components + } + .class public abstract BuildComponent + extends [mscorlib]System.Object + { + .method family hidebysig specialname + instance void .ctor(class [System.Xml]System.Xml.XPath.XPathNavigator configuration) + { + ret + } + .method public virtual hidebysig newslot abstract + instance void Apply(class [System.Xml]System.Xml.XmlDocument document, string key) + { + } + .method public virtual hidebysig newslot + instance void Apply(class [System.Xml]System.Xml.XmlDocument document) + { + ret + } + .method family static hidebysig specialname + class [mscorlib]'System.Collections.Generic.Dictionary`2'<string,object> get_Data() + { + ret + } + .method public static hidebysig specialname + class Microsoft.Ddue.Tools.MessageHandler get_MessageHandler() + { + ret + } + .method public static hidebysig specialname + void set_MessageHandler(class Microsoft.Ddue.Tools.MessageHandler 'value') + { + ret + } + .method family hidebysig + instance void WriteMessage(valuetype Microsoft.Ddue.Tools.MessageLevel level, string message) + { + ret + } + .method public static hidebysig + class [mscorlib]'System.Collections.Generic.List`1'<class Microsoft.Ddue.Tools.BuildComponent> LoadComponents(class [System.Xml]System.Xml.XPath.XPathNavigator configuration) + { + ret + } + .property class [mscorlib]'System.Collections.Generic.Dictionary`2'<string,object> Data() + { + .get class [mscorlib]'System.Collections.Generic.Dictionary`2'<string,object> Microsoft.Ddue.Tools.BuildComponent::get_Data() + } + .property class Microsoft.Ddue.Tools.MessageHandler MessageHandler() + { + .get class Microsoft.Ddue.Tools.MessageHandler Microsoft.Ddue.Tools.BuildComponent::get_MessageHandler() + .set void Microsoft.Ddue.Tools.BuildComponent::set_MessageHandler(class Microsoft.Ddue.Tools.MessageHandler) + } + } + .class public BuildContext + extends [mscorlib]System.Object + { + .custom instance void [mscorlib]System.Reflection.DefaultMemberAttribute::.ctor(string) = { string('Item') } + .method public hidebysig + instance void AddNamespace(string prefix, string uri) + { + ret + } + .method public hidebysig + instance string LookupNamespace(string prefix) + { + ret + } + .method public hidebysig + instance bool RemoveNamespace(string prefix) + { + ret + } + .method public hidebysig + instance void ClearNamespaces() + { + ret + } + .method public hidebysig + instance void AddVariable(string name, string 'value') + { + ret + } + .method public hidebysig + instance string LookupVariable(string name) + { + ret + } + .method public hidebysig + instance bool RemoveVariable(string name) + { + ret + } + .method public hidebysig + instance void ClearVariables() + { + ret + } + .method public hidebysig specialname + instance string get_Item(string name) + { + ret + } + .method public hidebysig specialname + instance void set_Item(string name, string 'value') + { + ret + } + .method public hidebysig specialname + instance class [System.Xml]System.Xml.Xsl.XsltContext get_QueryContext() + { + ret + } + .method public hidebysig specialname + instance void .ctor() + { + ret + } + .property instance string Item(string) + { + .get instance string Microsoft.Ddue.Tools.BuildContext::get_Item(string) + .set instance void Microsoft.Ddue.Tools.BuildContext::set_Item(string, string) + } + .property instance class [System.Xml]System.Xml.Xsl.XsltContext QueryContext() + { + .get instance class [System.Xml]System.Xml.Xsl.XsltContext Microsoft.Ddue.Tools.BuildContext::get_QueryContext() + } + } + .class public CustomContext + extends [System.Xml]System.Xml.Xsl.XsltContext + { + .custom instance void [mscorlib]System.Reflection.DefaultMemberAttribute::.ctor(string) = { string('Item') } + .method public hidebysig specialname + instance void .ctor() + { + ret + } + .method public hidebysig specialname + instance string get_Item(string variable) + { + ret + } + .method public hidebysig specialname + instance void set_Item(string variable, string 'value') + { + ret + } + .method public hidebysig + instance bool ClearVariable(string name) + { + ret + } + .method public hidebysig + instance void ClearVariables() + { + ret + } + .method public virtual hidebysig + instance class [System.Xml]System.Xml.Xsl.IXsltContextVariable ResolveVariable(string prefix, string name) + { + ret + } + .method public virtual hidebysig + instance class [System.Xml]System.Xml.Xsl.IXsltContextFunction ResolveFunction(string prefix, string name, valuetype [System.Xml]System.Xml.XPath.XPathResultType[] argumentTypes) + { + ret + } + .method public virtual hidebysig + instance int32 CompareDocument(string baseUri, string nextBaseUri) + { + ret + } + .method public virtual hidebysig specialname + instance bool get_Whitespace() + { + ret + } + .method public virtual hidebysig + instance bool PreserveWhitespace(class [System.Xml]System.Xml.XPath.XPathNavigator node) + { + ret + } + .property instance string Item(string) + { + .get instance string Microsoft.Ddue.Tools.CustomContext::get_Item(string) + .set instance void Microsoft.Ddue.Tools.CustomContext::set_Item(string, string) + } + .property instance bool Whitespace() + { + .get instance bool Microsoft.Ddue.Tools.CustomContext::get_Whitespace() + } + } + .class public sealed MessageHandler + extends [mscorlib]System.MulticastDelegate + { + .method public hidebysig specialname + instance void .ctor(object 'object', native int 'method') + runtime + { + } + .method public virtual hidebysig newslot + instance void Invoke(class [mscorlib]System.Type component, valuetype Microsoft.Ddue.Tools.MessageLevel level, string message) + runtime + { + } + .method public virtual hidebysig newslot + instance class [mscorlib]System.IAsyncResult BeginInvoke(class [mscorlib]System.Type component, valuetype Microsoft.Ddue.Tools.MessageLevel level, string message, class [mscorlib]System.AsyncCallback callback, object 'object') + runtime + { + } + .method public virtual hidebysig newslot + instance void EndInvoke(class [mscorlib]System.IAsyncResult result) + runtime + { + } + } + .class public sealed MessageLevel + extends [mscorlib]System.Enum + { + .field public rtspecialname specialname int32 value__ + .field static public literal valuetype Microsoft.Ddue.Tools.MessageLevel Error = int32(0x00000002) + .field static public literal valuetype Microsoft.Ddue.Tools.MessageLevel Info = int32(0x00000000) + .field static public literal valuetype Microsoft.Ddue.Tools.MessageLevel Warn = int32(0x00000001) + } +} + diff --git a/tools/Sandcastle/Source/BuildAssembler/BuildAssemblerLibrary/Properties/AssemblyInfo.cs b/tools/Sandcastle/Source/BuildAssembler/BuildAssemblerLibrary/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..f0aedd7 --- /dev/null +++ b/tools/Sandcastle/Source/BuildAssembler/BuildAssemblerLibrary/Properties/AssemblyInfo.cs @@ -0,0 +1,37 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// General Information about an assembly is controlled through the following +// set of attributes. Change these attribute values to modify the information +// associated with an assembly. +[assembly: AssemblyTitle("BuildAssemblerLibrary")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("Microsoft")] +[assembly: AssemblyProduct("BuildAssemblerLibrary")] +[assembly: AssemblyCopyright("Copyright © Microsoft 2006")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] + +// Setting ComVisible to false makes the types in this assembly not visible +// to COM components. If you need to access a type in this assembly from +// COM, set the ComVisible attribute to true on that type. +[assembly: ComVisible(false)] + +// The following GUID is for the ID of the typelib if this project is exposed to COM +[assembly: Guid("8dc79b50-d46d-4e02-b2e6-43abc681e189")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Revision and Build Numbers +// by using the '*' as shown below: +[assembly: AssemblyVersion("2.4.10522.00")] +[assembly: AssemblyFileVersion("2.4.10522.00")] diff --git a/tools/Sandcastle/Source/BuildAssembler/BuildAssemblerLibrary/makefile b/tools/Sandcastle/Source/BuildAssembler/BuildAssemblerLibrary/makefile new file mode 100644 index 0000000..5acbbd2 --- /dev/null +++ b/tools/Sandcastle/Source/BuildAssembler/BuildAssemblerLibrary/makefile @@ -0,0 +1 @@ +!INCLUDE $(NTMAKEENV)\makefile.def diff --git a/tools/Sandcastle/Source/BuildAssembler/BuildAssemblerLibrary/makefile.inc b/tools/Sandcastle/Source/BuildAssembler/BuildAssemblerLibrary/makefile.inc new file mode 100644 index 0000000..32f7350 --- /dev/null +++ b/tools/Sandcastle/Source/BuildAssembler/BuildAssemblerLibrary/makefile.inc @@ -0,0 +1,2 @@ +!INCLUDE $(INETROOT)\build\makefile.inc + diff --git a/tools/Sandcastle/Source/BuildAssembler/BuildAssemblerLibrary/placefile b/tools/Sandcastle/Source/BuildAssembler/BuildAssemblerLibrary/placefile new file mode 100644 index 0000000..1db2347 --- /dev/null +++ b/tools/Sandcastle/Source/BuildAssembler/BuildAssemblerLibrary/placefile @@ -0,0 +1 @@ +Microsoft.Ddue.Tools.BuildAssemblerLibrary.dll Manifold |