Пример #1
0
 public TextLinesCursor(TextLinesCursor InCsr)
 {
     mLines     = InCsr.mLines;
     mLinesNode = InCsr.mLinesNode;
     mLineOx    = InCsr.mLineOx;
     mRltv      = InCsr.mRltv;
 }
Пример #2
0
 public TextLinesCursor()
 {
     mLines     = null;
     mLinesNode = null;
     mLineOx    = -1;
     mRltv      = RelativePosition.None;
 }
Пример #3
0
        public void LineAdvance(TextLines InLines)
        {
            switch (mRltv)
            {
            case RelativePosition.Begin:
                mLinesNode = InLines.FirstLine;
                break;

            case RelativePosition.Before:
                break;

            case RelativePosition.At:
                mLinesNode = mLinesNode.Next;
                break;

            case RelativePosition.After:
                mLinesNode = mLinesNode.Next;
                break;

            default:
                mLinesNode = null;
                break;
            }

            if (mLinesNode == null)
            {
                mRltv = RelativePosition.None;
            }
            else
            {
                mRltv   = RelativePosition.At;
                mLineOx = 0;
            }
        }
Пример #4
0
 public TextLinesCursor(
     LinkedListNode <TextLine> InLinesNode, int InLineOx, RelativePosition InRltv)
 {
     mLines     = null;
     mLinesNode = InLinesNode;
     mLineOx    = InLineOx;
     mRltv      = InRltv;
 }
Пример #5
0
        public TextLinesCursor(
            TextLines InLines, RelativePosition InRltv)
        {
            mLines     = InLines;
            mLinesNode = null;
            mLineOx    = -1;
            mRltv      = InRltv;

            if ((InRltv != RelativePosition.Begin) &&
                (InRltv != RelativePosition.End) &&
                (InRltv != RelativePosition.None))
            {
                throw new ApplicationException(
                          "only pos bgn and pos end allowed thru this constructor");
            }
        }
Пример #6
0
        private static TextLinesCursor Scanner_InitialCursorSetup(
            TextLines InLines, TextLinesCursor InCsr)
        {
            TextLinesCursor csr = new TextLinesCursor(InCsr);

            if (csr.Position == RelativePosition.Begin)
            {
                csr.LineAdvance(InLines);
            }
            else if (csr.EndOfLine == true)
            {
                csr.LineAdvance(InLines);
            }

            return(csr);
        }
Пример #7
0
        public static TextLines FileToTextLines(string InPath)
        {
            TextLines     lines = new TextLines();
            StringBuilder sb    = new StringBuilder(20000);

            using (StreamReader sr = new StreamReader(InPath))
            {
                while (true)
                {
                    string line = sr.ReadLine();
                    if (line == null)
                    {
                        break;
                    }
                    lines.AddLast(line);
                }
            }
            return(lines);
        }