Core/CafeLib.Core.FileIO/LineReader.cs
/// <summary>
/// Position to a particular line.
/// </summary>
/// <param name="lineIndex">line index position</param>
/// <returns></returns>
/// <exception cref="ArgumentException">argument exception</exception>
Position to a particular line.
Position to a particular line .
public async Task SeekLine(int lineIndex)
        {
            lineIndex = lineIndex >= 0 ? lineIndex : throw new ArgumentException(nameof(lineIndex));
            var target = 0;
            switch (lineIndex)
            {
                case var _ when lineIndex == CurrentLine:
                    return;
                case var _ when lineIndex < CurrentLine:
                    SeekOrigin();
                    target = lineIndex;
                    break;
                case var _ when lineIndex > CurrentLine:
                    target = lineIndex;
                    break;
            }
            var line = "";
            while (CurrentLine < target && line != null)
            {
                line = await ReadLineAsync().ConfigureAwait(false);
            }
        }
public async Task SeekLine ( int lineIndex ) { lineIndex = lineIndex >= 0 ? lineIndex : throw new ArgumentException ( nameof ( lineIndex ) ) ; var target = 0 ; switch ( lineIndex ) { case var _ when lineIndex == CurrentLine : return ; case var _ when lineIndex < CurrentLine : SeekOrigin ( ) ; target = lineIndex ; break ; case var _ when lineIndex > CurrentLine : target = lineIndex ; break ; } var line = " " ; while ( CurrentLine < target && line != null ) { line = await ReadLineAsync ( ) . ConfigureAwait ( false ) ; } }
Position to a particular line.
Position to a particular line .
// Verify argument.
None
None
lineIndex
int
line index position
line index position