summaryrefslogtreecommitdiffstats
path: root/tools/Sandcastle/Source/CommandLine
diff options
context:
space:
mode:
authorAndrew Arnott <andrewarnott@gmail.com>2009-09-20 21:18:59 -0700
committerAndrew Arnott <andrewarnott@gmail.com>2009-09-21 08:06:22 -0700
commitbbe3f9cc9c8a1e5909273c1a162a63ea7a66afd8 (patch)
treec91f66e642c4d26fca266e226b3f2765f546d700 /tools/Sandcastle/Source/CommandLine
parent627014f0bbc3fd576277375e70f8391d150b0a67 (diff)
downloadDotNetOpenAuth-bbe3f9cc9c8a1e5909273c1a162a63ea7a66afd8.zip
DotNetOpenAuth-bbe3f9cc9c8a1e5909273c1a162a63ea7a66afd8.tar.gz
DotNetOpenAuth-bbe3f9cc9c8a1e5909273c1a162a63ea7a66afd8.tar.bz2
Switched out the Sandcastle binaries for the source code.
Diffstat (limited to 'tools/Sandcastle/Source/CommandLine')
-rw-r--r--tools/Sandcastle/Source/CommandLine/BooleanOption.cs34
-rw-r--r--tools/Sandcastle/Source/CommandLine/CommandLine.csproj92
-rw-r--r--tools/Sandcastle/Source/CommandLine/CommandLine.csproj.vspscc10
-rw-r--r--tools/Sandcastle/Source/CommandLine/ConsoleApplication.cs62
-rw-r--r--tools/Sandcastle/Source/CommandLine/ListOption.cs45
-rw-r--r--tools/Sandcastle/Source/CommandLine/LogLevel.cs16
-rw-r--r--tools/Sandcastle/Source/CommandLine/Makefile.org12
-rw-r--r--tools/Sandcastle/Source/CommandLine/Microsoft.Ddue.Tools.CommandLine.asmmeta379
-rw-r--r--tools/Sandcastle/Source/CommandLine/Option.cs94
-rw-r--r--tools/Sandcastle/Source/CommandLine/OptionCollection.cs180
-rw-r--r--tools/Sandcastle/Source/CommandLine/OutputWriter.cs25
-rw-r--r--tools/Sandcastle/Source/CommandLine/ParseArgumentsResult.cs61
-rw-r--r--tools/Sandcastle/Source/CommandLine/ParseResult.cs16
-rw-r--r--tools/Sandcastle/Source/CommandLine/Properties/AssemblyInfo.cs38
-rw-r--r--tools/Sandcastle/Source/CommandLine/StringOption.cs46
-rw-r--r--tools/Sandcastle/Source/CommandLine/SwitchOption.cs29
-rw-r--r--tools/Sandcastle/Source/CommandLine/makefile1
-rw-r--r--tools/Sandcastle/Source/CommandLine/makefile.inc2
-rw-r--r--tools/Sandcastle/Source/CommandLine/placefile1
19 files changed, 1143 insertions, 0 deletions
diff --git a/tools/Sandcastle/Source/CommandLine/BooleanOption.cs b/tools/Sandcastle/Source/CommandLine/BooleanOption.cs
new file mode 100644
index 0000000..93ea9fd
--- /dev/null
+++ b/tools/Sandcastle/Source/CommandLine/BooleanOption.cs
@@ -0,0 +1,34 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+using System;
+using System.IO;
+using System.Collections.Generic;
+
+namespace Microsoft.Ddue.Tools.CommandLine {
+
+ public sealed class BooleanOption : Option {
+
+ public BooleanOption(string name) : base(name) { }
+
+ public BooleanOption(string name, string description) : base(name, description) { }
+
+ internal override ParseResult ParseArgument(string argument) {
+ if ((argument != "+") && (argument != "-")) return (ParseResult.MalformedArgument);
+ if (present) return (ParseResult.MultipleOccurance);
+ present = true;
+ if (argument == "+") {
+ value = true;
+ } else {
+ value = false;
+ }
+ return (ParseResult.Success);
+ }
+
+ internal override void WriteTemplate(TextWriter writer) {
+ writer.WriteLine("/{0}+|-", Name);
+ }
+
+ }
+
+}
diff --git a/tools/Sandcastle/Source/CommandLine/CommandLine.csproj b/tools/Sandcastle/Source/CommandLine/CommandLine.csproj
new file mode 100644
index 0000000..fc69acb
--- /dev/null
+++ b/tools/Sandcastle/Source/CommandLine/CommandLine.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>{6CF7CA42-3706-4F6B-A2B4-10EF3F511888}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>CommandLine</RootNamespace>
+ <AssemblyName>CommandLine</AssemblyName>
+ <SignAssembly>false</SignAssembly>
+ <AssemblyOriginatorKeyFile>../../key.snk</AssemblyOriginatorKeyFile>
+ <SccProjectName>
+ </SccProjectName>
+ <SccLocalPath>
+ </SccLocalPath>
+ <SccAuxPath>
+ </SccAuxPath>
+ <SccProvider>
+ </SccProvider>
+ <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' ">
+ <OutputPath>bin\Sandcastle\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <Optimize>true</Optimize>
+ <DebugType>pdbonly</DebugType>
+ <PlatformTarget>AnyCPU</PlatformTarget>
+ <CodeAnalysisUseTypeNameInSuppression>true</CodeAnalysisUseTypeNameInSuppression>
+ <CodeAnalysisModuleSuppressionsFile>GlobalSuppressions.cs</CodeAnalysisModuleSuppressionsFile>
+ <ErrorReport>prompt</ErrorReport>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="BooleanOption.cs" />
+ <Compile Include="ConsoleApplication.cs" />
+ <Compile Include="ListOption.cs" />
+ <Compile Include="LogLevel.cs" />
+ <Compile Include="Option.cs" />
+ <Compile Include="OptionCollection.cs" />
+ <Compile Include="OutputWriter.cs" />
+ <Compile Include="ParseArgumentsResult.cs" />
+ <Compile Include="ParseResult.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="StringOption.cs" />
+ <Compile Include="SwitchOption.cs" />
+ </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/CommandLine/CommandLine.csproj.vspscc b/tools/Sandcastle/Source/CommandLine/CommandLine.csproj.vspscc
new file mode 100644
index 0000000..b6d3289
--- /dev/null
+++ b/tools/Sandcastle/Source/CommandLine/CommandLine.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/CommandLine/ConsoleApplication.cs b/tools/Sandcastle/Source/CommandLine/ConsoleApplication.cs
new file mode 100644
index 0000000..b1b653e
--- /dev/null
+++ b/tools/Sandcastle/Source/CommandLine/ConsoleApplication.cs
@@ -0,0 +1,62 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+using System;
+using System.IO;
+using System.Reflection;
+using System.Xml.XPath;
+
+namespace Microsoft.Ddue.Tools.CommandLine {
+
+ public static class ConsoleApplication {
+
+ public static XPathDocument GetConfigurationFile() {
+ return (GetConfigurationFile(Assembly.GetCallingAssembly().Location + ".config"));
+ }
+
+ public static XPathDocument GetConfigurationFile(string file) {
+ return (new XPathDocument(file));
+ }
+
+ public static string[] GetFiles(string filePattern) {
+
+ // get the full path to the relevent directory
+ string directoryPath = Path.GetDirectoryName(filePattern);
+ if ((directoryPath == null) || (directoryPath.Length == 0)) directoryPath = Environment.CurrentDirectory;
+ directoryPath = Path.GetFullPath(directoryPath);
+
+ // get the file name, which may contain wildcards
+ string filePath = Path.GetFileName(filePattern);
+
+ // look up the files and load them
+ string[] files = Directory.GetFiles(directoryPath, filePath);
+
+ return (files);
+
+ }
+
+ // Write the name, version, and copyright information of the calling assembly
+
+ public static void WriteBanner() {
+ Assembly application = Assembly.GetCallingAssembly();
+ AssemblyName applicationData = application.GetName();
+ Console.WriteLine("{0} (v{1})", applicationData.Name, applicationData.Version);
+ Object[] copyrightAttributes = application.GetCustomAttributes(typeof(AssemblyCopyrightAttribute), true);
+ foreach (AssemblyCopyrightAttribute copyrightAttribute in copyrightAttributes) {
+ Console.WriteLine(copyrightAttribute.Copyright);
+ }
+ }
+
+ public static void WriteMessage(LogLevel level, string message) {
+ Console.WriteLine("{0}: {1}", level, message);
+ }
+
+ public static void WriteMessage(LogLevel level, string format, params object[] arg)
+ {
+ Console.Write("{0}: ", level);
+ Console.WriteLine(format, arg);
+ }
+
+ }
+
+}
diff --git a/tools/Sandcastle/Source/CommandLine/ListOption.cs b/tools/Sandcastle/Source/CommandLine/ListOption.cs
new file mode 100644
index 0000000..bc04851
--- /dev/null
+++ b/tools/Sandcastle/Source/CommandLine/ListOption.cs
@@ -0,0 +1,45 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+using System;
+using System.IO;
+using System.Collections.Generic;
+
+namespace Microsoft.Ddue.Tools.CommandLine {
+
+ public class ListOption : Option {
+
+ private string template = "xxxx";
+
+ private List < string > values = new List < string >();
+
+ public ListOption(string name) : base(name) { }
+
+ public ListOption(string name, string description) : base(name, description) { }
+
+ public ListOption(string name, string description, string template) : base(name, description) {
+ this.template = template;
+ }
+
+ public override Object Value {
+ get {
+ return (values.ToArray());
+ }
+ }
+
+ internal override ParseResult ParseArgument(string argument) {
+ if (argument.Length == 0) return (ParseResult.MalformedArgument);
+ if (argument[0] != ':') return (ParseResult.MalformedArgument);
+ present = true;
+ string[] atoms = argument.Substring(1).Split(',');
+ foreach (string atom in atoms) values.Add(atom);
+ return (ParseResult.Success);
+ }
+
+ internal override void WriteTemplate(TextWriter writer) {
+ writer.WriteLine("/{0}:{1}[,{1},{1},...]", Name, template);
+ }
+
+ }
+
+}
diff --git a/tools/Sandcastle/Source/CommandLine/LogLevel.cs b/tools/Sandcastle/Source/CommandLine/LogLevel.cs
new file mode 100644
index 0000000..223796e
--- /dev/null
+++ b/tools/Sandcastle/Source/CommandLine/LogLevel.cs
@@ -0,0 +1,16 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+using System;
+using System.IO;
+using System.Reflection;
+using System.Xml.XPath;
+
+namespace Microsoft.Ddue.Tools.CommandLine {
+
+
+ public enum LogLevel {
+ Info, Warn, Error
+ }
+
+}
diff --git a/tools/Sandcastle/Source/CommandLine/Makefile.org b/tools/Sandcastle/Source/CommandLine/Makefile.org
new file mode 100644
index 0000000..66c5d2b
--- /dev/null
+++ b/tools/Sandcastle/Source/CommandLine/Makefile.org
@@ -0,0 +1,12 @@
+FILES = Assembly.cs OptionCollection.cs Options.cs ParseArgumentsResult.cs ParseResult.cs ConsoleApplication.cs
+
+CC = csc.exe
+
+all: TestOptions.exe Microsoft.Ddue.Tools.CommandLine.dll
+
+Microsoft.Ddue.Tools.CommandLine.dll: $(FILES)
+ $(CC) /t:library /out:Microsoft.Ddue.Tools.CommandLine.dll /keyfile:..\key.snk $(FILES)
+ copy Microsoft.Ddue.Tools.CommandLine.dll ..\..\ProductionTools
+
+TestOptions.exe: TestOptions.cs $(FILES)
+ $(CC) TestOptions.cs $(FILES)
diff --git a/tools/Sandcastle/Source/CommandLine/Microsoft.Ddue.Tools.CommandLine.asmmeta b/tools/Sandcastle/Source/CommandLine/Microsoft.Ddue.Tools.CommandLine.asmmeta
new file mode 100644
index 0000000..26db9b8
--- /dev/null
+++ b/tools/Sandcastle/Source/CommandLine/Microsoft.Ddue.Tools.CommandLine.asmmeta
@@ -0,0 +1,379 @@
+.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.CommandLine
+{
+ .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.CommandLine
+{
+ .class public sealed BooleanOption
+ extends Microsoft.Ddue.Tools.CommandLine.Option
+ {
+ .method public hidebysig specialname
+ instance void .ctor(string name)
+ {
+ ret
+ }
+ .method public hidebysig specialname
+ instance void .ctor(string name, string description)
+ {
+ ret
+ }
+ }
+ .class public abstract sealed ConsoleApplication
+ extends [mscorlib]System.Object
+ {
+ .method public static hidebysig
+ void WriteBanner()
+ {
+ ret
+ }
+ .method public static hidebysig
+ void WriteMessage(valuetype Microsoft.Ddue.Tools.CommandLine.LogLevel level, string message)
+ {
+ ret
+ }
+ .method public static hidebysig
+ class [System.Xml]System.Xml.XPath.XPathDocument GetConfigurationFile()
+ {
+ ret
+ }
+ .method public static hidebysig
+ class [System.Xml]System.Xml.XPath.XPathDocument GetConfigurationFile(string file)
+ {
+ ret
+ }
+ .method public static hidebysig
+ string[] GetFiles(string filePattern)
+ {
+ ret
+ }
+ }
+ .class public ListOption
+ extends Microsoft.Ddue.Tools.CommandLine.Option
+ {
+ .method public hidebysig specialname
+ instance void .ctor(string name)
+ {
+ ret
+ }
+ .method public hidebysig specialname
+ instance void .ctor(string name, string description)
+ {
+ ret
+ }
+ .method public hidebysig specialname
+ instance void .ctor(string name, string description, string template)
+ {
+ ret
+ }
+ .method public virtual hidebysig specialname
+ instance object get_Value()
+ {
+ ret
+ }
+ .property instance object Value()
+ {
+ .get instance object Microsoft.Ddue.Tools.CommandLine.ListOption::get_Value()
+ }
+ }
+ .class public sealed LogLevel
+ extends [mscorlib]System.Enum
+ {
+ .field public rtspecialname specialname int32 value__
+ .field static public literal valuetype Microsoft.Ddue.Tools.CommandLine.LogLevel Error = int32(0x00000002)
+ .field static public literal valuetype Microsoft.Ddue.Tools.CommandLine.LogLevel Info = int32(0x00000000)
+ .field static public literal valuetype Microsoft.Ddue.Tools.CommandLine.LogLevel Warn = int32(0x00000001)
+ }
+ .class public abstract Option
+ extends [mscorlib]System.Object
+ {
+ .method family hidebysig specialname
+ instance void .ctor(string name)
+ {
+ ret
+ }
+ .method family hidebysig specialname
+ instance void .ctor(string name, string description)
+ {
+ ret
+ }
+ .method family hidebysig specialname
+ instance void .ctor(string name, string description, bool required)
+ {
+ ret
+ }
+ .method public hidebysig specialname
+ instance string get_Name()
+ {
+ ret
+ }
+ .method public hidebysig specialname
+ instance void set_Name(string 'value')
+ {
+ ret
+ }
+ .method public hidebysig specialname
+ instance string get_Description()
+ {
+ ret
+ }
+ .method public hidebysig specialname
+ instance void set_Description(string 'value')
+ {
+ ret
+ }
+ .method public hidebysig specialname
+ instance bool get_IsRequired()
+ {
+ ret
+ }
+ .method public hidebysig specialname
+ instance void set_IsRequired(bool 'value')
+ {
+ ret
+ }
+ .method public virtual hidebysig newslot specialname
+ instance bool get_IsPresent()
+ {
+ ret
+ }
+ .method public virtual hidebysig newslot specialname
+ instance object get_Value()
+ {
+ ret
+ }
+ .field family bool present
+ .field family object 'value'
+ .property instance string Description()
+ {
+ .get instance string Microsoft.Ddue.Tools.CommandLine.Option::get_Description()
+ .set instance void Microsoft.Ddue.Tools.CommandLine.Option::set_Description(string)
+ }
+ .property instance bool IsPresent()
+ {
+ .get instance bool Microsoft.Ddue.Tools.CommandLine.Option::get_IsPresent()
+ }
+ .property instance bool IsRequired()
+ {
+ .get instance bool Microsoft.Ddue.Tools.CommandLine.Option::get_IsRequired()
+ .set instance void Microsoft.Ddue.Tools.CommandLine.Option::set_IsRequired(bool)
+ }
+ .property instance string Name()
+ {
+ .get instance string Microsoft.Ddue.Tools.CommandLine.Option::get_Name()
+ .set instance void Microsoft.Ddue.Tools.CommandLine.Option::set_Name(string)
+ }
+ .property instance object Value()
+ {
+ .get instance object Microsoft.Ddue.Tools.CommandLine.Option::get_Value()
+ }
+ }
+ .class public sealed OptionCollection
+ extends [mscorlib]System.Object
+ implements class [mscorlib]'System.Collections.Generic.ICollection`1'<class Microsoft.Ddue.Tools.CommandLine.Option>, [mscorlib]System.Collections.ICollection, class [mscorlib]'System.Collections.Generic.IEnumerable`1'<class Microsoft.Ddue.Tools.CommandLine.Option>, [mscorlib]System.Collections.IEnumerable
+ {
+ .custom instance void [mscorlib]System.Reflection.DefaultMemberAttribute::.ctor(string) = { string('Item') }
+ .method public hidebysig specialname
+ instance class Microsoft.Ddue.Tools.CommandLine.Option get_Item(string name)
+ {
+ ret
+ }
+ .method public final virtual hidebysig newslot specialname
+ instance int32 get_Count()
+ {
+ ret
+ }
+ .method public final virtual hidebysig newslot
+ instance void Add(class Microsoft.Ddue.Tools.CommandLine.Option option)
+ {
+ ret
+ }
+ .method public final virtual hidebysig newslot
+ instance bool Remove(class Microsoft.Ddue.Tools.CommandLine.Option option)
+ {
+ ret
+ }
+ .method public final virtual hidebysig newslot
+ instance void Clear()
+ {
+ ret
+ }
+ .method private final virtual hidebysig newslot specialname
+ instance bool 'System.Collections.Generic.ICollection<Microsoft.Ddue.Tools.CommandLine.Option>.get_IsReadOnly'()
+ {
+ .override method instance bool class [mscorlib]'System.Collections.Generic.ICollection`1'<class Microsoft.Ddue.Tools.CommandLine.Option>::get_IsReadOnly()
+ ret
+ }
+ .method private final virtual hidebysig newslot
+ instance bool 'System.Collections.Generic.ICollection<Microsoft.Ddue.Tools.CommandLine.Option>.Contains'(class Microsoft.Ddue.Tools.CommandLine.Option option)
+ {
+ .override method instance bool class [mscorlib]'System.Collections.Generic.ICollection`1'<class Microsoft.Ddue.Tools.CommandLine.Option>::Contains(!0)
+ ret
+ }
+ .method private final virtual hidebysig newslot
+ instance void 'System.Collections.Generic.ICollection<Microsoft.Ddue.Tools.CommandLine.Option>.CopyTo'(class Microsoft.Ddue.Tools.CommandLine.Option[] 'array', int32 startIndex)
+ {
+ .override method instance void class [mscorlib]'System.Collections.Generic.ICollection`1'<class Microsoft.Ddue.Tools.CommandLine.Option>::CopyTo(!0[], int32)
+ ret
+ }
+ .method private final virtual hidebysig newslot specialname
+ instance bool System.Collections.ICollection.get_IsSynchronized()
+ {
+ .override [mscorlib]System.Collections.ICollection::get_IsSynchronized
+ ret
+ }
+ .method private final virtual hidebysig newslot specialname
+ instance object System.Collections.ICollection.get_SyncRoot()
+ {
+ .override [mscorlib]System.Collections.ICollection::get_SyncRoot
+ ret
+ }
+ .method private final virtual hidebysig newslot
+ instance void System.Collections.ICollection.CopyTo(class [mscorlib]System.Array 'array', int32 startIndex)
+ {
+ .override [mscorlib]System.Collections.ICollection::CopyTo
+ ret
+ }
+ .method private final virtual hidebysig newslot
+ instance class [mscorlib]'System.Collections.Generic.IEnumerator`1'<class Microsoft.Ddue.Tools.CommandLine.Option> 'System.Collections.Generic.IEnumerable<Microsoft.Ddue.Tools.CommandLine.Option>.GetEnumerator'()
+ {
+ .override method instance class [mscorlib]'System.Collections.Generic.IEnumerator`1'<!0> class [mscorlib]'System.Collections.Generic.IEnumerable`1'<class Microsoft.Ddue.Tools.CommandLine.Option>::GetEnumerator()
+ ret
+ }
+ .method private final virtual hidebysig newslot
+ instance class [mscorlib]System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
+ {
+ .override [mscorlib]System.Collections.IEnumerable::GetEnumerator
+ ret
+ }
+ .method public hidebysig
+ instance void WriteOptionSummary(class [mscorlib]'System.IO.TextWriter' writer)
+ {
+ ret
+ }
+ .method public hidebysig
+ instance class Microsoft.Ddue.Tools.CommandLine.ParseArgumentsResult ParseArguments(string[] args)
+ {
+ ret
+ }
+ .method public hidebysig specialname
+ instance void .ctor()
+ {
+ ret
+ }
+ .property instance int32 Count()
+ {
+ .get instance int32 Microsoft.Ddue.Tools.CommandLine.OptionCollection::get_Count()
+ }
+ .property instance class Microsoft.Ddue.Tools.CommandLine.Option Item(string)
+ {
+ .get instance class Microsoft.Ddue.Tools.CommandLine.Option Microsoft.Ddue.Tools.CommandLine.OptionCollection::get_Item(string)
+ }
+ .property instance bool 'System.Collections.Generic.ICollection<Microsoft.Ddue.Tools.CommandLine.Option>.IsReadOnly'()
+ {
+ .get instance bool Microsoft.Ddue.Tools.CommandLine.OptionCollection::'System.Collections.Generic.ICollection<Microsoft.Ddue.Tools.CommandLine.Option>.get_IsReadOnly'()
+ }
+ .property instance bool System.Collections.ICollection.IsSynchronized()
+ {
+ .get instance bool Microsoft.Ddue.Tools.CommandLine.OptionCollection::System.Collections.ICollection.get_IsSynchronized()
+ }
+ .property instance object System.Collections.ICollection.SyncRoot()
+ {
+ .get instance object Microsoft.Ddue.Tools.CommandLine.OptionCollection::System.Collections.ICollection.get_SyncRoot()
+ }
+ }
+ .class public sealed ParseArgumentsResult
+ extends [mscorlib]System.Object
+ {
+ .method public hidebysig specialname
+ instance class Microsoft.Ddue.Tools.CommandLine.OptionCollection get_Options()
+ {
+ ret
+ }
+ .method public hidebysig specialname
+ instance class [mscorlib]'System.Collections.ObjectModel.ReadOnlyCollection`1'<string> get_UnusedArguments()
+ {
+ ret
+ }
+ .method public hidebysig specialname
+ instance bool get_Success()
+ {
+ ret
+ }
+ .method public hidebysig
+ instance void WriteParseErrors(class [mscorlib]'System.IO.TextWriter' writer)
+ {
+ ret
+ }
+ .property instance class Microsoft.Ddue.Tools.CommandLine.OptionCollection Options()
+ {
+ .get instance class Microsoft.Ddue.Tools.CommandLine.OptionCollection Microsoft.Ddue.Tools.CommandLine.ParseArgumentsResult::get_Options()
+ }
+ .property instance bool Success()
+ {
+ .get instance bool Microsoft.Ddue.Tools.CommandLine.ParseArgumentsResult::get_Success()
+ }
+ .property instance class [mscorlib]'System.Collections.ObjectModel.ReadOnlyCollection`1'<string> UnusedArguments()
+ {
+ .get instance class [mscorlib]'System.Collections.ObjectModel.ReadOnlyCollection`1'<string> Microsoft.Ddue.Tools.CommandLine.ParseArgumentsResult::get_UnusedArguments()
+ }
+ }
+ .class public sealed StringOption
+ extends Microsoft.Ddue.Tools.CommandLine.Option
+ {
+ .method public hidebysig specialname
+ instance void .ctor(string name)
+ {
+ ret
+ }
+ .method public hidebysig specialname
+ instance void .ctor(string name, string description)
+ {
+ ret
+ }
+ .method public hidebysig specialname
+ instance void .ctor(string name, string description, string template)
+ {
+ ret
+ }
+ .method public hidebysig specialname
+ instance string get_Template()
+ {
+ ret
+ }
+ .method public hidebysig specialname
+ instance void set_Template(string 'value')
+ {
+ ret
+ }
+ .property instance string Template()
+ {
+ .get instance string Microsoft.Ddue.Tools.CommandLine.StringOption::get_Template()
+ .set instance void Microsoft.Ddue.Tools.CommandLine.StringOption::set_Template(string)
+ }
+ }
+ .class public sealed SwitchOption
+ extends Microsoft.Ddue.Tools.CommandLine.Option
+ {
+ .method public hidebysig specialname
+ instance void .ctor(string name)
+ {
+ ret
+ }
+ .method public hidebysig specialname
+ instance void .ctor(string name, string description)
+ {
+ ret
+ }
+ }
+}
+
diff --git a/tools/Sandcastle/Source/CommandLine/Option.cs b/tools/Sandcastle/Source/CommandLine/Option.cs
new file mode 100644
index 0000000..fb9ed00
--- /dev/null
+++ b/tools/Sandcastle/Source/CommandLine/Option.cs
@@ -0,0 +1,94 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+using System;
+using System.IO;
+using System.Collections.Generic;
+
+namespace Microsoft.Ddue.Tools.CommandLine {
+
+ public abstract class Option {
+
+ internal bool processed;
+
+ protected bool present;
+ protected object value;
+ private string description;
+
+ // Data Members
+
+ private string name;
+ private bool required;
+
+ // Constructors
+
+ protected Option(string name) {
+ foreach (char character in name) {
+ if (!(Char.IsLetter(character) || (character == '?'))) throw new ArgumentException("Names must consist of letters.", "name");
+ }
+ this.name = name;
+ }
+
+ protected Option(string name, string description) : this(name) {
+ this.description = description;
+ }
+
+ protected Option(string name, string description, bool required) : this(name, description) {
+ this.required = required;
+ }
+
+ public string Description {
+ get {
+ return (description);
+ }
+ set {
+ if (processed) throw new InvalidOperationException();
+ description = value;
+ }
+ }
+
+ public virtual bool IsPresent {
+ get {
+ if (!processed) throw new InvalidOperationException();
+ return (present);
+ }
+ }
+
+ public bool IsRequired {
+ get {
+ return (required);
+ }
+ set {
+ if (processed) throw new InvalidOperationException();
+ required = value;
+ }
+ }
+
+ // Accessors
+
+ public string Name {
+ get {
+ return (name);
+ }
+ set {
+ if (processed) throw new InvalidOperationException();
+ name = value;
+ }
+ }
+
+ public virtual Object Value {
+ get {
+ if (!processed) throw new InvalidOperationException();
+ return (value);
+ }
+ }
+
+ // To be implemented by children
+
+ internal abstract ParseResult ParseArgument(string args);
+
+ internal abstract void WriteTemplate(TextWriter writer);
+
+ }
+
+}
diff --git a/tools/Sandcastle/Source/CommandLine/OptionCollection.cs b/tools/Sandcastle/Source/CommandLine/OptionCollection.cs
new file mode 100644
index 0000000..7e80441
--- /dev/null
+++ b/tools/Sandcastle/Source/CommandLine/OptionCollection.cs
@@ -0,0 +1,180 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+using System;
+using System.IO;
+using System.Collections.Generic;
+using System.Collections;
+
+namespace Microsoft.Ddue.Tools.CommandLine {
+
+
+ public sealed class OptionCollection : ICollection < Option >, ICollection, IEnumerable < Option >, IEnumerable {
+ private Dictionary < string, Option > map = new Dictionary < string, Option >();
+
+ private List < Option > options = new List < Option >();
+
+
+ public int Count {
+ get {
+ return (options.Count);
+ }
+ }
+
+ // Extras for ICollection<Option>
+
+ bool ICollection < Option >.IsReadOnly {
+ get {
+ return (false);
+ }
+ }
+
+ // Extras for ICollection
+
+ bool ICollection.IsSynchronized {
+ get {
+ return (false);
+ }
+ }
+
+ Object ICollection.SyncRoot {
+ get {
+ return (this);
+ }
+ }
+
+ public Option this[string name] {
+ get {
+ Option option;
+ if (map.TryGetValue(name, out option)) {
+ return (option);
+ } else {
+ return (null);
+ }
+ }
+ }
+
+ public void Add(Option option) {
+ if (option == null) throw new ArgumentNullException("option");
+ map.Add(option.Name, option);
+ options.Add(option);
+ }
+
+
+ public void Clear() {
+ options.Clear();
+ map.Clear();
+ }
+
+ bool ICollection < Option >.Contains(Option option) {
+ return (options.Contains(option));
+ }
+
+ void ICollection < Option >.CopyTo(Option[] array, int startIndex) {
+ options.CopyTo(array, startIndex);
+ }
+
+ void ICollection.CopyTo(Array array, int startIndex) {
+ ((ICollection)options).CopyTo(array, startIndex);
+ }
+
+ // Extras for IEnumerable<Option>
+
+ IEnumerator < Option > IEnumerable < Option >.GetEnumerator() {
+ return (options.GetEnumerator());
+ }
+
+ // Extras for IEnumerable
+
+ IEnumerator IEnumerable.GetEnumerator() {
+ return (options.GetEnumerator());
+ }
+
+ // Parse arguments -- the main show
+
+ public ParseArgumentsResult ParseArguments(string[] args) {
+
+ // keep track of results
+ ParseArgumentsResult results = new ParseArgumentsResult();
+ results.options = this;
+
+ // parse arguments
+ ParseArguments(args, results);
+
+ return (results);
+
+ }
+
+ public bool Remove(Option option) {
+ int index = options.IndexOf(option);
+ if (index < 0) return (false);
+ options.RemoveAt(index);
+ map.Remove(option.Name);
+ return (true);
+ }
+
+ // Print help
+
+ public void WriteOptionSummary(TextWriter writer) {
+ if (writer == null) throw new ArgumentNullException("writer");
+ foreach (Option option in options) {
+ writer.WriteLine();
+ option.WriteTemplate(writer);
+ writer.WriteLine(option.Description);
+ }
+ }
+
+ private void ParseArguments(string[] args, ParseArgumentsResult results) {
+
+ foreach (string arg in args) {
+ if (arg.Length == 0) continue;
+ if (arg[0] == '/') {
+ // option processing
+ // find the named option
+ int index = 1;
+ while (index < arg.Length) {
+ if ((!Char.IsLetter(arg, index)) && (arg[index] != '?')) break;
+ index++;
+ }
+ string key = arg.Substring(1, index - 1);
+ string value = arg.Substring(index);
+ // invoke the appropriate logic
+ if (map.ContainsKey(key)) {
+ Option option = (Option)map[key];
+ ParseResult result = option.ParseArgument(value);
+ if (result != ParseResult.Success) {
+ results.errors.Add(arg, result);
+ }
+ } else {
+ results.errors.Add(arg, ParseResult.UnrecognizedOption);
+ }
+ } else if (arg[0] == '@') {
+ string responseFile = arg.Substring(1);
+ List < string > responses = new List < string >();
+ using (TextReader reader = File.OpenText(responseFile)) {
+ while (true) {
+ string response = reader.ReadLine();
+ if (response == null) break;
+ responses.Add(response);
+ }
+ }
+ ParseArguments(responses.ToArray(), results);
+ } else {
+ // non-option processing
+ results.nonoptions.Add(arg);
+ }
+ }
+
+ // make sure the required arguments were present
+ foreach (Option option in map.Values) {
+ option.processed = true;
+ if ((option.IsRequired) && (!option.IsPresent)) {
+ results.errors.Add(option.Name, ParseResult.MissingOption);
+ }
+ }
+
+ }
+
+ }
+
+}
diff --git a/tools/Sandcastle/Source/CommandLine/OutputWriter.cs b/tools/Sandcastle/Source/CommandLine/OutputWriter.cs
new file mode 100644
index 0000000..f6aeeca
--- /dev/null
+++ b/tools/Sandcastle/Source/CommandLine/OutputWriter.cs
@@ -0,0 +1,25 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+using System;
+
+public static class OutputWriter {
+
+ private static int warningCount;
+
+ public static int WarningCount {
+ get {
+ return (warningCount);
+ }
+ }
+
+ public static void WriteWarning(string text) {
+ warningCount++;
+ Console.WriteLine(text);
+ }
+
+ public static void WriteWarning(string format, params Object[] values) {
+ warningCount++;
+ Console.WriteLine(format, values);
+ }
+}
diff --git a/tools/Sandcastle/Source/CommandLine/ParseArgumentsResult.cs b/tools/Sandcastle/Source/CommandLine/ParseArgumentsResult.cs
new file mode 100644
index 0000000..bc7835a
--- /dev/null
+++ b/tools/Sandcastle/Source/CommandLine/ParseArgumentsResult.cs
@@ -0,0 +1,61 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+using System;
+using System.IO;
+using System.Collections.Generic;
+using System.Collections.ObjectModel;
+
+namespace Microsoft.Ddue.Tools.CommandLine {
+
+ public sealed class ParseArgumentsResult {
+
+ internal Dictionary < string, ParseResult > errors = new Dictionary < string, ParseResult >();
+
+ internal List < string > nonoptions = new List < string >();
+
+ // data
+
+ internal OptionCollection options;
+
+ internal ParseArgumentsResult() { }
+
+ // accessors
+
+ public OptionCollection Options {
+ get {
+ return (options);
+ }
+ }
+
+ public bool Success {
+ get {
+ if (errors.Count == 0) {
+ return (true);
+ } else {
+ return (false);
+ }
+ }
+ }
+
+ public ReadOnlyCollection < string > UnusedArguments {
+
+ get {
+ return (new ReadOnlyCollection < string >(nonoptions));
+ }
+ }
+
+ public void WriteParseErrors(TextWriter writer) {
+
+ if (writer == null) throw new ArgumentNullException("writer");
+ foreach (KeyValuePair < string, ParseResult > error in errors) {
+ writer.WriteLine("{0}: {1}", error.Value, error.Key);
+
+ }
+
+ }
+
+ }
+
+
+}
diff --git a/tools/Sandcastle/Source/CommandLine/ParseResult.cs b/tools/Sandcastle/Source/CommandLine/ParseResult.cs
new file mode 100644
index 0000000..cfdd108
--- /dev/null
+++ b/tools/Sandcastle/Source/CommandLine/ParseResult.cs
@@ -0,0 +1,16 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+namespace Microsoft.Ddue.Tools.CommandLine
+{
+
+ internal enum ParseResult {
+ Success,
+ ArgumentNotAllowed,
+ MalformedArgument,
+ MissingOption,
+ UnrecognizedOption,
+ MultipleOccurance
+ }
+
+}
diff --git a/tools/Sandcastle/Source/CommandLine/Properties/AssemblyInfo.cs b/tools/Sandcastle/Source/CommandLine/Properties/AssemblyInfo.cs
new file mode 100644
index 0000000..6675118
--- /dev/null
+++ b/tools/Sandcastle/Source/CommandLine/Properties/AssemblyInfo.cs
@@ -0,0 +1,38 @@
+// 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("CommandLine")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("CommandLine")]
+[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("fd7d22ad-e481-446e-af49-3db9db2f4b61")]
+
+// 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/CommandLine/StringOption.cs b/tools/Sandcastle/Source/CommandLine/StringOption.cs
new file mode 100644
index 0000000..4680a56
--- /dev/null
+++ b/tools/Sandcastle/Source/CommandLine/StringOption.cs
@@ -0,0 +1,46 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+using System;
+using System.IO;
+using System.Collections.Generic;
+
+namespace Microsoft.Ddue.Tools.CommandLine {
+
+ public sealed class StringOption : Option {
+
+ private string template = "xxxx";
+
+ public StringOption(string name) : base(name) { }
+
+ public StringOption(string name, string description) : base(name, description) { }
+
+ public StringOption(string name, string description, string template) : base(name, description) {
+ this.template = template;
+ }
+
+ public string Template {
+ get {
+ return (template);
+ }
+ set {
+ template = value;
+ }
+ }
+
+ internal override ParseResult ParseArgument(string argument) {
+ if (!(argument.Length > 0)) return (ParseResult.MalformedArgument);
+ if (argument[0] != ':') return (ParseResult.MalformedArgument);
+ if (present) return (ParseResult.MultipleOccurance);
+ present = true;
+ value = argument.Substring(1);
+ return (ParseResult.Success);
+ }
+
+ internal override void WriteTemplate(TextWriter writer) {
+ writer.WriteLine("/{0}:{1}", Name, template);
+ }
+
+ }
+
+}
diff --git a/tools/Sandcastle/Source/CommandLine/SwitchOption.cs b/tools/Sandcastle/Source/CommandLine/SwitchOption.cs
new file mode 100644
index 0000000..daf6877
--- /dev/null
+++ b/tools/Sandcastle/Source/CommandLine/SwitchOption.cs
@@ -0,0 +1,29 @@
+// Copyright (c) Microsoft Corporation. All rights reserved.
+//
+
+using System;
+using System.IO;
+using System.Collections.Generic;
+
+namespace Microsoft.Ddue.Tools.CommandLine {
+
+ public sealed class SwitchOption : Option {
+
+ public SwitchOption(string name) : base(name) { }
+
+ public SwitchOption(string name, string description) : base(name, description) { }
+
+ internal override ParseResult ParseArgument(string argument) {
+ if (argument.Length > 0) return (ParseResult.MalformedArgument);
+ if (present) return (ParseResult.MultipleOccurance);
+ present = true;
+ return (ParseResult.Success);
+ }
+
+ internal override void WriteTemplate(TextWriter writer) {
+ writer.WriteLine("/{0}", Name);
+ }
+
+ }
+
+}
diff --git a/tools/Sandcastle/Source/CommandLine/makefile b/tools/Sandcastle/Source/CommandLine/makefile
new file mode 100644
index 0000000..5acbbd2
--- /dev/null
+++ b/tools/Sandcastle/Source/CommandLine/makefile
@@ -0,0 +1 @@
+!INCLUDE $(NTMAKEENV)\makefile.def
diff --git a/tools/Sandcastle/Source/CommandLine/makefile.inc b/tools/Sandcastle/Source/CommandLine/makefile.inc
new file mode 100644
index 0000000..32f7350
--- /dev/null
+++ b/tools/Sandcastle/Source/CommandLine/makefile.inc
@@ -0,0 +1,2 @@
+!INCLUDE $(INETROOT)\build\makefile.inc
+
diff --git a/tools/Sandcastle/Source/CommandLine/placefile b/tools/Sandcastle/Source/CommandLine/placefile
new file mode 100644
index 0000000..9c28e38
--- /dev/null
+++ b/tools/Sandcastle/Source/CommandLine/placefile
@@ -0,0 +1 @@
+Microsoft.Ddue.Tools.CommandLine.dll Manifold