public static CommandParameterGroupList Parse(string source) { if (source.IsNullOrTrimmedEmpty()) { return(new CommandParameterGroupList()); } CommandParameterGroupList result = new CommandParameterGroupList(); foreach (string groupText in source.Split(new[] { '|' }, StringSplitOptions.RemoveEmptyEntries)) { CommandParameterGroup group = new CommandParameterGroup(); foreach (string parameterText in Regex.Split(groupText, " +", RegexOptions.Singleline)) { int equalSignIndex = parameterText.IndexOf('='); if (equalSignIndex > 0) { group.Add(new CommandParameter(parameterText.Substring(0, equalSignIndex), Ts3Util.DecodeString(parameterText.Substring(equalSignIndex + 1)))); } else if (equalSignIndex == -1) { group.Add(new CommandParameter(Ts3Util.DecodeString(parameterText))); } } if (group.Count > 0) { result.Add(group); } } return(result); }
/// <summary> /// Encodes special characters (such as ' ') using the input string /// </summary> /// <param name="input">String to encode</param> /// <returns>The encoded string representation of the input</returns> public static string EncodeString(string input) { return(Ts3Util.EncodeString(input)); }