File tree Expand file tree Collapse file tree 2 files changed +36
-0
lines changed
Expand file tree Collapse file tree 2 files changed +36
-0
lines changed Original file line number Diff line number Diff line change 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+ }
Original file line number Diff line number Diff line change 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" />
You can’t perform that action at this time.
0 commit comments