Exemple #1
0
        public static void ParseParameters(String parametersString, List <String> parameterList)
        {
            if (parametersString == null)
            {
                return;
            }
            if (parametersString.Length <= 0)
            {
                return;
            }

            Int32 offset = 0;

            while (true)
            {
                while (true)
                {
                    Char c = parametersString[offset];
                    if (Sos.IsValidStartOfSosString(c))
                    {
                        break;
                    }
                    if (!Char.IsWhiteSpace(c))
                    {
                        throw new FormatException(String.Format(
                                                      "Every parameter string must start with 0-9,a-z,A-Z,\",[,{{ or ', but parameter {0} started with '{1}' (charcode={2})",
                                                      parameterList.Count, c, (UInt32)c));
                    }
                    offset++;
                    if (offset >= parametersString.Length)
                    {
                        return;
                    }
                }

                Int32 nextSpace = Sos.NextNonQuotedWhitespace(parametersString, offset);
                parameterList.Add(parametersString.Substring(offset, nextSpace - offset));

                offset = nextSpace + 1;
                if (offset >= parametersString.Length)
                {
                    return;
                }
            }
        }