From e9ea621b93fbb58d9edfca8375918791637bbd52 Mon Sep 17 00:00:00 2001 From: chai Date: Wed, 30 Dec 2020 20:59:04 +0800 Subject: +init --- Client/Assembly-CSharp/SubStringReader.cs | 51 +++++++++++++++++++++++++++++++ 1 file changed, 51 insertions(+) create mode 100644 Client/Assembly-CSharp/SubStringReader.cs (limited to 'Client/Assembly-CSharp/SubStringReader.cs') 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); + } +} -- cgit v1.1-26-g67d0