summaryrefslogtreecommitdiff
path: root/Client/Assembly-CSharp/SubStringReader.cs
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2020-12-30 20:59:04 +0800
committerchai <chaifix@163.com>2020-12-30 20:59:04 +0800
commite9ea621b93fbb58d9edfca8375918791637bbd52 (patch)
tree19ce3b1c1f2d51eda6878c9d0f2c9edc27f13650 /Client/Assembly-CSharp/SubStringReader.cs
+init
Diffstat (limited to 'Client/Assembly-CSharp/SubStringReader.cs')
-rw-r--r--Client/Assembly-CSharp/SubStringReader.cs51
1 files changed, 51 insertions, 0 deletions
diff --git a/Client/Assembly-CSharp/SubStringReader.cs b/Client/Assembly-CSharp/SubStringReader.cs
new file mode 100644
index 0000000..3d90f31
--- /dev/null
+++ b/Client/Assembly-CSharp/SubStringReader.cs
@@ -0,0 +1,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);
+ }
+}