GetWord() public static méthode

public static GetWord ( string entireString, int &startingIndex ) : string
entireString string
startingIndex int
Résultat string
        private void ParseHeader(string line, out int index)
        {
            index = 0;
            while (true)
            {
                string word = ParsedClass.GetWord(line, ref index).Trim();

                if (word == "public")
                {
                    IsPublic = true;
                }
                else if (word == "private" || word == "internal" || word == "protected")
                {
                    // toss it
                }
                else if (word == "enum")
                {
                    // toss it
                }
                else
                {
                    this.Name = word;
                    return;
                }
            }
        }
        internal void FillArgumentList(ParsedMethod parsedMethod, List <string> currentBlock, int lineIndex, bool requireTypes)
        {
            int  wordIndex                 = 0;
            int  parenthesisDeep           = 0;
            bool hasFoundClosedParenthesis = false;

            ParsedField argumentToAddTo = null;

            while (!hasFoundClosedParenthesis)
            {
                string line = currentBlock[lineIndex];

                wordIndex = 0;

                string currentType = null;

                while (true)
                {
                    string word = ParsedClass.GetWord(line, ref wordIndex);

                    if (word == "(")
                    {
                        if (argumentToAddTo != null)
                        {
                            argumentToAddTo.Name += word;
                        }

                        parenthesisDeep++;
                    }
                    else if (word == ")")
                    {
                        parenthesisDeep--;


                        if (parenthesisDeep == 0)
                        {
                            hasFoundClosedParenthesis = true;
                            break;
                        }
                        else if (argumentToAddTo != null)
                        {
                            argumentToAddTo.Name += word;
                        }
                    }
                    else if (word == "")
                    {
                        lineIndex++;
                        break;
                    }
                    else if (parenthesisDeep == 0)
                    {
                        continue;
                    }
                    else if (word == ",")
                    {
                        argumentToAddTo = null;
                        continue;
                    }
                    else if (currentType == null && requireTypes)
                    {
                        currentType = word;
                    }
                    else
                    {
                        ParsedField parsedField = new ParsedField(Scope.Public, currentType, word);
                        currentType = null;

                        parsedMethod.ArgumentList.Add(parsedField);

                        argumentToAddTo = parsedField;
                    }
                }
            }
        }
        public static void GetLineInformation(
            string line,
            out Scope scope,
            out ParsedType type,
            out string variableName,
            out bool isConst,
            out bool isVirtual,
            out bool isOverride,
            out bool isStatic,
            out bool isNew,
            out bool isAsync,
            out string valueToAssignTo
            )
        {
            int index = 0;

            scope           = Scope.Private;
            type            = null;
            variableName    = null;
            isConst         = false;
            valueToAssignTo = null;
            isVirtual       = false;
            isOverride      = false;
            isStatic        = false;
            isNew           = false;
            isAsync         = false;

            bool hasHadOpenParenthesis = false;
            bool hasHadOpenQuotes      = false;
            bool hasEqualsBeenUsed     = false;

            string currentType = "";

            while (true)
            {
                string word = ParsedClass.GetWord(line, ref index);

                const string public1 = " public ";
                //const string startWithPublic = "public ";

                if (string.IsNullOrEmpty(word))
                {
                    break;
                }
                else if (word == ";")
                {
                    continue;
                }
                else if (word == "const")
                {
                    isConst = true;
                }
                else if (word == "public")
                {
                    scope = Scope.Public;
                }
                else if (word == "private")
                {
                    scope = Scope.Private;
                }
                else if (word == "protected")
                {
                    scope = Scope.Protected;
                }
                else if (word == "internal")
                {
                    scope = Scope.Internal;
                }
                else if (word == "virtual")
                {
                    isVirtual = true;
                }
                else if (word == "override")
                {
                    isOverride = true;
                }
                else if (word == "static")
                {
                    isStatic = true;
                }
                else if (word == "new")
                {
                    isNew = true;
                }
                else if (word == "async")
                {
                    isAsync = true;
                }
                else if (type == null)
                {
                    if (word.Contains("<") && !word.Contains(">"))
                    {
                        currentType += word;
                    }
                    else if (currentType != "")
                    {
                        currentType += word;
                        if (word.Contains(">"))
                        {
                            type = new ParsedType(currentType);

                            currentType = "";
                        }
                    }
                    else
                    {
                        // check for []
                        int    tempIndex     = index;
                        string nextWord      = ParsedClass.GetWord(line, ref tempIndex);
                        string wordAfterThat = ParsedClass.GetWord(line, ref tempIndex);

                        if (nextWord == "[" && wordAfterThat == "]")
                        {
                            type  = new ParsedType(word + "[]");
                            index = tempIndex;
                        }
                        else
                        {
                            type = new ParsedType(word);
                        }
                    }
                }
                else if (!hasEqualsBeenUsed && word == "(")
                {
                    hasHadOpenParenthesis = true;
                }
                else if (variableName == null && !hasHadOpenParenthesis)
                {
                    if (word.EndsWith(";"))
                    {
                        variableName = word.Substring(0, word.Length - 1);
                    }
                    else
                    {
                        variableName = word;
                    }
                }
                else if (word == "=")
                {
                    hasEqualsBeenUsed = true;
                }
                else if (hasEqualsBeenUsed)
                {
                    if (valueToAssignTo == null)
                    {
                        valueToAssignTo = word;

                        if (valueToAssignTo.StartsWith("\"") && !hasHadOpenQuotes)
                        {
                            if (!valueToAssignTo.EndsWith("\""))
                            {
                                hasHadOpenQuotes = true;

                                int indexOfClosingQuotes = line.IndexOf("\"", index) + 1; // add 1 to capture the quote

                                string extraStuffToAdd = line.Substring(index, indexOfClosingQuotes - index);

                                valueToAssignTo += extraStuffToAdd;
                                index            = indexOfClosingQuotes;
                            }
                        }
                    }
                    else
                    {
                        valueToAssignTo += " " + word;
                    }
                }
            }
        }