[Nmailserver-commits] SF.net SVN: nmailserver: [277] NMail/trunk
Brought to you by:
dframpton-oss,
tmyroadctfig
|
From: <tmy...@us...> - 2007-10-12 13:11:20
|
Revision: 277
http://nmailserver.svn.sourceforge.net/nmailserver/?rev=277&view=rev
Author: tmyroadctfig
Date: 2007-10-12 06:11:22 -0700 (Fri, 12 Oct 2007)
Log Message:
-----------
Initial add of command line parser and data exporter.
Modified Paths:
--------------
NMail/trunk/NMail.sln
NMail/trunk/References/nunit.framework.dll
Added Paths:
-----------
NMail/trunk/CommandLineParser/
NMail/trunk/CommandLineParser/CommandLineParser.csproj
NMail/trunk/CommandLineParser/EnumOptionAttribute.cs
NMail/trunk/CommandLineParser/ParameterParser.cs
NMail/trunk/CommandLineParser/Properties/
NMail/trunk/CommandLineParser/Properties/AssemblyInfo.cs
NMail/trunk/CommandLineParser/WarningEventArgs.cs
NMail/trunk/CommandLineParser.UnitTests/
NMail/trunk/CommandLineParser.UnitTests/CommandLineParser.UnitTests.csproj
NMail/trunk/CommandLineParser.UnitTests/EnumOptions.cs
NMail/trunk/CommandLineParser.UnitTests/ParserFixture.cs
NMail/trunk/CommandLineParser.UnitTests/Properties/
NMail/trunk/CommandLineParser.UnitTests/Properties/AssemblyInfo.cs
NMail/trunk/NMail.LocalStoreData.Admin/
NMail/trunk/NMail.LocalStoreData.Admin/Action.cs
NMail/trunk/NMail.LocalStoreData.Admin/CommandLineOptions.cs
NMail/trunk/NMail.LocalStoreData.Admin/NMail.LocalStoreData.Admin.csproj
NMail/trunk/NMail.LocalStoreData.Admin/Program.cs
NMail/trunk/NMail.LocalStoreData.Admin/Properties/
NMail/trunk/NMail.LocalStoreData.Admin/Properties/AssemblyInfo.cs
NMail/trunk/NMail.LocalStoreData.Admin.UnitTests/
NMail/trunk/NMail.LocalStoreData.Admin.UnitTests/NMail.LocalStoreData.Admin.UnitTests.csproj
NMail/trunk/NMail.LocalStoreData.Admin.UnitTests/ProgramFixture.cs
NMail/trunk/NMail.LocalStoreData.Admin.UnitTests/Properties/
NMail/trunk/NMail.LocalStoreData.Admin.UnitTests/Properties/AssemblyInfo.cs
Added: NMail/trunk/CommandLineParser/CommandLineParser.csproj
===================================================================
--- NMail/trunk/CommandLineParser/CommandLineParser.csproj (rev 0)
+++ NMail/trunk/CommandLineParser/CommandLineParser.csproj 2007-10-12 13:11:22 UTC (rev 277)
@@ -0,0 +1,49 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{802B26D6-ED8D-454D-8FE8-946A907D0145}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>CommandLineParser</RootNamespace>
+ <AssemblyName>CommandLineParser</AssemblyName>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>..\References\NMail\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>..\References\NMail\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="EnumOptionAttribute.cs" />
+ <Compile Include="ParameterParser.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ <Compile Include="WarningEventArgs.cs" />
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file
Added: NMail/trunk/CommandLineParser/EnumOptionAttribute.cs
===================================================================
--- NMail/trunk/CommandLineParser/EnumOptionAttribute.cs (rev 0)
+++ NMail/trunk/CommandLineParser/EnumOptionAttribute.cs 2007-10-12 13:11:22 UTC (rev 277)
@@ -0,0 +1,9 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace CommandLineParser {
+ [AttributeUsage(AttributeTargets.Property)]
+ public class EnumOptionAttribute : Attribute {
+ }
+}
Added: NMail/trunk/CommandLineParser/ParameterParser.cs
===================================================================
--- NMail/trunk/CommandLineParser/ParameterParser.cs (rev 0)
+++ NMail/trunk/CommandLineParser/ParameterParser.cs 2007-10-12 13:11:22 UTC (rev 277)
@@ -0,0 +1,50 @@
+using System;
+using System.Collections.Generic;
+using System.Reflection;
+using System.Text;
+
+namespace CommandLineParser {
+ public class ParameterParser {
+
+ public EventHandler<WarningEventArgs> Warning;
+
+ public void Parse(string[] arguments, object optionsObject) {
+ Dictionary<PropertyInfo, EnumOptionAttribute> enumAttributes = new Dictionary<PropertyInfo, EnumOptionAttribute>();
+
+ foreach (PropertyInfo propInfo in optionsObject.GetType().GetProperties()) {
+ foreach (EnumOptionAttribute attribute in propInfo.GetCustomAttributes(typeof(EnumOptionAttribute), false)) {
+ if (!propInfo.PropertyType.IsEnum) {
+ throw new InvalidOperationException("The enumeration attribute can only be placed on enumerations properties/fields.");
+ }
+
+ enumAttributes.Add(propInfo, attribute);
+ break;
+ }
+ }
+
+ foreach (string argument in arguments) {
+ bool foundArgumentHandler = false;
+
+ foreach (KeyValuePair<PropertyInfo,EnumOptionAttribute> enumOption in enumAttributes) {
+ Type enumType = enumOption.Key.PropertyType;
+
+ try {
+ object enumValue = Enum.Parse(enumType, argument, true);
+ object[] invokeArgs = { enumValue };
+ enumOption.Key.GetSetMethod().Invoke(optionsObject, invokeArgs);
+
+ foundArgumentHandler = true;
+ break;
+
+ } catch (ArgumentException) {
+ // Ignore
+ }
+ }
+
+ if (!foundArgumentHandler) {
+ if (Warning != null) Warning(this, new WarningEventArgs(WarningType.UnknownArgument, argument));
+ }
+ }
+ }
+ }
+}
Added: NMail/trunk/CommandLineParser/Properties/AssemblyInfo.cs
===================================================================
--- NMail/trunk/CommandLineParser/Properties/AssemblyInfo.cs (rev 0)
+++ NMail/trunk/CommandLineParser/Properties/AssemblyInfo.cs 2007-10-12 13:11:22 UTC (rev 277)
@@ -0,0 +1,35 @@
+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("CommandLineParser")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("CommandLineParser")]
+[assembly: AssemblyCopyright("Copyright © 2007")]
+[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("62ba5d86-9628-4419-b9bf-acddc756248e")]
+
+// 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("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
Added: NMail/trunk/CommandLineParser/WarningEventArgs.cs
===================================================================
--- NMail/trunk/CommandLineParser/WarningEventArgs.cs (rev 0)
+++ NMail/trunk/CommandLineParser/WarningEventArgs.cs 2007-10-12 13:11:22 UTC (rev 277)
@@ -0,0 +1,44 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace CommandLineParser {
+ /// <summary>
+ /// Event arguments for an warning during parsing.
+ /// </summary>
+ public class WarningEventArgs : EventArgs {
+
+ public WarningEventArgs(WarningType warningType, string argument) {
+ this.warningType = warningType;
+ this.argument = argument;
+ }
+
+ private WarningType warningType;
+
+ public WarningType WarningType {
+ get { return warningType; }
+ set { warningType = value; }
+ }
+
+
+ private string argument;
+
+ /// <summary>
+ /// The argument that trigger the warning.
+ /// </summary>
+ public string Argument {
+ get { return argument; }
+ set { argument = value; }
+ }
+ }
+
+ /// <summary>
+ /// The possible warning types.
+ /// </summary>
+ public enum WarningType {
+ /// <summary>
+ /// The argument was not known to the parser.
+ /// </summary>
+ UnknownArgument
+ }
+}
Added: NMail/trunk/CommandLineParser.UnitTests/CommandLineParser.UnitTests.csproj
===================================================================
--- NMail/trunk/CommandLineParser.UnitTests/CommandLineParser.UnitTests.csproj (rev 0)
+++ NMail/trunk/CommandLineParser.UnitTests/CommandLineParser.UnitTests.csproj 2007-10-12 13:11:22 UTC (rev 277)
@@ -0,0 +1,58 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{744039D4-8E08-491C-98D2-1B6EC01765BA}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>CommandLineParser.UnitTests</RootNamespace>
+ <AssemblyName>CommandLineParser.UnitTests</AssemblyName>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>..\References\NMail\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>..\References\NMail\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="nunit.framework, Version=2.2.0.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\References\nunit.framework.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="EnumOptions.cs" />
+ <Compile Include="ParserFixture.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\CommandLineParser\CommandLineParser.csproj">
+ <Project>{802B26D6-ED8D-454D-8FE8-946A907D0145}</Project>
+ <Name>CommandLineParser</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file
Added: NMail/trunk/CommandLineParser.UnitTests/EnumOptions.cs
===================================================================
--- NMail/trunk/CommandLineParser.UnitTests/EnumOptions.cs (rev 0)
+++ NMail/trunk/CommandLineParser.UnitTests/EnumOptions.cs 2007-10-12 13:11:22 UTC (rev 277)
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace CommandLineParser.UnitTests {
+ class EnumOptions {
+ private TestOption option;
+
+ [EnumOption]
+ public TestOption Option {
+ get { return option; }
+ set { option = value; }
+ }
+ }
+
+ enum TestOption {
+ First,
+ Second
+ }
+}
Added: NMail/trunk/CommandLineParser.UnitTests/ParserFixture.cs
===================================================================
--- NMail/trunk/CommandLineParser.UnitTests/ParserFixture.cs (rev 0)
+++ NMail/trunk/CommandLineParser.UnitTests/ParserFixture.cs 2007-10-12 13:11:22 UTC (rev 277)
@@ -0,0 +1,43 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+using NUnit.Framework;
+using NUnit.Framework.SyntaxHelpers;
+
+namespace CommandLineParser.UnitTests {
+ /// <summary>
+ /// A test fixture for the parser.
+ /// </summary>
+ [TestFixture]
+ public class ParserFixture {
+
+ ParameterParser parser = new ParameterParser();
+
+ [Test]
+ public void ShouldHandleEnumerationAttribute() {
+ string[] arguments = { "second" };
+ EnumOptions enumOptions = new EnumOptions();
+ parser.Parse(arguments, enumOptions);
+
+ Assert.That(enumOptions.Option, Is.EqualTo(TestOption.Second), "Correct enum value.");
+ }
+
+ [Test]
+ public void ShouldWarnOnUnknownArgument() {
+ bool warned = false;
+ string[] arguments = { "unknown" };
+ EnumOptions enumOptions = new EnumOptions();
+
+ parser.Warning += delegate(object sender, WarningEventArgs e) {
+ warned = true;
+ Assert.That(e.WarningType, Is.EqualTo(WarningType.UnknownArgument), "Correct warning.");
+ Assert.That(e.Argument, Is.EqualTo("unknown"), "Correct arugment.");
+ };
+
+ parser.Parse(arguments, enumOptions);
+
+ Assert.That(warned, Is.True, "Received warning.");
+ }
+ }
+}
Added: NMail/trunk/CommandLineParser.UnitTests/Properties/AssemblyInfo.cs
===================================================================
--- NMail/trunk/CommandLineParser.UnitTests/Properties/AssemblyInfo.cs (rev 0)
+++ NMail/trunk/CommandLineParser.UnitTests/Properties/AssemblyInfo.cs 2007-10-12 13:11:22 UTC (rev 277)
@@ -0,0 +1,35 @@
+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("CommandLineParser.UnitTests")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("CommandLineParser.UnitTests")]
+[assembly: AssemblyCopyright("Copyright © 2007")]
+[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("4ce7c355-4282-4094-a742-1be364460653")]
+
+// 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("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
Added: NMail/trunk/NMail.LocalStoreData.Admin/Action.cs
===================================================================
--- NMail/trunk/NMail.LocalStoreData.Admin/Action.cs (rev 0)
+++ NMail/trunk/NMail.LocalStoreData.Admin/Action.cs 2007-10-12 13:11:22 UTC (rev 277)
@@ -0,0 +1,20 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+namespace NMail.LocalStoreData.Admin {
+ /// <summary>
+ /// Possible actions the administration tool can perform.
+ /// </summary>
+ public enum Action {
+ /// <summary>
+ /// An unknown or invalid action.
+ /// </summary>
+ Unknown = 0,
+
+ /// <summary>
+ /// The action to export the complete localstore database.
+ /// </summary>
+ ExportComplete
+ }
+}
Added: NMail/trunk/NMail.LocalStoreData.Admin/CommandLineOptions.cs
===================================================================
--- NMail/trunk/NMail.LocalStoreData.Admin/CommandLineOptions.cs (rev 0)
+++ NMail/trunk/NMail.LocalStoreData.Admin/CommandLineOptions.cs 2007-10-12 13:11:22 UTC (rev 277)
@@ -0,0 +1,19 @@
+using System;
+using System.Collections.Generic;
+using System.ComponentModel;
+using System.Text;
+
+using CommandLineParser;
+
+namespace NMail.LocalStoreData.Admin {
+ public class CommandLineOptions {
+
+ private Action action;
+
+ [EnumOption]
+ public Action Action {
+ get { return action; }
+ set { action = value; }
+ }
+ }
+}
Added: NMail/trunk/NMail.LocalStoreData.Admin/NMail.LocalStoreData.Admin.csproj
===================================================================
--- NMail/trunk/NMail.LocalStoreData.Admin/NMail.LocalStoreData.Admin.csproj (rev 0)
+++ NMail/trunk/NMail.LocalStoreData.Admin/NMail.LocalStoreData.Admin.csproj 2007-10-12 13:11:22 UTC (rev 277)
@@ -0,0 +1,55 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{C141815B-AEDD-4B5A-998B-042E134452AD}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>NMail.LocalStoreData.Admin</RootNamespace>
+ <AssemblyName>NMail.LocalStoreData.Admin</AssemblyName>
+ </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>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Action.cs" />
+ <Compile Include="CommandLineOptions.cs" />
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\CommandLineParser\CommandLineParser.csproj">
+ <Project>{802B26D6-ED8D-454D-8FE8-946A907D0145}</Project>
+ <Name>CommandLineParser</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file
Added: NMail/trunk/NMail.LocalStoreData.Admin/Program.cs
===================================================================
--- NMail/trunk/NMail.LocalStoreData.Admin/Program.cs (rev 0)
+++ NMail/trunk/NMail.LocalStoreData.Admin/Program.cs 2007-10-12 13:11:22 UTC (rev 277)
@@ -0,0 +1,28 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+using CommandLineParser;
+
+namespace NMail.LocalStoreData.Admin {
+ public class Program {
+ public static int Main(string[] arguments) {
+ int returnValue = SuccessReturnValue;
+ CommandLineOptions options = new CommandLineOptions();
+
+ ParameterParser parser = new ParameterParser();
+ parser.Warning += delegate(object sender, WarningEventArgs e) {
+ Console.WriteLine("Warning: {0}", e.WarningType);
+ returnValue = WarningReturnValue;
+ };
+ parser.Parse(arguments, options);
+
+ Console.ReadKey();
+
+ return returnValue;
+ }
+
+ public const int SuccessReturnValue = 0;
+ public const int WarningReturnValue = 2;
+ }
+}
Added: NMail/trunk/NMail.LocalStoreData.Admin/Properties/AssemblyInfo.cs
===================================================================
--- NMail/trunk/NMail.LocalStoreData.Admin/Properties/AssemblyInfo.cs (rev 0)
+++ NMail/trunk/NMail.LocalStoreData.Admin/Properties/AssemblyInfo.cs 2007-10-12 13:11:22 UTC (rev 277)
@@ -0,0 +1,33 @@
+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("NMail.LocalStoreData.Admin")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("NMail.LocalStoreData.Admin")]
+[assembly: AssemblyCopyright("Copyright © 2007")]
+[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("aa2a030c-1852-4d78-b573-320a958f42bd")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
Added: NMail/trunk/NMail.LocalStoreData.Admin.UnitTests/NMail.LocalStoreData.Admin.UnitTests.csproj
===================================================================
--- NMail/trunk/NMail.LocalStoreData.Admin.UnitTests/NMail.LocalStoreData.Admin.UnitTests.csproj (rev 0)
+++ NMail/trunk/NMail.LocalStoreData.Admin.UnitTests/NMail.LocalStoreData.Admin.UnitTests.csproj 2007-10-12 13:11:22 UTC (rev 277)
@@ -0,0 +1,57 @@
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
+ <ProductVersion>8.0.50727</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{A82463DE-C7D9-4EE3-BAED-857629229FE8}</ProjectGuid>
+ <OutputType>Library</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>NMail.LocalStoreData.Admin.UnitTests</RootNamespace>
+ <AssemblyName>NMail.LocalStoreData.Admin.UnitTests</AssemblyName>
+ </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>
+ <ItemGroup>
+ <Reference Include="nunit.framework, Version=2.4.3.0, Culture=neutral, PublicKeyToken=96d09a1eb7f44a77, processorArchitecture=MSIL">
+ <SpecificVersion>False</SpecificVersion>
+ <HintPath>..\References\nunit.framework.dll</HintPath>
+ </Reference>
+ <Reference Include="System" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="ProgramFixture.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\NMail.LocalStoreData.Admin\NMail.LocalStoreData.Admin.csproj">
+ <Project>{C141815B-AEDD-4B5A-998B-042E134452AD}</Project>
+ <Name>NMail.LocalStoreData.Admin</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
\ No newline at end of file
Added: NMail/trunk/NMail.LocalStoreData.Admin.UnitTests/ProgramFixture.cs
===================================================================
--- NMail/trunk/NMail.LocalStoreData.Admin.UnitTests/ProgramFixture.cs (rev 0)
+++ NMail/trunk/NMail.LocalStoreData.Admin.UnitTests/ProgramFixture.cs 2007-10-12 13:11:22 UTC (rev 277)
@@ -0,0 +1,18 @@
+using System;
+using System.Collections.Generic;
+using System.Text;
+
+using NUnit.Framework;
+using NUnit.Framework.SyntaxHelpers;
+
+namespace NMail.LocalStoreData.Admin.UnitTests {
+ [TestFixture]
+ public class ProgramFixture {
+
+ [Test]
+ public void ShouldAcceptExportCompleteAction() {
+ string[] arguments = { Action.ExportComplete.ToString() };
+ Assert.That(Program.Main(arguments), Is.EqualTo(Program.SuccessReturnValue), "Success return value.");
+ }
+ }
+}
Added: NMail/trunk/NMail.LocalStoreData.Admin.UnitTests/Properties/AssemblyInfo.cs
===================================================================
--- NMail/trunk/NMail.LocalStoreData.Admin.UnitTests/Properties/AssemblyInfo.cs (rev 0)
+++ NMail/trunk/NMail.LocalStoreData.Admin.UnitTests/Properties/AssemblyInfo.cs 2007-10-12 13:11:22 UTC (rev 277)
@@ -0,0 +1,35 @@
+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("NMail.LocalStoreData.Admin.UnitTests")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("")]
+[assembly: AssemblyProduct("NMail.LocalStoreData.Admin.UnitTests")]
+[assembly: AssemblyCopyright("Copyright © 2007")]
+[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("23cd8376-5432-4be5-955f-b676809928af")]
+
+// 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("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
Modified: NMail/trunk/NMail.sln
===================================================================
--- NMail/trunk/NMail.sln 2007-09-23 10:24:28 UTC (rev 276)
+++ NMail/trunk/NMail.sln 2007-10-12 13:11:22 UTC (rev 277)
@@ -54,6 +54,14 @@
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NMail.DatabaseTests", "NMail.DatabaseTests\NMail.DatabaseTests.csproj", "{B55D01B3-4A0C-4473-BF0C-5D59AA10506E}"
EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NMail.LocalStoreData.Admin.UnitTests", "NMail.LocalStoreData.Admin.UnitTests\NMail.LocalStoreData.Admin.UnitTests.csproj", "{A82463DE-C7D9-4EE3-BAED-857629229FE8}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NMail.LocalStoreData.Admin", "NMail.LocalStoreData.Admin\NMail.LocalStoreData.Admin.csproj", "{C141815B-AEDD-4B5A-998B-042E134452AD}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommandLineParser", "CommandLineParser\CommandLineParser.csproj", "{802B26D6-ED8D-454D-8FE8-946A907D0145}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CommandLineParser.UnitTests", "CommandLineParser.UnitTests\CommandLineParser.UnitTests.csproj", "{744039D4-8E08-491C-98D2-1B6EC01765BA}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
@@ -278,6 +286,38 @@
{B55D01B3-4A0C-4473-BF0C-5D59AA10506E}.Release|Any CPU.Build.0 = Release|Any CPU
{B55D01B3-4A0C-4473-BF0C-5D59AA10506E}.Release2005|Any CPU.ActiveCfg = Release|Any CPU
{B55D01B3-4A0C-4473-BF0C-5D59AA10506E}.Release2005|Any CPU.Build.0 = Release|Any CPU
+ {A82463DE-C7D9-4EE3-BAED-857629229FE8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {A82463DE-C7D9-4EE3-BAED-857629229FE8}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {A82463DE-C7D9-4EE3-BAED-857629229FE8}.Debug2005|Any CPU.ActiveCfg = Debug|Any CPU
+ {A82463DE-C7D9-4EE3-BAED-857629229FE8}.Debug2005|Any CPU.Build.0 = Debug|Any CPU
+ {A82463DE-C7D9-4EE3-BAED-857629229FE8}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {A82463DE-C7D9-4EE3-BAED-857629229FE8}.Release|Any CPU.Build.0 = Release|Any CPU
+ {A82463DE-C7D9-4EE3-BAED-857629229FE8}.Release2005|Any CPU.ActiveCfg = Release|Any CPU
+ {A82463DE-C7D9-4EE3-BAED-857629229FE8}.Release2005|Any CPU.Build.0 = Release|Any CPU
+ {C141815B-AEDD-4B5A-998B-042E134452AD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {C141815B-AEDD-4B5A-998B-042E134452AD}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {C141815B-AEDD-4B5A-998B-042E134452AD}.Debug2005|Any CPU.ActiveCfg = Debug|Any CPU
+ {C141815B-AEDD-4B5A-998B-042E134452AD}.Debug2005|Any CPU.Build.0 = Debug|Any CPU
+ {C141815B-AEDD-4B5A-998B-042E134452AD}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {C141815B-AEDD-4B5A-998B-042E134452AD}.Release|Any CPU.Build.0 = Release|Any CPU
+ {C141815B-AEDD-4B5A-998B-042E134452AD}.Release2005|Any CPU.ActiveCfg = Release|Any CPU
+ {C141815B-AEDD-4B5A-998B-042E134452AD}.Release2005|Any CPU.Build.0 = Release|Any CPU
+ {802B26D6-ED8D-454D-8FE8-946A907D0145}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {802B26D6-ED8D-454D-8FE8-946A907D0145}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {802B26D6-ED8D-454D-8FE8-946A907D0145}.Debug2005|Any CPU.ActiveCfg = Debug|Any CPU
+ {802B26D6-ED8D-454D-8FE8-946A907D0145}.Debug2005|Any CPU.Build.0 = Debug|Any CPU
+ {802B26D6-ED8D-454D-8FE8-946A907D0145}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {802B26D6-ED8D-454D-8FE8-946A907D0145}.Release|Any CPU.Build.0 = Release|Any CPU
+ {802B26D6-ED8D-454D-8FE8-946A907D0145}.Release2005|Any CPU.ActiveCfg = Release|Any CPU
+ {802B26D6-ED8D-454D-8FE8-946A907D0145}.Release2005|Any CPU.Build.0 = Release|Any CPU
+ {744039D4-8E08-491C-98D2-1B6EC01765BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {744039D4-8E08-491C-98D2-1B6EC01765BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {744039D4-8E08-491C-98D2-1B6EC01765BA}.Debug2005|Any CPU.ActiveCfg = Debug|Any CPU
+ {744039D4-8E08-491C-98D2-1B6EC01765BA}.Debug2005|Any CPU.Build.0 = Debug|Any CPU
+ {744039D4-8E08-491C-98D2-1B6EC01765BA}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {744039D4-8E08-491C-98D2-1B6EC01765BA}.Release|Any CPU.Build.0 = Release|Any CPU
+ {744039D4-8E08-491C-98D2-1B6EC01765BA}.Release2005|Any CPU.ActiveCfg = Release|Any CPU
+ {744039D4-8E08-491C-98D2-1B6EC01765BA}.Release2005|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
Modified: NMail/trunk/References/nunit.framework.dll
===================================================================
(Binary files differ)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|