private static string[] getSuggestedArgs(IList <string> values, string token) { // we need to keep suggested values in a sorted order List <string> sortedValues = new List <string>(values.Count); for (int i = 0; i < values.Count; ++i) { if (token.Length == 0 || CStringUtils.StartsWithIgnoreCase(CStringUtils.RemoveRichTextTags(values[i]), token)) { sortedValues.Add(CStringUtils.RemoveRichTextTags(values[i])); } } if (sortedValues.Count == 0) { return(EMPTY_SUGGESTIONS); } if (sortedValues.Count > 1) { sortedValues.Sort(); return(sortedValues.ToArray()); } return(singleSuggestion(sortedValues[0])); }
internal IList <Option> ListOptions(IList <Option> outList, string prefix = null) { if (!string.IsNullOrEmpty(prefix)) { return(ListOptions(outList, delegate(Option opt) { return CStringUtils.StartsWithIgnoreCase(opt.Name, prefix); })); } return(ListOptions(outList, DefaultListOptionsFilter)); }
public string[] ListValues(string token = null) { if (HasValues()) { List <string> list = new List <string>(Values.Length); for (int i = 0; i < Values.Length; ++i) { string str = Values[i]; if (token == null || CStringUtils.StartsWithIgnoreCase(str, token)) { list.Add(str); } } return(list.ToArray()); } return(new string[0]); }
public static IList <string> ListConfigs(string token = null) { List <string> result = new List <string>(); string configsPath = ConfigPath; if (Directory.Exists(configsPath)) { string[] files = Directory.GetFiles(configsPath, "*.cfg"); foreach (string file in files) { string filename = CFileUtils.GetFileName(file); if (token == null || CStringUtils.StartsWithIgnoreCase(filename, token)) { result.Add(filename); } } } return(result); }
internal Option FindNonAmbiguousOption(string name, bool useShort) { if (name.Length == 0) { return(null); } if (m_options != null) { Option targetOpt = null; foreach (Option opt in m_options) { String optName = useShort ? opt.ShortName : opt.Name; if (optName == null) { continue; } if (targetOpt == null) { if (CStringUtils.EqualsIgnoreCase(optName, name)) { targetOpt = opt; } } else if (CStringUtils.StartsWithIgnoreCase(optName, name)) { return(null); } } return(targetOpt); } return(null); }
internal bool StartsWith(string prefix) { return(CStringUtils.StartsWithIgnoreCase(Name, prefix)); }
public static bool ShouldListObject(GameObject obj, string prefix) { return(prefix == null || CStringUtils.StartsWithIgnoreCase(obj.name, prefix)); }