219 lines
5.1 KiB
C#
219 lines
5.1 KiB
C#
using System;
|
|
using System.Runtime.InteropServices;
|
|
using System.Text;
|
|
|
|
namespace System.IO
|
|
{
|
|
// Token: 0x020001D9 RID: 473
|
|
internal class UnexceptionalStreamReader : StreamReader
|
|
{
|
|
// Token: 0x06001865 RID: 6245 RVA: 0x0005D67C File Offset: 0x0005B87C
|
|
public UnexceptionalStreamReader(Stream stream)
|
|
: base(stream)
|
|
{
|
|
}
|
|
|
|
// Token: 0x06001866 RID: 6246 RVA: 0x0005D688 File Offset: 0x0005B888
|
|
public UnexceptionalStreamReader(Stream stream, bool detect_encoding_from_bytemarks)
|
|
: base(stream, detect_encoding_from_bytemarks)
|
|
{
|
|
}
|
|
|
|
// Token: 0x06001867 RID: 6247 RVA: 0x0005D694 File Offset: 0x0005B894
|
|
public UnexceptionalStreamReader(Stream stream, Encoding encoding)
|
|
: base(stream, encoding)
|
|
{
|
|
}
|
|
|
|
// Token: 0x06001868 RID: 6248 RVA: 0x0005D6A0 File Offset: 0x0005B8A0
|
|
public UnexceptionalStreamReader(Stream stream, Encoding encoding, bool detect_encoding_from_bytemarks)
|
|
: base(stream, encoding, detect_encoding_from_bytemarks)
|
|
{
|
|
}
|
|
|
|
// Token: 0x06001869 RID: 6249 RVA: 0x0005D6AC File Offset: 0x0005B8AC
|
|
public UnexceptionalStreamReader(Stream stream, Encoding encoding, bool detect_encoding_from_bytemarks, int buffer_size)
|
|
: base(stream, encoding, detect_encoding_from_bytemarks, buffer_size)
|
|
{
|
|
}
|
|
|
|
// Token: 0x0600186A RID: 6250 RVA: 0x0005D6BC File Offset: 0x0005B8BC
|
|
public UnexceptionalStreamReader(string path)
|
|
: base(path)
|
|
{
|
|
}
|
|
|
|
// Token: 0x0600186B RID: 6251 RVA: 0x0005D6C8 File Offset: 0x0005B8C8
|
|
public UnexceptionalStreamReader(string path, bool detect_encoding_from_bytemarks)
|
|
: base(path, detect_encoding_from_bytemarks)
|
|
{
|
|
}
|
|
|
|
// Token: 0x0600186C RID: 6252 RVA: 0x0005D6D4 File Offset: 0x0005B8D4
|
|
public UnexceptionalStreamReader(string path, Encoding encoding)
|
|
: base(path, encoding)
|
|
{
|
|
}
|
|
|
|
// Token: 0x0600186D RID: 6253 RVA: 0x0005D6E0 File Offset: 0x0005B8E0
|
|
public UnexceptionalStreamReader(string path, Encoding encoding, bool detect_encoding_from_bytemarks)
|
|
: base(path, encoding, detect_encoding_from_bytemarks)
|
|
{
|
|
}
|
|
|
|
// Token: 0x0600186E RID: 6254 RVA: 0x0005D6EC File Offset: 0x0005B8EC
|
|
public UnexceptionalStreamReader(string path, Encoding encoding, bool detect_encoding_from_bytemarks, int buffer_size)
|
|
: base(path, encoding, detect_encoding_from_bytemarks, buffer_size)
|
|
{
|
|
}
|
|
|
|
// Token: 0x0600186F RID: 6255 RVA: 0x0005D6FC File Offset: 0x0005B8FC
|
|
static UnexceptionalStreamReader()
|
|
{
|
|
string newLine = Environment.NewLine;
|
|
if (newLine.Length == 1)
|
|
{
|
|
UnexceptionalStreamReader.newlineChar = newLine[0];
|
|
}
|
|
}
|
|
|
|
// Token: 0x06001870 RID: 6256 RVA: 0x0005D73C File Offset: 0x0005B93C
|
|
public override int Peek()
|
|
{
|
|
try
|
|
{
|
|
return base.Peek();
|
|
}
|
|
catch (IOException)
|
|
{
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
// Token: 0x06001871 RID: 6257 RVA: 0x0005D780 File Offset: 0x0005B980
|
|
public override int Read()
|
|
{
|
|
try
|
|
{
|
|
return base.Read();
|
|
}
|
|
catch (IOException)
|
|
{
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
// Token: 0x06001872 RID: 6258 RVA: 0x0005D7C4 File Offset: 0x0005B9C4
|
|
public override int Read([In] [Out] char[] dest_buffer, int index, int count)
|
|
{
|
|
if (dest_buffer == null)
|
|
{
|
|
throw new ArgumentNullException("dest_buffer");
|
|
}
|
|
if (index < 0)
|
|
{
|
|
throw new ArgumentOutOfRangeException("index", "< 0");
|
|
}
|
|
if (count < 0)
|
|
{
|
|
throw new ArgumentOutOfRangeException("count", "< 0");
|
|
}
|
|
if (index > dest_buffer.Length - count)
|
|
{
|
|
throw new ArgumentException("index + count > dest_buffer.Length");
|
|
}
|
|
int num = 0;
|
|
char c = UnexceptionalStreamReader.newlineChar;
|
|
try
|
|
{
|
|
while (count > 0)
|
|
{
|
|
int num2 = base.Read();
|
|
if (num2 < 0)
|
|
{
|
|
break;
|
|
}
|
|
num++;
|
|
count--;
|
|
dest_buffer[index] = (char)num2;
|
|
if (c != '\0')
|
|
{
|
|
if ((char)num2 == c)
|
|
{
|
|
return num;
|
|
}
|
|
}
|
|
else if (this.CheckEOL((char)num2))
|
|
{
|
|
return num;
|
|
}
|
|
index++;
|
|
}
|
|
}
|
|
catch (IOException)
|
|
{
|
|
}
|
|
return num;
|
|
}
|
|
|
|
// Token: 0x06001873 RID: 6259 RVA: 0x0005D8B8 File Offset: 0x0005BAB8
|
|
private bool CheckEOL(char current)
|
|
{
|
|
int i = 0;
|
|
while (i < UnexceptionalStreamReader.newline.Length)
|
|
{
|
|
if (!UnexceptionalStreamReader.newline[i])
|
|
{
|
|
if (current == Environment.NewLine[i])
|
|
{
|
|
UnexceptionalStreamReader.newline[i] = true;
|
|
return i == UnexceptionalStreamReader.newline.Length - 1;
|
|
}
|
|
break;
|
|
}
|
|
else
|
|
{
|
|
i++;
|
|
}
|
|
}
|
|
for (int j = 0; j < UnexceptionalStreamReader.newline.Length; j++)
|
|
{
|
|
UnexceptionalStreamReader.newline[j] = false;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
// Token: 0x06001874 RID: 6260 RVA: 0x0005D938 File Offset: 0x0005BB38
|
|
public override string ReadLine()
|
|
{
|
|
try
|
|
{
|
|
return base.ReadLine();
|
|
}
|
|
catch (IOException)
|
|
{
|
|
}
|
|
return null;
|
|
}
|
|
|
|
// Token: 0x06001875 RID: 6261 RVA: 0x0005D97C File Offset: 0x0005BB7C
|
|
public override string ReadToEnd()
|
|
{
|
|
try
|
|
{
|
|
return base.ReadToEnd();
|
|
}
|
|
catch (IOException)
|
|
{
|
|
}
|
|
return null;
|
|
}
|
|
|
|
// Token: 0x0400072A RID: 1834
|
|
private static bool[] newline = new bool[Environment.NewLine.Length];
|
|
|
|
// Token: 0x0400072B RID: 1835
|
|
private static char newlineChar;
|
|
}
|
|
}
|