blob: 3d90f31af2cfd84d9ad2b43cb915b65ab415e9c1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
|
using System;
public class SubStringReader
{
private readonly string Source;
private int Position;
public SubStringReader(string source)
{
this.Source = source;
}
public SubString ReadLine()
{
int position = this.Position;
if (position >= this.Source.Length)
{
return default(SubString);
}
int num = this.Position;
int i = position;
while (i < this.Source.Length)
{
char c = this.Source[i];
if (c == '\r')
{
num = i - 1;
this.Position = i + 1;
if (i + 1 < this.Source.Length && this.Source[i + 1] == '\n')
{
this.Position = i + 2;
break;
}
break;
}
else
{
if (c == '\n')
{
num = i - 1;
this.Position = i + 1;
break;
}
this.Position++;
i++;
}
}
return new SubString(this.Source, position, num - position);
}
}
|