Skip to content

Commit 8e1f4f6

Browse files
committed
Added Argument class
1 parent 6349403 commit 8e1f4f6

File tree

2 files changed

+36
-0
lines changed

2 files changed

+36
-0
lines changed
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
using System;
2+
using System.CodeDom;
3+
using System.Collections.Generic;
4+
5+
namespace ProgramArgumentsManager
6+
{
7+
public class Arguments
8+
{
9+
public string ApplicationName { get; }
10+
public string Version { get; }
11+
12+
private Dictionary<string, string> _options;
13+
14+
public Arguments(string name) : this(name, "1.0.0") { }
15+
16+
public Arguments(string name, string version)
17+
{
18+
ApplicationName = name;
19+
Version = version;
20+
21+
_options = new Dictionary<string, string>();
22+
}
23+
24+
public void AddArguments(string format, string description)
25+
{
26+
format = format.Trim();
27+
28+
if (!format.Contains("-") && !format.Contains("--"))
29+
throw new ArgumentException("Le format '" + format + " n'est pas comaptible en tant que paramètre !",
30+
nameof(format));
31+
32+
_options.Add(format, description);
33+
}
34+
}
35+
}

ProgramArgumentsManager/ProgramArgumentsManager.csproj

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@
4141
<Reference Include="System.Xml" />
4242
</ItemGroup>
4343
<ItemGroup>
44+
<Compile Include="Arguments.cs" />
4445
<Compile Include="Properties\AssemblyInfo.cs" />
4546
</ItemGroup>
4647
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />

0 commit comments

Comments
 (0)