diff --git a/ConsoleArgsParser/CodeKatas/ArgsClass.cs b/ConsoleArgsParser/CodeKatas/ArgsClass.cs index 8514d07..9f65a02 100755 --- a/ConsoleArgsParser/CodeKatas/ArgsClass.cs +++ b/ConsoleArgsParser/CodeKatas/ArgsClass.cs @@ -1,6 +1,5 @@ using System; using System.Collections.Generic; -using System.Text; namespace ArgsConsole { @@ -111,17 +110,9 @@ public Dictionary GeneralSParse(string args) } if ((chain[i].Length == 2 && chain[i][0] == '-') || (chain[i].Length == 3 && chain[i].Contains("--"))) { } - else - { throw new InvalidArgException(); - }/* - if ((schems[chain[i]]=="false" || schems[chain[i]] == "true")) - { //if(chain[i + 1][0] == '-') - throw new InvalidArgException(); - }*/ - //dict.Remove(chain[i]); if (schems[chain[i]] == "false") dict.Add(chain[i], "true"); else @@ -133,9 +124,7 @@ public Dictionary GeneralSParse(string args) } else - { throw new InvalidArgException(); - } } } return dict; @@ -160,6 +149,7 @@ public Dictionary GeneralSParse(string[] args) var dict = new Dictionary(); if (args != null || args.Length == 0) { + chain = args; int cant = chain.Length; for (int i = 0; i < cant; i++) { @@ -177,11 +167,7 @@ public Dictionary GeneralSParse(string[] args) } if ((chain[i].Length != 2 && chain[i][0] != '-') || (chain[i].Length != 3 && chain[i].Contains("--"))) throw new InvalidArgException(); - /* - if ((schems[chain[i]]=="false" || schems[chain[i]] == "true")) - { //if(chain[i + 1][0] == '-') - throw new InvalidArgException(); - }*/ + dict.Remove(chain[i]); if (schems[chain[i]] == "false") dict.Add(chain[i], "true"); @@ -229,9 +215,7 @@ public Dictionary BoolArgs(string[] scheme, string args) if (command.Length != 2 || command[0] != '-') throw new InvalidSchemeException(); else - { dict.Add(command, false); - } } if (args != null) { @@ -247,10 +231,7 @@ public Dictionary BoolArgs(string[] scheme, string args) dict.Add(item, true); } else - { throw new InvalidArgException(); - } - } } return dict;