public CommandLine() { _parameters = new Dictionary <string, CommandLineParameter>(); var args = Environment.GetCommandLineArgs(); for (int i = 1; i < args.Length; ++i) { var arg = args[i].Trim('"'); if (arg.Length > 1 && arg.StartsWith("/")) { var colonIndex = arg.IndexOf(':'); if (colonIndex != -1) { if (colonIndex > 1) { string value; var name = arg.Substring(1, colonIndex - 1); if (colonIndex < arg.Length - 1) { value = arg.Substring(colonIndex + 1); } else { value = string.Empty; } _parameters[name] = new CommandLineParameter(name, value); } } else { var name = arg.Substring(1); _parameters[name] = new CommandLineParameter(name, null); } } } }
public CommandLine() { _parameters = new Dictionary<string, CommandLineParameter>(); var args = Environment.GetCommandLineArgs(); for(int i = 1; i < args.Length; ++i) { var arg = args[i].Trim('"'); if(arg.Length > 1 && arg.StartsWith("/")) { var colonIndex = arg.IndexOf(':'); if(colonIndex != -1) { if(colonIndex > 1) { string value; var name = arg.Substring(1, colonIndex - 1); if(colonIndex < arg.Length - 1) { value = arg.Substring(colonIndex + 1); } else { value = string.Empty; } _parameters[name] = new CommandLineParameter(name, value); } } else { var name = arg.Substring(1); _parameters[name] = new CommandLineParameter(name, null); } } } }