summaryrefslogtreecommitdiffstats
path: root/tools/Sandcastle/Source/CommandLine/ConsoleApplication.cs
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/ConsoleApplication.cs
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/ConsoleApplication.cs')
-rw-r--r--tools/Sandcastle/Source/CommandLine/ConsoleApplication.cs62
1 files changed, 62 insertions, 0 deletions
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);
+ }
+
+ }
+
+}