private void print_options(Hashtable Opts) { String type = ""; String defaultVal = ""; IEnumerator It; String help = ""; ICollection generalKeys = (ICollection)Opts.Keys; It = generalKeys.GetEnumerator(); while (It.MoveNext()) { String keyValue = It.Current.ToString(); OptionSpec oSpec = (OptionSpec)Opts[keyValue]; if ((oSpec.getOptionType() != null) && (oSpec.getOptionDefault() != null)) { type = oSpec.getOptionType(); defaultVal = oSpec.getOptionDefault(); Console.WriteLine(" --" + keyValue + " < type " + type + ", default " + defaultVal + ">"); } if ((oSpec.getOptionDefault() != null) && (oSpec.getOptionType() == null)) { defaultVal = oSpec.getOptionDefault(); Console.WriteLine(" --" + keyValue + " < default " + defaultVal + " >"); } else if ((oSpec.getOptionType() != null) && (oSpec.getOptionDefault() == null)) { type = oSpec.getOptionType(); Console.WriteLine(" --" + keyValue + " < type " + type + " >"); } else if ((oSpec.getOptionType() == null) && (oSpec.getOptionDefault() == null)) { Console.WriteLine(" --" + keyValue + " "); } help = oSpec.getOptionDesc(); Console.WriteLine(" " + help); } }
public String get_option(String key) { if (optsEntered.ContainsKey(key)) { foreach (DictionaryEntry uniEntry in optsEntered) { if (uniEntry.Key.Equals(key) && uniEntry.Value != null) { return(uniEntry.Value.ToString()); } else if (uniEntry.Key.Equals(key) && uniEntry.Value == null) { throw new ArgumentHandlingException("Missing Value for Arguement: " + key); } } } else if (checkInputOptions(builtInOpts, key)) { IEnumerator It = builtInOpts.Keys.GetEnumerator(); while (It.MoveNext()) { String strC = It.Current.ToString(); if (strC.Equals(key)) { OptionSpec oSpec = (OptionSpec)builtInOpts[strC]; if (oSpec.getOptionDefault() != null) { String str = oSpec.getOptionDefault(); return(str); } else { return(null); } } } } else if (checkInputOptions(userOpts, key)) { IEnumerator It = userOpts.Keys.GetEnumerator(); while (It.MoveNext()) { String strC = It.Current.ToString(); if (strC.Equals(key)) { OptionSpec oSpec = (OptionSpec)userOpts[strC]; if (oSpec.getOptionDefault() != null) { String str = oSpec.getOptionDefault(); return(str); } else { return(null); } } } } else { Console.WriteLine("undefined variable"); } return(null); }