AGS.CScript.Compiler.FastString.ToString C# (CSharp) Method

ToString() public method

public ToString ( ) : string
return string
        public override string ToString()
        {
            if (_offset > 0)
            {
                return _data.Substring(_offset);
            }
            return _data;
        }

Usage Example

Example #1
0
        private string PreProcessLine(string lineToProcess)
        {
            if (DeletingCurrentLine())
            {
                return string.Empty;
            }

            Stack<StringBuilder> previousOutput = new Stack<StringBuilder>();
            Stack<FastString> previousLine = new Stack<FastString>();
            StringBuilder output = new StringBuilder(lineToProcess.Length);
            FastString line = new FastString(lineToProcess);
            Stack<String> ignored = new Stack<String>();
            while (line.Length > 0)
            {
                int i = 0;
                while ((i < line.Length) && (!Char.IsLetterOrDigit(line[i])))
                {
                    if ((line[i] == '"') || (line[i] == '\''))
                    {
                        i = FindIndexOfMatchingCharacter(line.ToString(), i, line[i]);
                        if (i < 0)
                        {
                            i = line.Length;
                            break;
                        }
                    }
                    i++;
                }

                output.Append(line.Substring(0, i));

                if (i < line.Length)
                {
                    bool precededByDot = false;
                    if (i > 0) precededByDot = (line[i - 1] == '.');

                    line = line.Substring(i);

                    string realStringLine = line.ToString();
                    string theWord = GetNextWord(ref realStringLine, false, false);
                    line = realStringLine;

                    if ((!precededByDot) && (!ignored.Contains(theWord)) && (_state.Macros.Contains(theWord)))
                    {
                        previousOutput.Push(output);
                        previousLine.Push(line);
                        ignored.Push(theWord);
                        line = new FastString(_state.Macros[theWord]);
                        output = new StringBuilder(line.Length);
                    }
                    else
                    {
                        output.Append(theWord);
                    }
                }
                else
                    line = "";

                while (line.Length == 0 && previousOutput.Count > 0)
                {
                    String result = output.ToString();
                    output = previousOutput.Pop();
                    line = previousLine.Pop();
                    ignored.Pop();
                    output.Append(result);
                }

            }

            return output.ToString();
        }
All Usage Examples Of AGS.CScript.Compiler.FastString::ToString