scripts
This commit is contained in:
@@ -0,0 +1,722 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using Mono.Security;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
/// <summary>Reads primitive data types as binary values in a specific encoding.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x020001A7 RID: 423
|
||||
[ComVisible(true)]
|
||||
public class BinaryReader : IDisposable
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.BinaryReader" /> class based on the supplied stream and using <see cref="T:System.Text.UTF8Encoding" />.</summary>
|
||||
/// <param name="input">A stream. </param>
|
||||
/// <exception cref="T:System.ArgumentException">The stream does not support reading, the stream is null, or the stream is already closed. </exception>
|
||||
// Token: 0x0600158C RID: 5516 RVA: 0x00052824 File Offset: 0x00050A24
|
||||
public BinaryReader(Stream input)
|
||||
: this(input, Encoding.UTF8UnmarkedUnsafe)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.BinaryReader" /> class based on the supplied stream and a specific character encoding.</summary>
|
||||
/// <param name="input">The supplied stream. </param>
|
||||
/// <param name="encoding">The character encoding. </param>
|
||||
/// <exception cref="T:System.ArgumentException">The stream does not support reading, the stream is null, or the stream is already closed. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="encoding" /> is null. </exception>
|
||||
// Token: 0x0600158D RID: 5517 RVA: 0x00052834 File Offset: 0x00050A34
|
||||
public BinaryReader(Stream input, Encoding encoding)
|
||||
{
|
||||
if (input == null || encoding == null)
|
||||
{
|
||||
throw new ArgumentNullException(Locale.GetText("Input or Encoding is a null reference."));
|
||||
}
|
||||
if (!input.CanRead)
|
||||
{
|
||||
throw new ArgumentException(Locale.GetText("The stream doesn't support reading."));
|
||||
}
|
||||
this.m_stream = input;
|
||||
this.m_encoding = encoding;
|
||||
this.decoder = encoding.GetDecoder();
|
||||
this.m_buffer = new byte[32];
|
||||
}
|
||||
|
||||
/// <summary>Releases all resources used by the <see cref="T:System.IO.BinaryWriter" />.</summary>
|
||||
// Token: 0x0600158E RID: 5518 RVA: 0x000528A8 File Offset: 0x00050AA8
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
this.Dispose(true);
|
||||
}
|
||||
|
||||
/// <summary>Exposes access to the underlying stream of the <see cref="T:System.IO.BinaryReader" />.</summary>
|
||||
/// <returns>The underlying stream associated with the BinaryReader.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x170003D7 RID: 983
|
||||
// (get) Token: 0x0600158F RID: 5519 RVA: 0x000528B4 File Offset: 0x00050AB4
|
||||
public virtual Stream BaseStream
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_stream;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Closes the current reader and the underlying stream.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06001590 RID: 5520 RVA: 0x000528BC File Offset: 0x00050ABC
|
||||
public virtual void Close()
|
||||
{
|
||||
this.Dispose(true);
|
||||
this.m_disposed = true;
|
||||
}
|
||||
|
||||
/// <summary>Releases the unmanaged resources used by the <see cref="T:System.IO.BinaryReader" /> and optionally releases the managed resources.</summary>
|
||||
/// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources. </param>
|
||||
// Token: 0x06001591 RID: 5521 RVA: 0x000528CC File Offset: 0x00050ACC
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && this.m_stream != null)
|
||||
{
|
||||
this.m_stream.Close();
|
||||
}
|
||||
this.m_disposed = true;
|
||||
this.m_buffer = null;
|
||||
this.m_encoding = null;
|
||||
this.m_stream = null;
|
||||
this.charBuffer = null;
|
||||
}
|
||||
|
||||
/// <summary>Fills the internal buffer with the specified number of bytes read from the stream.</summary>
|
||||
/// <param name="numBytes">The number of bytes to be read. </param>
|
||||
/// <exception cref="T:System.IO.EndOfStreamException">The end of the stream is reached before <paramref name="numBytes" /> could be read. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">Requested <paramref name="numBytes" /> is larger than the internal buffer size.</exception>
|
||||
// Token: 0x06001592 RID: 5522 RVA: 0x00052918 File Offset: 0x00050B18
|
||||
protected virtual void FillBuffer(int numBytes)
|
||||
{
|
||||
if (this.m_disposed)
|
||||
{
|
||||
throw new ObjectDisposedException("BinaryReader", "Cannot read from a closed BinaryReader.");
|
||||
}
|
||||
if (this.m_stream == null)
|
||||
{
|
||||
throw new IOException("Stream is invalid");
|
||||
}
|
||||
this.CheckBuffer(numBytes);
|
||||
int num;
|
||||
for (int i = 0; i < numBytes; i += num)
|
||||
{
|
||||
num = this.m_stream.Read(this.m_buffer, i, numBytes - i);
|
||||
if (num == 0)
|
||||
{
|
||||
throw new EndOfStreamException();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Returns the next available character and does not advance the byte or character position.</summary>
|
||||
/// <returns>The next available character, or -1 if no more characters are available or the stream does not support seeking.</returns>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">The current character cannot be decoded into the internal character buffer by using the <see cref="T:System.Text.Encoding" /> selected for the stream.</exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06001593 RID: 5523 RVA: 0x00052994 File Offset: 0x00050B94
|
||||
public virtual int PeekChar()
|
||||
{
|
||||
if (this.m_stream == null)
|
||||
{
|
||||
if (this.m_disposed)
|
||||
{
|
||||
throw new ObjectDisposedException("BinaryReader", "Cannot read from a closed BinaryReader.");
|
||||
}
|
||||
throw new IOException("Stream is invalid");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!this.m_stream.CanSeek)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
char[] array = new char[1];
|
||||
int num2;
|
||||
int num = this.ReadCharBytes(array, 0, 1, out num2);
|
||||
this.m_stream.Position -= (long)num2;
|
||||
if (num == 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return (int)array[0];
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Reads characters from the underlying stream and advances the current position of the stream in accordance with the Encoding used and the specific character being read from the stream.</summary>
|
||||
/// <returns>The next character from the input stream, or -1 if no characters are currently available.</returns>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06001594 RID: 5524 RVA: 0x00052A18 File Offset: 0x00050C18
|
||||
public virtual int Read()
|
||||
{
|
||||
if (this.charBuffer == null)
|
||||
{
|
||||
this.charBuffer = new char[128];
|
||||
}
|
||||
if (this.Read(this.charBuffer, 0, 1) == 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return (int)this.charBuffer[0];
|
||||
}
|
||||
|
||||
/// <summary>Reads <paramref name="count" /> bytes from the stream with <paramref name="index" /> as the starting point in the byte array.</summary>
|
||||
/// <returns>The number of characters read into <paramref name="buffer" />. This might be less than the number of bytes requested if that many bytes are not available, or it might be zero if the end of the stream is reached.</returns>
|
||||
/// <param name="buffer">The buffer to read data into. </param>
|
||||
/// <param name="index">The starting point in the buffer at which to begin reading into the buffer. </param>
|
||||
/// <param name="count">The number of characters to read. </param>
|
||||
/// <exception cref="T:System.ArgumentException">The buffer length minus <paramref name="index" /> is less than <paramref name="count" />. -or-The number of decoded characters to read is greater than <paramref name="count" />. This can happen if a Unicode decoder returns fallback characters or a surrogate pair.</exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="buffer" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> or <paramref name="count" /> is negative. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06001595 RID: 5525 RVA: 0x00052A60 File Offset: 0x00050C60
|
||||
public virtual int Read(byte[] buffer, int index, int count)
|
||||
{
|
||||
if (this.m_stream == null)
|
||||
{
|
||||
if (this.m_disposed)
|
||||
{
|
||||
throw new ObjectDisposedException("BinaryReader", "Cannot read from a closed BinaryReader.");
|
||||
}
|
||||
throw new IOException("Stream is invalid");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (buffer == null)
|
||||
{
|
||||
throw new ArgumentNullException("buffer is null");
|
||||
}
|
||||
if (index < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("index is less than 0");
|
||||
}
|
||||
if (count < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count is less than 0");
|
||||
}
|
||||
if (buffer.Length - index < count)
|
||||
{
|
||||
throw new ArgumentException("buffer is too small");
|
||||
}
|
||||
return this.m_stream.Read(buffer, index, count);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Reads <paramref name="count" /> characters from the stream with <paramref name="index" /> as the starting point in the character array.</summary>
|
||||
/// <returns>The total number of characters read into the buffer. This might be less than the number of characters requested if that many characters are not currently available, or it might be zero if the end of the stream is reached.</returns>
|
||||
/// <param name="buffer">The buffer to read data into. </param>
|
||||
/// <param name="index">The starting point in the buffer at which to begin reading into the buffer. </param>
|
||||
/// <param name="count">The number of characters to read. </param>
|
||||
/// <exception cref="T:System.ArgumentException">The buffer length minus <paramref name="index" /> is less than <paramref name="count" />. -or-The number of decoded characters to read is greater than <paramref name="count" />. This can happen if a Unicode decoder returns fallback characters or a surrogate pair.</exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="buffer" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> or <paramref name="count" /> is negative. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06001596 RID: 5526 RVA: 0x00052AFC File Offset: 0x00050CFC
|
||||
public virtual int Read(char[] buffer, int index, int count)
|
||||
{
|
||||
if (this.m_stream == null)
|
||||
{
|
||||
if (this.m_disposed)
|
||||
{
|
||||
throw new ObjectDisposedException("BinaryReader", "Cannot read from a closed BinaryReader.");
|
||||
}
|
||||
throw new IOException("Stream is invalid");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (buffer == null)
|
||||
{
|
||||
throw new ArgumentNullException("buffer is null");
|
||||
}
|
||||
if (index < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("index is less than 0");
|
||||
}
|
||||
if (count < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count is less than 0");
|
||||
}
|
||||
if (buffer.Length - index < count)
|
||||
{
|
||||
throw new ArgumentException("buffer is too small");
|
||||
}
|
||||
int num;
|
||||
return this.ReadCharBytes(buffer, index, count, out num);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001597 RID: 5527 RVA: 0x00052B90 File Offset: 0x00050D90
|
||||
private int ReadCharBytes(char[] buffer, int index, int count, out int bytes_read)
|
||||
{
|
||||
int i = 0;
|
||||
bytes_read = 0;
|
||||
while (i < count)
|
||||
{
|
||||
int num = 0;
|
||||
int chars;
|
||||
do
|
||||
{
|
||||
this.CheckBuffer(num + 1);
|
||||
int num2 = this.m_stream.ReadByte();
|
||||
if (num2 == -1)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
this.m_buffer[num++] = (byte)num2;
|
||||
bytes_read++;
|
||||
chars = this.m_encoding.GetChars(this.m_buffer, 0, num, buffer, index + i);
|
||||
}
|
||||
while (chars <= 0);
|
||||
i++;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
/// <summary>Reads in a 32-bit integer in compressed format.</summary>
|
||||
/// <returns>A 32-bit integer in compressed format.</returns>
|
||||
/// <exception cref="T:System.IO.EndOfStreamException">The end of the stream is reached. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.FormatException">The stream is corrupted.</exception>
|
||||
// Token: 0x06001598 RID: 5528 RVA: 0x00052C14 File Offset: 0x00050E14
|
||||
protected int Read7BitEncodedInt()
|
||||
{
|
||||
int num = 0;
|
||||
int num2 = 0;
|
||||
int i;
|
||||
for (i = 0; i < 5; i++)
|
||||
{
|
||||
byte b = this.ReadByte();
|
||||
num |= (int)(b & 127) << num2;
|
||||
num2 += 7;
|
||||
if ((b & 128) == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i < 5)
|
||||
{
|
||||
return num;
|
||||
}
|
||||
throw new FormatException("Too many bytes in what should have been a 7 bit encoded Int32.");
|
||||
}
|
||||
|
||||
/// <summary>Reads a Boolean value from the current stream and advances the current position of the stream by one byte.</summary>
|
||||
/// <returns>true if the byte is nonzero; otherwise, false.</returns>
|
||||
/// <exception cref="T:System.IO.EndOfStreamException">The end of the stream is reached. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06001599 RID: 5529 RVA: 0x00052C74 File Offset: 0x00050E74
|
||||
public virtual bool ReadBoolean()
|
||||
{
|
||||
return this.ReadByte() != 0;
|
||||
}
|
||||
|
||||
/// <summary>Reads the next byte from the current stream and advances the current position of the stream by one byte.</summary>
|
||||
/// <returns>The next byte read from the current stream.</returns>
|
||||
/// <exception cref="T:System.IO.EndOfStreamException">The end of the stream is reached. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x0600159A RID: 5530 RVA: 0x00052C84 File Offset: 0x00050E84
|
||||
public virtual byte ReadByte()
|
||||
{
|
||||
if (this.m_stream == null)
|
||||
{
|
||||
if (this.m_disposed)
|
||||
{
|
||||
throw new ObjectDisposedException("BinaryReader", "Cannot read from a closed BinaryReader.");
|
||||
}
|
||||
throw new IOException("Stream is invalid");
|
||||
}
|
||||
else
|
||||
{
|
||||
int num = this.m_stream.ReadByte();
|
||||
if (num != -1)
|
||||
{
|
||||
return (byte)num;
|
||||
}
|
||||
throw new EndOfStreamException();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Reads <paramref name="count" /> bytes from the current stream into a byte array and advances the current position by <paramref name="count" /> bytes.</summary>
|
||||
/// <returns>A byte array containing data read from the underlying stream. This might be less than the number of bytes requested if the end of the stream is reached.</returns>
|
||||
/// <param name="count">The number of bytes to read. </param>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="count" /> is negative. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x0600159B RID: 5531 RVA: 0x00052CE0 File Offset: 0x00050EE0
|
||||
public virtual byte[] ReadBytes(int count)
|
||||
{
|
||||
if (this.m_stream == null)
|
||||
{
|
||||
if (this.m_disposed)
|
||||
{
|
||||
throw new ObjectDisposedException("BinaryReader", "Cannot read from a closed BinaryReader.");
|
||||
}
|
||||
throw new IOException("Stream is invalid");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (count < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count is less than 0");
|
||||
}
|
||||
byte[] array = new byte[count];
|
||||
int i;
|
||||
int num;
|
||||
for (i = 0; i < count; i += num)
|
||||
{
|
||||
num = this.m_stream.Read(array, i, count - i);
|
||||
if (num == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i != count)
|
||||
{
|
||||
byte[] array2 = new byte[i];
|
||||
Buffer.BlockCopyInternal(array, 0, array2, 0, i);
|
||||
return array2;
|
||||
}
|
||||
return array;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Reads the next character from the current stream and advances the current position of the stream in accordance with the Encoding used and the specific character being read from the stream.</summary>
|
||||
/// <returns>A character read from the current stream.</returns>
|
||||
/// <exception cref="T:System.IO.EndOfStreamException">The end of the stream is reached. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">A surrogate character was read. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x0600159C RID: 5532 RVA: 0x00052D84 File Offset: 0x00050F84
|
||||
public virtual char ReadChar()
|
||||
{
|
||||
int num = this.Read();
|
||||
if (num == -1)
|
||||
{
|
||||
throw new EndOfStreamException();
|
||||
}
|
||||
return (char)num;
|
||||
}
|
||||
|
||||
/// <summary>Reads <paramref name="count" /> characters from the current stream, returns the data in a character array, and advances the current position in accordance with the Encoding used and the specific character being read from the stream.</summary>
|
||||
/// <returns>A character array containing data read from the underlying stream. This might be less than the number of characters requested if the end of the stream is reached.</returns>
|
||||
/// <param name="count">The number of characters to read. </param>
|
||||
/// <exception cref="T:System.ArgumentException">The number of decoded characters to read is greater than <paramref name="count" />. This can happen if a Unicode decoder returns fallback characters or a surrogate pair.</exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="count" /> is negative. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x0600159D RID: 5533 RVA: 0x00052DA8 File Offset: 0x00050FA8
|
||||
public virtual char[] ReadChars(int count)
|
||||
{
|
||||
if (count < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count is less than 0");
|
||||
}
|
||||
if (count == 0)
|
||||
{
|
||||
return new char[0];
|
||||
}
|
||||
char[] array = new char[count];
|
||||
int num = this.Read(array, 0, count);
|
||||
if (num == 0)
|
||||
{
|
||||
throw new EndOfStreamException();
|
||||
}
|
||||
if (num != array.Length)
|
||||
{
|
||||
char[] array2 = new char[num];
|
||||
Array.Copy(array, 0, array2, 0, num);
|
||||
return array2;
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
/// <summary>Reads a decimal value from the current stream and advances the current position of the stream by sixteen bytes.</summary>
|
||||
/// <returns>A decimal value read from the current stream.</returns>
|
||||
/// <exception cref="T:System.IO.EndOfStreamException">The end of the stream is reached. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x0600159E RID: 5534 RVA: 0x00052E10 File Offset: 0x00051010
|
||||
public unsafe virtual decimal ReadDecimal()
|
||||
{
|
||||
this.FillBuffer(16);
|
||||
decimal num;
|
||||
if (BitConverter.IsLittleEndian)
|
||||
{
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
if (i < 4)
|
||||
{
|
||||
*((ref num) + (i + 8)) = this.m_buffer[i];
|
||||
}
|
||||
else if (i < 8)
|
||||
{
|
||||
*((ref num) + (i + 8)) = this.m_buffer[i];
|
||||
}
|
||||
else if (i < 12)
|
||||
{
|
||||
*((ref num) + (i - 4)) = this.m_buffer[i];
|
||||
}
|
||||
else if (i < 16)
|
||||
{
|
||||
*((ref num) + (i - 12)) = this.m_buffer[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int j = 0; j < 16; j++)
|
||||
{
|
||||
if (j < 4)
|
||||
{
|
||||
*((ref num) + (11 - j)) = this.m_buffer[j];
|
||||
}
|
||||
else if (j < 8)
|
||||
{
|
||||
*((ref num) + (19 - j)) = this.m_buffer[j];
|
||||
}
|
||||
else if (j < 12)
|
||||
{
|
||||
*((ref num) + (15 - j)) = this.m_buffer[j];
|
||||
}
|
||||
else if (j < 16)
|
||||
{
|
||||
*((ref num) + (15 - j)) = this.m_buffer[j];
|
||||
}
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
/// <summary>Reads an 8-byte floating point value from the current stream and advances the current position of the stream by eight bytes.</summary>
|
||||
/// <returns>An 8-byte floating point value read from the current stream.</returns>
|
||||
/// <exception cref="T:System.IO.EndOfStreamException">The end of the stream is reached. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x0600159F RID: 5535 RVA: 0x00052F30 File Offset: 0x00051130
|
||||
public virtual double ReadDouble()
|
||||
{
|
||||
this.FillBuffer(8);
|
||||
return BitConverterLE.ToDouble(this.m_buffer, 0);
|
||||
}
|
||||
|
||||
/// <summary>Reads a 2-byte signed integer from the current stream and advances the current position of the stream by two bytes.</summary>
|
||||
/// <returns>A 2-byte signed integer read from the current stream.</returns>
|
||||
/// <exception cref="T:System.IO.EndOfStreamException">The end of the stream is reached. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060015A0 RID: 5536 RVA: 0x00052F48 File Offset: 0x00051148
|
||||
public virtual short ReadInt16()
|
||||
{
|
||||
this.FillBuffer(2);
|
||||
return (short)((int)this.m_buffer[0] | ((int)this.m_buffer[1] << 8));
|
||||
}
|
||||
|
||||
/// <summary>Reads a 4-byte signed integer from the current stream and advances the current position of the stream by four bytes.</summary>
|
||||
/// <returns>A 4-byte signed integer read from the current stream.</returns>
|
||||
/// <exception cref="T:System.IO.EndOfStreamException">The end of the stream is reached. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060015A1 RID: 5537 RVA: 0x00052F68 File Offset: 0x00051168
|
||||
public virtual int ReadInt32()
|
||||
{
|
||||
this.FillBuffer(4);
|
||||
return (int)this.m_buffer[0] | ((int)this.m_buffer[1] << 8) | ((int)this.m_buffer[2] << 16) | ((int)this.m_buffer[3] << 24);
|
||||
}
|
||||
|
||||
/// <summary>Reads an 8-byte signed integer from the current stream and advances the current position of the stream by eight bytes.</summary>
|
||||
/// <returns>An 8-byte signed integer read from the current stream.</returns>
|
||||
/// <exception cref="T:System.IO.EndOfStreamException">The end of the stream is reached. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060015A2 RID: 5538 RVA: 0x00052FA8 File Offset: 0x000511A8
|
||||
public virtual long ReadInt64()
|
||||
{
|
||||
this.FillBuffer(8);
|
||||
uint num = (uint)((int)this.m_buffer[0] | ((int)this.m_buffer[1] << 8) | ((int)this.m_buffer[2] << 16) | ((int)this.m_buffer[3] << 24));
|
||||
uint num2 = (uint)((int)this.m_buffer[4] | ((int)this.m_buffer[5] << 8) | ((int)this.m_buffer[6] << 16) | ((int)this.m_buffer[7] << 24));
|
||||
return (long)(((ulong)num2 << 32) | (ulong)num);
|
||||
}
|
||||
|
||||
/// <summary>Reads a signed byte from this stream and advances the current position of the stream by one byte.</summary>
|
||||
/// <returns>A signed byte read from the current stream.</returns>
|
||||
/// <exception cref="T:System.IO.EndOfStreamException">The end of the stream is reached. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060015A3 RID: 5539 RVA: 0x0005301C File Offset: 0x0005121C
|
||||
[CLSCompliant(false)]
|
||||
public virtual sbyte ReadSByte()
|
||||
{
|
||||
return (sbyte)this.ReadByte();
|
||||
}
|
||||
|
||||
/// <summary>Reads a string from the current stream. The string is prefixed with the length, encoded as an integer seven bits at a time.</summary>
|
||||
/// <returns>The string being read.</returns>
|
||||
/// <exception cref="T:System.IO.EndOfStreamException">The end of the stream is reached. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060015A4 RID: 5540 RVA: 0x00053028 File Offset: 0x00051228
|
||||
public virtual string ReadString()
|
||||
{
|
||||
int num = this.Read7BitEncodedInt();
|
||||
if (num < 0)
|
||||
{
|
||||
throw new IOException("Invalid binary file (string len < 0)");
|
||||
}
|
||||
if (num == 0)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
if (this.charBuffer == null)
|
||||
{
|
||||
this.charBuffer = new char[128];
|
||||
}
|
||||
StringBuilder stringBuilder = null;
|
||||
int chars;
|
||||
for (;;)
|
||||
{
|
||||
int num2 = ((num <= 128) ? num : 128);
|
||||
this.FillBuffer(num2);
|
||||
chars = this.decoder.GetChars(this.m_buffer, 0, num2, this.charBuffer, 0);
|
||||
if (stringBuilder == null && num2 == num)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (stringBuilder == null)
|
||||
{
|
||||
stringBuilder = new StringBuilder(num);
|
||||
}
|
||||
stringBuilder.Append(this.charBuffer, 0, chars);
|
||||
num -= num2;
|
||||
if (num <= 0)
|
||||
{
|
||||
goto Block_8;
|
||||
}
|
||||
}
|
||||
return new string(this.charBuffer, 0, chars);
|
||||
Block_8:
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
|
||||
/// <summary>Reads a 4-byte floating point value from the current stream and advances the current position of the stream by four bytes.</summary>
|
||||
/// <returns>A 4-byte floating point value read from the current stream.</returns>
|
||||
/// <exception cref="T:System.IO.EndOfStreamException">The end of the stream is reached. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060015A5 RID: 5541 RVA: 0x000530F8 File Offset: 0x000512F8
|
||||
public virtual float ReadSingle()
|
||||
{
|
||||
this.FillBuffer(4);
|
||||
return BitConverterLE.ToSingle(this.m_buffer, 0);
|
||||
}
|
||||
|
||||
/// <summary>Reads a 2-byte unsigned integer from the current stream using little-endian encoding and advances the position of the stream by two bytes.</summary>
|
||||
/// <returns>A 2-byte unsigned integer read from this stream.</returns>
|
||||
/// <exception cref="T:System.IO.EndOfStreamException">The end of the stream is reached. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060015A6 RID: 5542 RVA: 0x00053110 File Offset: 0x00051310
|
||||
[CLSCompliant(false)]
|
||||
public virtual ushort ReadUInt16()
|
||||
{
|
||||
this.FillBuffer(2);
|
||||
return (ushort)((int)this.m_buffer[0] | ((int)this.m_buffer[1] << 8));
|
||||
}
|
||||
|
||||
/// <summary>Reads a 4-byte unsigned integer from the current stream and advances the position of the stream by four bytes.</summary>
|
||||
/// <returns>A 4-byte unsigned integer read from this stream.</returns>
|
||||
/// <exception cref="T:System.IO.EndOfStreamException">The end of the stream is reached. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060015A7 RID: 5543 RVA: 0x00053130 File Offset: 0x00051330
|
||||
[CLSCompliant(false)]
|
||||
public virtual uint ReadUInt32()
|
||||
{
|
||||
this.FillBuffer(4);
|
||||
return (uint)((int)this.m_buffer[0] | ((int)this.m_buffer[1] << 8) | ((int)this.m_buffer[2] << 16) | ((int)this.m_buffer[3] << 24));
|
||||
}
|
||||
|
||||
/// <summary>Reads an 8-byte unsigned integer from the current stream and advances the position of the stream by eight bytes.</summary>
|
||||
/// <returns>An 8-byte unsigned integer read from this stream.</returns>
|
||||
/// <exception cref="T:System.IO.EndOfStreamException">The end of the stream is reached. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060015A8 RID: 5544 RVA: 0x00053170 File Offset: 0x00051370
|
||||
[CLSCompliant(false)]
|
||||
public virtual ulong ReadUInt64()
|
||||
{
|
||||
this.FillBuffer(8);
|
||||
uint num = (uint)((int)this.m_buffer[0] | ((int)this.m_buffer[1] << 8) | ((int)this.m_buffer[2] << 16) | ((int)this.m_buffer[3] << 24));
|
||||
uint num2 = (uint)((int)this.m_buffer[4] | ((int)this.m_buffer[5] << 8) | ((int)this.m_buffer[6] << 16) | ((int)this.m_buffer[7] << 24));
|
||||
return ((ulong)num2 << 32) | (ulong)num;
|
||||
}
|
||||
|
||||
// Token: 0x060015A9 RID: 5545 RVA: 0x000531E4 File Offset: 0x000513E4
|
||||
private void CheckBuffer(int length)
|
||||
{
|
||||
if (this.m_buffer.Length <= length)
|
||||
{
|
||||
byte[] array = new byte[length];
|
||||
Buffer.BlockCopyInternal(this.m_buffer, 0, array, 0, this.m_buffer.Length);
|
||||
this.m_buffer = array;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x04000634 RID: 1588
|
||||
private const int MaxBufferSize = 128;
|
||||
|
||||
// Token: 0x04000635 RID: 1589
|
||||
private Stream m_stream;
|
||||
|
||||
// Token: 0x04000636 RID: 1590
|
||||
private Encoding m_encoding;
|
||||
|
||||
// Token: 0x04000637 RID: 1591
|
||||
private byte[] m_buffer;
|
||||
|
||||
// Token: 0x04000638 RID: 1592
|
||||
private Decoder decoder;
|
||||
|
||||
// Token: 0x04000639 RID: 1593
|
||||
private char[] charBuffer;
|
||||
|
||||
// Token: 0x0400063A RID: 1594
|
||||
private bool m_disposed;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,573 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
using Mono.Security;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
/// <summary>Writes primitive types in binary to a stream and supports writing strings in a specific encoding.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x020001A8 RID: 424
|
||||
[ComVisible(true)]
|
||||
[Serializable]
|
||||
public class BinaryWriter : IDisposable
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.BinaryWriter" /> class that writes to a stream.</summary>
|
||||
// Token: 0x060015AA RID: 5546 RVA: 0x00053224 File Offset: 0x00051424
|
||||
protected BinaryWriter()
|
||||
: this(Stream.Null, Encoding.UTF8UnmarkedUnsafe)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.BinaryWriter" /> class based on the supplied stream and using UTF-8 as the encoding for strings.</summary>
|
||||
/// <param name="output">The output stream. </param>
|
||||
/// <exception cref="T:System.ArgumentException">The stream does not support writing, or the stream is already closed. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="output" /> is null. </exception>
|
||||
// Token: 0x060015AB RID: 5547 RVA: 0x00053238 File Offset: 0x00051438
|
||||
public BinaryWriter(Stream output)
|
||||
: this(output, Encoding.UTF8UnmarkedUnsafe)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.BinaryWriter" /> class based on the supplied stream and a specific character encoding.</summary>
|
||||
/// <param name="output">The supplied stream. </param>
|
||||
/// <param name="encoding">The character encoding. </param>
|
||||
/// <exception cref="T:System.ArgumentException">The stream does not support writing, or the stream is already closed. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="output" /> or <paramref name="encoding" /> is null. </exception>
|
||||
// Token: 0x060015AC RID: 5548 RVA: 0x00053248 File Offset: 0x00051448
|
||||
public BinaryWriter(Stream output, Encoding encoding)
|
||||
{
|
||||
if (output == null)
|
||||
{
|
||||
throw new ArgumentNullException("output");
|
||||
}
|
||||
if (encoding == null)
|
||||
{
|
||||
throw new ArgumentNullException("encoding");
|
||||
}
|
||||
if (!output.CanWrite)
|
||||
{
|
||||
throw new ArgumentException(Locale.GetText("Stream does not support writing or already closed."));
|
||||
}
|
||||
this.OutStream = output;
|
||||
this.m_encoding = encoding;
|
||||
this.buffer = new byte[16];
|
||||
}
|
||||
|
||||
/// <summary>Releases the unmanaged resources used by the <see cref="T:System.IO.BinaryWriter" /> and optionally releases the managed resources.</summary>
|
||||
// Token: 0x060015AE RID: 5550 RVA: 0x000532C0 File Offset: 0x000514C0
|
||||
void IDisposable.Dispose()
|
||||
{
|
||||
this.Dispose(true);
|
||||
}
|
||||
|
||||
/// <summary>Gets the underlying stream of the <see cref="T:System.IO.BinaryWriter" />.</summary>
|
||||
/// <returns>The underlying stream associated with the BinaryWriter.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x170003D8 RID: 984
|
||||
// (get) Token: 0x060015AF RID: 5551 RVA: 0x000532CC File Offset: 0x000514CC
|
||||
public virtual Stream BaseStream
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.OutStream;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Closes the current <see cref="T:System.IO.BinaryWriter" /> and the underlying stream.</summary>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060015B0 RID: 5552 RVA: 0x000532D4 File Offset: 0x000514D4
|
||||
public virtual void Close()
|
||||
{
|
||||
this.Dispose(true);
|
||||
}
|
||||
|
||||
/// <summary>Releases the unmanaged resources used by the <see cref="T:System.IO.BinaryWriter" /> and optionally releases the managed resources.</summary>
|
||||
/// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources. </param>
|
||||
// Token: 0x060015B1 RID: 5553 RVA: 0x000532E0 File Offset: 0x000514E0
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && this.OutStream != null)
|
||||
{
|
||||
this.OutStream.Close();
|
||||
}
|
||||
this.buffer = null;
|
||||
this.m_encoding = null;
|
||||
this.disposed = true;
|
||||
}
|
||||
|
||||
/// <summary>Clears all buffers for the current writer and causes any buffered data to be written to the underlying device.</summary>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060015B2 RID: 5554 RVA: 0x00053314 File Offset: 0x00051514
|
||||
public virtual void Flush()
|
||||
{
|
||||
this.OutStream.Flush();
|
||||
}
|
||||
|
||||
/// <summary>Sets the position within the current stream.</summary>
|
||||
/// <returns>The position with the current stream.</returns>
|
||||
/// <param name="offset">A byte offset relative to <paramref name="origin" />. </param>
|
||||
/// <param name="origin">A field of <see cref="T:System.IO.SeekOrigin" /> indicating the reference point from which the new position is to be obtained. </param>
|
||||
/// <exception cref="T:System.IO.IOException">The file pointer was moved to an invalid location. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">The <see cref="T:System.IO.SeekOrigin" /> value is invalid. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060015B3 RID: 5555 RVA: 0x00053324 File Offset: 0x00051524
|
||||
public virtual long Seek(int offset, SeekOrigin origin)
|
||||
{
|
||||
return this.OutStream.Seek((long)offset, origin);
|
||||
}
|
||||
|
||||
/// <summary>Writes a one-byte Boolean value to the current stream, with 0 representing false and 1 representing true.</summary>
|
||||
/// <param name="value">The Boolean value to write (0 or 1). </param>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060015B4 RID: 5556 RVA: 0x00053334 File Offset: 0x00051534
|
||||
public virtual void Write(bool value)
|
||||
{
|
||||
if (this.disposed)
|
||||
{
|
||||
throw new ObjectDisposedException("BinaryWriter", "Cannot write to a closed BinaryWriter");
|
||||
}
|
||||
this.buffer[0] = ((!value) ? 0 : 1);
|
||||
this.OutStream.Write(this.buffer, 0, 1);
|
||||
}
|
||||
|
||||
/// <summary>Writes an unsigned byte to the current stream and advances the stream position by one byte.</summary>
|
||||
/// <param name="value">The unsigned byte to write. </param>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060015B5 RID: 5557 RVA: 0x00053388 File Offset: 0x00051588
|
||||
public virtual void Write(byte value)
|
||||
{
|
||||
if (this.disposed)
|
||||
{
|
||||
throw new ObjectDisposedException("BinaryWriter", "Cannot write to a closed BinaryWriter");
|
||||
}
|
||||
this.OutStream.WriteByte(value);
|
||||
}
|
||||
|
||||
/// <summary>Writes a byte array to the underlying stream.</summary>
|
||||
/// <param name="buffer">A byte array containing the data to write. </param>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="buffer" /> is null. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060015B6 RID: 5558 RVA: 0x000533B4 File Offset: 0x000515B4
|
||||
public virtual void Write(byte[] buffer)
|
||||
{
|
||||
if (this.disposed)
|
||||
{
|
||||
throw new ObjectDisposedException("BinaryWriter", "Cannot write to a closed BinaryWriter");
|
||||
}
|
||||
if (buffer == null)
|
||||
{
|
||||
throw new ArgumentNullException("buffer");
|
||||
}
|
||||
this.OutStream.Write(buffer, 0, buffer.Length);
|
||||
}
|
||||
|
||||
/// <summary>Writes a region of a byte array to the current stream.</summary>
|
||||
/// <param name="buffer">A byte array containing the data to write. </param>
|
||||
/// <param name="index">The starting point in <paramref name="buffer" /> at which to begin writing. </param>
|
||||
/// <param name="count">The number of bytes to write. </param>
|
||||
/// <exception cref="T:System.ArgumentException">The buffer length minus <paramref name="index" /> is less than <paramref name="count" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="buffer" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> or <paramref name="count" /> is negative. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060015B7 RID: 5559 RVA: 0x00053400 File Offset: 0x00051600
|
||||
public virtual void Write(byte[] buffer, int index, int count)
|
||||
{
|
||||
if (this.disposed)
|
||||
{
|
||||
throw new ObjectDisposedException("BinaryWriter", "Cannot write to a closed BinaryWriter");
|
||||
}
|
||||
if (buffer == null)
|
||||
{
|
||||
throw new ArgumentNullException("buffer");
|
||||
}
|
||||
this.OutStream.Write(buffer, index, count);
|
||||
}
|
||||
|
||||
/// <summary>Writes a Unicode character to the current stream and advances the current position of the stream in accordance with the Encoding used and the specific characters being written to the stream.</summary>
|
||||
/// <param name="ch">The non-surrogate, Unicode character to write. </param>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="ch" /> is a single surrogate character.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060015B8 RID: 5560 RVA: 0x00053448 File Offset: 0x00051648
|
||||
public virtual void Write(char ch)
|
||||
{
|
||||
if (this.disposed)
|
||||
{
|
||||
throw new ObjectDisposedException("BinaryWriter", "Cannot write to a closed BinaryWriter");
|
||||
}
|
||||
char[] array = new char[] { ch };
|
||||
byte[] bytes = this.m_encoding.GetBytes(array, 0, 1);
|
||||
this.OutStream.Write(bytes, 0, bytes.Length);
|
||||
}
|
||||
|
||||
/// <summary>Writes a character array to the current stream and advances the current position of the stream in accordance with the Encoding used and the specific characters being written to the stream.</summary>
|
||||
/// <param name="chars">A character array containing the data to write. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="chars" /> is null. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060015B9 RID: 5561 RVA: 0x0005349C File Offset: 0x0005169C
|
||||
public virtual void Write(char[] chars)
|
||||
{
|
||||
if (this.disposed)
|
||||
{
|
||||
throw new ObjectDisposedException("BinaryWriter", "Cannot write to a closed BinaryWriter");
|
||||
}
|
||||
if (chars == null)
|
||||
{
|
||||
throw new ArgumentNullException("chars");
|
||||
}
|
||||
byte[] bytes = this.m_encoding.GetBytes(chars, 0, chars.Length);
|
||||
this.OutStream.Write(bytes, 0, bytes.Length);
|
||||
}
|
||||
|
||||
/// <summary>Writes a section of a character array to the current stream, and advances the current position of the stream in accordance with the Encoding used and perhaps the specific characters being written to the stream.</summary>
|
||||
/// <param name="chars">A character array containing the data to write. </param>
|
||||
/// <param name="index">The starting point in <paramref name="chars" /> from which to begin writing. </param>
|
||||
/// <param name="count">The number of characters to write. </param>
|
||||
/// <exception cref="T:System.ArgumentException">The buffer length minus <paramref name="index" /> is less than <paramref name="count" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="chars" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> or <paramref name="count" /> is negative. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060015BA RID: 5562 RVA: 0x000534F8 File Offset: 0x000516F8
|
||||
public virtual void Write(char[] chars, int index, int count)
|
||||
{
|
||||
if (this.disposed)
|
||||
{
|
||||
throw new ObjectDisposedException("BinaryWriter", "Cannot write to a closed BinaryWriter");
|
||||
}
|
||||
if (chars == null)
|
||||
{
|
||||
throw new ArgumentNullException("chars");
|
||||
}
|
||||
byte[] bytes = this.m_encoding.GetBytes(chars, index, count);
|
||||
this.OutStream.Write(bytes, 0, bytes.Length);
|
||||
}
|
||||
|
||||
/// <summary>Writes a decimal value to the current stream and advances the stream position by sixteen bytes.</summary>
|
||||
/// <param name="value">The decimal value to write. </param>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060015BB RID: 5563 RVA: 0x00053550 File Offset: 0x00051750
|
||||
public unsafe virtual void Write(decimal value)
|
||||
{
|
||||
if (this.disposed)
|
||||
{
|
||||
throw new ObjectDisposedException("BinaryWriter", "Cannot write to a closed BinaryWriter");
|
||||
}
|
||||
if (BitConverter.IsLittleEndian)
|
||||
{
|
||||
for (int i = 0; i < 16; i++)
|
||||
{
|
||||
if (i < 4)
|
||||
{
|
||||
this.buffer[i + 12] = *((ref value) + i);
|
||||
}
|
||||
else if (i < 8)
|
||||
{
|
||||
this.buffer[i + 4] = *((ref value) + i);
|
||||
}
|
||||
else if (i < 12)
|
||||
{
|
||||
this.buffer[i - 8] = *((ref value) + i);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.buffer[i - 8] = *((ref value) + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
for (int j = 0; j < 16; j++)
|
||||
{
|
||||
if (j < 4)
|
||||
{
|
||||
this.buffer[15 - j] = *((ref value) + j);
|
||||
}
|
||||
else if (j < 8)
|
||||
{
|
||||
this.buffer[15 - j] = *((ref value) + j);
|
||||
}
|
||||
else if (j < 12)
|
||||
{
|
||||
this.buffer[11 - j] = *((ref value) + j);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.buffer[19 - j] = *((ref value) + j);
|
||||
}
|
||||
}
|
||||
}
|
||||
this.OutStream.Write(this.buffer, 0, 16);
|
||||
}
|
||||
|
||||
/// <summary>Writes an eight-byte floating-point value to the current stream and advances the stream position by eight bytes.</summary>
|
||||
/// <param name="value">The eight-byte floating-point value to write. </param>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060015BC RID: 5564 RVA: 0x00053684 File Offset: 0x00051884
|
||||
public virtual void Write(double value)
|
||||
{
|
||||
if (this.disposed)
|
||||
{
|
||||
throw new ObjectDisposedException("BinaryWriter", "Cannot write to a closed BinaryWriter");
|
||||
}
|
||||
this.OutStream.Write(BitConverterLE.GetBytes(value), 0, 8);
|
||||
}
|
||||
|
||||
/// <summary>Writes a two-byte signed integer to the current stream and advances the stream position by two bytes.</summary>
|
||||
/// <param name="value">The two-byte signed integer to write. </param>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060015BD RID: 5565 RVA: 0x000536C0 File Offset: 0x000518C0
|
||||
public virtual void Write(short value)
|
||||
{
|
||||
if (this.disposed)
|
||||
{
|
||||
throw new ObjectDisposedException("BinaryWriter", "Cannot write to a closed BinaryWriter");
|
||||
}
|
||||
this.buffer[0] = (byte)value;
|
||||
this.buffer[1] = (byte)(value >> 8);
|
||||
this.OutStream.Write(this.buffer, 0, 2);
|
||||
}
|
||||
|
||||
/// <summary>Writes a four-byte signed integer to the current stream and advances the stream position by four bytes.</summary>
|
||||
/// <param name="value">The four-byte signed integer to write. </param>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060015BE RID: 5566 RVA: 0x00053714 File Offset: 0x00051914
|
||||
public virtual void Write(int value)
|
||||
{
|
||||
if (this.disposed)
|
||||
{
|
||||
throw new ObjectDisposedException("BinaryWriter", "Cannot write to a closed BinaryWriter");
|
||||
}
|
||||
this.buffer[0] = (byte)value;
|
||||
this.buffer[1] = (byte)(value >> 8);
|
||||
this.buffer[2] = (byte)(value >> 16);
|
||||
this.buffer[3] = (byte)(value >> 24);
|
||||
this.OutStream.Write(this.buffer, 0, 4);
|
||||
}
|
||||
|
||||
/// <summary>Writes an eight-byte signed integer to the current stream and advances the stream position by eight bytes.</summary>
|
||||
/// <param name="value">The eight-byte signed integer to write. </param>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060015BF RID: 5567 RVA: 0x00053780 File Offset: 0x00051980
|
||||
public virtual void Write(long value)
|
||||
{
|
||||
if (this.disposed)
|
||||
{
|
||||
throw new ObjectDisposedException("BinaryWriter", "Cannot write to a closed BinaryWriter");
|
||||
}
|
||||
int i = 0;
|
||||
int num = 0;
|
||||
while (i < 8)
|
||||
{
|
||||
this.buffer[i] = (byte)(value >> num);
|
||||
i++;
|
||||
num += 8;
|
||||
}
|
||||
this.OutStream.Write(this.buffer, 0, 8);
|
||||
}
|
||||
|
||||
/// <summary>Writes a signed byte to the current stream and advances the stream position by one byte.</summary>
|
||||
/// <param name="value">The signed byte to write. </param>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060015C0 RID: 5568 RVA: 0x000537E4 File Offset: 0x000519E4
|
||||
[CLSCompliant(false)]
|
||||
public virtual void Write(sbyte value)
|
||||
{
|
||||
if (this.disposed)
|
||||
{
|
||||
throw new ObjectDisposedException("BinaryWriter", "Cannot write to a closed BinaryWriter");
|
||||
}
|
||||
this.buffer[0] = (byte)value;
|
||||
this.OutStream.Write(this.buffer, 0, 1);
|
||||
}
|
||||
|
||||
/// <summary>Writes a four-byte floating-point value to the current stream and advances the stream position by four bytes.</summary>
|
||||
/// <param name="value">The four-byte floating-point value to write. </param>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060015C1 RID: 5569 RVA: 0x0005382C File Offset: 0x00051A2C
|
||||
public virtual void Write(float value)
|
||||
{
|
||||
if (this.disposed)
|
||||
{
|
||||
throw new ObjectDisposedException("BinaryWriter", "Cannot write to a closed BinaryWriter");
|
||||
}
|
||||
this.OutStream.Write(BitConverterLE.GetBytes(value), 0, 4);
|
||||
}
|
||||
|
||||
/// <summary>Writes a length-prefixed string to this stream in the current encoding of the <see cref="T:System.IO.BinaryWriter" />, and advances the current position of the stream in accordance with the encoding used and the specific characters being written to the stream.</summary>
|
||||
/// <param name="value">The value to write. </param>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="value" /> is null. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060015C2 RID: 5570 RVA: 0x00053868 File Offset: 0x00051A68
|
||||
public virtual void Write(string value)
|
||||
{
|
||||
if (this.disposed)
|
||||
{
|
||||
throw new ObjectDisposedException("BinaryWriter", "Cannot write to a closed BinaryWriter");
|
||||
}
|
||||
int byteCount = this.m_encoding.GetByteCount(value);
|
||||
this.Write7BitEncodedInt(byteCount);
|
||||
if (this.stringBuffer == null)
|
||||
{
|
||||
this.stringBuffer = new byte[512];
|
||||
this.maxCharsPerRound = 512 / this.m_encoding.GetMaxByteCount(1);
|
||||
}
|
||||
int num = 0;
|
||||
int num2;
|
||||
for (int i = value.Length; i > 0; i -= num2)
|
||||
{
|
||||
num2 = ((i <= this.maxCharsPerRound) ? i : this.maxCharsPerRound);
|
||||
int bytes = this.m_encoding.GetBytes(value, num, num2, this.stringBuffer, 0);
|
||||
this.OutStream.Write(this.stringBuffer, 0, bytes);
|
||||
num += num2;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Writes a two-byte unsigned integer to the current stream and advances the stream position by two bytes.</summary>
|
||||
/// <param name="value">The two-byte unsigned integer to write. </param>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060015C3 RID: 5571 RVA: 0x00053938 File Offset: 0x00051B38
|
||||
[CLSCompliant(false)]
|
||||
public virtual void Write(ushort value)
|
||||
{
|
||||
if (this.disposed)
|
||||
{
|
||||
throw new ObjectDisposedException("BinaryWriter", "Cannot write to a closed BinaryWriter");
|
||||
}
|
||||
this.buffer[0] = (byte)value;
|
||||
this.buffer[1] = (byte)(value >> 8);
|
||||
this.OutStream.Write(this.buffer, 0, 2);
|
||||
}
|
||||
|
||||
/// <summary>Writes a four-byte unsigned integer to the current stream and advances the stream position by four bytes.</summary>
|
||||
/// <param name="value">The four-byte unsigned integer to write. </param>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060015C4 RID: 5572 RVA: 0x0005398C File Offset: 0x00051B8C
|
||||
[CLSCompliant(false)]
|
||||
public virtual void Write(uint value)
|
||||
{
|
||||
if (this.disposed)
|
||||
{
|
||||
throw new ObjectDisposedException("BinaryWriter", "Cannot write to a closed BinaryWriter");
|
||||
}
|
||||
this.buffer[0] = (byte)value;
|
||||
this.buffer[1] = (byte)(value >> 8);
|
||||
this.buffer[2] = (byte)(value >> 16);
|
||||
this.buffer[3] = (byte)(value >> 24);
|
||||
this.OutStream.Write(this.buffer, 0, 4);
|
||||
}
|
||||
|
||||
/// <summary>Writes an eight-byte unsigned integer to the current stream and advances the stream position by eight bytes.</summary>
|
||||
/// <param name="value">The eight-byte unsigned integer to write. </param>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060015C5 RID: 5573 RVA: 0x000539F8 File Offset: 0x00051BF8
|
||||
[CLSCompliant(false)]
|
||||
public virtual void Write(ulong value)
|
||||
{
|
||||
if (this.disposed)
|
||||
{
|
||||
throw new ObjectDisposedException("BinaryWriter", "Cannot write to a closed BinaryWriter");
|
||||
}
|
||||
int i = 0;
|
||||
int num = 0;
|
||||
while (i < 8)
|
||||
{
|
||||
this.buffer[i] = (byte)(value >> num);
|
||||
i++;
|
||||
num += 8;
|
||||
}
|
||||
this.OutStream.Write(this.buffer, 0, 8);
|
||||
}
|
||||
|
||||
/// <summary>Writes a 32-bit integer in a compressed format.</summary>
|
||||
/// <param name="value">The 32-bit integer to be written. </param>
|
||||
/// <exception cref="T:System.IO.EndOfStreamException">The end of the stream is reached. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">The stream is closed. </exception>
|
||||
// Token: 0x060015C6 RID: 5574 RVA: 0x00053A5C File Offset: 0x00051C5C
|
||||
protected void Write7BitEncodedInt(int value)
|
||||
{
|
||||
do
|
||||
{
|
||||
int num = (value >> 7) & 33554431;
|
||||
byte b = (byte)(value & 127);
|
||||
if (num != 0)
|
||||
{
|
||||
b |= 128;
|
||||
}
|
||||
this.Write(b);
|
||||
value = num;
|
||||
}
|
||||
while (value != 0);
|
||||
}
|
||||
|
||||
/// <summary>Specifies a <see cref="T:System.IO.BinaryWriter" /> with no backing store.</summary>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0400063B RID: 1595
|
||||
public static readonly BinaryWriter Null = new BinaryWriter();
|
||||
|
||||
/// <summary>Holds the underlying stream.</summary>
|
||||
// Token: 0x0400063C RID: 1596
|
||||
protected Stream OutStream;
|
||||
|
||||
// Token: 0x0400063D RID: 1597
|
||||
private Encoding m_encoding;
|
||||
|
||||
// Token: 0x0400063E RID: 1598
|
||||
private byte[] buffer;
|
||||
|
||||
// Token: 0x0400063F RID: 1599
|
||||
private bool disposed;
|
||||
|
||||
// Token: 0x04000640 RID: 1600
|
||||
private byte[] stringBuffer;
|
||||
|
||||
// Token: 0x04000641 RID: 1601
|
||||
private int maxCharsPerRound;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,424 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
/// <summary>Adds a buffering layer to read and write operations on another stream. This class cannot be inherited.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x020001A9 RID: 425
|
||||
[ComVisible(true)]
|
||||
public sealed class BufferedStream : Stream
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.BufferedStream" /> class with a default buffer size of 4096 bytes.</summary>
|
||||
/// <param name="stream">The current stream. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="stream" /> is null. </exception>
|
||||
// Token: 0x060015C7 RID: 5575 RVA: 0x00053A98 File Offset: 0x00051C98
|
||||
public BufferedStream(Stream stream)
|
||||
: this(stream, 4096)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.BufferedStream" /> class with the specified buffer size.</summary>
|
||||
/// <param name="stream">The current stream. </param>
|
||||
/// <param name="bufferSize">The buffer size in bytes. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="stream" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="bufferSize" /> is negative. </exception>
|
||||
// Token: 0x060015C8 RID: 5576 RVA: 0x00053AA8 File Offset: 0x00051CA8
|
||||
public BufferedStream(Stream stream, int bufferSize)
|
||||
{
|
||||
if (stream == null)
|
||||
{
|
||||
throw new ArgumentNullException("stream");
|
||||
}
|
||||
if (bufferSize <= 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("bufferSize", "<= 0");
|
||||
}
|
||||
if (!stream.CanRead && !stream.CanWrite)
|
||||
{
|
||||
throw new ObjectDisposedException(Locale.GetText("Cannot access a closed Stream."));
|
||||
}
|
||||
this.m_stream = stream;
|
||||
this.m_buffer = new byte[bufferSize];
|
||||
}
|
||||
|
||||
/// <summary>Gets a value indicating whether the current stream supports reading.</summary>
|
||||
/// <returns>true if the stream supports reading; false if the stream is closed or was opened with write-only access.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x170003D9 RID: 985
|
||||
// (get) Token: 0x060015C9 RID: 5577 RVA: 0x00053B1C File Offset: 0x00051D1C
|
||||
public override bool CanRead
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_stream.CanRead;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a value indicating whether the current stream supports writing.</summary>
|
||||
/// <returns>true if the stream supports writing; false if the stream is closed or was opened with read-only access.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x170003DA RID: 986
|
||||
// (get) Token: 0x060015CA RID: 5578 RVA: 0x00053B2C File Offset: 0x00051D2C
|
||||
public override bool CanWrite
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_stream.CanWrite;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a value indicating whether the current stream supports seeking.</summary>
|
||||
/// <returns>true if the stream supports seeking; false if the stream is closed or if the stream was constructed from an operating system handle such as a pipe or output to the console.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x170003DB RID: 987
|
||||
// (get) Token: 0x060015CB RID: 5579 RVA: 0x00053B3C File Offset: 0x00051D3C
|
||||
public override bool CanSeek
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.m_stream.CanSeek;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the stream length in bytes.</summary>
|
||||
/// <returns>The stream length in bytes.</returns>
|
||||
/// <exception cref="T:System.IO.IOException">The underlying stream is null or closed. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">The stream does not support seeking. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">Methods were called after the stream was closed. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x170003DC RID: 988
|
||||
// (get) Token: 0x060015CC RID: 5580 RVA: 0x00053B4C File Offset: 0x00051D4C
|
||||
public override long Length
|
||||
{
|
||||
get
|
||||
{
|
||||
this.Flush();
|
||||
return this.m_stream.Length;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the position within the current stream.</summary>
|
||||
/// <returns>The position within the current stream.</returns>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">The value passed to <see cref="M:System.IO.BufferedStream.Seek(System.Int64,System.IO.SeekOrigin)" /> is negative. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs, such as the stream being closed. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">The stream does not support seeking. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">Methods were called after the stream was closed. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x170003DD RID: 989
|
||||
// (get) Token: 0x060015CD RID: 5581 RVA: 0x00053B60 File Offset: 0x00051D60
|
||||
// (set) Token: 0x060015CE RID: 5582 RVA: 0x00053B84 File Offset: 0x00051D84
|
||||
public override long Position
|
||||
{
|
||||
get
|
||||
{
|
||||
this.CheckObjectDisposedException();
|
||||
return this.m_stream.Position - (long)this.m_buffer_read_ahead + (long)this.m_buffer_pos;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value < this.Position && this.Position - value <= (long)this.m_buffer_pos && this.m_buffer_reading)
|
||||
{
|
||||
this.m_buffer_pos -= (int)(this.Position - value);
|
||||
}
|
||||
else if (value > this.Position && value - this.Position < (long)(this.m_buffer_read_ahead - this.m_buffer_pos) && this.m_buffer_reading)
|
||||
{
|
||||
this.m_buffer_pos += (int)(value - this.Position);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.Flush();
|
||||
this.m_stream.Position = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060015CF RID: 5583 RVA: 0x00053C38 File Offset: 0x00051E38
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (this.disposed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (this.m_buffer != null)
|
||||
{
|
||||
this.Flush();
|
||||
}
|
||||
this.m_stream.Close();
|
||||
this.m_buffer = null;
|
||||
this.disposed = true;
|
||||
}
|
||||
|
||||
/// <summary>Clears all buffers for this stream and causes any buffered data to be written to the underlying device.</summary>
|
||||
/// <exception cref="T:System.IO.IOException">The data source or repository is not open. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060015D0 RID: 5584 RVA: 0x00053C7C File Offset: 0x00051E7C
|
||||
public override void Flush()
|
||||
{
|
||||
this.CheckObjectDisposedException();
|
||||
if (this.m_buffer_reading)
|
||||
{
|
||||
if (this.CanSeek)
|
||||
{
|
||||
this.m_stream.Position = this.Position;
|
||||
}
|
||||
}
|
||||
else if (this.m_buffer_pos > 0)
|
||||
{
|
||||
this.m_stream.Write(this.m_buffer, 0, this.m_buffer_pos);
|
||||
}
|
||||
this.m_buffer_read_ahead = 0;
|
||||
this.m_buffer_pos = 0;
|
||||
}
|
||||
|
||||
/// <summary>Sets the position within the current buffered stream.</summary>
|
||||
/// <returns>The new position within the current buffered stream.</returns>
|
||||
/// <param name="offset">A byte offset relative to <paramref name="origin" />. </param>
|
||||
/// <param name="origin">A value of type <see cref="T:System.IO.SeekOrigin" /> indicating the reference point from which to obtain the new position. </param>
|
||||
/// <exception cref="T:System.IO.IOException">The stream is not open or is null. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">The stream does not support seeking. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">Methods were called after the stream was closed. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060015D1 RID: 5585 RVA: 0x00053CF0 File Offset: 0x00051EF0
|
||||
public override long Seek(long offset, SeekOrigin origin)
|
||||
{
|
||||
this.CheckObjectDisposedException();
|
||||
if (!this.CanSeek)
|
||||
{
|
||||
throw new NotSupportedException(Locale.GetText("Non seekable stream."));
|
||||
}
|
||||
this.Flush();
|
||||
return this.m_stream.Seek(offset, origin);
|
||||
}
|
||||
|
||||
/// <summary>Sets the length of the buffered stream.</summary>
|
||||
/// <param name="value">An integer indicating the desired length of the current buffered stream in bytes. </param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="value" /> is negative. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">The stream is not open or is null. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">The stream does not support both writing and seeking. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">Methods were called after the stream was closed. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060015D2 RID: 5586 RVA: 0x00053D34 File Offset: 0x00051F34
|
||||
public override void SetLength(long value)
|
||||
{
|
||||
this.CheckObjectDisposedException();
|
||||
if (value < 0L)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("value must be positive");
|
||||
}
|
||||
if (!this.m_stream.CanWrite && !this.m_stream.CanSeek)
|
||||
{
|
||||
throw new NotSupportedException("the stream cannot seek nor write.");
|
||||
}
|
||||
if (this.m_stream == null || (!this.m_stream.CanRead && !this.m_stream.CanWrite))
|
||||
{
|
||||
throw new IOException("the stream is not open");
|
||||
}
|
||||
this.m_stream.SetLength(value);
|
||||
if (this.Position > value)
|
||||
{
|
||||
this.Position = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Reads a byte from the underlying stream and returns the byte cast to an int, or returns -1 if reading from the end of the stream.</summary>
|
||||
/// <returns>The byte cast to an int, or -1 if reading from the end of the stream.</returns>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs, such as the stream being closed. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">The stream does not support reading. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">Methods were called after the stream was closed. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060015D3 RID: 5587 RVA: 0x00053DDC File Offset: 0x00051FDC
|
||||
public override int ReadByte()
|
||||
{
|
||||
this.CheckObjectDisposedException();
|
||||
byte[] array = new byte[1];
|
||||
if (this.Read(array, 0, 1) == 1)
|
||||
{
|
||||
return (int)array[0];
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/// <summary>Writes a byte to the current position in the buffered stream.</summary>
|
||||
/// <param name="value">A byte to write to the stream. </param>
|
||||
/// <exception cref="T:System.NotSupportedException">The stream does not support writing. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="value" /> is null. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">Methods were called after the stream was closed. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060015D4 RID: 5588 RVA: 0x00053E0C File Offset: 0x0005200C
|
||||
public override void WriteByte(byte value)
|
||||
{
|
||||
this.CheckObjectDisposedException();
|
||||
this.Write(new byte[] { value }, 0, 1);
|
||||
}
|
||||
|
||||
/// <summary>Copies bytes from the current buffered stream to an array.</summary>
|
||||
/// <returns>The total number of bytes read into <paramref name="array" />. This can be less than the number of bytes requested if that many bytes are not currently available, or 0 if the end of the stream has been reached before any data can be read.</returns>
|
||||
/// <param name="array">The buffer to which bytes are to be copied. </param>
|
||||
/// <param name="offset">The byte offset in the buffer at which to begin reading bytes. </param>
|
||||
/// <param name="count">The number of bytes to be read. </param>
|
||||
/// <exception cref="T:System.ArgumentException">Length of <paramref name="array" /> minus <paramref name="offset" /> is less than <paramref name="count" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="array" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="offset" /> or <paramref name="count" /> is negative. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">The stream is not open or is null. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">The stream does not support reading. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">Methods were called after the stream was closed. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060015D5 RID: 5589 RVA: 0x00053E34 File Offset: 0x00052034
|
||||
public override int Read([In] [Out] byte[] array, int offset, int count)
|
||||
{
|
||||
if (array == null)
|
||||
{
|
||||
throw new ArgumentNullException("array");
|
||||
}
|
||||
this.CheckObjectDisposedException();
|
||||
if (!this.m_stream.CanRead)
|
||||
{
|
||||
throw new NotSupportedException(Locale.GetText("Cannot read from stream"));
|
||||
}
|
||||
if (offset < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("offset", "< 0");
|
||||
}
|
||||
if (count < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count", "< 0");
|
||||
}
|
||||
if (array.Length - offset < count)
|
||||
{
|
||||
throw new ArgumentException("array.Length - offset < count");
|
||||
}
|
||||
if (!this.m_buffer_reading)
|
||||
{
|
||||
this.Flush();
|
||||
this.m_buffer_reading = true;
|
||||
}
|
||||
if (count <= this.m_buffer_read_ahead - this.m_buffer_pos)
|
||||
{
|
||||
Buffer.BlockCopyInternal(this.m_buffer, this.m_buffer_pos, array, offset, count);
|
||||
this.m_buffer_pos += count;
|
||||
if (this.m_buffer_pos == this.m_buffer_read_ahead)
|
||||
{
|
||||
this.m_buffer_pos = 0;
|
||||
this.m_buffer_read_ahead = 0;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
int num = this.m_buffer_read_ahead - this.m_buffer_pos;
|
||||
Buffer.BlockCopyInternal(this.m_buffer, this.m_buffer_pos, array, offset, num);
|
||||
this.m_buffer_pos = 0;
|
||||
this.m_buffer_read_ahead = 0;
|
||||
offset += num;
|
||||
count -= num;
|
||||
if (count >= this.m_buffer.Length)
|
||||
{
|
||||
num += this.m_stream.Read(array, offset, count);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.m_buffer_read_ahead = this.m_stream.Read(this.m_buffer, 0, this.m_buffer.Length);
|
||||
if (count < this.m_buffer_read_ahead)
|
||||
{
|
||||
Buffer.BlockCopyInternal(this.m_buffer, 0, array, offset, count);
|
||||
this.m_buffer_pos = count;
|
||||
num += count;
|
||||
}
|
||||
else
|
||||
{
|
||||
Buffer.BlockCopyInternal(this.m_buffer, 0, array, offset, this.m_buffer_read_ahead);
|
||||
num += this.m_buffer_read_ahead;
|
||||
this.m_buffer_read_ahead = 0;
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
/// <summary>Copies bytes to the buffered stream and advances the current position within the buffered stream by the number of bytes written.</summary>
|
||||
/// <param name="array">The byte array from which to copy <paramref name="count" /> bytes to the current buffered stream. </param>
|
||||
/// <param name="offset">The offset in the buffer at which to begin copying bytes to the current buffered stream. </param>
|
||||
/// <param name="count">The number of bytes to be written to the current buffered stream. </param>
|
||||
/// <exception cref="T:System.ArgumentException">Length of <paramref name="array" /> minus <paramref name="offset" /> is less than <paramref name="count" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="array" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="offset" /> or <paramref name="count" /> is negative. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">The stream is closed or null. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">The stream does not support writing. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">Methods were called after the stream was closed. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060015D6 RID: 5590 RVA: 0x00053FFC File Offset: 0x000521FC
|
||||
public override void Write(byte[] array, int offset, int count)
|
||||
{
|
||||
if (array == null)
|
||||
{
|
||||
throw new ArgumentNullException("array");
|
||||
}
|
||||
this.CheckObjectDisposedException();
|
||||
if (!this.m_stream.CanWrite)
|
||||
{
|
||||
throw new NotSupportedException(Locale.GetText("Cannot write to stream"));
|
||||
}
|
||||
if (offset < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("offset", "< 0");
|
||||
}
|
||||
if (count < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count", "< 0");
|
||||
}
|
||||
if (array.Length - offset < count)
|
||||
{
|
||||
throw new ArgumentException("array.Length - offset < count");
|
||||
}
|
||||
if (this.m_buffer_reading)
|
||||
{
|
||||
this.Flush();
|
||||
this.m_buffer_reading = false;
|
||||
}
|
||||
if (this.m_buffer_pos >= this.m_buffer.Length - count)
|
||||
{
|
||||
this.Flush();
|
||||
this.m_stream.Write(array, offset, count);
|
||||
}
|
||||
else
|
||||
{
|
||||
Buffer.BlockCopyInternal(array, offset, this.m_buffer, this.m_buffer_pos, count);
|
||||
this.m_buffer_pos += count;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060015D7 RID: 5591 RVA: 0x000540F0 File Offset: 0x000522F0
|
||||
private void CheckObjectDisposedException()
|
||||
{
|
||||
if (this.disposed)
|
||||
{
|
||||
throw new ObjectDisposedException("BufferedStream", Locale.GetText("Stream is closed"));
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x04000642 RID: 1602
|
||||
private Stream m_stream;
|
||||
|
||||
// Token: 0x04000643 RID: 1603
|
||||
private byte[] m_buffer;
|
||||
|
||||
// Token: 0x04000644 RID: 1604
|
||||
private int m_buffer_pos;
|
||||
|
||||
// Token: 0x04000645 RID: 1605
|
||||
private int m_buffer_read_ahead;
|
||||
|
||||
// Token: 0x04000646 RID: 1606
|
||||
private bool m_buffer_reading;
|
||||
|
||||
// Token: 0x04000647 RID: 1607
|
||||
private bool disposed;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,946 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
/// <summary>Exposes static methods for creating, moving, and enumerating through directories and subdirectories. This class cannot be inherited.</summary>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x020001AA RID: 426
|
||||
[ComVisible(true)]
|
||||
public static class Directory
|
||||
{
|
||||
/// <summary>Creates all directories and subdirectories as specified by <paramref name="path" />.</summary>
|
||||
/// <returns>A <see cref="T:System.IO.DirectoryInfo" /> as specified by <paramref name="path" />.</returns>
|
||||
/// <param name="path">The directory path to create. </param>
|
||||
/// <exception cref="T:System.IO.IOException">The directory specified by <paramref name="path" /> is a file.-or-The network name was not found.</exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />.-or-<paramref name="path" /> is prefixed with, or contains only a colon character (:).</exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive). </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> contains a colon character (:) that is not part of a drive label ("C:\").</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060015D8 RID: 5592 RVA: 0x00054120 File Offset: 0x00052320
|
||||
public static DirectoryInfo CreateDirectory(string path)
|
||||
{
|
||||
if (path == null)
|
||||
{
|
||||
throw new ArgumentNullException("path");
|
||||
}
|
||||
if (path.Length == 0)
|
||||
{
|
||||
throw new ArgumentException("Path is empty");
|
||||
}
|
||||
if (path.IndexOfAny(Path.InvalidPathChars) != -1)
|
||||
{
|
||||
throw new ArgumentException("Path contains invalid chars");
|
||||
}
|
||||
if (path.Trim().Length == 0)
|
||||
{
|
||||
throw new ArgumentException("Only blank characters in path");
|
||||
}
|
||||
if (File.Exists(path))
|
||||
{
|
||||
throw new IOException("Cannot create " + path + " because a file with the same name already exists.");
|
||||
}
|
||||
if (path == ":")
|
||||
{
|
||||
throw new ArgumentException("Only ':' In path");
|
||||
}
|
||||
return Directory.CreateDirectoriesInternal(path);
|
||||
}
|
||||
|
||||
// Token: 0x060015D9 RID: 5593 RVA: 0x000541D0 File Offset: 0x000523D0
|
||||
private static DirectoryInfo CreateDirectoriesInternal(string path)
|
||||
{
|
||||
DirectoryInfo directoryInfo = new DirectoryInfo(path, true);
|
||||
if (directoryInfo.Parent != null && !directoryInfo.Parent.Exists)
|
||||
{
|
||||
directoryInfo.Parent.Create();
|
||||
}
|
||||
MonoIOError monoIOError;
|
||||
if (!MonoIO.CreateDirectory(path, out monoIOError) && monoIOError != MonoIOError.ERROR_ALREADY_EXISTS && monoIOError != MonoIOError.ERROR_FILE_EXISTS)
|
||||
{
|
||||
throw MonoIO.GetException(path, monoIOError);
|
||||
}
|
||||
return directoryInfo;
|
||||
}
|
||||
|
||||
/// <summary>Deletes an empty directory from a specified path.</summary>
|
||||
/// <param name="path">The name of the empty directory to remove. This directory must be writable or empty. </param>
|
||||
/// <exception cref="T:System.IO.IOException">A file with the same name and location specified by <paramref name="path" /> exists.-or-The directory is the application's current working directory.-or-The directory specified by <paramref name="path" /> is not empty.-or-The directory is read-only or contains a read-only file.-or-The directory is being used by another process..</exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">
|
||||
/// <paramref name="path" /> does not exist or could not be found.-or-<paramref name="path" /> refers to a file instead of a directory.-or-The specified path is invalid (for example, it is on an unmapped drive). </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060015DA RID: 5594 RVA: 0x00054234 File Offset: 0x00052434
|
||||
public static void Delete(string path)
|
||||
{
|
||||
if (path == null)
|
||||
{
|
||||
throw new ArgumentNullException("path");
|
||||
}
|
||||
if (path.Length == 0)
|
||||
{
|
||||
throw new ArgumentException("Path is empty");
|
||||
}
|
||||
if (path.IndexOfAny(Path.InvalidPathChars) != -1)
|
||||
{
|
||||
throw new ArgumentException("Path contains invalid chars");
|
||||
}
|
||||
if (path.Trim().Length == 0)
|
||||
{
|
||||
throw new ArgumentException("Only blank characters in path");
|
||||
}
|
||||
if (path == ":")
|
||||
{
|
||||
throw new NotSupportedException("Only ':' In path");
|
||||
}
|
||||
MonoIOError monoIOError;
|
||||
bool flag;
|
||||
if (MonoIO.ExistsSymlink(path, out monoIOError))
|
||||
{
|
||||
flag = MonoIO.DeleteFile(path, out monoIOError);
|
||||
}
|
||||
else
|
||||
{
|
||||
flag = MonoIO.RemoveDirectory(path, out monoIOError);
|
||||
}
|
||||
if (flag)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (monoIOError != MonoIOError.ERROR_FILE_NOT_FOUND)
|
||||
{
|
||||
throw MonoIO.GetException(path, monoIOError);
|
||||
}
|
||||
if (File.Exists(path))
|
||||
{
|
||||
throw new IOException("Directory does not exist, but a file of the same name exist.");
|
||||
}
|
||||
throw new DirectoryNotFoundException("Directory does not exist.");
|
||||
}
|
||||
|
||||
// Token: 0x060015DB RID: 5595 RVA: 0x00054314 File Offset: 0x00052514
|
||||
private static void RecursiveDelete(string path)
|
||||
{
|
||||
foreach (string text in Directory.GetDirectories(path))
|
||||
{
|
||||
MonoIOError monoIOError;
|
||||
if (MonoIO.ExistsSymlink(text, out monoIOError))
|
||||
{
|
||||
MonoIO.DeleteFile(text, out monoIOError);
|
||||
}
|
||||
else
|
||||
{
|
||||
Directory.RecursiveDelete(text);
|
||||
}
|
||||
}
|
||||
foreach (string text2 in Directory.GetFiles(path))
|
||||
{
|
||||
File.Delete(text2);
|
||||
}
|
||||
Directory.Delete(path);
|
||||
}
|
||||
|
||||
/// <summary>Deletes an empty directory and, if indicated, any subdirectories and files in the directory. </summary>
|
||||
/// <param name="path">The name of the directory to remove. </param>
|
||||
/// <param name="recursive">true to remove directories, subdirectories, and files in <paramref name="path" />; otherwise, false. </param>
|
||||
/// <exception cref="T:System.IO.IOException">A file with the same name and location specified by <paramref name="path" /> exists.-or-The directory specified by <paramref name="path" /> is read-only, or <paramref name="recursive" /> is false and <paramref name="path" /> is not an empty directory. -or-The directory is the application's current working directory. -or-The directory contains a read-only file.-or-The directory is being used by another process.</exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">
|
||||
/// <paramref name="path" /> does not exist or could not be found.-or-<paramref name="path" /> refers to a file instead of a directory.-or-The specified path is invalid (for example, it is on an unmapped drive). </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060015DC RID: 5596 RVA: 0x00054398 File Offset: 0x00052598
|
||||
public static void Delete(string path, bool recursive)
|
||||
{
|
||||
Directory.CheckPathExceptions(path);
|
||||
if (recursive)
|
||||
{
|
||||
Directory.RecursiveDelete(path);
|
||||
}
|
||||
else
|
||||
{
|
||||
Directory.Delete(path);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Determines whether the given path refers to an existing directory on disk.</summary>
|
||||
/// <returns>true if <paramref name="path" /> refers to an existing directory; otherwise, false.</returns>
|
||||
/// <param name="path">The path to test. </param>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060015DD RID: 5597 RVA: 0x000543B8 File Offset: 0x000525B8
|
||||
public static bool Exists(string path)
|
||||
{
|
||||
MonoIOError monoIOError;
|
||||
return path != null && MonoIO.ExistsDirectory(path, out monoIOError);
|
||||
}
|
||||
|
||||
/// <summary>Returns the date and time the specified file or directory was last accessed.</summary>
|
||||
/// <returns>A <see cref="T:System.DateTime" /> structure set to the date and time the specified file or directory was last accessed. This value is expressed in local time.</returns>
|
||||
/// <param name="path">The file or directory for which to obtain access date and time information. </param>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">The <paramref name="path" /> parameter is in an invalid format. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060015DE RID: 5598 RVA: 0x000543D8 File Offset: 0x000525D8
|
||||
public static DateTime GetLastAccessTime(string path)
|
||||
{
|
||||
return File.GetLastAccessTime(path);
|
||||
}
|
||||
|
||||
/// <summary>Returns the date and time, in Coordinated Universal Time (UTC) format, that the specified file or directory was last accessed.</summary>
|
||||
/// <returns>A <see cref="T:System.DateTime" /> structure set to the date and time the specified file or directory was last accessed. This value is expressed in UTC time.</returns>
|
||||
/// <param name="path">The file or directory for which to obtain access date and time information. </param>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">The <paramref name="path" /> parameter is in an invalid format. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060015DF RID: 5599 RVA: 0x000543E0 File Offset: 0x000525E0
|
||||
public static DateTime GetLastAccessTimeUtc(string path)
|
||||
{
|
||||
return Directory.GetLastAccessTime(path).ToUniversalTime();
|
||||
}
|
||||
|
||||
/// <summary>Returns the date and time the specified file or directory was last written to.</summary>
|
||||
/// <returns>A <see cref="T:System.DateTime" /> structure set to the date and time the specified file or directory was last written to. This value is expressed in local time.</returns>
|
||||
/// <param name="path">The file or directory for which to obtain modification date and time information. </param>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060015E0 RID: 5600 RVA: 0x000543FC File Offset: 0x000525FC
|
||||
public static DateTime GetLastWriteTime(string path)
|
||||
{
|
||||
return File.GetLastWriteTime(path);
|
||||
}
|
||||
|
||||
/// <summary>Returns the date and time, in Coordinated Universal Time (UTC) format, that the specified file or directory was last written to.</summary>
|
||||
/// <returns>A <see cref="T:System.DateTime" /> structure set to the date and time the specified file or directory was last written to. This value is expressed in UTC time.</returns>
|
||||
/// <param name="path">The file or directory for which to obtain modification date and time information. </param>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060015E1 RID: 5601 RVA: 0x00054404 File Offset: 0x00052604
|
||||
public static DateTime GetLastWriteTimeUtc(string path)
|
||||
{
|
||||
return Directory.GetLastWriteTime(path).ToUniversalTime();
|
||||
}
|
||||
|
||||
/// <summary>Gets the creation date and time of a directory.</summary>
|
||||
/// <returns>A <see cref="T:System.DateTime" /> structure set to the creation date and time for the specified directory. This value is expressed in local time.</returns>
|
||||
/// <param name="path">The path of the directory. </param>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060015E2 RID: 5602 RVA: 0x00054420 File Offset: 0x00052620
|
||||
public static DateTime GetCreationTime(string path)
|
||||
{
|
||||
return File.GetCreationTime(path);
|
||||
}
|
||||
|
||||
/// <summary>Gets the creation date and time, in Coordinated Universal Time (UTC) format, of a directory.</summary>
|
||||
/// <returns>A <see cref="T:System.DateTime" /> structure set to the creation date and time for the specified directory. This value is expressed in UTC time.</returns>
|
||||
/// <param name="path">The path of the directory. </param>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060015E3 RID: 5603 RVA: 0x00054428 File Offset: 0x00052628
|
||||
public static DateTime GetCreationTimeUtc(string path)
|
||||
{
|
||||
return Directory.GetCreationTime(path).ToUniversalTime();
|
||||
}
|
||||
|
||||
/// <summary>Gets the current working directory of the application.</summary>
|
||||
/// <returns>A string that contains the path of the current working directory, and does not end with a backslash ("\").</returns>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">The operating system is Windows CE, which does not have current directory functionality.This method is available in the .NET Compact Framework, but is not currently supported.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060015E4 RID: 5604 RVA: 0x00054444 File Offset: 0x00052644
|
||||
public static string GetCurrentDirectory()
|
||||
{
|
||||
MonoIOError monoIOError;
|
||||
string currentDirectory = MonoIO.GetCurrentDirectory(out monoIOError);
|
||||
if (monoIOError != MonoIOError.ERROR_SUCCESS)
|
||||
{
|
||||
throw MonoIO.GetException(monoIOError);
|
||||
}
|
||||
return currentDirectory;
|
||||
}
|
||||
|
||||
/// <summary>Gets the names of subdirectories in the specified directory.</summary>
|
||||
/// <returns>An array of type String containing the names of subdirectories in <paramref name="path" />.</returns>
|
||||
/// <param name="path">The path for which an array of subdirectory names is returned. </param>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">
|
||||
/// <paramref name="path" /> is a file name. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive). </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060015E5 RID: 5605 RVA: 0x00054468 File Offset: 0x00052668
|
||||
public static string[] GetDirectories(string path)
|
||||
{
|
||||
return Directory.GetDirectories(path, "*");
|
||||
}
|
||||
|
||||
/// <summary>Gets an array of directories matching the specified search pattern from the current directory.</summary>
|
||||
/// <returns>A String array of directories matching the search pattern.</returns>
|
||||
/// <param name="path">The path to search. </param>
|
||||
/// <param name="searchPattern">The search string to match against the names of files in <paramref name="path" />. The parameter cannot end in two periods ("..") or contain two periods ("..") followed by <see cref="F:System.IO.Path.DirectorySeparatorChar" /> or <see cref="F:System.IO.Path.AltDirectorySeparatorChar" />, nor can it contain any of the characters in <see cref="F:System.IO.Path.InvalidPathChars" />. </param>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />.-or- <paramref name="searchPattern" /> does not contain a valid pattern. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> or <paramref name="searchPattern" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">
|
||||
/// <paramref name="path" /> is a file name. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive). </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060015E6 RID: 5606 RVA: 0x00054478 File Offset: 0x00052678
|
||||
public static string[] GetDirectories(string path, string searchPattern)
|
||||
{
|
||||
return Directory.GetFileSystemEntries(path, searchPattern, FileAttributes.Directory, FileAttributes.Directory);
|
||||
}
|
||||
|
||||
/// <summary>Gets an array of directories matching the specified search pattern from the current directory, using a value to determine whether to search subdirectories.</summary>
|
||||
/// <returns>A String array of directories matching the search pattern.</returns>
|
||||
/// <param name="path">The path to search. </param>
|
||||
/// <param name="searchPattern">The search string to match against the names of files in <paramref name="path" />. The parameter cannot end in two periods ("..") or contain two periods ("..") followed by <see cref="F:System.IO.Path.DirectorySeparatorChar" /> or <see cref="F:System.IO.Path.AltDirectorySeparatorChar" />, nor can it contain any of the characters in <see cref="F:System.IO.Path.InvalidPathChars" />. </param>
|
||||
/// <param name="searchOption">One of the <see cref="T:System.IO.SearchOption" /> values that specifies whether the search operation should include all subdirectories or only the current directory.</param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />.-or- <paramref name="searchPattern" /> does not contain a valid pattern. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> or <paramref name="searchPattern" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="searchOption" /> is not a valid <see cref="T:System.IO.SearchOption" /> value.</exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive). </exception>
|
||||
/// <exception cref="T:System.IO.IOException">
|
||||
/// <paramref name="path" /> is a file name. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters. </exception>
|
||||
// Token: 0x060015E7 RID: 5607 RVA: 0x00054488 File Offset: 0x00052688
|
||||
public static string[] GetDirectories(string path, string searchPattern, SearchOption searchOption)
|
||||
{
|
||||
if (searchOption == SearchOption.TopDirectoryOnly)
|
||||
{
|
||||
return Directory.GetDirectories(path, searchPattern);
|
||||
}
|
||||
ArrayList arrayList = new ArrayList();
|
||||
Directory.GetDirectoriesRecurse(path, searchPattern, arrayList);
|
||||
return (string[])arrayList.ToArray(typeof(string));
|
||||
}
|
||||
|
||||
// Token: 0x060015E8 RID: 5608 RVA: 0x000544C8 File Offset: 0x000526C8
|
||||
private static void GetDirectoriesRecurse(string path, string searchPattern, ArrayList all)
|
||||
{
|
||||
all.AddRange(Directory.GetDirectories(path, searchPattern));
|
||||
foreach (string text in Directory.GetDirectories(path))
|
||||
{
|
||||
Directory.GetDirectoriesRecurse(text, searchPattern, all);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Returns the volume information, root information, or both for the specified path.</summary>
|
||||
/// <returns>A string containing the volume information, root information, or both for the specified path.</returns>
|
||||
/// <param name="path">The path of a file or directory. </param>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060015E9 RID: 5609 RVA: 0x0005450C File Offset: 0x0005270C
|
||||
public static string GetDirectoryRoot(string path)
|
||||
{
|
||||
return new string(Path.DirectorySeparatorChar, 1);
|
||||
}
|
||||
|
||||
/// <summary>Returns the names of files (including their paths) in the specified directory.</summary>
|
||||
/// <returns>A String array of file names in the specified directory. File names include the full path.</returns>
|
||||
/// <param name="path">The directory from which to retrieve the files. </param>
|
||||
/// <exception cref="T:System.IO.IOException">
|
||||
/// <paramref name="path" /> is a file name.-or-A network error has occurred. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive). </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060015EA RID: 5610 RVA: 0x0005451C File Offset: 0x0005271C
|
||||
public static string[] GetFiles(string path)
|
||||
{
|
||||
return Directory.GetFiles(path, "*");
|
||||
}
|
||||
|
||||
/// <summary>Returns the names of files (including their paths) in the specified directory that match the specified search pattern.</summary>
|
||||
/// <returns>A String array containing the names of files in the specified directory that match the specified search pattern. File names include the full path.</returns>
|
||||
/// <param name="path">The directory to search. </param>
|
||||
/// <param name="searchPattern">The search string to match against the names of files in <paramref name="path" />. The parameter cannot end in two periods ("..") or contain two periods ("..") followed by <see cref="F:System.IO.Path.DirectorySeparatorChar" /> or <see cref="F:System.IO.Path.AltDirectorySeparatorChar" />, nor can it contain any of the characters in <see cref="F:System.IO.Path.InvalidPathChars" />. </param>
|
||||
/// <exception cref="T:System.IO.IOException">
|
||||
/// <paramref name="path" /> is a file name.-or-A network error has occurred. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />.-or- <paramref name="searchPattern" /> does not contain a valid pattern. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> or <paramref name="searchPattern" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive). </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060015EB RID: 5611 RVA: 0x0005452C File Offset: 0x0005272C
|
||||
public static string[] GetFiles(string path, string searchPattern)
|
||||
{
|
||||
return Directory.GetFileSystemEntries(path, searchPattern, FileAttributes.Directory, (FileAttributes)0);
|
||||
}
|
||||
|
||||
/// <summary>Returns the names of files (including their paths) in the specified directory that match the specified search pattern, using a value to determine whether to search subdirectories.</summary>
|
||||
/// <returns>A String array containing the names of files in the specified directory that match the specified search pattern. File names include the full path.</returns>
|
||||
/// <param name="path">The directory to search. </param>
|
||||
/// <param name="searchPattern">The search string to match against the names of files in <paramref name="path" />. The parameter cannot end in two periods ("..") or contain two periods ("..") followed by <see cref="F:System.IO.Path.DirectorySeparatorChar" /> or <see cref="F:System.IO.Path.AltDirectorySeparatorChar" />, nor can it contain any of the characters in <see cref="F:System.IO.Path.InvalidPathChars" />. </param>
|
||||
/// <param name="searchOption">One of the <see cref="T:System.IO.SearchOption" /> values that specifies whether the search operation should include all subdirectories or only the current directory.</param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. -or- <paramref name="searchPattern" /> does not contain a valid pattern.</exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> or <paramref name="searchpattern" /> is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="searchOption" /> is not a valid <see cref="T:System.IO.SearchOption" /> value.</exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive). </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">
|
||||
/// <paramref name="path" /> is a file name.-or-A network error has occurred. </exception>
|
||||
// Token: 0x060015EC RID: 5612 RVA: 0x00054538 File Offset: 0x00052738
|
||||
public static string[] GetFiles(string path, string searchPattern, SearchOption searchOption)
|
||||
{
|
||||
if (searchOption == SearchOption.TopDirectoryOnly)
|
||||
{
|
||||
return Directory.GetFiles(path, searchPattern);
|
||||
}
|
||||
ArrayList arrayList = new ArrayList();
|
||||
Directory.GetFilesRecurse(path, searchPattern, arrayList);
|
||||
return (string[])arrayList.ToArray(typeof(string));
|
||||
}
|
||||
|
||||
// Token: 0x060015ED RID: 5613 RVA: 0x00054578 File Offset: 0x00052778
|
||||
private static void GetFilesRecurse(string path, string searchPattern, ArrayList all)
|
||||
{
|
||||
all.AddRange(Directory.GetFiles(path, searchPattern));
|
||||
foreach (string text in Directory.GetDirectories(path))
|
||||
{
|
||||
Directory.GetFilesRecurse(text, searchPattern, all);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Returns the names of all files and subdirectories in the specified directory.</summary>
|
||||
/// <returns>A String array containing the names of file system entries in the specified directory.</returns>
|
||||
/// <param name="path">The directory for which file and subdirectory names are returned. </param>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">
|
||||
/// <paramref name="path" /> is a file name. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive). </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060015EE RID: 5614 RVA: 0x000545BC File Offset: 0x000527BC
|
||||
public static string[] GetFileSystemEntries(string path)
|
||||
{
|
||||
return Directory.GetFileSystemEntries(path, "*");
|
||||
}
|
||||
|
||||
/// <summary>Returns an array of file system entries matching the specified search criteria.</summary>
|
||||
/// <returns>A String array of file system entries matching the search criteria.</returns>
|
||||
/// <param name="path">The path to be searched. </param>
|
||||
/// <param name="searchPattern">The search string to match against the names of files in <paramref name="path" />. The <paramref name="searchPattern" /> parameter cannot end in two periods ("..") or contain two periods ("..") followed by <see cref="F:System.IO.Path.DirectorySeparatorChar" /> or <see cref="F:System.IO.Path.AltDirectorySeparatorChar" />, nor can it contain any of the characters in <see cref="F:System.IO.Path.InvalidPathChars" />. </param>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />.-or- <paramref name="searchPattern" /> does not contain a valid pattern. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> or <paramref name="searchPattern" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">
|
||||
/// <paramref name="path" /> is a file name. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive). </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060015EF RID: 5615 RVA: 0x000545CC File Offset: 0x000527CC
|
||||
public static string[] GetFileSystemEntries(string path, string searchPattern)
|
||||
{
|
||||
return Directory.GetFileSystemEntries(path, searchPattern, (FileAttributes)0, (FileAttributes)0);
|
||||
}
|
||||
|
||||
/// <summary>Retrieves the names of the logical drives on this computer in the form "<drive letter>:\".</summary>
|
||||
/// <returns>The logical drives on this computer.</returns>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occured (for example, a disk error). </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060015F0 RID: 5616 RVA: 0x000545D8 File Offset: 0x000527D8
|
||||
public static string[] GetLogicalDrives()
|
||||
{
|
||||
return Environment.GetLogicalDrives();
|
||||
}
|
||||
|
||||
// Token: 0x060015F1 RID: 5617 RVA: 0x000545E0 File Offset: 0x000527E0
|
||||
private static bool IsRootDirectory(string path)
|
||||
{
|
||||
return (Path.DirectorySeparatorChar == '/' && path == "/") || (Path.DirectorySeparatorChar == '\\' && path.Length == 3 && path.EndsWith(":\\"));
|
||||
}
|
||||
|
||||
/// <summary>Retrieves the parent directory of the specified path, including both absolute and relative paths.</summary>
|
||||
/// <returns>The parent directory, or null if <paramref name="path" /> is the root directory, including the root of a UNC server or share name.</returns>
|
||||
/// <param name="path">The path for which to retrieve the parent directory. </param>
|
||||
/// <exception cref="T:System.IO.IOException">The directory specified by <paramref name="path" /> is read-only. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path was not found. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060015F2 RID: 5618 RVA: 0x00054638 File Offset: 0x00052838
|
||||
public static DirectoryInfo GetParent(string path)
|
||||
{
|
||||
if (path == null)
|
||||
{
|
||||
throw new ArgumentNullException("path");
|
||||
}
|
||||
if (path.IndexOfAny(Path.InvalidPathChars) != -1)
|
||||
{
|
||||
throw new ArgumentException("Path contains invalid characters");
|
||||
}
|
||||
if (path.Length == 0)
|
||||
{
|
||||
throw new ArgumentException("The Path do not have a valid format");
|
||||
}
|
||||
if (Directory.IsRootDirectory(path))
|
||||
{
|
||||
return null;
|
||||
}
|
||||
string text = Path.GetDirectoryName(path);
|
||||
if (text.Length == 0)
|
||||
{
|
||||
text = Directory.GetCurrentDirectory();
|
||||
}
|
||||
return new DirectoryInfo(text);
|
||||
}
|
||||
|
||||
/// <summary>Moves a file or a directory and its contents to a new location.</summary>
|
||||
/// <param name="sourceDirName">The path of the file or directory to move. </param>
|
||||
/// <param name="destDirName">The path to the new location for <paramref name="sourceDirName" />. If <paramref name="sourceDirName" /> is a file, then <paramref name="destDirName" /> must also be a file name.</param>
|
||||
/// <exception cref="T:System.IO.IOException">An attempt was made to move a directory to a different volume. -or- <paramref name="destDirName" /> already exists. -or- The <paramref name="sourceDirName" /> and <paramref name="destDirName" /> parameters refer to the same file or directory. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="sourceDirName" /> or <paramref name="destDirName" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="sourceDirName" /> or <paramref name="destDirName" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The path specified by <paramref name="sourceDirName" /> is invalid (for example, it is on an unmapped drive). </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060015F3 RID: 5619 RVA: 0x000546B4 File Offset: 0x000528B4
|
||||
public static void Move(string sourceDirName, string destDirName)
|
||||
{
|
||||
if (sourceDirName == null)
|
||||
{
|
||||
throw new ArgumentNullException("sourceDirName");
|
||||
}
|
||||
if (destDirName == null)
|
||||
{
|
||||
throw new ArgumentNullException("destDirName");
|
||||
}
|
||||
if (sourceDirName.Trim().Length == 0 || sourceDirName.IndexOfAny(Path.InvalidPathChars) != -1)
|
||||
{
|
||||
throw new ArgumentException("Invalid source directory name: " + sourceDirName, "sourceDirName");
|
||||
}
|
||||
if (destDirName.Trim().Length == 0 || destDirName.IndexOfAny(Path.InvalidPathChars) != -1)
|
||||
{
|
||||
throw new ArgumentException("Invalid target directory name: " + destDirName, "destDirName");
|
||||
}
|
||||
if (sourceDirName == destDirName)
|
||||
{
|
||||
throw new IOException("Source and destination path must be different.");
|
||||
}
|
||||
if (Directory.Exists(destDirName))
|
||||
{
|
||||
throw new IOException(destDirName + " already exists.");
|
||||
}
|
||||
if (!Directory.Exists(sourceDirName) && !File.Exists(sourceDirName))
|
||||
{
|
||||
throw new DirectoryNotFoundException(sourceDirName + " does not exist");
|
||||
}
|
||||
MonoIOError monoIOError;
|
||||
if (!MonoIO.MoveFile(sourceDirName, destDirName, out monoIOError))
|
||||
{
|
||||
throw MonoIO.GetException(monoIOError);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Sets the creation date and time for the specified file or directory.</summary>
|
||||
/// <param name="path">The file or directory for which to set the creation date and time information. </param>
|
||||
/// <param name="creationTime">A <see cref="T:System.DateTime" /> containing the value to set for the creation date and time of <paramref name="path" />. This value is expressed in local time. </param>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The specified path was not found. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="creationTime" /> specifies a value outside the range of dates or times permitted for this operation. </exception>
|
||||
/// <exception cref="T:System.PlatformNotSupportedException">The current operating system is not Microsoft Windows NT or later.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060015F4 RID: 5620 RVA: 0x000547C0 File Offset: 0x000529C0
|
||||
public static void SetCreationTime(string path, DateTime creationTime)
|
||||
{
|
||||
File.SetCreationTime(path, creationTime);
|
||||
}
|
||||
|
||||
/// <summary>Sets the creation date and time, in Coordinated Universal Time (UTC) format, for the specified file or directory.</summary>
|
||||
/// <param name="path">The file or directory for which to set the creation date and time information. </param>
|
||||
/// <param name="creationTimeUtc">A <see cref="T:System.DateTime" /> containing the value to set for the creation date and time of <paramref name="path" />. This value is expressed in UTC time. </param>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The specified path was not found. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="creationTime" /> specifies a value outside the range of dates or times permitted for this operation. </exception>
|
||||
/// <exception cref="T:System.PlatformNotSupportedException">The current operating system is not Microsoft Windows NT or later.</exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060015F5 RID: 5621 RVA: 0x000547CC File Offset: 0x000529CC
|
||||
public static void SetCreationTimeUtc(string path, DateTime creationTimeUtc)
|
||||
{
|
||||
Directory.SetCreationTime(path, creationTimeUtc.ToLocalTime());
|
||||
}
|
||||
|
||||
/// <summary>Sets the application's current working directory to the specified directory.</summary>
|
||||
/// <param name="path">The path to which the current working directory is set. </param>
|
||||
/// <exception cref="T:System.IO.IOException">An IO error occurred. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission to access unmanaged code. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The specified path was not found. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified directory was not found.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060015F6 RID: 5622 RVA: 0x000547DC File Offset: 0x000529DC
|
||||
public static void SetCurrentDirectory(string path)
|
||||
{
|
||||
if (path == null)
|
||||
{
|
||||
throw new ArgumentNullException("path");
|
||||
}
|
||||
if (path.Trim().Length == 0)
|
||||
{
|
||||
throw new ArgumentException("path string must not be an empty string or whitespace string");
|
||||
}
|
||||
if (!Directory.Exists(path))
|
||||
{
|
||||
throw new DirectoryNotFoundException("Directory \"" + path + "\" not found.");
|
||||
}
|
||||
MonoIOError monoIOError;
|
||||
MonoIO.SetCurrentDirectory(path, out monoIOError);
|
||||
if (monoIOError != MonoIOError.ERROR_SUCCESS)
|
||||
{
|
||||
throw MonoIO.GetException(path, monoIOError);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Sets the date and time the specified file or directory was last accessed.</summary>
|
||||
/// <param name="path">The file or directory for which to set the access date and time information. </param>
|
||||
/// <param name="lastAccessTime">A <see cref="T:System.DateTime" /> containing the value to set for the access date and time of <paramref name="path" />. This value is expressed in local time. </param>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The specified path was not found. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.PlatformNotSupportedException">The current operating system is not Microsoft Windows NT or later.</exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="lastAccessTime" /> specifies a value outside the range of dates or times permitted for this operation.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060015F7 RID: 5623 RVA: 0x00054850 File Offset: 0x00052A50
|
||||
public static void SetLastAccessTime(string path, DateTime lastAccessTime)
|
||||
{
|
||||
File.SetLastAccessTime(path, lastAccessTime);
|
||||
}
|
||||
|
||||
/// <summary>Sets the date and time, in Coordinated Universal Time (UTC) format, that the specified file or directory was last accessed.</summary>
|
||||
/// <param name="path">The file or directory for which to set the access date and time information. </param>
|
||||
/// <param name="lastAccessTimeUtc">A <see cref="T:System.DateTime" /> containing the value to set for the access date and time of <paramref name="path" />. This value is expressed in UTC time. </param>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The specified path was not found. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.PlatformNotSupportedException">The current operating system is not Microsoft Windows NT or later.</exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="lastAccessTimeUtc" /> specifies a value outside the range of dates or times permitted for this operation.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060015F8 RID: 5624 RVA: 0x0005485C File Offset: 0x00052A5C
|
||||
public static void SetLastAccessTimeUtc(string path, DateTime lastAccessTimeUtc)
|
||||
{
|
||||
Directory.SetLastAccessTime(path, lastAccessTimeUtc.ToLocalTime());
|
||||
}
|
||||
|
||||
/// <summary>Sets the date and time a directory was last written to.</summary>
|
||||
/// <param name="path">The path of the directory. </param>
|
||||
/// <param name="lastWriteTime">The date and time the directory was last written to. This value is expressed in local time. </param>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The specified path was not found. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.PlatformNotSupportedException">The current operating system is not Microsoft Windows NT or later.</exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="lastWriteTime" /> specifies a value outside the range of dates or times permitted for this operation.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060015F9 RID: 5625 RVA: 0x0005486C File Offset: 0x00052A6C
|
||||
public static void SetLastWriteTime(string path, DateTime lastWriteTime)
|
||||
{
|
||||
File.SetLastWriteTime(path, lastWriteTime);
|
||||
}
|
||||
|
||||
/// <summary>Sets the date and time, in Coordinated Universal Time (UTC) format, that a directory was last written to.</summary>
|
||||
/// <param name="path">The path of the directory. </param>
|
||||
/// <param name="lastWriteTimeUtc">The date and time the directory was last written to. This value is expressed in UTC time. </param>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The specified path was not found. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.PlatformNotSupportedException">The current operating system is not Microsoft Windows NT or later.</exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="lastWriteTimeUtc" /> specifies a value outside the range of dates or times permitted for this operation.</exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060015FA RID: 5626 RVA: 0x00054878 File Offset: 0x00052A78
|
||||
public static void SetLastWriteTimeUtc(string path, DateTime lastWriteTimeUtc)
|
||||
{
|
||||
Directory.SetLastWriteTime(path, lastWriteTimeUtc.ToLocalTime());
|
||||
}
|
||||
|
||||
// Token: 0x060015FB RID: 5627 RVA: 0x00054888 File Offset: 0x00052A88
|
||||
private static void CheckPathExceptions(string path)
|
||||
{
|
||||
if (path == null)
|
||||
{
|
||||
throw new ArgumentNullException("path");
|
||||
}
|
||||
if (path.Length == 0)
|
||||
{
|
||||
throw new ArgumentException("Path is Empty");
|
||||
}
|
||||
if (path.Trim().Length == 0)
|
||||
{
|
||||
throw new ArgumentException("Only blank characters in path");
|
||||
}
|
||||
if (path.IndexOfAny(Path.InvalidPathChars) != -1)
|
||||
{
|
||||
throw new ArgumentException("Path contains invalid chars");
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060015FC RID: 5628 RVA: 0x000548F4 File Offset: 0x00052AF4
|
||||
private static string[] GetFileSystemEntries(string path, string searchPattern, FileAttributes mask, FileAttributes attrs)
|
||||
{
|
||||
if (path == null || searchPattern == null)
|
||||
{
|
||||
throw new ArgumentNullException();
|
||||
}
|
||||
if (searchPattern.Length == 0)
|
||||
{
|
||||
return new string[0];
|
||||
}
|
||||
if (path.Trim().Length == 0)
|
||||
{
|
||||
throw new ArgumentException("The Path does not have a valid format");
|
||||
}
|
||||
string text = Path.Combine(path, searchPattern);
|
||||
string directoryName = Path.GetDirectoryName(text);
|
||||
if (directoryName.IndexOfAny(Path.InvalidPathChars) != -1)
|
||||
{
|
||||
throw new ArgumentException("Path contains invalid characters");
|
||||
}
|
||||
MonoIOError monoIOError;
|
||||
if (directoryName.IndexOfAny(Path.InvalidPathChars) != -1)
|
||||
{
|
||||
if (path.IndexOfAny(SearchPattern.InvalidChars) == -1)
|
||||
{
|
||||
throw new ArgumentException("Path contains invalid characters", "path");
|
||||
}
|
||||
throw new ArgumentException("Pattern contains invalid characters", "pattern");
|
||||
}
|
||||
else if (!MonoIO.ExistsDirectory(directoryName, out monoIOError))
|
||||
{
|
||||
MonoIOError monoIOError2;
|
||||
if (monoIOError == MonoIOError.ERROR_SUCCESS && MonoIO.ExistsFile(directoryName, out monoIOError2))
|
||||
{
|
||||
return new string[] { directoryName };
|
||||
}
|
||||
if (monoIOError != MonoIOError.ERROR_PATH_NOT_FOUND)
|
||||
{
|
||||
throw MonoIO.GetException(directoryName, monoIOError);
|
||||
}
|
||||
if (directoryName.IndexOfAny(SearchPattern.WildcardChars) == -1)
|
||||
{
|
||||
throw new DirectoryNotFoundException("Directory '" + directoryName + "' not found.");
|
||||
}
|
||||
if (path.IndexOfAny(SearchPattern.WildcardChars) == -1)
|
||||
{
|
||||
throw new ArgumentException("Pattern is invalid", "searchPattern");
|
||||
}
|
||||
throw new ArgumentException("Path is invalid", "path");
|
||||
}
|
||||
else
|
||||
{
|
||||
string text2 = Path.Combine(directoryName, searchPattern);
|
||||
string[] fileSystemEntries = MonoIO.GetFileSystemEntries(path, text2, (int)attrs, (int)mask, out monoIOError);
|
||||
if (monoIOError != MonoIOError.ERROR_SUCCESS)
|
||||
{
|
||||
throw MonoIO.GetException(directoryName, monoIOError);
|
||||
}
|
||||
return fileSystemEntries;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,500 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
/// <summary>Exposes instance methods for creating, moving, and enumerating through directories and subdirectories. This class cannot be inherited.</summary>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x020001AB RID: 427
|
||||
[ComVisible(true)]
|
||||
[Serializable]
|
||||
public sealed class DirectoryInfo : FileSystemInfo
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.DirectoryInfo" /> class on the specified path.</summary>
|
||||
/// <param name="path">A string specifying the path on which to create the DirectoryInfo. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> contains invalid characters such as ", <, >, or |. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. The specified path, file name, or both are too long.</exception>
|
||||
// Token: 0x060015FD RID: 5629 RVA: 0x00054A68 File Offset: 0x00052C68
|
||||
public DirectoryInfo(string path)
|
||||
: this(path, false)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x060015FE RID: 5630 RVA: 0x00054A74 File Offset: 0x00052C74
|
||||
internal DirectoryInfo(string path, bool simpleOriginalPath)
|
||||
{
|
||||
base.CheckPath(path);
|
||||
this.FullPath = Path.GetFullPath(path);
|
||||
if (simpleOriginalPath)
|
||||
{
|
||||
this.OriginalPath = Path.GetFileName(path);
|
||||
}
|
||||
else
|
||||
{
|
||||
this.OriginalPath = path;
|
||||
}
|
||||
this.Initialize();
|
||||
}
|
||||
|
||||
// Token: 0x060015FF RID: 5631 RVA: 0x00054AC0 File Offset: 0x00052CC0
|
||||
private DirectoryInfo(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context)
|
||||
{
|
||||
this.Initialize();
|
||||
}
|
||||
|
||||
// Token: 0x06001600 RID: 5632 RVA: 0x00054AD0 File Offset: 0x00052CD0
|
||||
private void Initialize()
|
||||
{
|
||||
int num = this.FullPath.Length - 1;
|
||||
if (num > 1 && this.FullPath[num] == Path.DirectorySeparatorChar)
|
||||
{
|
||||
num--;
|
||||
}
|
||||
int num2 = this.FullPath.LastIndexOf(Path.DirectorySeparatorChar, num);
|
||||
if (num2 == -1 || (num2 == 0 && num == 0))
|
||||
{
|
||||
this.current = this.FullPath;
|
||||
this.parent = null;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.current = this.FullPath.Substring(num2 + 1, num - num2);
|
||||
if (num2 == 0 && !Environment.IsRunningOnWindows)
|
||||
{
|
||||
this.parent = Path.DirectorySeparatorStr;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.parent = this.FullPath.Substring(0, num2);
|
||||
}
|
||||
if (Environment.IsRunningOnWindows && this.parent.Length == 2 && this.parent[1] == ':' && char.IsLetter(this.parent[0]))
|
||||
{
|
||||
this.parent += Path.DirectorySeparatorChar;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a value indicating whether the directory exists.</summary>
|
||||
/// <returns>true if the directory exists; otherwise, false.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x170003DE RID: 990
|
||||
// (get) Token: 0x06001601 RID: 5633 RVA: 0x00054BF4 File Offset: 0x00052DF4
|
||||
public override bool Exists
|
||||
{
|
||||
get
|
||||
{
|
||||
base.Refresh(false);
|
||||
return this.stat.Attributes != MonoIO.InvalidFileAttributes && (this.stat.Attributes & FileAttributes.Directory) != (FileAttributes)0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the name of this <see cref="T:System.IO.DirectoryInfo" /> instance.</summary>
|
||||
/// <returns>The directory name.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x170003DF RID: 991
|
||||
// (get) Token: 0x06001602 RID: 5634 RVA: 0x00054C38 File Offset: 0x00052E38
|
||||
public override string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.current;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the parent directory of a specified subdirectory.</summary>
|
||||
/// <returns>The parent directory, or null if the path is null or if the file path denotes a root (such as "\", "C:", or * "\\server\share").</returns>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x170003E0 RID: 992
|
||||
// (get) Token: 0x06001603 RID: 5635 RVA: 0x00054C40 File Offset: 0x00052E40
|
||||
public DirectoryInfo Parent
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.parent == null || this.parent.Length == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new DirectoryInfo(this.parent);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the root portion of a path.</summary>
|
||||
/// <returns>A <see cref="T:System.IO.DirectoryInfo" /> object representing the root of a path.</returns>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x170003E1 RID: 993
|
||||
// (get) Token: 0x06001604 RID: 5636 RVA: 0x00054C78 File Offset: 0x00052E78
|
||||
public DirectoryInfo Root
|
||||
{
|
||||
get
|
||||
{
|
||||
string pathRoot = Path.GetPathRoot(this.FullPath);
|
||||
if (pathRoot == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new DirectoryInfo(pathRoot);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Creates a directory.</summary>
|
||||
/// <exception cref="T:System.IO.IOException">The directory cannot be created. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001605 RID: 5637 RVA: 0x00054CA0 File Offset: 0x00052EA0
|
||||
public void Create()
|
||||
{
|
||||
Directory.CreateDirectory(this.FullPath);
|
||||
}
|
||||
|
||||
/// <summary>Creates a subdirectory or subdirectories on the specified path. The specified path can be relative to this instance of the <see cref="T:System.IO.DirectoryInfo" /> class.</summary>
|
||||
/// <returns>The last directory specified in <paramref name="path" />.</returns>
|
||||
/// <param name="path">The specified path. This cannot be a different disk volume or Universal Naming Convention (UNC) name. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> does not specify a valid file path or contains invalid DirectoryInfo characters. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid, such as being on an unmapped drive. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">The subdirectory cannot be created.-or- A file or directory already has the name specified by <paramref name="path" />. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. The specified path, file name, or both are too long.</exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have code access permission to create the directory.-or-The caller does not have code access permission to read the directory described by the returned <see cref="T:System.IO.DirectoryInfo" /> object. This can occur when the <paramref name="path" /> parameter describes an existing directory.</exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> contains a colon (:) that is not part of a drive label ("C:\").</exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001606 RID: 5638 RVA: 0x00054CB0 File Offset: 0x00052EB0
|
||||
public DirectoryInfo CreateSubdirectory(string path)
|
||||
{
|
||||
base.CheckPath(path);
|
||||
path = Path.Combine(this.FullPath, path);
|
||||
Directory.CreateDirectory(path);
|
||||
return new DirectoryInfo(path);
|
||||
}
|
||||
|
||||
/// <summary>Returns a file list from the current directory.</summary>
|
||||
/// <returns>An array of type <see cref="T:System.IO.FileInfo" />.</returns>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The path is invalid, such as being on an unmapped drive. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001607 RID: 5639 RVA: 0x00054CE0 File Offset: 0x00052EE0
|
||||
public FileInfo[] GetFiles()
|
||||
{
|
||||
return this.GetFiles("*");
|
||||
}
|
||||
|
||||
/// <summary>Returns a file list from the current directory matching the given <paramref name="searchPattern" />.</summary>
|
||||
/// <returns>An array of type <see cref="T:System.IO.FileInfo" />.</returns>
|
||||
/// <param name="searchPattern">The search string, such as "*.txt". </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="searchPattern " />contains invalid characters. To determine the invalid characters, use the <see cref="M:System.IO.Path.GetInvalidPathChars" /> method. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="searchPattern" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The path is invalid, such as being on an unmapped drive. </exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001608 RID: 5640 RVA: 0x00054CF0 File Offset: 0x00052EF0
|
||||
public FileInfo[] GetFiles(string searchPattern)
|
||||
{
|
||||
if (searchPattern == null)
|
||||
{
|
||||
throw new ArgumentNullException("searchPattern");
|
||||
}
|
||||
string[] files = Directory.GetFiles(this.FullPath, searchPattern);
|
||||
FileInfo[] array = new FileInfo[files.Length];
|
||||
int num = 0;
|
||||
foreach (string text in files)
|
||||
{
|
||||
array[num++] = new FileInfo(text);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
/// <summary>Returns the subdirectories of the current directory.</summary>
|
||||
/// <returns>An array of <see cref="T:System.IO.DirectoryInfo" /> objects.</returns>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The path encapsulated in the DirectoryInfo object is invalid, such as being on an unmapped drive. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001609 RID: 5641 RVA: 0x00054D58 File Offset: 0x00052F58
|
||||
public DirectoryInfo[] GetDirectories()
|
||||
{
|
||||
return this.GetDirectories("*");
|
||||
}
|
||||
|
||||
/// <summary>Returns an array of directories in the current <see cref="T:System.IO.DirectoryInfo" /> matching the given search criteria.</summary>
|
||||
/// <returns>An array of type DirectoryInfo matching <paramref name="searchPattern" />.</returns>
|
||||
/// <param name="searchPattern">The search string, such as "System*", used to search for all directories beginning with the word "System". </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="searchPattern " />contains invalid characters. To determine the invalid characters, use the <see cref="M:System.IO.Path.GetInvalidPathChars" /> method. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="searchPattern" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The path encapsulated in the DirectoryInfo object is invalid, such as being on an unmapped drive. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600160A RID: 5642 RVA: 0x00054D68 File Offset: 0x00052F68
|
||||
public DirectoryInfo[] GetDirectories(string searchPattern)
|
||||
{
|
||||
if (searchPattern == null)
|
||||
{
|
||||
throw new ArgumentNullException("searchPattern");
|
||||
}
|
||||
string[] directories = Directory.GetDirectories(this.FullPath, searchPattern);
|
||||
DirectoryInfo[] array = new DirectoryInfo[directories.Length];
|
||||
int num = 0;
|
||||
foreach (string text in directories)
|
||||
{
|
||||
array[num++] = new DirectoryInfo(text);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
/// <summary>Returns an array of strongly typed <see cref="T:System.IO.FileSystemInfo" /> entries representing all the files and subdirectories in a directory.</summary>
|
||||
/// <returns>An array of strongly typed <see cref="T:System.IO.FileSystemInfo" /> entries.</returns>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The path is invalid, such as being on an unmapped drive. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600160B RID: 5643 RVA: 0x00054DD0 File Offset: 0x00052FD0
|
||||
public FileSystemInfo[] GetFileSystemInfos()
|
||||
{
|
||||
return this.GetFileSystemInfos("*");
|
||||
}
|
||||
|
||||
/// <summary>Retrieves an array of strongly typed <see cref="T:System.IO.FileSystemInfo" /> objects representing the files and subdirectories matching the specified search criteria.</summary>
|
||||
/// <returns>An array of strongly typed FileSystemInfo objects matching the search criteria.</returns>
|
||||
/// <param name="searchPattern">The search string, such as "System*", used to search for all directories beginning with the word "System". </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="searchPattern " />contains invalid characters. To determine the invalid characters, use the <see cref="M:System.IO.Path.GetInvalidPathChars" /> method. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="searchPattern" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid, such as being on an unmapped drive. </exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600160C RID: 5644 RVA: 0x00054DE0 File Offset: 0x00052FE0
|
||||
public FileSystemInfo[] GetFileSystemInfos(string searchPattern)
|
||||
{
|
||||
if (searchPattern == null)
|
||||
{
|
||||
throw new ArgumentNullException("searchPattern");
|
||||
}
|
||||
if (!Directory.Exists(this.FullPath))
|
||||
{
|
||||
throw new IOException("Invalid directory");
|
||||
}
|
||||
string[] directories = Directory.GetDirectories(this.FullPath, searchPattern);
|
||||
string[] files = Directory.GetFiles(this.FullPath, searchPattern);
|
||||
FileSystemInfo[] array = new FileSystemInfo[directories.Length + files.Length];
|
||||
int num = 0;
|
||||
foreach (string text in directories)
|
||||
{
|
||||
array[num++] = new DirectoryInfo(text);
|
||||
}
|
||||
foreach (string text2 in files)
|
||||
{
|
||||
array[num++] = new FileInfo(text2);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
/// <summary>Deletes this <see cref="T:System.IO.DirectoryInfo" /> if it is empty.</summary>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The directory contains a read-only file.</exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The directory described by this <see cref="T:System.IO.DirectoryInfo" /> object does not exist or could not be found.</exception>
|
||||
/// <exception cref="T:System.IO.IOException">The directory is not empty. -or-The directory is the application's current working directory.</exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600160D RID: 5645 RVA: 0x00054EA8 File Offset: 0x000530A8
|
||||
public override void Delete()
|
||||
{
|
||||
this.Delete(false);
|
||||
}
|
||||
|
||||
/// <summary>Deletes this instance of a <see cref="T:System.IO.DirectoryInfo" />, specifying whether to delete subdirectories and files.</summary>
|
||||
/// <param name="recursive">true to delete this directory, its subdirectories, and all files; otherwise, false. </param>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The directory contains a read-only file.</exception>
|
||||
/// <exception cref="T:System.IO.IOException">The directory is read-only.-or- The directory contains one or more files or subdirectories and <paramref name="recursive" /> is false.-or-The directory is the application's current working directory. </exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600160E RID: 5646 RVA: 0x00054EB4 File Offset: 0x000530B4
|
||||
public void Delete(bool recursive)
|
||||
{
|
||||
Directory.Delete(this.FullPath, recursive);
|
||||
}
|
||||
|
||||
/// <summary>Moves a <see cref="T:System.IO.DirectoryInfo" /> instance and its contents to a new path.</summary>
|
||||
/// <param name="destDirName">The name and path to which to move this directory. The destination cannot be another disk volume or a directory with the identical name. It can be an existing directory to which you want to add this directory as a subdirectory. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="destDirName" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="destDirName" /> is an empty string (''"). </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An attempt was made to move a directory to a different volume. -or-<paramref name="destDirName" /> already exists.-or-You are not authorized to access this path.-or- The directory being moved and the destination directory have the same name.</exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The destination directory cannot be found.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600160F RID: 5647 RVA: 0x00054EC4 File Offset: 0x000530C4
|
||||
public void MoveTo(string destDirName)
|
||||
{
|
||||
if (destDirName == null)
|
||||
{
|
||||
throw new ArgumentNullException("destDirName");
|
||||
}
|
||||
if (destDirName.Length == 0)
|
||||
{
|
||||
throw new ArgumentException("An empty file name is not valid.", "destDirName");
|
||||
}
|
||||
Directory.Move(this.FullPath, Path.GetFullPath(destDirName));
|
||||
}
|
||||
|
||||
/// <summary>Returns the original path that was passed by the user.</summary>
|
||||
/// <returns>Returns the original path that was passed by the user.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06001610 RID: 5648 RVA: 0x00054F04 File Offset: 0x00053104
|
||||
public override string ToString()
|
||||
{
|
||||
return this.OriginalPath;
|
||||
}
|
||||
|
||||
/// <summary>Returns an array of directories in the current <see cref="T:System.IO.DirectoryInfo" /> matching the given search criteria and using a value to determine whether to search subdirectories.</summary>
|
||||
/// <returns>An array of type DirectoryInfo matching <paramref name="searchPattern" />.</returns>
|
||||
/// <param name="searchPattern">The search string, such as "System*", used to search for all directories beginning with the word "System".</param>
|
||||
/// <param name="searchOption">One of the values of the <see cref="T:System.IO.SearchOption" /> enumeration that specifies whether the search operation should include only the current directory or should include all subdirectories.</param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="searchPattern " />contains invalid characters. To determine the invalid characters, use the <see cref="M:System.IO.Path.GetInvalidPathChars" /> method. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="searchPattern" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The path encapsulated in the DirectoryInfo object is invalid, such as being on an unmapped drive. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
// Token: 0x06001611 RID: 5649 RVA: 0x00054F0C File Offset: 0x0005310C
|
||||
public DirectoryInfo[] GetDirectories(string searchPattern, SearchOption searchOption)
|
||||
{
|
||||
if (searchOption == SearchOption.TopDirectoryOnly)
|
||||
{
|
||||
return this.GetDirectories(searchPattern);
|
||||
}
|
||||
if (searchOption != SearchOption.AllDirectories)
|
||||
{
|
||||
string text = Locale.GetText("Invalid enum value '{0}' for '{1}'.", new object[] { searchOption, "SearchOption" });
|
||||
throw new ArgumentOutOfRangeException("searchOption", text);
|
||||
}
|
||||
Queue queue = new Queue(this.GetDirectories(searchPattern));
|
||||
Queue queue2 = new Queue();
|
||||
while (queue.Count > 0)
|
||||
{
|
||||
DirectoryInfo directoryInfo = (DirectoryInfo)queue.Dequeue();
|
||||
DirectoryInfo[] directories = directoryInfo.GetDirectories(searchPattern);
|
||||
foreach (DirectoryInfo directoryInfo2 in directories)
|
||||
{
|
||||
queue.Enqueue(directoryInfo2);
|
||||
}
|
||||
queue2.Enqueue(directoryInfo);
|
||||
}
|
||||
DirectoryInfo[] array2 = new DirectoryInfo[queue2.Count];
|
||||
queue2.CopyTo(array2, 0);
|
||||
return array2;
|
||||
}
|
||||
|
||||
// Token: 0x06001612 RID: 5650 RVA: 0x00054FEC File Offset: 0x000531EC
|
||||
internal int GetFilesSubdirs(ArrayList l, string pattern)
|
||||
{
|
||||
FileInfo[] array = null;
|
||||
try
|
||||
{
|
||||
array = this.GetFiles(pattern);
|
||||
}
|
||||
catch (UnauthorizedAccessException)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int num = array.Length;
|
||||
l.Add(array);
|
||||
foreach (DirectoryInfo directoryInfo in this.GetDirectories())
|
||||
{
|
||||
num += directoryInfo.GetFilesSubdirs(l, pattern);
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
/// <summary>Returns a file list from the current directory matching the given <paramref name="searchPattern" /> and using a value to determine whether to search subdirectories.</summary>
|
||||
/// <returns>An array of type <see cref="T:System.IO.FileInfo" />.</returns>
|
||||
/// <param name="searchPattern">The search string, such as "System*", used to search for all directories beginning with the word "System".</param>
|
||||
/// <param name="searchOption">One of the values of the <see cref="T:System.IO.SearchOption" /> enumeration that specifies whether the search operation should include only the current directory or should include all subdirectories.</param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="searchPattern " />contains invalid characters. To determine invalid characters, use the <see cref="M:System.IO.Path.GetInvalidPathChars" /> method. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="searchPattern" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="searchOption" /> is not a valid <see cref="T:System.IO.SearchOption" /> value.</exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The path is invalid, such as being on an unmapped drive. </exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
// Token: 0x06001613 RID: 5651 RVA: 0x00055074 File Offset: 0x00053274
|
||||
public FileInfo[] GetFiles(string searchPattern, SearchOption searchOption)
|
||||
{
|
||||
if (searchOption == SearchOption.TopDirectoryOnly)
|
||||
{
|
||||
return this.GetFiles(searchPattern);
|
||||
}
|
||||
if (searchOption != SearchOption.AllDirectories)
|
||||
{
|
||||
string text = Locale.GetText("Invalid enum value '{0}' for '{1}'.", new object[] { searchOption, "SearchOption" });
|
||||
throw new ArgumentOutOfRangeException("searchOption", text);
|
||||
}
|
||||
ArrayList arrayList = new ArrayList();
|
||||
int filesSubdirs = this.GetFilesSubdirs(arrayList, searchPattern);
|
||||
int num = 0;
|
||||
FileInfo[] array = new FileInfo[filesSubdirs];
|
||||
foreach (object obj in arrayList)
|
||||
{
|
||||
FileInfo[] array2 = (FileInfo[])obj;
|
||||
array2.CopyTo(array, num);
|
||||
num += array2.Length;
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
// Token: 0x04000648 RID: 1608
|
||||
private string current;
|
||||
|
||||
// Token: 0x04000649 RID: 1609
|
||||
private string parent;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
/// <summary>The exception that is thrown when part of a file or directory cannot be found.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x020001AC RID: 428
|
||||
[ComVisible(true)]
|
||||
[Serializable]
|
||||
public class DirectoryNotFoundException : IOException
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.DirectoryNotFoundException" /> class with its message string set to a system-supplied message and its HRESULT set to COR_E_DIRECTORYNOTFOUND.</summary>
|
||||
// Token: 0x06001614 RID: 5652 RVA: 0x00055158 File Offset: 0x00053358
|
||||
public DirectoryNotFoundException()
|
||||
: base("Directory not found")
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.DirectoryNotFoundException" /> class with its message string set to <paramref name="message" /> and its HRESULT set to COR_E_DIRECTORYNOTFOUND.</summary>
|
||||
/// <param name="message">A <see cref="T:System.String" /> that describes the error. The content of <paramref name="message" /> is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture. </param>
|
||||
// Token: 0x06001615 RID: 5653 RVA: 0x00055168 File Offset: 0x00053368
|
||||
public DirectoryNotFoundException(string message)
|
||||
: base(message)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.DirectoryNotFoundException" /> class with a specified error message and a reference to the inner exception that is the cause of this exception.</summary>
|
||||
/// <param name="message">The error message that explains the reason for the exception. </param>
|
||||
/// <param name="innerException">The exception that is the cause of the current exception. If the <paramref name="innerException" /> parameter is not null, the current exception is raised in a catch block that handles the inner exception. </param>
|
||||
// Token: 0x06001616 RID: 5654 RVA: 0x00055174 File Offset: 0x00053374
|
||||
public DirectoryNotFoundException(string message, Exception innerException)
|
||||
: base(message, innerException)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.DirectoryNotFoundException" /> class with the specified serialization and context information.</summary>
|
||||
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data about the exception being thrown. </param>
|
||||
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination. </param>
|
||||
// Token: 0x06001617 RID: 5655 RVA: 0x00055180 File Offset: 0x00053380
|
||||
protected DirectoryNotFoundException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,364 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
/// <summary>Provides access to information on a drive.</summary>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x020001AD RID: 429
|
||||
[ComVisible(true)]
|
||||
[Serializable]
|
||||
public sealed class DriveInfo : ISerializable
|
||||
{
|
||||
// Token: 0x06001618 RID: 5656 RVA: 0x0005518C File Offset: 0x0005338C
|
||||
private DriveInfo(DriveInfo._DriveType _drive_type, string path, string fstype)
|
||||
{
|
||||
this._drive_type = _drive_type;
|
||||
this.drive_format = fstype;
|
||||
this.path = path;
|
||||
}
|
||||
|
||||
/// <summary>Provides access to information on the specified drive.</summary>
|
||||
/// <param name="driveName">A valid drive path or drive letter. This can be either uppercase or lowercase, 'a' to 'z'. A null value is not valid. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">The drive letter cannot be null. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">The first letter of <paramref name="driveName" /> is not an uppercase or lowercase letter from 'a' to 'z'.-or-<paramref name="driveName" /> does not refer to a valid drive.</exception>
|
||||
// Token: 0x06001619 RID: 5657 RVA: 0x000551AC File Offset: 0x000533AC
|
||||
public DriveInfo(string driveName)
|
||||
{
|
||||
DriveInfo[] drives = DriveInfo.GetDrives();
|
||||
foreach (DriveInfo driveInfo in drives)
|
||||
{
|
||||
if (driveInfo.path == driveName)
|
||||
{
|
||||
this.path = driveInfo.path;
|
||||
this.drive_format = driveInfo.drive_format;
|
||||
this.path = driveInfo.path;
|
||||
return;
|
||||
}
|
||||
}
|
||||
throw new ArgumentException("The drive name does not exist", "driveName");
|
||||
}
|
||||
|
||||
/// <summary>Populates a <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object with the data needed to serialize the target object.</summary>
|
||||
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object to populate with data.</param>
|
||||
/// <param name="context">The destination (see <see cref="T:System.Runtime.Serialization.StreamingContext" />) for this serialization.</param>
|
||||
// Token: 0x0600161A RID: 5658 RVA: 0x00055224 File Offset: 0x00053424
|
||||
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
// Token: 0x0600161B RID: 5659 RVA: 0x0005522C File Offset: 0x0005342C
|
||||
private static void GetDiskFreeSpace(string path, out ulong availableFreeSpace, out ulong totalSize, out ulong totalFreeSpace)
|
||||
{
|
||||
MonoIOError monoIOError;
|
||||
if (!DriveInfo.GetDiskFreeSpaceInternal(path, out availableFreeSpace, out totalSize, out totalFreeSpace, out monoIOError))
|
||||
{
|
||||
throw MonoIO.GetException(path, monoIOError);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Indicates the amount of available free space on a drive.</summary>
|
||||
/// <returns>The amount of free space available on the drive, in bytes.</returns>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">Access to the drive information is denied.</exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurred (for example, a disk error or a drive was not ready). </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x170003E2 RID: 994
|
||||
// (get) Token: 0x0600161C RID: 5660 RVA: 0x00055254 File Offset: 0x00053454
|
||||
public long AvailableFreeSpace
|
||||
{
|
||||
get
|
||||
{
|
||||
ulong num;
|
||||
ulong num2;
|
||||
ulong num3;
|
||||
DriveInfo.GetDiskFreeSpace(this.path, out num, out num2, out num3);
|
||||
return (long)((num <= 9223372036854775807UL) ? num : 9223372036854775807UL);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the total amount of free space available on a drive.</summary>
|
||||
/// <returns>The total free space available on a drive, in bytes.</returns>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">Access to the drive information is denied.</exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurred (for example, a disk error or a drive was not ready). </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x170003E3 RID: 995
|
||||
// (get) Token: 0x0600161D RID: 5661 RVA: 0x00055290 File Offset: 0x00053490
|
||||
public long TotalFreeSpace
|
||||
{
|
||||
get
|
||||
{
|
||||
ulong num;
|
||||
ulong num2;
|
||||
ulong num3;
|
||||
DriveInfo.GetDiskFreeSpace(this.path, out num, out num2, out num3);
|
||||
return (long)((num3 <= 9223372036854775807UL) ? num3 : 9223372036854775807UL);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the total size of storage space on a drive.</summary>
|
||||
/// <returns>The total size of the drive, in bytes.</returns>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">Access to the drive information is denied.</exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurred (for example, a disk error or a drive was not ready). </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x170003E4 RID: 996
|
||||
// (get) Token: 0x0600161E RID: 5662 RVA: 0x000552CC File Offset: 0x000534CC
|
||||
public long TotalSize
|
||||
{
|
||||
get
|
||||
{
|
||||
ulong num;
|
||||
ulong num2;
|
||||
ulong num3;
|
||||
DriveInfo.GetDiskFreeSpace(this.path, out num, out num2, out num3);
|
||||
return (long)((num2 <= 9223372036854775807UL) ? num2 : 9223372036854775807UL);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the volume label of a drive.</summary>
|
||||
/// <returns>The volume label.</returns>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">Access to the drive information is denied.-or-The volume label is being set on a network or CD-ROM drive.</exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurred (for example, a disk error or a drive was not ready). </exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x170003E5 RID: 997
|
||||
// (get) Token: 0x0600161F RID: 5663 RVA: 0x00055308 File Offset: 0x00053508
|
||||
// (set) Token: 0x06001620 RID: 5664 RVA: 0x00055324 File Offset: 0x00053524
|
||||
[MonoTODO("Currently get only works on Mono/Unix; set not implemented")]
|
||||
public string VolumeLabel
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this._drive_type != DriveInfo._DriveType.Windows)
|
||||
{
|
||||
return this.path;
|
||||
}
|
||||
return this.path;
|
||||
}
|
||||
set
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the name of the file system, such as NTFS or FAT32.</summary>
|
||||
/// <returns>The name of the file system on the specified drive.</returns>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">Access to the drive information is denied.</exception>
|
||||
/// <exception cref="T:System.IO.DriveNotFoundException">The drive does not exist or is not mapped.</exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurred (for example, a disk error or a drive was not ready). </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x170003E6 RID: 998
|
||||
// (get) Token: 0x06001621 RID: 5665 RVA: 0x0005532C File Offset: 0x0005352C
|
||||
public string DriveFormat
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.drive_format;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the drive type.</summary>
|
||||
/// <returns>One of the <see cref="T:System.IO.DriveType" /> values. </returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x170003E7 RID: 999
|
||||
// (get) Token: 0x06001622 RID: 5666 RVA: 0x00055334 File Offset: 0x00053534
|
||||
public DriveType DriveType
|
||||
{
|
||||
get
|
||||
{
|
||||
return (DriveType)DriveInfo.GetDriveTypeInternal(this.path);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the name of a drive.</summary>
|
||||
/// <returns>The name of the drive.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x170003E8 RID: 1000
|
||||
// (get) Token: 0x06001623 RID: 5667 RVA: 0x00055344 File Offset: 0x00053544
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.path;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the root directory of a drive.</summary>
|
||||
/// <returns>A <see cref="T:System.IO.DirectoryInfo" /> object that contains the root directory of the drive.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x170003E9 RID: 1001
|
||||
// (get) Token: 0x06001624 RID: 5668 RVA: 0x0005534C File Offset: 0x0005354C
|
||||
public DirectoryInfo RootDirectory
|
||||
{
|
||||
get
|
||||
{
|
||||
return new DirectoryInfo(this.path);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a value indicating whether a drive is ready.</summary>
|
||||
/// <returns>true if the drive is ready; false if the drive is not ready.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x170003EA RID: 1002
|
||||
// (get) Token: 0x06001625 RID: 5669 RVA: 0x0005535C File Offset: 0x0005355C
|
||||
[MonoTODO("It always returns true")]
|
||||
public bool IsReady
|
||||
{
|
||||
get
|
||||
{
|
||||
return this._drive_type == DriveInfo._DriveType.Windows || true;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001626 RID: 5670 RVA: 0x00055370 File Offset: 0x00053570
|
||||
private static StreamReader TryOpen(string name)
|
||||
{
|
||||
if (File.Exists(name))
|
||||
{
|
||||
return new StreamReader(name, Encoding.ASCII);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Token: 0x06001627 RID: 5671 RVA: 0x0005538C File Offset: 0x0005358C
|
||||
private static DriveInfo[] LinuxGetDrives()
|
||||
{
|
||||
DriveInfo[] array;
|
||||
using (StreamReader streamReader = DriveInfo.TryOpen("/proc/mounts"))
|
||||
{
|
||||
ArrayList arrayList = new ArrayList();
|
||||
string text;
|
||||
while ((text = streamReader.ReadLine()) != null)
|
||||
{
|
||||
if (!text.StartsWith("rootfs"))
|
||||
{
|
||||
int num = text.IndexOf(' ');
|
||||
if (num != -1)
|
||||
{
|
||||
string text2 = text.Substring(num + 1);
|
||||
num = text2.IndexOf(' ');
|
||||
if (num != -1)
|
||||
{
|
||||
string text3 = text2.Substring(0, num);
|
||||
text2 = text2.Substring(num + 1);
|
||||
num = text2.IndexOf(' ');
|
||||
if (num != -1)
|
||||
{
|
||||
string text4 = text2.Substring(0, num);
|
||||
arrayList.Add(new DriveInfo(DriveInfo._DriveType.Linux, text3, text4));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
array = (DriveInfo[])arrayList.ToArray(typeof(DriveInfo));
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
// Token: 0x06001628 RID: 5672 RVA: 0x0005549C File Offset: 0x0005369C
|
||||
private static DriveInfo[] UnixGetDrives()
|
||||
{
|
||||
DriveInfo[] array = null;
|
||||
try
|
||||
{
|
||||
using (StreamReader streamReader = DriveInfo.TryOpen("/proc/sys/kernel/ostype"))
|
||||
{
|
||||
if (streamReader != null)
|
||||
{
|
||||
string text = streamReader.ReadLine();
|
||||
if (text == "Linux")
|
||||
{
|
||||
array = DriveInfo.LinuxGetDrives();
|
||||
}
|
||||
}
|
||||
}
|
||||
if (array != null)
|
||||
{
|
||||
return array;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
return new DriveInfo[]
|
||||
{
|
||||
new DriveInfo(DriveInfo._DriveType.GenericUnix, "/", "unixfs")
|
||||
};
|
||||
}
|
||||
|
||||
// Token: 0x06001629 RID: 5673 RVA: 0x00055558 File Offset: 0x00053758
|
||||
private static DriveInfo[] WindowsGetDrives()
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>Retrieves the drive names of all logical drives on a computer.</summary>
|
||||
/// <returns>An array of type <see cref="T:System.IO.DriveInfo" /> that represents the logical drives on a computer.</returns>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurred (for example, a disk error or a drive was not ready). </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600162A RID: 5674 RVA: 0x00055560 File Offset: 0x00053760
|
||||
[MonoTODO("Currently only implemented on Mono/Linux")]
|
||||
public static DriveInfo[] GetDrives()
|
||||
{
|
||||
int platform = (int)Environment.Platform;
|
||||
if (platform == 4 || platform == 128 || platform == 6)
|
||||
{
|
||||
return DriveInfo.UnixGetDrives();
|
||||
}
|
||||
return DriveInfo.WindowsGetDrives();
|
||||
}
|
||||
|
||||
/// <summary>Returns a drive name as a string.</summary>
|
||||
/// <returns>The name of the drive.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600162B RID: 5675 RVA: 0x00055598 File Offset: 0x00053798
|
||||
public override string ToString()
|
||||
{
|
||||
return this.Name;
|
||||
}
|
||||
|
||||
// Token: 0x0600162C RID: 5676
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
private static extern bool GetDiskFreeSpaceInternal(string pathName, out ulong freeBytesAvail, out ulong totalNumberOfBytes, out ulong totalNumberOfFreeBytes, out MonoIOError error);
|
||||
|
||||
// Token: 0x0600162D RID: 5677
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
private static extern uint GetDriveTypeInternal(string rootPathName);
|
||||
|
||||
// Token: 0x0400064A RID: 1610
|
||||
private DriveInfo._DriveType _drive_type;
|
||||
|
||||
// Token: 0x0400064B RID: 1611
|
||||
private string drive_format;
|
||||
|
||||
// Token: 0x0400064C RID: 1612
|
||||
private string path;
|
||||
|
||||
// Token: 0x020001AE RID: 430
|
||||
private enum _DriveType
|
||||
{
|
||||
// Token: 0x0400064E RID: 1614
|
||||
GenericUnix,
|
||||
// Token: 0x0400064F RID: 1615
|
||||
Linux,
|
||||
// Token: 0x04000650 RID: 1616
|
||||
Windows
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
/// <summary>The exception that is thrown when trying to access a drive or share that is not available.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x020001AF RID: 431
|
||||
[ComVisible(true)]
|
||||
[Serializable]
|
||||
public class DriveNotFoundException : IOException
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.DriveNotFoundException" /> class with its message string set to a system-supplied message and its HRESULT set to COR_E_DIRECTORYNOTFOUND. </summary>
|
||||
// Token: 0x0600162E RID: 5678 RVA: 0x000555A0 File Offset: 0x000537A0
|
||||
public DriveNotFoundException()
|
||||
: base("Attempted to access a drive that is not available.")
|
||||
{
|
||||
base.HResult = -2147024893;
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.DriveNotFoundException" /> class with the specified message string and the HRESULT set to COR_E_DIRECTORYNOTFOUND. </summary>
|
||||
/// <param name="message">A <see cref="T:System.String" /> object that describes the error. The caller of this constructor is required to ensure that this string has been localized for the current system culture.</param>
|
||||
// Token: 0x0600162F RID: 5679 RVA: 0x000555B8 File Offset: 0x000537B8
|
||||
public DriveNotFoundException(string message)
|
||||
: base(message)
|
||||
{
|
||||
base.HResult = -2147024893;
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.DriveNotFoundException" /> class with the specified error message and a reference to the inner exception that is the cause of this exception. </summary>
|
||||
/// <param name="message">The error message that explains the reason for the exception. </param>
|
||||
/// <param name="innerException">The exception that is the cause of the current exception. If the <paramref name="innerException" /> parameter is not null, the current exception is raised in a catch block that handles the inner exception. </param>
|
||||
// Token: 0x06001630 RID: 5680 RVA: 0x000555CC File Offset: 0x000537CC
|
||||
public DriveNotFoundException(string message, Exception innerException)
|
||||
: base(message, innerException)
|
||||
{
|
||||
base.HResult = -2147024893;
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.DriveNotFoundException" /> class with the specified serialization and context information. </summary>
|
||||
/// <param name="info">A <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object that contains the serialized object data about the exception being thrown. </param>
|
||||
/// <param name="context">A <see cref="T:System.Runtime.Serialization.StreamingContext" /> object that contains contextual information about the source or destination of the exception being thrown. </param>
|
||||
// Token: 0x06001631 RID: 5681 RVA: 0x000555E4 File Offset: 0x000537E4
|
||||
protected DriveNotFoundException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x04000651 RID: 1617
|
||||
private const int ErrorCode = -2147024893;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
/// <summary>Defines constants for drive types, including CDRom, Fixed, Network, NoRootDirectory, Ram, Removable, and Unknown.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x020001B0 RID: 432
|
||||
[ComVisible(true)]
|
||||
[Serializable]
|
||||
public enum DriveType
|
||||
{
|
||||
/// <summary>The drive is an optical disc device, such as a CD or DVD-ROM.</summary>
|
||||
// Token: 0x04000653 RID: 1619
|
||||
CDRom = 5,
|
||||
/// <summary>The drive is a fixed disk.</summary>
|
||||
// Token: 0x04000654 RID: 1620
|
||||
Fixed = 3,
|
||||
/// <summary>The drive is a network drive.</summary>
|
||||
// Token: 0x04000655 RID: 1621
|
||||
Network,
|
||||
/// <summary>The drive does not have a root directory.</summary>
|
||||
// Token: 0x04000656 RID: 1622
|
||||
NoRootDirectory = 1,
|
||||
/// <summary>The drive is a RAM disk.</summary>
|
||||
// Token: 0x04000657 RID: 1623
|
||||
Ram = 6,
|
||||
/// <summary>The drive is a removable storage device, such as a floppy disk drive or a USB flash drive.</summary>
|
||||
// Token: 0x04000658 RID: 1624
|
||||
Removable = 2,
|
||||
/// <summary>The type of drive is unknown.</summary>
|
||||
// Token: 0x04000659 RID: 1625
|
||||
Unknown = 0
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
/// <summary>The exception that is thrown when reading is attempted past the end of a stream.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x020001B1 RID: 433
|
||||
[ComVisible(true)]
|
||||
[Serializable]
|
||||
public class EndOfStreamException : IOException
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.EndOfStreamException" /> class with its message string set to a system-supplied message and its HRESULT set to COR_E_ENDOFSTREAM.</summary>
|
||||
// Token: 0x06001632 RID: 5682 RVA: 0x000555F0 File Offset: 0x000537F0
|
||||
public EndOfStreamException()
|
||||
: base(Locale.GetText("Failed to read past end of stream."))
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.EndOfStreamException" /> class with its message string set to <paramref name="message" /> and its HRESULT set to COR_E_ENDOFSTREAM.</summary>
|
||||
/// <param name="message">A string that describes the error. The content of <paramref name="message" /> is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture. </param>
|
||||
// Token: 0x06001633 RID: 5683 RVA: 0x00055604 File Offset: 0x00053804
|
||||
public EndOfStreamException(string message)
|
||||
: base(message)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.EndOfStreamException" /> class with the specified serialization and context information.</summary>
|
||||
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data about the exception being thrown. </param>
|
||||
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination. </param>
|
||||
// Token: 0x06001634 RID: 5684 RVA: 0x00055610 File Offset: 0x00053810
|
||||
protected EndOfStreamException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.EndOfStreamException" /> class with a specified error message and a reference to the inner exception that is the cause of this exception.</summary>
|
||||
/// <param name="message">A string that describes the error. The content of <paramref name="message" /> is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture. </param>
|
||||
/// <param name="innerException">The exception that is the cause of the current exception. If the <paramref name="innerException" /> parameter is not null, the current exception is raised in a catch block that handles the inner exception. </param>
|
||||
// Token: 0x06001635 RID: 5685 RVA: 0x0005561C File Offset: 0x0005381C
|
||||
public EndOfStreamException(string message, Exception innerException)
|
||||
: base(message, innerException)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,1479 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
/// <summary>Provides static methods for the creation, copying, deletion, moving, and opening of files, and aids in the creation of <see cref="T:System.IO.FileStream" /> objects.</summary>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x020001B2 RID: 434
|
||||
[ComVisible(true)]
|
||||
public static class File
|
||||
{
|
||||
/// <summary>Opens a file, appends the specified string to the file, and then closes the file. If the file does not exist, this method creates a file, writes the specified string to the file, then closes the file.</summary>
|
||||
/// <param name="path">The file to append the specified string to. </param>
|
||||
/// <param name="contents">The string to append to the file. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive). </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurred while opening the file. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">
|
||||
/// <paramref name="path" /> specified a file that is read-only.-or- This operation is not supported on the current platform.-or- <paramref name="path" /> specified a directory.-or- The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file specified in <paramref name="path" /> was not found. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> is in an invalid format. </exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001636 RID: 5686 RVA: 0x00055628 File Offset: 0x00053828
|
||||
public static void AppendAllText(string path, string contents)
|
||||
{
|
||||
using (TextWriter textWriter = new StreamWriter(path, true))
|
||||
{
|
||||
textWriter.Write(contents);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Appends the specified string to the file, creating the file if it does not already exist.</summary>
|
||||
/// <param name="path">The file to append the specified string to. </param>
|
||||
/// <param name="contents">The string to append to the file. </param>
|
||||
/// <param name="encoding">The character encoding to use. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive). </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurred while opening the file. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">
|
||||
/// <paramref name="path" /> specified a file that is read-only.-or- This operation is not supported on the current platform.-or- <paramref name="path" /> specified a directory.-or- The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file specified in <paramref name="path" /> was not found. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> is in an invalid format. </exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001637 RID: 5687 RVA: 0x00055674 File Offset: 0x00053874
|
||||
public static void AppendAllText(string path, string contents, Encoding encoding)
|
||||
{
|
||||
using (TextWriter textWriter = new StreamWriter(path, true, encoding))
|
||||
{
|
||||
textWriter.Write(contents);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.IO.StreamWriter" /> that appends UTF-8 encoded text to an existing file.</summary>
|
||||
/// <returns>A StreamWriter that appends UTF-8 encoded text to an existing file.</returns>
|
||||
/// <param name="path">The path to the file to append to. </param>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission.-OR-<paramref name="destFileName" /> is read-only. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive). </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> is in an invalid format. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001638 RID: 5688 RVA: 0x000556C0 File Offset: 0x000538C0
|
||||
public static StreamWriter AppendText(string path)
|
||||
{
|
||||
return new StreamWriter(path, true);
|
||||
}
|
||||
|
||||
/// <summary>Copies an existing file to a new file. Overwriting a file of the same name is not allowed.</summary>
|
||||
/// <param name="sourceFileName">The file to copy. </param>
|
||||
/// <param name="destFileName">The name of the destination file. This cannot be a directory or an existing file. </param>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="sourceFileName" /> or <paramref name="destFileName" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />.-or- <paramref name="sourceFileName" /> or <paramref name="destFileName" /> specifies a directory. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="sourceFileName" /> or <paramref name="destFileName" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The path specified in <paramref name="sourceFileName" /> or <paramref name="destFileName" /> is invalid (for example, it is on an unmapped drive). </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">
|
||||
/// <paramref name="sourceFileName" /> was not found. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">
|
||||
/// <paramref name="destFileName" /> exists.-or- An I/O error has occurred. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="sourceFileName" /> or <paramref name="destFileName" /> is in an invalid format. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001639 RID: 5689 RVA: 0x000556CC File Offset: 0x000538CC
|
||||
public static void Copy(string sourceFileName, string destFileName)
|
||||
{
|
||||
File.Copy(sourceFileName, destFileName, false);
|
||||
}
|
||||
|
||||
/// <summary>Copies an existing file to a new file. Overwriting a file of the same name is allowed.</summary>
|
||||
/// <param name="sourceFileName">The file to copy. </param>
|
||||
/// <param name="destFileName">The name of the destination file. This cannot be a directory. </param>
|
||||
/// <param name="overwrite">true if the destination file can be overwritten; otherwise, false. </param>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. -or-<paramref name="destFileName" /> is read-only.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="sourceFileName" /> or <paramref name="destFileName" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />.-or- <paramref name="sourceFileName" /> or <paramref name="destFileName" /> specifies a directory. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="sourceFileName" /> or <paramref name="destFileName" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The path specified in <paramref name="sourceFileName" /> or <paramref name="destFileName" /> is invalid (for example, it is on an unmapped drive). </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">
|
||||
/// <paramref name="sourceFileName" /> was not found. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">
|
||||
/// <paramref name="destFileName" /> exists and <paramref name="overwrite" /> is false.-or- An I/O error has occurred. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="sourceFileName" /> or <paramref name="destFileName" /> is in an invalid format. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600163A RID: 5690 RVA: 0x000556D8 File Offset: 0x000538D8
|
||||
public static void Copy(string sourceFileName, string destFileName, bool overwrite)
|
||||
{
|
||||
if (sourceFileName == null)
|
||||
{
|
||||
throw new ArgumentNullException("sourceFileName");
|
||||
}
|
||||
if (destFileName == null)
|
||||
{
|
||||
throw new ArgumentNullException("destFileName");
|
||||
}
|
||||
if (sourceFileName.Length == 0)
|
||||
{
|
||||
throw new ArgumentException("An empty file name is not valid.", "sourceFileName");
|
||||
}
|
||||
if (sourceFileName.Trim().Length == 0 || sourceFileName.IndexOfAny(Path.InvalidPathChars) != -1)
|
||||
{
|
||||
throw new ArgumentException("The file name is not valid.");
|
||||
}
|
||||
if (destFileName.Length == 0)
|
||||
{
|
||||
throw new ArgumentException("An empty file name is not valid.", "destFileName");
|
||||
}
|
||||
if (destFileName.Trim().Length == 0 || destFileName.IndexOfAny(Path.InvalidPathChars) != -1)
|
||||
{
|
||||
throw new ArgumentException("The file name is not valid.");
|
||||
}
|
||||
MonoIOError monoIOError;
|
||||
if (!MonoIO.Exists(sourceFileName, out monoIOError))
|
||||
{
|
||||
throw new FileNotFoundException(Locale.GetText("{0} does not exist", new object[] { sourceFileName }), sourceFileName);
|
||||
}
|
||||
if ((File.GetAttributes(sourceFileName) & FileAttributes.Directory) == FileAttributes.Directory)
|
||||
{
|
||||
throw new ArgumentException(Locale.GetText("{0} is a directory", new object[] { sourceFileName }));
|
||||
}
|
||||
if (MonoIO.Exists(destFileName, out monoIOError))
|
||||
{
|
||||
if ((File.GetAttributes(destFileName) & FileAttributes.Directory) == FileAttributes.Directory)
|
||||
{
|
||||
throw new ArgumentException(Locale.GetText("{0} is a directory", new object[] { destFileName }));
|
||||
}
|
||||
if (!overwrite)
|
||||
{
|
||||
throw new IOException(Locale.GetText("{0} already exists", new object[] { destFileName }));
|
||||
}
|
||||
}
|
||||
string directoryName = Path.GetDirectoryName(destFileName);
|
||||
if (directoryName != string.Empty && !Directory.Exists(directoryName))
|
||||
{
|
||||
throw new DirectoryNotFoundException(Locale.GetText("Destination directory not found: {0}", new object[] { directoryName }));
|
||||
}
|
||||
if (!MonoIO.CopyFile(sourceFileName, destFileName, overwrite, out monoIOError))
|
||||
{
|
||||
string text = Locale.GetText("{0}\" or \"{1}", new object[] { sourceFileName, destFileName });
|
||||
throw MonoIO.GetException(text, monoIOError);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Creates or overwrites a file in the specified path.</summary>
|
||||
/// <returns>A <see cref="T:System.IO.FileStream" /> that provides read/write access to the file specified in <paramref name="path" />.</returns>
|
||||
/// <param name="path">The path and name of the file to create. </param>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission.-or- <paramref name="path" /> specified a file that is read-only. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive). </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurred while creating the file. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> is in an invalid format. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600163B RID: 5691 RVA: 0x000558AC File Offset: 0x00053AAC
|
||||
public static FileStream Create(string path)
|
||||
{
|
||||
return File.Create(path, 8192);
|
||||
}
|
||||
|
||||
/// <summary>Creates or overwrites the specified file.</summary>
|
||||
/// <returns>A <see cref="T:System.IO.FileStream" /> with the specified buffer size that provides read/write access to the file specified in <paramref name="path" />.</returns>
|
||||
/// <param name="path">The name of the file. </param>
|
||||
/// <param name="bufferSize">The number of bytes buffered for reads and writes to the file. </param>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission.-or- <paramref name="path" /> specified a file that is read-only. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive). </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurred while creating the file. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> is in an invalid format. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600163C RID: 5692 RVA: 0x000558BC File Offset: 0x00053ABC
|
||||
public static FileStream Create(string path, int bufferSize)
|
||||
{
|
||||
return new FileStream(path, FileMode.Create, FileAccess.ReadWrite, FileShare.None, bufferSize);
|
||||
}
|
||||
|
||||
/// <summary>Creates or opens a file for writing UTF-8 encoded text.</summary>
|
||||
/// <returns>A <see cref="T:System.IO.StreamWriter" /> that writes to the specified file using UTF-8 encoding.</returns>
|
||||
/// <param name="path">The file to be opened for writing. </param>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive). </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> is in an invalid format. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600163D RID: 5693 RVA: 0x000558C8 File Offset: 0x00053AC8
|
||||
public static StreamWriter CreateText(string path)
|
||||
{
|
||||
return new StreamWriter(path, false);
|
||||
}
|
||||
|
||||
/// <summary>Deletes the specified file. An exception is not thrown if the specified file does not exist.</summary>
|
||||
/// <param name="path">The name of the file to be deleted. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid, (for example, it is on an unmapped drive). </exception>
|
||||
/// <exception cref="T:System.IO.IOException">The specified file is in use. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> is in an invalid format. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission.-or- <paramref name="path" /> is a directory.-or- <paramref name="path" /> specified a read-only file. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600163E RID: 5694 RVA: 0x000558D4 File Offset: 0x00053AD4
|
||||
public static void Delete(string path)
|
||||
{
|
||||
if (path == null)
|
||||
{
|
||||
throw new ArgumentNullException("path");
|
||||
}
|
||||
if (path.Trim().Length == 0 || path.IndexOfAny(Path.InvalidPathChars) >= 0)
|
||||
{
|
||||
throw new ArgumentException("path");
|
||||
}
|
||||
if (Directory.Exists(path))
|
||||
{
|
||||
throw new UnauthorizedAccessException(Locale.GetText("{0} is a directory", new object[] { path }));
|
||||
}
|
||||
string directoryName = Path.GetDirectoryName(path);
|
||||
if (directoryName != string.Empty && !Directory.Exists(directoryName))
|
||||
{
|
||||
throw new DirectoryNotFoundException(Locale.GetText("Could not find a part of the path \"{0}\".", new object[] { path }));
|
||||
}
|
||||
MonoIOError monoIOError;
|
||||
if (!MonoIO.DeleteFile(path, out monoIOError) && monoIOError != MonoIOError.ERROR_FILE_NOT_FOUND)
|
||||
{
|
||||
throw MonoIO.GetException(path, monoIOError);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Determines whether the specified file exists.</summary>
|
||||
/// <returns>true if the caller has the required permissions and <paramref name="path" /> contains the name of an existing file; otherwise, false. This method also returns false if <paramref name="path" /> is null, an invalid path, or a zero-length string. If the caller does not have sufficient permissions to read the specified file, no exception is thrown and the method returns false regardless of the existence of <paramref name="path" />.</returns>
|
||||
/// <param name="path">The file to check. </param>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600163F RID: 5695 RVA: 0x0005599C File Offset: 0x00053B9C
|
||||
public static bool Exists(string path)
|
||||
{
|
||||
MonoIOError monoIOError;
|
||||
return path != null && path.Trim().Length != 0 && path.IndexOfAny(Path.InvalidPathChars) < 0 && MonoIO.ExistsFile(path, out monoIOError);
|
||||
}
|
||||
|
||||
/// <summary>Gets the <see cref="T:System.IO.FileAttributes" /> of the file on the path.</summary>
|
||||
/// <returns>The <see cref="T:System.IO.FileAttributes" /> of the file on the path.</returns>
|
||||
/// <param name="path">The path to the file. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is empty, contains only white spaces, or contains invalid characters. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> is in an invalid format. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">
|
||||
/// <paramref name="path" /> represents a file and is invalid, such as being on an unmapped drive, or the file cannot be found. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">
|
||||
/// <paramref name="path" /> represents a directory and is invalid, such as being on an unmapped drive, or the directory cannot be found.</exception>
|
||||
/// <exception cref="T:System.IO.IOException">This file is being used by another process.</exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001640 RID: 5696 RVA: 0x000559DC File Offset: 0x00053BDC
|
||||
public static FileAttributes GetAttributes(string path)
|
||||
{
|
||||
if (path == null)
|
||||
{
|
||||
throw new ArgumentNullException("path");
|
||||
}
|
||||
if (path.Trim().Length == 0)
|
||||
{
|
||||
throw new ArgumentException(Locale.GetText("Path is empty"));
|
||||
}
|
||||
if (path.IndexOfAny(Path.InvalidPathChars) >= 0)
|
||||
{
|
||||
throw new ArgumentException(Locale.GetText("Path contains invalid chars"));
|
||||
}
|
||||
MonoIOError monoIOError;
|
||||
FileAttributes fileAttributes = MonoIO.GetFileAttributes(path, out monoIOError);
|
||||
if (monoIOError != MonoIOError.ERROR_SUCCESS)
|
||||
{
|
||||
throw MonoIO.GetException(path, monoIOError);
|
||||
}
|
||||
return fileAttributes;
|
||||
}
|
||||
|
||||
/// <summary>Returns the creation date and time of the specified file or directory.</summary>
|
||||
/// <returns>A <see cref="T:System.DateTime" /> structure set to the creation date and time for the specified file or directory. This value is expressed in local time.</returns>
|
||||
/// <param name="path">The file or directory for which to obtain creation date and time information. </param>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> is in an invalid format. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001641 RID: 5697 RVA: 0x00055A54 File Offset: 0x00053C54
|
||||
public static DateTime GetCreationTime(string path)
|
||||
{
|
||||
File.CheckPathExceptions(path);
|
||||
MonoIOStat monoIOStat;
|
||||
MonoIOError monoIOError;
|
||||
if (MonoIO.GetFileStat(path, out monoIOStat, out monoIOError))
|
||||
{
|
||||
return DateTime.FromFileTime(monoIOStat.CreationTime);
|
||||
}
|
||||
if (monoIOError == MonoIOError.ERROR_PATH_NOT_FOUND || monoIOError == MonoIOError.ERROR_FILE_NOT_FOUND)
|
||||
{
|
||||
return File.DefaultLocalFileTime;
|
||||
}
|
||||
throw new IOException(path);
|
||||
}
|
||||
|
||||
/// <summary>Returns the creation date and time, in coordinated universal time (UTC), of the specified file or directory.</summary>
|
||||
/// <returns>A <see cref="T:System.DateTime" /> structure set to the creation date and time for the specified file or directory. This value is expressed in UTC time.</returns>
|
||||
/// <param name="path">The file or directory for which to obtain creation date and time information. </param>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> is in an invalid format. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001642 RID: 5698 RVA: 0x00055AA0 File Offset: 0x00053CA0
|
||||
public static DateTime GetCreationTimeUtc(string path)
|
||||
{
|
||||
return File.GetCreationTime(path).ToUniversalTime();
|
||||
}
|
||||
|
||||
/// <summary>Returns the date and time the specified file or directory was last accessed.</summary>
|
||||
/// <returns>A <see cref="T:System.DateTime" /> structure set to the date and time that the specified file or directory was last accessed. This value is expressed in local time.</returns>
|
||||
/// <param name="path">The file or directory for which to obtain access date and time information. </param>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> is in an invalid format. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001643 RID: 5699 RVA: 0x00055ABC File Offset: 0x00053CBC
|
||||
public static DateTime GetLastAccessTime(string path)
|
||||
{
|
||||
File.CheckPathExceptions(path);
|
||||
MonoIOStat monoIOStat;
|
||||
MonoIOError monoIOError;
|
||||
if (MonoIO.GetFileStat(path, out monoIOStat, out monoIOError))
|
||||
{
|
||||
return DateTime.FromFileTime(monoIOStat.LastAccessTime);
|
||||
}
|
||||
if (monoIOError == MonoIOError.ERROR_PATH_NOT_FOUND || monoIOError == MonoIOError.ERROR_FILE_NOT_FOUND)
|
||||
{
|
||||
return File.DefaultLocalFileTime;
|
||||
}
|
||||
throw new IOException(path);
|
||||
}
|
||||
|
||||
/// <summary>Returns the date and time, in coordinated universal time (UTC), that the specified file or directory was last accessed.</summary>
|
||||
/// <returns>A <see cref="T:System.DateTime" /> structure set to the date and time that the specified file or directory was last accessed. This value is expressed in UTC time.</returns>
|
||||
/// <param name="path">The file or directory for which to obtain access date and time information. </param>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> is in an invalid format. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001644 RID: 5700 RVA: 0x00055B08 File Offset: 0x00053D08
|
||||
public static DateTime GetLastAccessTimeUtc(string path)
|
||||
{
|
||||
return File.GetLastAccessTime(path).ToUniversalTime();
|
||||
}
|
||||
|
||||
/// <summary>Returns the date and time the specified file or directory was last written to.</summary>
|
||||
/// <returns>A <see cref="T:System.DateTime" /> structure set to the date and time that the specified file or directory was last written to. This value is expressed in local time.</returns>
|
||||
/// <param name="path">The file or directory for which to obtain write date and time information. </param>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> is in an invalid format. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001645 RID: 5701 RVA: 0x00055B24 File Offset: 0x00053D24
|
||||
public static DateTime GetLastWriteTime(string path)
|
||||
{
|
||||
File.CheckPathExceptions(path);
|
||||
MonoIOStat monoIOStat;
|
||||
MonoIOError monoIOError;
|
||||
if (MonoIO.GetFileStat(path, out monoIOStat, out monoIOError))
|
||||
{
|
||||
return DateTime.FromFileTime(monoIOStat.LastWriteTime);
|
||||
}
|
||||
if (monoIOError == MonoIOError.ERROR_PATH_NOT_FOUND || monoIOError == MonoIOError.ERROR_FILE_NOT_FOUND)
|
||||
{
|
||||
return File.DefaultLocalFileTime;
|
||||
}
|
||||
throw new IOException(path);
|
||||
}
|
||||
|
||||
/// <summary>Returns the date and time, in coordinated universal time (UTC), that the specified file or directory was last written to.</summary>
|
||||
/// <returns>A <see cref="T:System.DateTime" /> structure set to the date and time that the specified file or directory was last written to. This value is expressed in UTC time.</returns>
|
||||
/// <param name="path">The file or directory for which to obtain write date and time information. </param>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> is in an invalid format. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001646 RID: 5702 RVA: 0x00055B70 File Offset: 0x00053D70
|
||||
public static DateTime GetLastWriteTimeUtc(string path)
|
||||
{
|
||||
return File.GetLastWriteTime(path).ToUniversalTime();
|
||||
}
|
||||
|
||||
/// <summary>Moves a specified file to a new location, providing the option to specify a new file name.</summary>
|
||||
/// <param name="sourceFileName">The name of the file to move. </param>
|
||||
/// <param name="destFileName">The new path for the file. </param>
|
||||
/// <exception cref="T:System.IO.IOException">The destination file already exists.-or-<paramref name="sourceFileName" /> was not found.</exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="sourceFileName" /> or <paramref name="destFileName" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="sourceFileName" /> or <paramref name="destFileName" /> is a zero-length string, contains only white space, or contains invalid characters as defined in <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The path specified in <paramref name="sourceFileName" /> or <paramref name="destFileName" /> is invalid, (for example, it is on an unmapped drive). </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="sourceFileName" /> or <paramref name="destFileName" /> is in an invalid format. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001647 RID: 5703 RVA: 0x00055B8C File Offset: 0x00053D8C
|
||||
public static void Move(string sourceFileName, string destFileName)
|
||||
{
|
||||
if (sourceFileName == null)
|
||||
{
|
||||
throw new ArgumentNullException("sourceFileName");
|
||||
}
|
||||
if (destFileName == null)
|
||||
{
|
||||
throw new ArgumentNullException("destFileName");
|
||||
}
|
||||
if (sourceFileName.Length == 0)
|
||||
{
|
||||
throw new ArgumentException("An empty file name is not valid.", "sourceFileName");
|
||||
}
|
||||
if (sourceFileName.Trim().Length == 0 || sourceFileName.IndexOfAny(Path.InvalidPathChars) != -1)
|
||||
{
|
||||
throw new ArgumentException("The file name is not valid.");
|
||||
}
|
||||
if (destFileName.Length == 0)
|
||||
{
|
||||
throw new ArgumentException("An empty file name is not valid.", "destFileName");
|
||||
}
|
||||
if (destFileName.Trim().Length == 0 || destFileName.IndexOfAny(Path.InvalidPathChars) != -1)
|
||||
{
|
||||
throw new ArgumentException("The file name is not valid.");
|
||||
}
|
||||
MonoIOError monoIOError;
|
||||
if (!MonoIO.Exists(sourceFileName, out monoIOError))
|
||||
{
|
||||
throw new FileNotFoundException(Locale.GetText("{0} does not exist", new object[] { sourceFileName }), sourceFileName);
|
||||
}
|
||||
string directoryName = Path.GetDirectoryName(destFileName);
|
||||
if (directoryName != string.Empty && !Directory.Exists(directoryName))
|
||||
{
|
||||
throw new DirectoryNotFoundException(Locale.GetText("Could not find a part of the path."));
|
||||
}
|
||||
if (MonoIO.MoveFile(sourceFileName, destFileName, out monoIOError))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (monoIOError == MonoIOError.ERROR_ALREADY_EXISTS)
|
||||
{
|
||||
throw MonoIO.GetException(monoIOError);
|
||||
}
|
||||
if (monoIOError == MonoIOError.ERROR_SHARING_VIOLATION)
|
||||
{
|
||||
throw MonoIO.GetException(sourceFileName, monoIOError);
|
||||
}
|
||||
throw MonoIO.GetException(monoIOError);
|
||||
}
|
||||
|
||||
/// <summary>Opens a <see cref="T:System.IO.FileStream" /> on the specified path with read/write access.</summary>
|
||||
/// <returns>A <see cref="T:System.IO.FileStream" /> opened in the specified mode and path, with read/write access and not shared.</returns>
|
||||
/// <param name="path">The file to open. </param>
|
||||
/// <param name="mode">A <see cref="T:System.IO.FileMode" /> value that specifies whether a file is created if one does not exist, and determines whether the contents of existing files are retained or overwritten. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid, (for example, it is on an unmapped drive). </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurred while opening the file. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">
|
||||
/// <paramref name="path" /> specified a file that is read-only.-or- This operation is not supported on the current platform.-or- <paramref name="path" /> specified a directory.-or- The caller does not have the required permission. -or-<paramref name="mode" /> is <see cref="F:System.IO.FileMode.Create" /> and the specified file is a hidden file.</exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="mode" /> specified an invalid value. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file specified in <paramref name="path" /> was not found. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> is in an invalid format. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001648 RID: 5704 RVA: 0x00055CDC File Offset: 0x00053EDC
|
||||
public static FileStream Open(string path, FileMode mode)
|
||||
{
|
||||
return new FileStream(path, mode, (mode != FileMode.Append) ? FileAccess.ReadWrite : FileAccess.Write, FileShare.None);
|
||||
}
|
||||
|
||||
/// <summary>Opens a <see cref="T:System.IO.FileStream" /> on the specified path, with the specified mode and access.</summary>
|
||||
/// <returns>An unshared <see cref="T:System.IO.FileStream" /> that provides access to the specified file, with the specified mode and access.</returns>
|
||||
/// <param name="path">The file to open. </param>
|
||||
/// <param name="mode">A <see cref="T:System.IO.FileMode" /> value that specifies whether a file is created if one does not exist, and determines whether the contents of existing files are retained or overwritten. </param>
|
||||
/// <param name="access">A <see cref="T:System.IO.FileAccess" /> value that specifies the operations that can be performed on the file. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />.-or- <paramref name="access" /> specified Read and <paramref name="mode" /> specified Create, CreateNew, Truncate, or Append. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid, (for example, it is on an unmapped drive). </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurred while opening the file. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">
|
||||
/// <paramref name="path" /> specified a file that is read-only and <paramref name="access" /> is not Read.-or- <paramref name="path" /> specified a directory.-or- The caller does not have the required permission. -or-<paramref name="mode" /> is <see cref="F:System.IO.FileMode.Create" /> and the specified file is a hidden file.</exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="mode" /> or <paramref name="access" /> specified an invalid value. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file specified in <paramref name="path" /> was not found. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> is in an invalid format. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001649 RID: 5705 RVA: 0x00055CF4 File Offset: 0x00053EF4
|
||||
public static FileStream Open(string path, FileMode mode, FileAccess access)
|
||||
{
|
||||
return new FileStream(path, mode, access, FileShare.None);
|
||||
}
|
||||
|
||||
/// <summary>Opens a <see cref="T:System.IO.FileStream" /> on the specified path, having the specified mode with read, write, or read/write access and the specified sharing option.</summary>
|
||||
/// <returns>A <see cref="T:System.IO.FileStream" /> on the specified path, having the specified mode with read, write, or read/write access and the specified sharing option.</returns>
|
||||
/// <param name="path">The file to open. </param>
|
||||
/// <param name="mode">A <see cref="T:System.IO.FileMode" /> value that specifies whether a file is created if one does not exist, and determines whether the contents of existing files are retained or overwritten. </param>
|
||||
/// <param name="access">A <see cref="T:System.IO.FileAccess" /> value that specifies the operations that can be performed on the file. </param>
|
||||
/// <param name="share">A <see cref="T:System.IO.FileShare" /> value specifying the type of access other threads have to the file. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />.-or- <paramref name="access" /> specified Read and <paramref name="mode" /> specified Create, CreateNew, Truncate, or Append. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid, (for example, it is on an unmapped drive). </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurred while opening the file. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">
|
||||
/// <paramref name="path" /> specified a file that is read-only and <paramref name="access" /> is not Read.-or- <paramref name="path" /> specified a directory.-or- The caller does not have the required permission. -or-<paramref name="mode" /> is <see cref="F:System.IO.FileMode.Create" /> and the specified file is a hidden file.</exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="mode" />, <paramref name="access" />, or <paramref name="share" /> specified an invalid value. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file specified in <paramref name="path" /> was not found. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> is in an invalid format. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600164A RID: 5706 RVA: 0x00055D00 File Offset: 0x00053F00
|
||||
public static FileStream Open(string path, FileMode mode, FileAccess access, FileShare share)
|
||||
{
|
||||
return new FileStream(path, mode, access, share);
|
||||
}
|
||||
|
||||
/// <summary>Opens an existing file for reading.</summary>
|
||||
/// <returns>A read-only <see cref="T:System.IO.FileStream" /> on the specified path.</returns>
|
||||
/// <param name="path">The file to be opened for reading. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid, (for example, it is on an unmapped drive). </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">
|
||||
/// <paramref name="path" /> specified a directory.-or- The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file specified in <paramref name="path" /> was not found. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> is in an invalid format. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600164B RID: 5707 RVA: 0x00055D0C File Offset: 0x00053F0C
|
||||
public static FileStream OpenRead(string path)
|
||||
{
|
||||
return new FileStream(path, FileMode.Open, FileAccess.Read, FileShare.Read);
|
||||
}
|
||||
|
||||
/// <summary>Opens an existing UTF-8 encoded text file for reading.</summary>
|
||||
/// <returns>A <see cref="T:System.IO.StreamReader" /> on the specified path.</returns>
|
||||
/// <param name="path">The file to be opened for reading. </param>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid, (for example, it is on an unmapped drive). </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file specified in <paramref name="path" /> was not found. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> is in an invalid format. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600164C RID: 5708 RVA: 0x00055D18 File Offset: 0x00053F18
|
||||
public static StreamReader OpenText(string path)
|
||||
{
|
||||
return new StreamReader(path);
|
||||
}
|
||||
|
||||
/// <summary>Opens an existing file for writing.</summary>
|
||||
/// <returns>An unshared <see cref="T:System.IO.FileStream" /> object on the specified path with <see cref="F:System.IO.FileAccess.Write" /> access.</returns>
|
||||
/// <param name="path">The file to be opened for writing. </param>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission.-or- <paramref name="path" /> specified a read-only file or directory. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid, (for example, it is on an unmapped drive). </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file specified in <paramref name="path" /> was not found. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> is in an invalid format. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600164D RID: 5709 RVA: 0x00055D20 File Offset: 0x00053F20
|
||||
public static FileStream OpenWrite(string path)
|
||||
{
|
||||
return new FileStream(path, FileMode.OpenOrCreate, FileAccess.Write, FileShare.None);
|
||||
}
|
||||
|
||||
/// <summary>Replaces the contents of a specified file with the contents of another file, deleting the original file, and creating a backup of the replaced file.</summary>
|
||||
/// <param name="sourceFileName">The name of a file that replaces the file specified by <paramref name="destinationFileName" />.</param>
|
||||
/// <param name="destinationFileName">The name of the file being replaced.</param>
|
||||
/// <param name="destinationBackupFileName">The name of the backup file.</param>
|
||||
/// <exception cref="T:System.ArgumentException">The path described by the <paramref name="destinationFileName" /> parameter was not of a legal form.-or-The path described by the <paramref name="destinationBackupFileName" /> parameter was not of a legal form.</exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">The <paramref name="destinationFileName" /> parameter is null.</exception>
|
||||
/// <exception cref="T:System.IO.DriveNotFoundException">An invalid drive was specified. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file described by the current <see cref="T:System.IO.FileInfo" /> object could not be found.-or-The file described by the <paramref name="destinationBackupFileName" /> parameter could not be found. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurred while opening the file.- or -The <paramref name="sourceFileName" /> and <paramref name="destinationFileName" /> parameters specify the same file.</exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.PlatformNotSupportedException">The operating system is Windows 98 Second Edition or earlier and the files system is not NTFS.</exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The <paramref name="sourceFileName" /> or <paramref name="destinationFileName" /> parameter specifies a file that is read-only.-or- This operation is not supported on the current platform.-or- Source or destination parameters specify a directory instead of a file.-or- The caller does not have the required permission.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600164E RID: 5710 RVA: 0x00055D2C File Offset: 0x00053F2C
|
||||
public static void Replace(string sourceFileName, string destinationFileName, string destinationBackupFileName)
|
||||
{
|
||||
File.Replace(sourceFileName, destinationFileName, destinationBackupFileName, false);
|
||||
}
|
||||
|
||||
/// <summary>Replaces the contents of a specified file with the contents of another file, deleting the original file, and creating a backup of the replaced file and optionally ignores merge errors.</summary>
|
||||
/// <param name="sourceFileName">The name of a file that replaces the file specified by <paramref name="destinationFileName" />.</param>
|
||||
/// <param name="destinationFileName">The name of the file being replaced.</param>
|
||||
/// <param name="destinationBackupFileName">The name of the backup file.</param>
|
||||
/// <param name="ignoreMetadataErrors">true to ignore merge errors (such as attributes and access control lists (ACLs)) from the replaced file to the replacement file; otherwise, false. </param>
|
||||
/// <exception cref="T:System.ArgumentException">The path described by the <paramref name="destinationFileName" /> parameter was not of a legal form.-or-The path described by the <paramref name="destinationBackupFileName" /> parameter was not of a legal form.</exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">The <paramref name="destinationFileName" /> parameter is null.</exception>
|
||||
/// <exception cref="T:System.IO.DriveNotFoundException">An invalid drive was specified. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file described by the current <see cref="T:System.IO.FileInfo" /> object could not be found.-or-The file described by the <paramref name="destinationBackupFileName" /> parameter could not be found. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurred while opening the file.- or -The <paramref name="sourceFileName" /> and <paramref name="destinationFileName" /> parameters specify the same file.</exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.PlatformNotSupportedException">The operating system is Windows 98 Second Edition or earlier and the files system is not NTFS.</exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The <paramref name="sourceFileName" /> or <paramref name="destinationFileName" /> parameter specifies a file that is read-only.-or- This operation is not supported on the current platform.-or- Source or destination parameters specify a directory instead of a file.-or- The caller does not have the required permission.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600164F RID: 5711 RVA: 0x00055D38 File Offset: 0x00053F38
|
||||
public static void Replace(string sourceFileName, string destinationFileName, string destinationBackupFileName, bool ignoreMetadataErrors)
|
||||
{
|
||||
if (sourceFileName == null)
|
||||
{
|
||||
throw new ArgumentNullException("sourceFileName");
|
||||
}
|
||||
if (destinationFileName == null)
|
||||
{
|
||||
throw new ArgumentNullException("destinationFileName");
|
||||
}
|
||||
if (sourceFileName.Trim().Length == 0 || sourceFileName.IndexOfAny(Path.InvalidPathChars) != -1)
|
||||
{
|
||||
throw new ArgumentException("sourceFileName");
|
||||
}
|
||||
if (destinationFileName.Trim().Length == 0 || destinationFileName.IndexOfAny(Path.InvalidPathChars) != -1)
|
||||
{
|
||||
throw new ArgumentException("destinationFileName");
|
||||
}
|
||||
string fullPath = Path.GetFullPath(sourceFileName);
|
||||
string fullPath2 = Path.GetFullPath(destinationFileName);
|
||||
MonoIOError monoIOError;
|
||||
if (MonoIO.ExistsDirectory(fullPath, out monoIOError))
|
||||
{
|
||||
throw new IOException(Locale.GetText("{0} is a directory", new object[] { sourceFileName }));
|
||||
}
|
||||
if (MonoIO.ExistsDirectory(fullPath2, out monoIOError))
|
||||
{
|
||||
throw new IOException(Locale.GetText("{0} is a directory", new object[] { destinationFileName }));
|
||||
}
|
||||
if (!File.Exists(fullPath))
|
||||
{
|
||||
throw new FileNotFoundException(Locale.GetText("{0} does not exist", new object[] { sourceFileName }), sourceFileName);
|
||||
}
|
||||
if (!File.Exists(fullPath2))
|
||||
{
|
||||
throw new FileNotFoundException(Locale.GetText("{0} does not exist", new object[] { destinationFileName }), destinationFileName);
|
||||
}
|
||||
if (fullPath == fullPath2)
|
||||
{
|
||||
throw new IOException(Locale.GetText("Source and destination arguments are the same file."));
|
||||
}
|
||||
string text = null;
|
||||
if (destinationBackupFileName != null)
|
||||
{
|
||||
if (destinationBackupFileName.Trim().Length == 0 || destinationBackupFileName.IndexOfAny(Path.InvalidPathChars) != -1)
|
||||
{
|
||||
throw new ArgumentException("destinationBackupFileName");
|
||||
}
|
||||
text = Path.GetFullPath(destinationBackupFileName);
|
||||
if (MonoIO.ExistsDirectory(text, out monoIOError))
|
||||
{
|
||||
throw new IOException(Locale.GetText("{0} is a directory", new object[] { destinationBackupFileName }));
|
||||
}
|
||||
if (fullPath == text)
|
||||
{
|
||||
throw new IOException(Locale.GetText("Source and backup arguments are the same file."));
|
||||
}
|
||||
if (fullPath2 == text)
|
||||
{
|
||||
throw new IOException(Locale.GetText("Destination and backup arguments are the same file."));
|
||||
}
|
||||
}
|
||||
if (!MonoIO.ReplaceFile(fullPath, fullPath2, text, ignoreMetadataErrors, out monoIOError))
|
||||
{
|
||||
throw MonoIO.GetException(monoIOError);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Sets the specified <see cref="T:System.IO.FileAttributes" /> of the file on the specified path.</summary>
|
||||
/// <param name="path">The path to the file. </param>
|
||||
/// <param name="fileAttributes">A bitwise combination of the enumeration values. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is empty, contains only white spaces, contains invalid characters, or the file attribute is invalid. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> is in an invalid format. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid, (for example, it is on an unmapped drive). </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file cannot be found.</exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">
|
||||
/// <paramref name="path" /> specified a file that is read-only.-or- This operation is not supported on the current platform.-or- <paramref name="path" /> specified a directory.-or- The caller does not have the required permission.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001650 RID: 5712 RVA: 0x00055F34 File Offset: 0x00054134
|
||||
public static void SetAttributes(string path, FileAttributes fileAttributes)
|
||||
{
|
||||
File.CheckPathExceptions(path);
|
||||
MonoIOError monoIOError;
|
||||
if (!MonoIO.SetFileAttributes(path, fileAttributes, out monoIOError))
|
||||
{
|
||||
throw MonoIO.GetException(path, monoIOError);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Sets the date and time the file was created.</summary>
|
||||
/// <param name="path">The file for which to set the creation date and time information. </param>
|
||||
/// <param name="creationTime">A <see cref="T:System.DateTime" /> containing the value to set for the creation date and time of <paramref name="path" />. This value is expressed in local time. </param>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The specified path was not found. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurred while performing the operation. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="creationTime" /> specifies a value outside the range of dates, times, or both permitted for this operation. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> is in an invalid format. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001651 RID: 5713 RVA: 0x00055F60 File Offset: 0x00054160
|
||||
public static void SetCreationTime(string path, DateTime creationTime)
|
||||
{
|
||||
File.CheckPathExceptions(path);
|
||||
MonoIOError monoIOError;
|
||||
if (!MonoIO.Exists(path, out monoIOError))
|
||||
{
|
||||
throw MonoIO.GetException(path, monoIOError);
|
||||
}
|
||||
if (!MonoIO.SetCreationTime(path, creationTime, out monoIOError))
|
||||
{
|
||||
throw MonoIO.GetException(path, monoIOError);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Sets the date and time, in coordinated universal time (UTC), that the file was created.</summary>
|
||||
/// <param name="path">The file for which to set the creation date and time information. </param>
|
||||
/// <param name="creationTimeUtc">A <see cref="T:System.DateTime" /> containing the value to set for the creation date and time of <paramref name="path" />. This value is expressed in UTC time. </param>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The specified path was not found. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurred while performing the operation. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="creationTime" /> specifies a value outside the range of dates, times, or both permitted for this operation. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> is in an invalid format. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001652 RID: 5714 RVA: 0x00055FA0 File Offset: 0x000541A0
|
||||
public static void SetCreationTimeUtc(string path, DateTime creationTimeUtc)
|
||||
{
|
||||
File.SetCreationTime(path, creationTimeUtc.ToLocalTime());
|
||||
}
|
||||
|
||||
/// <summary>Sets the date and time the specified file was last accessed.</summary>
|
||||
/// <param name="path">The file for which to set the access date and time information. </param>
|
||||
/// <param name="lastAccessTime">A <see cref="T:System.DateTime" /> containing the value to set for the last access date and time of <paramref name="path" />. This value is expressed in local time. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The specified path was not found. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> is in an invalid format. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="lastAccessTime" /> specifies a value outside the range of dates or times permitted for this operation.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001653 RID: 5715 RVA: 0x00055FB0 File Offset: 0x000541B0
|
||||
public static void SetLastAccessTime(string path, DateTime lastAccessTime)
|
||||
{
|
||||
File.CheckPathExceptions(path);
|
||||
MonoIOError monoIOError;
|
||||
if (!MonoIO.Exists(path, out monoIOError))
|
||||
{
|
||||
throw MonoIO.GetException(path, monoIOError);
|
||||
}
|
||||
if (!MonoIO.SetLastAccessTime(path, lastAccessTime, out monoIOError))
|
||||
{
|
||||
throw MonoIO.GetException(path, monoIOError);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Sets the date and time, in coordinated universal time (UTC), that the specified file was last accessed.</summary>
|
||||
/// <param name="path">The file for which to set the access date and time information. </param>
|
||||
/// <param name="lastAccessTimeUtc">A <see cref="T:System.DateTime" /> containing the value to set for the last access date and time of <paramref name="path" />. This value is expressed in UTC time. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The specified path was not found. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> is in an invalid format. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="lastAccessTimeUtc" /> specifies a value outside the range of dates or times permitted for this operation.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001654 RID: 5716 RVA: 0x00055FF0 File Offset: 0x000541F0
|
||||
public static void SetLastAccessTimeUtc(string path, DateTime lastAccessTimeUtc)
|
||||
{
|
||||
File.SetLastAccessTime(path, lastAccessTimeUtc.ToLocalTime());
|
||||
}
|
||||
|
||||
/// <summary>Sets the date and time that the specified file was last written to.</summary>
|
||||
/// <param name="path">The file for which to set the date and time information. </param>
|
||||
/// <param name="lastWriteTime">A <see cref="T:System.DateTime" /> containing the value to set for the last write date and time of <paramref name="path" />. This value is expressed in local time. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The specified path was not found. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> is in an invalid format. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="lastWriteTime" /> specifies a value outside the range of dates or times permitted for this operation.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001655 RID: 5717 RVA: 0x00056000 File Offset: 0x00054200
|
||||
public static void SetLastWriteTime(string path, DateTime lastWriteTime)
|
||||
{
|
||||
File.CheckPathExceptions(path);
|
||||
MonoIOError monoIOError;
|
||||
if (!MonoIO.Exists(path, out monoIOError))
|
||||
{
|
||||
throw MonoIO.GetException(path, monoIOError);
|
||||
}
|
||||
if (!MonoIO.SetLastWriteTime(path, lastWriteTime, out monoIOError))
|
||||
{
|
||||
throw MonoIO.GetException(path, monoIOError);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Sets the date and time, in coordinated universal time (UTC), that the specified file was last written to.</summary>
|
||||
/// <param name="path">The file for which to set the date and time information. </param>
|
||||
/// <param name="lastWriteTimeUtc">A <see cref="T:System.DateTime" /> containing the value to set for the last write date and time of <paramref name="path" />. This value is expressed in UTC time. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The specified path was not found. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> is in an invalid format. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="lastWriteTimeUtc" /> specifies a value outside the range of dates or times permitted for this operation.</exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001656 RID: 5718 RVA: 0x00056040 File Offset: 0x00054240
|
||||
public static void SetLastWriteTimeUtc(string path, DateTime lastWriteTimeUtc)
|
||||
{
|
||||
File.SetLastWriteTime(path, lastWriteTimeUtc.ToLocalTime());
|
||||
}
|
||||
|
||||
// Token: 0x06001657 RID: 5719 RVA: 0x00056050 File Offset: 0x00054250
|
||||
private static void CheckPathExceptions(string path)
|
||||
{
|
||||
if (path == null)
|
||||
{
|
||||
throw new ArgumentNullException("path");
|
||||
}
|
||||
if (path.Length == 0)
|
||||
{
|
||||
throw new ArgumentException(Locale.GetText("Path is empty"));
|
||||
}
|
||||
if (path.Trim().Length == 0)
|
||||
{
|
||||
throw new ArgumentException(Locale.GetText("Path is empty"));
|
||||
}
|
||||
if (path.IndexOfAny(Path.InvalidPathChars) != -1)
|
||||
{
|
||||
throw new ArgumentException(Locale.GetText("Path contains invalid chars"));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Opens a binary file, reads the contents of the file into a byte array, and then closes the file.</summary>
|
||||
/// <returns>A byte array containing the contents of the file.</returns>
|
||||
/// <param name="path">The file to open for reading. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive). </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurred while opening the file. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">This operation is not supported on the current platform.-or- <paramref name="path" /> specified a directory.-or- The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file specified in <paramref name="path" /> was not found. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> is in an invalid format. </exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001658 RID: 5720 RVA: 0x000560CC File Offset: 0x000542CC
|
||||
public static byte[] ReadAllBytes(string path)
|
||||
{
|
||||
byte[] array2;
|
||||
using (FileStream fileStream = File.OpenRead(path))
|
||||
{
|
||||
long length = fileStream.Length;
|
||||
if (length > 2147483647L)
|
||||
{
|
||||
throw new IOException("Reading more than 2GB with this call is not supported");
|
||||
}
|
||||
int num = 0;
|
||||
int i = (int)length;
|
||||
byte[] array = new byte[length];
|
||||
while (i > 0)
|
||||
{
|
||||
int num2 = fileStream.Read(array, num, i);
|
||||
if (num2 == 0)
|
||||
{
|
||||
throw new IOException("Unexpected end of stream");
|
||||
}
|
||||
num += num2;
|
||||
i -= num2;
|
||||
}
|
||||
array2 = array;
|
||||
}
|
||||
return array2;
|
||||
}
|
||||
|
||||
/// <summary>Opens a text file, reads all lines of the file, and then closes the file.</summary>
|
||||
/// <returns>A string array containing all lines of the file.</returns>
|
||||
/// <param name="path">The file to open for reading. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive). </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurred while opening the file. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">
|
||||
/// <paramref name="path" /> specified a file that is read-only.-or- This operation is not supported on the current platform.-or- <paramref name="path" /> specified a directory.-or- The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file specified in <paramref name="path" /> was not found. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> is in an invalid format. </exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001659 RID: 5721 RVA: 0x0005617C File Offset: 0x0005437C
|
||||
public static string[] ReadAllLines(string path)
|
||||
{
|
||||
string[] array;
|
||||
using (StreamReader streamReader = File.OpenText(path))
|
||||
{
|
||||
array = File.ReadAllLines(streamReader);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
/// <summary>Opens a file, reads all lines of the file with the specified encoding, and then closes the file.</summary>
|
||||
/// <returns>A string array containing all lines of the file.</returns>
|
||||
/// <param name="path">The file to open for reading. </param>
|
||||
/// <param name="encoding">The encoding applied to the contents of the file. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive). </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurred while opening the file. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">
|
||||
/// <paramref name="path" /> specified a file that is read-only.-or- This operation is not supported on the current platform.-or- <paramref name="path" /> specified a directory.-or- The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file specified in <paramref name="path" /> was not found. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> is in an invalid format. </exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600165A RID: 5722 RVA: 0x000561CC File Offset: 0x000543CC
|
||||
public static string[] ReadAllLines(string path, Encoding encoding)
|
||||
{
|
||||
string[] array;
|
||||
using (StreamReader streamReader = new StreamReader(path, encoding))
|
||||
{
|
||||
array = File.ReadAllLines(streamReader);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
// Token: 0x0600165B RID: 5723 RVA: 0x0005621C File Offset: 0x0005441C
|
||||
private static string[] ReadAllLines(StreamReader reader)
|
||||
{
|
||||
List<string> list = new List<string>();
|
||||
while (!reader.EndOfStream)
|
||||
{
|
||||
list.Add(reader.ReadLine());
|
||||
}
|
||||
return list.ToArray();
|
||||
}
|
||||
|
||||
/// <summary>Opens a text file, reads all lines of the file, and then closes the file.</summary>
|
||||
/// <returns>A string containing all lines of the file.</returns>
|
||||
/// <param name="path">The file to open for reading. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive). </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurred while opening the file. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">
|
||||
/// <paramref name="path" /> specified a file that is read-only.-or- This operation is not supported on the current platform.-or- <paramref name="path" /> specified a directory.-or- The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file specified in <paramref name="path" /> was not found. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> is in an invalid format. </exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600165C RID: 5724 RVA: 0x00056254 File Offset: 0x00054454
|
||||
public static string ReadAllText(string path)
|
||||
{
|
||||
return File.ReadAllText(path, Encoding.UTF8Unmarked);
|
||||
}
|
||||
|
||||
/// <summary>Opens a file, reads all lines of the file with the specified encoding, and then closes the file.</summary>
|
||||
/// <returns>A string containing all lines of the file.</returns>
|
||||
/// <param name="path">The file to open for reading. </param>
|
||||
/// <param name="encoding">The encoding applied to the contents of the file. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive). </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurred while opening the file. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">
|
||||
/// <paramref name="path" /> specified a file that is read-only.-or- This operation is not supported on the current platform.-or- <paramref name="path" /> specified a directory.-or- The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file specified in <paramref name="path" /> was not found. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> is in an invalid format. </exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600165D RID: 5725 RVA: 0x00056264 File Offset: 0x00054464
|
||||
public static string ReadAllText(string path, Encoding encoding)
|
||||
{
|
||||
string text;
|
||||
using (StreamReader streamReader = new StreamReader(path, encoding))
|
||||
{
|
||||
text = streamReader.ReadToEnd();
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
/// <summary>Creates a new file, writes the specified byte array to the file, and then closes the file. If the target file already exists, it is overwritten.</summary>
|
||||
/// <param name="path">The file to write to. </param>
|
||||
/// <param name="bytes">The bytes to write to the file. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null or the byte array is empty. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive). </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurred while opening the file.-or-An attempt is made to write a file that is larger than 64 MB to a network path.</exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">
|
||||
/// <paramref name="path" /> specified a file that is read-only.-or- This operation is not supported on the current platform.-or- <paramref name="path" /> specified a directory.-or- The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file specified in <paramref name="path" /> was not found. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> is in an invalid format. </exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600165E RID: 5726 RVA: 0x000562B4 File Offset: 0x000544B4
|
||||
public static void WriteAllBytes(string path, byte[] bytes)
|
||||
{
|
||||
using (Stream stream = File.Create(path))
|
||||
{
|
||||
stream.Write(bytes, 0, bytes.Length);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Creates a new file, write the specified string array to the file, and then closes the file. If the target file already exists, it is overwritten.</summary>
|
||||
/// <param name="path">The file to write to. </param>
|
||||
/// <param name="contents">The string array to write to the file. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> or <paramref name="contents" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive). </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurred while opening the file. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">
|
||||
/// <paramref name="path" /> specified a file that is read-only.-or- This operation is not supported on the current platform.-or- <paramref name="path" /> specified a directory.-or- The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file specified in <paramref name="path" /> was not found. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> is in an invalid format. </exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600165F RID: 5727 RVA: 0x00056304 File Offset: 0x00054504
|
||||
public static void WriteAllLines(string path, string[] contents)
|
||||
{
|
||||
using (StreamWriter streamWriter = new StreamWriter(path))
|
||||
{
|
||||
File.WriteAllLines(streamWriter, contents);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Creates a new file, writes the specified string array to the file using the specified encoding, and then closes the file. If the target file already exists, it is overwritten.</summary>
|
||||
/// <param name="path">The file to write to. </param>
|
||||
/// <param name="contents">The string array to write to the file. </param>
|
||||
/// <param name="encoding">An <see cref="T:System.Text.Encoding" /> object that represents the character encoding applied to the string array.</param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> or <paramref name="contents" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive). </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurred while opening the file. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">
|
||||
/// <paramref name="path" /> specified a file that is read-only.-or- This operation is not supported on the current platform.-or- <paramref name="path" /> specified a directory.-or- The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file specified in <paramref name="path" /> was not found. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> is in an invalid format. </exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001660 RID: 5728 RVA: 0x00056350 File Offset: 0x00054550
|
||||
public static void WriteAllLines(string path, string[] contents, Encoding encoding)
|
||||
{
|
||||
using (StreamWriter streamWriter = new StreamWriter(path, false, encoding))
|
||||
{
|
||||
File.WriteAllLines(streamWriter, contents);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001661 RID: 5729 RVA: 0x0005639C File Offset: 0x0005459C
|
||||
private static void WriteAllLines(StreamWriter writer, string[] contents)
|
||||
{
|
||||
foreach (string text in contents)
|
||||
{
|
||||
writer.WriteLine(text);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Creates a new file, writes the specified string to the file, and then closes the file. If the target file already exists, it is overwritten.</summary>
|
||||
/// <param name="path">The file to write to. </param>
|
||||
/// <param name="contents">The string to write to the file. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive). </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurred while opening the file. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">
|
||||
/// <paramref name="path" /> specified a file that is read-only.-or- This operation is not supported on the current platform.-or- <paramref name="path" /> specified a directory.-or- The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file specified in <paramref name="path" /> was not found. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> is in an invalid format. </exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001662 RID: 5730 RVA: 0x000563CC File Offset: 0x000545CC
|
||||
public static void WriteAllText(string path, string contents)
|
||||
{
|
||||
File.WriteAllText(path, contents, Encoding.UTF8Unmarked);
|
||||
}
|
||||
|
||||
/// <summary>Creates a new file, writes the specified string to the file using the specified encoding, and then closes the file. If the target file already exists, it is overwritten.</summary>
|
||||
/// <param name="path">The file to write to. </param>
|
||||
/// <param name="contents">The string to write to the file. </param>
|
||||
/// <param name="encoding">An <see cref="T:System.Text.Encoding" /> object that represents the encoding to apply to the string.</param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null or contents string is empty. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid (for example, it is on an unmapped drive). </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurred while opening the file. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">
|
||||
/// <paramref name="path" /> specified a file that is read-only.-or- This operation is not supported on the current platform.-or- <paramref name="path" /> specified a directory.-or- The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file specified in <paramref name="path" /> was not found. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> is in an invalid format. </exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001663 RID: 5731 RVA: 0x000563DC File Offset: 0x000545DC
|
||||
public static void WriteAllText(string path, string contents, Encoding encoding)
|
||||
{
|
||||
using (StreamWriter streamWriter = new StreamWriter(path, false, encoding))
|
||||
{
|
||||
streamWriter.Write(contents);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170003EB RID: 1003
|
||||
// (get) Token: 0x06001664 RID: 5732 RVA: 0x00056428 File Offset: 0x00054628
|
||||
private static DateTime DefaultLocalFileTime
|
||||
{
|
||||
get
|
||||
{
|
||||
DateTime? dateTime = File.defaultLocalFileTime;
|
||||
if (dateTime == null)
|
||||
{
|
||||
DateTime dateTime2 = new DateTime(1601, 1, 1);
|
||||
File.defaultLocalFileTime = new DateTime?(dateTime2.ToLocalTime());
|
||||
}
|
||||
return File.defaultLocalFileTime.Value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Encrypts a file so that only the account used to encrypt the file can decrypt it.</summary>
|
||||
/// <param name="path">A path that describes a file to encrypt.</param>
|
||||
/// <exception cref="T:System.ArgumentException">The <paramref name="path" /> parameter is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />.</exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">The <paramref name="path" /> parameter is null.</exception>
|
||||
/// <exception cref="T:System.IO.DriveNotFoundException">An invalid drive was specified. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file described by the <paramref name="path" /> parameter could not be found.</exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurred while opening the file.-or-This operation is not supported on the current platform.</exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.PlatformNotSupportedException">The current operating system is not Microsoft Windows NT or later.</exception>
|
||||
/// <exception cref="T:System.NotSupportedException">The file system is not NTFS.</exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The <paramref name="path" /> parameter specified a file that is read-only.-or- This operation is not supported on the current platform.-or- The <paramref name="path" /> parameter specified a directory.-or- The caller does not have the required permission.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001665 RID: 5733 RVA: 0x00056474 File Offset: 0x00054674
|
||||
[MonoLimitation("File encryption isn't supported (even on NTFS).")]
|
||||
public static void Encrypt(string path)
|
||||
{
|
||||
throw new NotSupportedException(Locale.GetText("File encryption isn't supported on any file system."));
|
||||
}
|
||||
|
||||
/// <summary>Decrypts a file that was encrypted by the current account using the <see cref="M:System.IO.File.Encrypt(System.String)" /> method.</summary>
|
||||
/// <param name="path">A path that describes a file to decrypt.</param>
|
||||
/// <exception cref="T:System.ArgumentException">The <paramref name="path" /> parameter is a zero-length string, contains only white space, or contains one or more invalid characters as defined by <see cref="F:System.IO.Path.InvalidPathChars" />.</exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">The <paramref name="path" /> parameter is null.</exception>
|
||||
/// <exception cref="T:System.IO.DriveNotFoundException">An invalid drive was specified. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file described by the <paramref name="path" /> parameter could not be found.</exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurred while opening the file. For example, the encrypted file is already open. -or-This operation is not supported on the current platform.</exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.PlatformNotSupportedException">The current operating system is not Microsoft Windows NT or later.</exception>
|
||||
/// <exception cref="T:System.NotSupportedException">The file system is not NTFS.</exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The <paramref name="path" /> parameter specified a file that is read-only.-or- This operation is not supported on the current platform.-or- The <paramref name="path" /> parameter specified a directory.-or- The caller does not have the required permission.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001666 RID: 5734 RVA: 0x00056488 File Offset: 0x00054688
|
||||
[MonoLimitation("File encryption isn't supported (even on NTFS).")]
|
||||
public static void Decrypt(string path)
|
||||
{
|
||||
throw new NotSupportedException(Locale.GetText("File encryption isn't supported on any file system."));
|
||||
}
|
||||
|
||||
// Token: 0x0400065A RID: 1626
|
||||
private static DateTime? defaultLocalFileTime;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
/// <summary>Defines constants for read, write, or read/write access to a file.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x020001B3 RID: 435
|
||||
[Flags]
|
||||
[ComVisible(true)]
|
||||
[Serializable]
|
||||
public enum FileAccess
|
||||
{
|
||||
/// <summary>Read access to the file. Data can be read from the file. Combine with Write for read/write access.</summary>
|
||||
// Token: 0x0400065C RID: 1628
|
||||
Read = 1,
|
||||
/// <summary>Write access to the file. Data can be written to the file. Combine with Read for read/write access.</summary>
|
||||
// Token: 0x0400065D RID: 1629
|
||||
Write = 2,
|
||||
/// <summary>Read and write access to the file. Data can be written to and read from the file.</summary>
|
||||
// Token: 0x0400065E RID: 1630
|
||||
ReadWrite = 3
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
/// <summary>Provides attributes for files and directories.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x020001B4 RID: 436
|
||||
[Flags]
|
||||
[ComVisible(true)]
|
||||
[Serializable]
|
||||
public enum FileAttributes
|
||||
{
|
||||
/// <summary>The file's archive status. Applications use this attribute to mark files for backup or removal.</summary>
|
||||
// Token: 0x04000660 RID: 1632
|
||||
Archive = 32,
|
||||
/// <summary>The file is compressed.</summary>
|
||||
// Token: 0x04000661 RID: 1633
|
||||
Compressed = 2048,
|
||||
/// <summary>Reserved for future use.</summary>
|
||||
// Token: 0x04000662 RID: 1634
|
||||
Device = 64,
|
||||
/// <summary>The file is a directory.</summary>
|
||||
// Token: 0x04000663 RID: 1635
|
||||
Directory = 16,
|
||||
/// <summary>The file or directory is encrypted. For a file, this means that all data in the file is encrypted. For a directory, this means that encryption is the default for newly created files and directories.</summary>
|
||||
// Token: 0x04000664 RID: 1636
|
||||
Encrypted = 16384,
|
||||
/// <summary>The file is hidden, and thus is not included in an ordinary directory listing.</summary>
|
||||
// Token: 0x04000665 RID: 1637
|
||||
Hidden = 2,
|
||||
/// <summary>The file is normal and has no other attributes set. This attribute is valid only if used alone.</summary>
|
||||
// Token: 0x04000666 RID: 1638
|
||||
Normal = 128,
|
||||
/// <summary>The file will not be indexed by the operating system's content indexing service.</summary>
|
||||
// Token: 0x04000667 RID: 1639
|
||||
NotContentIndexed = 8192,
|
||||
/// <summary>The file is offline. The data of the file is not immediately available.</summary>
|
||||
// Token: 0x04000668 RID: 1640
|
||||
Offline = 4096,
|
||||
/// <summary>The file is read-only.</summary>
|
||||
// Token: 0x04000669 RID: 1641
|
||||
ReadOnly = 1,
|
||||
/// <summary>The file contains a reparse point, which is a block of user-defined data associated with a file or a directory.</summary>
|
||||
// Token: 0x0400066A RID: 1642
|
||||
ReparsePoint = 1024,
|
||||
/// <summary>The file is a sparse file. Sparse files are typically large files whose data are mostly zeros.</summary>
|
||||
// Token: 0x0400066B RID: 1643
|
||||
SparseFile = 512,
|
||||
/// <summary>The file is a system file. The file is part of the operating system or is used exclusively by the operating system.</summary>
|
||||
// Token: 0x0400066C RID: 1644
|
||||
System = 4,
|
||||
/// <summary>The file is temporary. File systems attempt to keep all of the data in memory for quicker access rather than flushing the data back to mass storage. A temporary file should be deleted by the application as soon as it is no longer needed.</summary>
|
||||
// Token: 0x0400066D RID: 1645
|
||||
Temporary = 256
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,569 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
/// <summary>Provides instance methods for the creation, copying, deletion, moving, and opening of files, and aids in the creation of <see cref="T:System.IO.FileStream" /> objects. This class cannot be inherited.</summary>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x020001B5 RID: 437
|
||||
[ComVisible(true)]
|
||||
[Serializable]
|
||||
public sealed class FileInfo : FileSystemInfo
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.FileInfo" /> class, which acts as a wrapper for a file path.</summary>
|
||||
/// <param name="fileName">The fully qualified name of the new file, or the relative file name. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="fileName" /> is null. </exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">The file name is empty, contains only white spaces, or contains invalid characters. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">Access to <paramref name="fileName" /> is denied. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="fileName" /> contains a colon (:) in the middle of the string. </exception>
|
||||
// Token: 0x06001667 RID: 5735 RVA: 0x0005649C File Offset: 0x0005469C
|
||||
public FileInfo(string fileName)
|
||||
{
|
||||
if (fileName == null)
|
||||
{
|
||||
throw new ArgumentNullException("fileName");
|
||||
}
|
||||
base.CheckPath(fileName);
|
||||
this.OriginalPath = fileName;
|
||||
this.FullPath = Path.GetFullPath(fileName);
|
||||
}
|
||||
|
||||
// Token: 0x06001668 RID: 5736 RVA: 0x000564D0 File Offset: 0x000546D0
|
||||
private FileInfo(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06001669 RID: 5737 RVA: 0x000564DC File Offset: 0x000546DC
|
||||
internal override void InternalRefresh()
|
||||
{
|
||||
this.exists = File.Exists(this.FullPath);
|
||||
}
|
||||
|
||||
/// <summary>Gets a value indicating whether a file exists.</summary>
|
||||
/// <returns>true if the file exists; false if the file does not exist or if the file is a directory.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x170003EC RID: 1004
|
||||
// (get) Token: 0x0600166A RID: 5738 RVA: 0x000564F0 File Offset: 0x000546F0
|
||||
public override bool Exists
|
||||
{
|
||||
get
|
||||
{
|
||||
base.Refresh(false);
|
||||
return this.stat.Attributes != MonoIO.InvalidFileAttributes && (this.stat.Attributes & FileAttributes.Directory) == (FileAttributes)0 && this.exists;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the name of the file.</summary>
|
||||
/// <returns>The name of the file.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x170003ED RID: 1005
|
||||
// (get) Token: 0x0600166B RID: 5739 RVA: 0x0005652C File Offset: 0x0005472C
|
||||
public override string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return Path.GetFileName(this.FullPath);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets a value that determines if the current file is read only.</summary>
|
||||
/// <returns>true if the current file is read only; otherwise, false.</returns>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file described by the current <see cref="T:System.IO.FileInfo" /> object could not be found.</exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurred while opening the file.</exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The file described by the current <see cref="T:System.IO.FileInfo" /> object is read-only.-or- This operation is not supported on the current platform.-or- The caller does not have the required permission.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x170003EE RID: 1006
|
||||
// (get) Token: 0x0600166C RID: 5740 RVA: 0x0005653C File Offset: 0x0005473C
|
||||
// (set) Token: 0x0600166D RID: 5741 RVA: 0x00056588 File Offset: 0x00054788
|
||||
public bool IsReadOnly
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!this.Exists)
|
||||
{
|
||||
throw new FileNotFoundException("Could not find file \"" + this.OriginalPath + "\".", this.OriginalPath);
|
||||
}
|
||||
return (this.stat.Attributes & FileAttributes.ReadOnly) != (FileAttributes)0;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (!this.Exists)
|
||||
{
|
||||
throw new FileNotFoundException("Could not find file \"" + this.OriginalPath + "\".", this.OriginalPath);
|
||||
}
|
||||
FileAttributes fileAttributes = File.GetAttributes(this.FullPath);
|
||||
if (value)
|
||||
{
|
||||
fileAttributes |= FileAttributes.ReadOnly;
|
||||
}
|
||||
else
|
||||
{
|
||||
fileAttributes &= ~FileAttributes.ReadOnly;
|
||||
}
|
||||
File.SetAttributes(this.FullPath, fileAttributes);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Encrypts a file so that only the account used to encrypt the file can decrypt it.</summary>
|
||||
/// <exception cref="T:System.IO.DriveNotFoundException">An invalid drive was specified. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file described by the current <see cref="T:System.IO.FileInfo" /> object could not be found.</exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurred while opening the file.</exception>
|
||||
/// <exception cref="T:System.NotSupportedException">The file system is not NTFS.</exception>
|
||||
/// <exception cref="T:System.PlatformNotSupportedException">The current operating system is not Microsoft Windows NT or later.</exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The file described by the current <see cref="T:System.IO.FileInfo" /> object is read-only.-or- This operation is not supported on the current platform.-or- The caller does not have the required permission.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600166E RID: 5742 RVA: 0x000565F0 File Offset: 0x000547F0
|
||||
[ComVisible(false)]
|
||||
[MonoLimitation("File encryption isn't supported (even on NTFS).")]
|
||||
public void Encrypt()
|
||||
{
|
||||
throw new NotSupportedException(Locale.GetText("File encryption isn't supported on any file system."));
|
||||
}
|
||||
|
||||
/// <summary>Decrypts a file that was encrypted by the current account using the <see cref="M:System.IO.FileInfo.Encrypt" /> method.</summary>
|
||||
/// <exception cref="T:System.IO.DriveNotFoundException">An invalid drive was specified. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file described by the current <see cref="T:System.IO.FileInfo" /> object could not be found.</exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurred while opening the file.</exception>
|
||||
/// <exception cref="T:System.NotSupportedException">The file system is not NTFS.</exception>
|
||||
/// <exception cref="T:System.PlatformNotSupportedException">The current operating system is not Microsoft Windows NT or later.</exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The file described by the current <see cref="T:System.IO.FileInfo" /> object is read-only.-or- This operation is not supported on the current platform.-or- The caller does not have the required permission.</exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600166F RID: 5743 RVA: 0x00056604 File Offset: 0x00054804
|
||||
[MonoLimitation("File encryption isn't supported (even on NTFS).")]
|
||||
[ComVisible(false)]
|
||||
public void Decrypt()
|
||||
{
|
||||
throw new NotSupportedException(Locale.GetText("File encryption isn't supported on any file system."));
|
||||
}
|
||||
|
||||
/// <summary>Gets the size, in bytes, of the current file.</summary>
|
||||
/// <returns>The size of the current file in bytes.</returns>
|
||||
/// <exception cref="T:System.IO.IOException">
|
||||
/// <see cref="M:System.IO.FileSystemInfo.Refresh" /> cannot update the state of the file or directory. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file does not exist.-or- The Length property is called for a directory. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x170003EF RID: 1007
|
||||
// (get) Token: 0x06001670 RID: 5744 RVA: 0x00056618 File Offset: 0x00054818
|
||||
public long Length
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!this.Exists)
|
||||
{
|
||||
throw new FileNotFoundException("Could not find file \"" + this.OriginalPath + "\".", this.OriginalPath);
|
||||
}
|
||||
return this.stat.Length;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a string representing the directory's full path.</summary>
|
||||
/// <returns>A string representing the directory's full path.</returns>
|
||||
/// <exception cref="T:System.ArgumentNullException">null was passed in for the directory name. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The fully qualified path is 260 or more characters.</exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x170003F0 RID: 1008
|
||||
// (get) Token: 0x06001671 RID: 5745 RVA: 0x00056654 File Offset: 0x00054854
|
||||
public string DirectoryName
|
||||
{
|
||||
get
|
||||
{
|
||||
return Path.GetDirectoryName(this.FullPath);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets an instance of the parent directory.</summary>
|
||||
/// <returns>A <see cref="T:System.IO.DirectoryInfo" /> object representing the parent directory of this file.</returns>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid, such as being on an unmapped drive. </exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x170003F1 RID: 1009
|
||||
// (get) Token: 0x06001672 RID: 5746 RVA: 0x00056664 File Offset: 0x00054864
|
||||
public DirectoryInfo Directory
|
||||
{
|
||||
get
|
||||
{
|
||||
return new DirectoryInfo(this.DirectoryName);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.IO.StreamReader" /> with UTF8 encoding that reads from an existing text file.</summary>
|
||||
/// <returns>A new StreamReader with UTF8 encoding.</returns>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file is not found. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">
|
||||
/// <paramref name="path" /> is read-only or is a directory. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid, such as being on an unmapped drive. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001673 RID: 5747 RVA: 0x00056674 File Offset: 0x00054874
|
||||
public StreamReader OpenText()
|
||||
{
|
||||
return new StreamReader(this.Open(FileMode.Open, FileAccess.Read));
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.IO.StreamWriter" /> that writes a new text file.</summary>
|
||||
/// <returns>A new StreamWriter.</returns>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The file name is a directory. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">The disk is read-only. </exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001674 RID: 5748 RVA: 0x00056684 File Offset: 0x00054884
|
||||
public StreamWriter CreateText()
|
||||
{
|
||||
return new StreamWriter(this.Open(FileMode.Create, FileAccess.Write));
|
||||
}
|
||||
|
||||
/// <summary>Creates a <see cref="T:System.IO.StreamWriter" /> that appends text to the file represented by this instance of the <see cref="T:System.IO.FileInfo" />.</summary>
|
||||
/// <returns>A new StreamWriter.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001675 RID: 5749 RVA: 0x00056694 File Offset: 0x00054894
|
||||
public StreamWriter AppendText()
|
||||
{
|
||||
return new StreamWriter(this.Open(FileMode.Append, FileAccess.Write));
|
||||
}
|
||||
|
||||
/// <summary>Creates a file.</summary>
|
||||
/// <returns>A new file.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001676 RID: 5750 RVA: 0x000566A4 File Offset: 0x000548A4
|
||||
public FileStream Create()
|
||||
{
|
||||
return File.Create(this.FullPath);
|
||||
}
|
||||
|
||||
/// <summary>Creates a read-only <see cref="T:System.IO.FileStream" />.</summary>
|
||||
/// <returns>A new read-only <see cref="T:System.IO.FileStream" /> object.</returns>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">
|
||||
/// <paramref name="path" /> is read-only or is a directory. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid, such as being on an unmapped drive. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">The file is already open. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001677 RID: 5751 RVA: 0x000566B4 File Offset: 0x000548B4
|
||||
public FileStream OpenRead()
|
||||
{
|
||||
return this.Open(FileMode.Open, FileAccess.Read, FileShare.Read);
|
||||
}
|
||||
|
||||
/// <summary>Creates a write-only <see cref="T:System.IO.FileStream" />.</summary>
|
||||
/// <returns>A new write-only unshared <see cref="T:System.IO.FileStream" /> object.</returns>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">
|
||||
/// <paramref name="path" /> is read-only or is a directory. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid, such as being on an unmapped drive. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001678 RID: 5752 RVA: 0x000566C0 File Offset: 0x000548C0
|
||||
public FileStream OpenWrite()
|
||||
{
|
||||
return this.Open(FileMode.OpenOrCreate, FileAccess.Write);
|
||||
}
|
||||
|
||||
/// <summary>Opens a file in the specified mode.</summary>
|
||||
/// <returns>A file opened in the specified mode, with read/write access and unshared.</returns>
|
||||
/// <param name="mode">A <see cref="T:System.IO.FileMode" /> constant specifying the mode (for example, Open or Append) in which to open the file. </param>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file is not found. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The file is read-only or is a directory. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid, such as being on an unmapped drive. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">The file is already open. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001679 RID: 5753 RVA: 0x000566CC File Offset: 0x000548CC
|
||||
public FileStream Open(FileMode mode)
|
||||
{
|
||||
return this.Open(mode, FileAccess.ReadWrite);
|
||||
}
|
||||
|
||||
/// <summary>Opens a file in the specified mode with read, write, or read/write access.</summary>
|
||||
/// <returns>A <see cref="T:System.IO.FileStream" /> object opened in the specified mode and access, and unshared.</returns>
|
||||
/// <param name="mode">A <see cref="T:System.IO.FileMode" /> constant specifying the mode (for example, Open or Append) in which to open the file. </param>
|
||||
/// <param name="access">A <see cref="T:System.IO.FileAccess" /> constant specifying whether to open the file with Read, Write, or ReadWrite file access. </param>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is empty or contains only white spaces. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file is not found. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">One or more arguments is null. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">
|
||||
/// <paramref name="path" /> is read-only or is a directory. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid, such as being on an unmapped drive. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">The file is already open. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600167A RID: 5754 RVA: 0x000566D8 File Offset: 0x000548D8
|
||||
public FileStream Open(FileMode mode, FileAccess access)
|
||||
{
|
||||
return this.Open(mode, access, FileShare.None);
|
||||
}
|
||||
|
||||
/// <summary>Opens a file in the specified mode with read, write, or read/write access and the specified sharing option.</summary>
|
||||
/// <returns>A <see cref="T:System.IO.FileStream" /> object opened with the specified mode, access, and sharing options.</returns>
|
||||
/// <param name="mode">A <see cref="T:System.IO.FileMode" /> constant specifying the mode (for example, Open or Append) in which to open the file. </param>
|
||||
/// <param name="access">A <see cref="T:System.IO.FileAccess" /> constant specifying whether to open the file with Read, Write, or ReadWrite file access. </param>
|
||||
/// <param name="share">A <see cref="T:System.IO.FileShare" /> constant specifying the type of access other FileStream objects have to this file. </param>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is empty or contains only white spaces. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file is not found. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">One or more arguments is null. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">
|
||||
/// <paramref name="path" /> is read-only or is a directory. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid, such as being on an unmapped drive. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">The file is already open. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600167B RID: 5755 RVA: 0x000566E4 File Offset: 0x000548E4
|
||||
public FileStream Open(FileMode mode, FileAccess access, FileShare share)
|
||||
{
|
||||
return new FileStream(this.FullPath, mode, access, share);
|
||||
}
|
||||
|
||||
/// <summary>Permanently deletes a file.</summary>
|
||||
/// <exception cref="T:System.IO.IOException">The target file is open or memory-mapped on a computer running Microsoft Windows NT. </exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The path is a directory. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600167C RID: 5756 RVA: 0x000566F4 File Offset: 0x000548F4
|
||||
public override void Delete()
|
||||
{
|
||||
MonoIOError monoIOError;
|
||||
if (!MonoIO.Exists(this.FullPath, out monoIOError))
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (MonoIO.ExistsDirectory(this.FullPath, out monoIOError))
|
||||
{
|
||||
throw new UnauthorizedAccessException("Access to the path \"" + this.FullPath + "\" is denied.");
|
||||
}
|
||||
if (!MonoIO.DeleteFile(this.FullPath, out monoIOError))
|
||||
{
|
||||
throw MonoIO.GetException(this.OriginalPath, monoIOError);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Moves a specified file to a new location, providing the option to specify a new file name.</summary>
|
||||
/// <param name="destFileName">The path to move the file to, which can specify a different file name. </param>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs, such as the destination file already exists or the destination device is not ready. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="destFileName" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="destFileName" /> is empty, contains only white spaces, or contains invalid characters. </exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">
|
||||
/// <paramref name="destFileName" /> is read-only or is a directory. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file is not found. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid, such as being on an unmapped drive. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="destFileName" /> contains a colon (:) in the middle of the string. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600167D RID: 5757 RVA: 0x00056760 File Offset: 0x00054960
|
||||
public void MoveTo(string destFileName)
|
||||
{
|
||||
if (destFileName == null)
|
||||
{
|
||||
throw new ArgumentNullException("destFileName");
|
||||
}
|
||||
if (destFileName == this.Name || destFileName == this.FullName)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!File.Exists(this.FullPath))
|
||||
{
|
||||
throw new FileNotFoundException();
|
||||
}
|
||||
File.Move(this.FullPath, destFileName);
|
||||
this.FullPath = Path.GetFullPath(destFileName);
|
||||
}
|
||||
|
||||
/// <summary>Copies an existing file to a new file, disallowing the overwriting of an existing file.</summary>
|
||||
/// <returns>A new file with a fully qualified path.</returns>
|
||||
/// <param name="destFileName">The name of the new file to copy to. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="destFileName" /> is empty, contains only white spaces, or contains invalid characters. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An error occurs, or the destination file already exists. </exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="destFileName" /> is null. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">A directory path is passed in, or the file is being moved to a different drive. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The directory specified in <paramref name="destFileName" /> does not exist.</exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="destFileName" /> contains a colon (:) within the string but does not specify the volume. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600167E RID: 5758 RVA: 0x000567D0 File Offset: 0x000549D0
|
||||
public FileInfo CopyTo(string destFileName)
|
||||
{
|
||||
return this.CopyTo(destFileName, false);
|
||||
}
|
||||
|
||||
/// <summary>Copies an existing file to a new file, allowing the overwriting of an existing file.</summary>
|
||||
/// <returns>A new file, or an overwrite of an existing file if <paramref name="overwrite" /> is true. If the file exists and <paramref name="overwrite" /> is false, an <see cref="T:System.IO.IOException" /> is thrown.</returns>
|
||||
/// <param name="destFileName">The name of the new file to copy to. </param>
|
||||
/// <param name="overwrite">true to allow an existing file to be overwritten; otherwise, false. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="destFileName" /> is empty, contains only white spaces, or contains invalid characters. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An error occurs, or the destination file already exists and <paramref name="overwrite" /> is false. </exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="destFileName" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The directory specified in <paramref name="destFileName" /> does not exist.</exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">A directory path is passed in, or the file is being moved to a different drive. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="destFileName" /> contains a colon (:) in the middle of the string. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600167F RID: 5759 RVA: 0x000567DC File Offset: 0x000549DC
|
||||
public FileInfo CopyTo(string destFileName, bool overwrite)
|
||||
{
|
||||
if (destFileName == null)
|
||||
{
|
||||
throw new ArgumentNullException("destFileName");
|
||||
}
|
||||
if (destFileName.Length == 0)
|
||||
{
|
||||
throw new ArgumentException("An empty file name is not valid.", "destFileName");
|
||||
}
|
||||
string fullPath = Path.GetFullPath(destFileName);
|
||||
if (overwrite && File.Exists(fullPath))
|
||||
{
|
||||
File.Delete(fullPath);
|
||||
}
|
||||
File.Copy(this.FullPath, fullPath);
|
||||
return new FileInfo(fullPath);
|
||||
}
|
||||
|
||||
/// <summary>Returns the path as a string.</summary>
|
||||
/// <returns>A string representing the path.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06001680 RID: 5760 RVA: 0x00056848 File Offset: 0x00054A48
|
||||
public override string ToString()
|
||||
{
|
||||
return this.Name;
|
||||
}
|
||||
|
||||
/// <summary>Replaces the contents of a specified file with the file described by the current <see cref="T:System.IO.FileInfo" /> object, deleting the original file, and creating a backup of the replaced file.</summary>
|
||||
/// <returns>A <see cref="T:System.IO.FileInfo" /> object that encapsulates information about the file described by the <paramref name="destFileName" /> parameter.</returns>
|
||||
/// <param name="destinationFileName">The name of a file to replace with the current file.</param>
|
||||
/// <param name="destinationBackupFileName">The name of a file with which to create a backup of the file described by the <paramref name="destFileName" /> parameter.</param>
|
||||
/// <exception cref="T:System.ArgumentException">The path described by the <paramref name="destFileName" /> parameter was not of a legal form.-or-The path described by the <paramref name="destBackupFileName" /> parameter was not of a legal form.</exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">The <paramref name="destFileName" /> parameter is null.</exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file described by the current <see cref="T:System.IO.FileInfo" /> object could not be found.-or-The file described by the <paramref name="destinationFileName" /> parameter could not be found. </exception>
|
||||
/// <exception cref="T:System.PlatformNotSupportedException">The current operating system is not Microsoft Windows NT or later.</exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001681 RID: 5761 RVA: 0x00056850 File Offset: 0x00054A50
|
||||
[ComVisible(false)]
|
||||
public FileInfo Replace(string destinationFileName, string destinationBackupFileName)
|
||||
{
|
||||
if (!this.Exists)
|
||||
{
|
||||
throw new FileNotFoundException();
|
||||
}
|
||||
if (destinationFileName == null)
|
||||
{
|
||||
throw new ArgumentNullException("destinationFileName");
|
||||
}
|
||||
if (destinationFileName.Length == 0)
|
||||
{
|
||||
throw new ArgumentException("An empty file name is not valid.", "destinationFileName");
|
||||
}
|
||||
string fullPath = Path.GetFullPath(destinationFileName);
|
||||
if (!File.Exists(fullPath))
|
||||
{
|
||||
throw new FileNotFoundException();
|
||||
}
|
||||
FileAttributes attributes = File.GetAttributes(fullPath);
|
||||
if ((attributes & FileAttributes.ReadOnly) == FileAttributes.ReadOnly)
|
||||
{
|
||||
throw new UnauthorizedAccessException();
|
||||
}
|
||||
if (destinationBackupFileName != null)
|
||||
{
|
||||
if (destinationBackupFileName.Length == 0)
|
||||
{
|
||||
throw new ArgumentException("An empty file name is not valid.", "destinationBackupFileName");
|
||||
}
|
||||
File.Copy(fullPath, Path.GetFullPath(destinationBackupFileName), true);
|
||||
}
|
||||
File.Copy(this.FullPath, fullPath, true);
|
||||
File.Delete(this.FullPath);
|
||||
return new FileInfo(fullPath);
|
||||
}
|
||||
|
||||
/// <summary>Replaces the contents of a specified file with the file described by the current <see cref="T:System.IO.FileInfo" /> object, deleting the original file, and creating a backup of the replaced file. Also specifies whether to ignore merge errors. </summary>
|
||||
/// <returns>A <see cref="T:System.IO.FileInfo" /> object that encapsulates information about the file described by the <paramref name="destFileName" /> parameter.</returns>
|
||||
/// <param name="destinationFileName">The name of a file to replace with the current file.</param>
|
||||
/// <param name="destinationBackupFileName">The name of a file with which to create a backup of the file described by the <paramref name="destFileName" /> parameter.</param>
|
||||
/// <param name="ignoreMetadataErrors">true to ignore merge errors (such as attributes and ACLs) from the replaced file to the replacement file; otherwise false. </param>
|
||||
/// <exception cref="T:System.ArgumentException">The path described by the <paramref name="destFileName" /> parameter was not of a legal form.-or-The path described by the <paramref name="destBackupFileName" /> parameter was not of a legal form.</exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">The <paramref name="destFileName" /> parameter is null.</exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file described by the current <see cref="T:System.IO.FileInfo" /> object could not be found.-or-The file described by the <paramref name="destinationFileName" /> parameter could not be found. </exception>
|
||||
/// <exception cref="T:System.PlatformNotSupportedException">The current operating system is not Microsoft Windows NT or later.</exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001682 RID: 5762 RVA: 0x00056918 File Offset: 0x00054B18
|
||||
[ComVisible(false)]
|
||||
public FileInfo Replace(string destinationFileName, string destinationBackupFileName, bool ignoreMetadataErrors)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
// Token: 0x0400066E RID: 1646
|
||||
private bool exists;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,179 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
/// <summary>The exception that is thrown when a managed assembly is found but cannot be loaded.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x020001B6 RID: 438
|
||||
[ComVisible(true)]
|
||||
[Serializable]
|
||||
public class FileLoadException : IOException
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.FileLoadException" /> class, setting the <see cref="P:System.Exception.Message" /> property of the new instance to a system-supplied message that describes the error, such as "Could not load the specified file." This message takes into account the current system culture.</summary>
|
||||
// Token: 0x06001683 RID: 5763 RVA: 0x00056920 File Offset: 0x00054B20
|
||||
public FileLoadException()
|
||||
: base(Locale.GetText("I/O Error"))
|
||||
{
|
||||
base.HResult = -2147024894;
|
||||
this.msg = Locale.GetText("I/O Error");
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.FileLoadException" /> class with the specified error message.</summary>
|
||||
/// <param name="message">A <see cref="T:System.String" /> that describes the error. The content of <paramref name="message" /> is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture. </param>
|
||||
// Token: 0x06001684 RID: 5764 RVA: 0x00056958 File Offset: 0x00054B58
|
||||
public FileLoadException(string message)
|
||||
: base(message)
|
||||
{
|
||||
base.HResult = -2147024894;
|
||||
this.msg = message;
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.FileLoadException" /> class with a specified error message and the name of the file that could not be loaded.</summary>
|
||||
/// <param name="message">A <see cref="T:System.String" /> that describes the error. The content of <paramref name="message" /> is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture. </param>
|
||||
/// <param name="fileName">A <see cref="T:System.String" /> containing the name of the file that was not loaded. </param>
|
||||
// Token: 0x06001685 RID: 5765 RVA: 0x00056974 File Offset: 0x00054B74
|
||||
public FileLoadException(string message, string fileName)
|
||||
: base(message)
|
||||
{
|
||||
base.HResult = -2147024894;
|
||||
this.msg = message;
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.FileLoadException" /> class with a specified error message and a reference to the inner exception that is the cause of this exception.</summary>
|
||||
/// <param name="message">A <see cref="T:System.String" /> that describes the error. The content of <paramref name="message" /> is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture. </param>
|
||||
/// <param name="inner">The exception that is the cause of the current exception. If the <paramref name="inner" /> parameter is not null, the current exception is raised in a catch block that handles the inner exception. </param>
|
||||
// Token: 0x06001686 RID: 5766 RVA: 0x000569A4 File Offset: 0x00054BA4
|
||||
public FileLoadException(string message, Exception inner)
|
||||
: base(message, inner)
|
||||
{
|
||||
base.HResult = -2147024894;
|
||||
this.msg = message;
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.FileLoadException" /> class with a specified error message, the name of the file that could not be loaded, and a reference to the inner exception that is the cause of this exception.</summary>
|
||||
/// <param name="message">A <see cref="T:System.String" /> that describes the error. The content of <paramref name="message" /> is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture. </param>
|
||||
/// <param name="fileName">A <see cref="T:System.String" /> containing the name of the file that was not loaded. </param>
|
||||
/// <param name="inner">The exception that is the cause of the current exception. If the <paramref name="inner" /> parameter is not null, the current exception is raised in a catch block that handles the inner exception. </param>
|
||||
// Token: 0x06001687 RID: 5767 RVA: 0x000569C0 File Offset: 0x00054BC0
|
||||
public FileLoadException(string message, string fileName, Exception inner)
|
||||
: base(message, inner)
|
||||
{
|
||||
base.HResult = -2147024894;
|
||||
this.msg = message;
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.FileLoadException" /> class with serialized data.</summary>
|
||||
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data about the exception being thrown. </param>
|
||||
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination. </param>
|
||||
// Token: 0x06001688 RID: 5768 RVA: 0x000569E4 File Offset: 0x00054BE4
|
||||
protected FileLoadException(SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
this.fileName = info.GetString("FileLoad_FileName");
|
||||
this.fusionLog = info.GetString("FileLoad_FusionLog");
|
||||
}
|
||||
|
||||
/// <summary>Gets the error message and the name of the file that caused this exception.</summary>
|
||||
/// <returns>A string containing the error message and the name of the file that caused this exception.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x170003F2 RID: 1010
|
||||
// (get) Token: 0x06001689 RID: 5769 RVA: 0x00056A1C File Offset: 0x00054C1C
|
||||
public override string Message
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.msg;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the name of the file that causes this exception.</summary>
|
||||
/// <returns>A <see cref="T:System.String" /> containing the name of the file with the invalid image, or a null reference if no file name was passed to the constructor for the current instance.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x170003F3 RID: 1011
|
||||
// (get) Token: 0x0600168A RID: 5770 RVA: 0x00056A24 File Offset: 0x00054C24
|
||||
public string FileName
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.fileName;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the log file that describes why an assembly load failed.</summary>
|
||||
/// <returns>A string containing errors reported by the assembly cache.</returns>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence, ControlPolicy" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x170003F4 RID: 1012
|
||||
// (get) Token: 0x0600168B RID: 5771 RVA: 0x00056A2C File Offset: 0x00054C2C
|
||||
public string FusionLog
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.fusionLog;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Sets the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> with the file name and additional exception information.</summary>
|
||||
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data about the exception being thrown. </param>
|
||||
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination. </param>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Read="*AllFiles*" PathDiscovery="*AllFiles*" />
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence, ControlPolicy" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600168C RID: 5772 RVA: 0x00056A34 File Offset: 0x00054C34
|
||||
public override void GetObjectData(SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
base.GetObjectData(info, context);
|
||||
info.AddValue("FileLoad_FileName", this.fileName);
|
||||
info.AddValue("FileLoad_FusionLog", this.fusionLog);
|
||||
}
|
||||
|
||||
/// <summary>Returns the fully qualified name of the current exception, and possibly the error message, the name of the inner exception, and the stack trace.</summary>
|
||||
/// <returns>A string containing the fully qualified name of this exception, and possibly the error message, the name of the inner exception, and the stack trace, depending on which <see cref="T:System.IO.FileLoadException" /> constructor is used.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence, ControlPolicy" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600168D RID: 5773 RVA: 0x00056A6C File Offset: 0x00054C6C
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder(this.GetType().FullName);
|
||||
stringBuilder.AppendFormat(": {0}", this.msg);
|
||||
if (this.fileName != null)
|
||||
{
|
||||
stringBuilder.AppendFormat(" : {0}", this.fileName);
|
||||
}
|
||||
if (this.InnerException != null)
|
||||
{
|
||||
stringBuilder.AppendFormat(" ----> {0}", this.InnerException);
|
||||
}
|
||||
if (this.StackTrace != null)
|
||||
{
|
||||
stringBuilder.Append(Environment.NewLine);
|
||||
stringBuilder.Append(this.StackTrace);
|
||||
}
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
|
||||
// Token: 0x0400066F RID: 1647
|
||||
private const int Result = -2147024894;
|
||||
|
||||
// Token: 0x04000670 RID: 1648
|
||||
private string msg;
|
||||
|
||||
// Token: 0x04000671 RID: 1649
|
||||
private string fileName;
|
||||
|
||||
// Token: 0x04000672 RID: 1650
|
||||
private string fusionLog;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
/// <summary>Specifies how the operating system should open a file.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x020001B7 RID: 439
|
||||
[ComVisible(true)]
|
||||
[Serializable]
|
||||
public enum FileMode
|
||||
{
|
||||
/// <summary>Specifies that the operating system should create a new file. This requires <see cref="F:System.Security.Permissions.FileIOPermissionAccess.Write" />. If the file already exists, an <see cref="T:System.IO.IOException" /> is thrown.</summary>
|
||||
// Token: 0x04000674 RID: 1652
|
||||
CreateNew = 1,
|
||||
/// <summary>Specifies that the operating system should create a new file. If the file already exists, it will be overwritten. This requires <see cref="F:System.Security.Permissions.FileIOPermissionAccess.Write" />. System.IO.FileMode.Create is equivalent to requesting that if the file does not exist, use <see cref="F:System.IO.FileMode.CreateNew" />; otherwise, use <see cref="F:System.IO.FileMode.Truncate" />. If the file already exists but is a hidden file, an <see cref="T:System.UnauthorizedAccessException" /> is thrown.</summary>
|
||||
// Token: 0x04000675 RID: 1653
|
||||
Create,
|
||||
/// <summary>Specifies that the operating system should open an existing file. The ability to open the file is dependent on the value specified by <see cref="T:System.IO.FileAccess" />. A <see cref="T:System.IO.FileNotFoundException" /> is thrown if the file does not exist.</summary>
|
||||
// Token: 0x04000676 RID: 1654
|
||||
Open,
|
||||
/// <summary>Specifies that the operating system should open a file if it exists; otherwise, a new file should be created. If the file is opened with FileAccess.Read, <see cref="F:System.Security.Permissions.FileIOPermissionAccess.Read" /> is required. If the file access is FileAccess.Write then <see cref="F:System.Security.Permissions.FileIOPermissionAccess.Write" /> is required. If the file is opened with FileAccess.ReadWrite, both <see cref="F:System.Security.Permissions.FileIOPermissionAccess.Read" /> and <see cref="F:System.Security.Permissions.FileIOPermissionAccess.Write" /> are required. If the file access is FileAccess.Append, then <see cref="F:System.Security.Permissions.FileIOPermissionAccess.Append" /> is required.</summary>
|
||||
// Token: 0x04000677 RID: 1655
|
||||
OpenOrCreate,
|
||||
/// <summary>Specifies that the operating system should open an existing file. Once opened, the file should be truncated so that its size is zero bytes. This requires <see cref="F:System.Security.Permissions.FileIOPermissionAccess.Write" />. Attempts to read from a file opened with Truncate cause an exception.</summary>
|
||||
// Token: 0x04000678 RID: 1656
|
||||
Truncate,
|
||||
/// <summary>Opens the file if it exists and seeks to the end of the file, or creates a new file. FileMode.Append can only be used in conjunction with FileAccess.Write. Attempting to seek to a position before the end of the file will throw an <see cref="T:System.IO.IOException" /> and any attempt to read fails and throws an <see cref="T:System.NotSupportedException" />.</summary>
|
||||
// Token: 0x04000679 RID: 1657
|
||||
Append
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,177 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Serialization;
|
||||
using System.Text;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
/// <summary>The exception that is thrown when an attempt to access a file that does not exist on disk fails.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x020001B8 RID: 440
|
||||
[ComVisible(true)]
|
||||
[Serializable]
|
||||
public class FileNotFoundException : IOException
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.FileNotFoundException" /> class with its message string set to a system-supplied message and its HRESULT set to COR_E_FILENOTFOUND.</summary>
|
||||
// Token: 0x0600168E RID: 5774 RVA: 0x00056B00 File Offset: 0x00054D00
|
||||
public FileNotFoundException()
|
||||
: base(Locale.GetText("Unable to find the specified file."))
|
||||
{
|
||||
base.HResult = -2146232799;
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.FileNotFoundException" /> class with its message string set to <paramref name="message" /> and its HRESULT set to COR_E_FILENOTFOUND.</summary>
|
||||
/// <param name="message">A description of the error. The content of <paramref name="message" /> is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture. </param>
|
||||
// Token: 0x0600168F RID: 5775 RVA: 0x00056B20 File Offset: 0x00054D20
|
||||
public FileNotFoundException(string message)
|
||||
: base(message)
|
||||
{
|
||||
base.HResult = -2146232799;
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.FileNotFoundException" /> class with a specified error message and a reference to the inner exception that is the cause of this exception.</summary>
|
||||
/// <param name="message">A description of the error. The content of <paramref name="message" /> is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture. </param>
|
||||
/// <param name="innerException">The exception that is the cause of the current exception. If the <paramref name="innerException" /> parameter is not null, the current exception is raised in a catch block that handles the inner exception. </param>
|
||||
// Token: 0x06001690 RID: 5776 RVA: 0x00056B34 File Offset: 0x00054D34
|
||||
public FileNotFoundException(string message, Exception innerException)
|
||||
: base(message, innerException)
|
||||
{
|
||||
base.HResult = -2146232799;
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.FileNotFoundException" /> class with its message string set to <paramref name="message" />, specifying the file name that cannot be found, and its HRESULT set to COR_E_FILENOTFOUND.</summary>
|
||||
/// <param name="message">A description of the error. The content of <paramref name="message" /> is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture. </param>
|
||||
/// <param name="fileName">The full name of the file with the invalid image. </param>
|
||||
// Token: 0x06001691 RID: 5777 RVA: 0x00056B4C File Offset: 0x00054D4C
|
||||
public FileNotFoundException(string message, string fileName)
|
||||
: base(message)
|
||||
{
|
||||
base.HResult = -2146232799;
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.FileNotFoundException" /> class with a specified error message and a reference to the inner exception that is the cause of this exception.</summary>
|
||||
/// <param name="message">The error message that explains the reason for the exception. </param>
|
||||
/// <param name="fileName">The full name of the file with the invalid image. </param>
|
||||
/// <param name="innerException">The exception that is the cause of the current exception. If the <paramref name="innerException" /> parameter is not null, the current exception is raised in a catch block that handles the inner exception. </param>
|
||||
// Token: 0x06001692 RID: 5778 RVA: 0x00056B68 File Offset: 0x00054D68
|
||||
public FileNotFoundException(string message, string fileName, Exception innerException)
|
||||
: base(message, innerException)
|
||||
{
|
||||
base.HResult = -2146232799;
|
||||
this.fileName = fileName;
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.FileNotFoundException" /> class with the specified serialization and context information.</summary>
|
||||
/// <param name="info">An object that holds the serialized object data about the exception being thrown. </param>
|
||||
/// <param name="context">An object that contains contextual information about the source or destination. </param>
|
||||
// Token: 0x06001693 RID: 5779 RVA: 0x00056B84 File Offset: 0x00054D84
|
||||
protected FileNotFoundException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context)
|
||||
{
|
||||
this.fileName = info.GetString("FileNotFound_FileName");
|
||||
this.fusionLog = info.GetString("FileNotFound_FusionLog");
|
||||
}
|
||||
|
||||
/// <summary>Gets the name of the file that cannot be found.</summary>
|
||||
/// <returns>A <see cref="T:System.String" /> containing the name of the file, or null if no file name was passed to the constructor for this instance.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x170003F5 RID: 1013
|
||||
// (get) Token: 0x06001694 RID: 5780 RVA: 0x00056BBC File Offset: 0x00054DBC
|
||||
public string FileName
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.fileName;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the log file that describes why loading of an assembly failed.</summary>
|
||||
/// <returns>A String containing errors reported by the assembly cache.</returns>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence, ControlPolicy" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x170003F6 RID: 1014
|
||||
// (get) Token: 0x06001695 RID: 5781 RVA: 0x00056BC4 File Offset: 0x00054DC4
|
||||
public string FusionLog
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.fusionLog;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the error message that explains the reason for the exception.</summary>
|
||||
/// <returns>A string containing the error message.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x170003F7 RID: 1015
|
||||
// (get) Token: 0x06001696 RID: 5782 RVA: 0x00056BCC File Offset: 0x00054DCC
|
||||
public override string Message
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.message == null && this.fileName != null)
|
||||
{
|
||||
return string.Format(CultureInfo.CurrentCulture, "Could not load file or assembly '{0}' or one of its dependencies. The system cannot find the file specified.", new object[] { this.fileName });
|
||||
}
|
||||
return this.message;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Sets the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object with the file name and additional exception information.</summary>
|
||||
/// <param name="info">The object that holds the serialized object data about the exception being thrown. </param>
|
||||
/// <param name="context">The object that contains contextual information about the source or destination. </param>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Read="*AllFiles*" PathDiscovery="*AllFiles*" />
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence, ControlPolicy" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001697 RID: 5783 RVA: 0x00056C18 File Offset: 0x00054E18
|
||||
public override void GetObjectData(SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
base.GetObjectData(info, context);
|
||||
info.AddValue("FileNotFound_FileName", this.fileName);
|
||||
info.AddValue("FileNotFound_FusionLog", this.fusionLog);
|
||||
}
|
||||
|
||||
/// <summary>Returns the fully qualified name of this exception and possibly the error message, the name of the inner exception, and the stack trace.</summary>
|
||||
/// <returns>A string containing the fully qualified name of this exception and possibly the error message, the name of the inner exception, and the stack trace.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlEvidence, ControlPolicy" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001698 RID: 5784 RVA: 0x00056C50 File Offset: 0x00054E50
|
||||
public override string ToString()
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder(this.GetType().FullName);
|
||||
stringBuilder.AppendFormat(": {0}", this.Message);
|
||||
if (this.fileName != null && this.fileName.Length > 0)
|
||||
{
|
||||
stringBuilder.Append(Environment.NewLine);
|
||||
stringBuilder.AppendFormat("File name: '{0}'", this.fileName);
|
||||
}
|
||||
if (this.InnerException != null)
|
||||
{
|
||||
stringBuilder.AppendFormat(" ---> {0}", this.InnerException);
|
||||
}
|
||||
if (this.StackTrace != null)
|
||||
{
|
||||
stringBuilder.Append(Environment.NewLine);
|
||||
stringBuilder.Append(this.StackTrace);
|
||||
}
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
|
||||
// Token: 0x0400067A RID: 1658
|
||||
private const int Result = -2146232799;
|
||||
|
||||
// Token: 0x0400067B RID: 1659
|
||||
private string fileName;
|
||||
|
||||
// Token: 0x0400067C RID: 1660
|
||||
private string fusionLog;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
/// <summary>Represents additional options for creating a <see cref="T:System.IO.FileStream" /> object.</summary>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x020001B9 RID: 441
|
||||
[Flags]
|
||||
[ComVisible(true)]
|
||||
[Serializable]
|
||||
public enum FileOptions
|
||||
{
|
||||
/// <summary>Indicates no additional parameters.</summary>
|
||||
// Token: 0x0400067E RID: 1662
|
||||
None = 0,
|
||||
/// <summary>Indicates that a file is encrypted and can be decrypted only by using the same user account used for encryption.</summary>
|
||||
// Token: 0x0400067F RID: 1663
|
||||
Encrypted = 16384,
|
||||
/// <summary>Indicates that a file is automatically deleted when it is no longer in use.</summary>
|
||||
// Token: 0x04000680 RID: 1664
|
||||
DeleteOnClose = 67108864,
|
||||
/// <summary>Indicates that the file is to be accessed sequentially from beginning to end. The system can use this as a hint to optimize file caching. If an application moves the file pointer for random access, optimum caching may not occur; however, correct operation is still guaranteed. </summary>
|
||||
// Token: 0x04000681 RID: 1665
|
||||
SequentialScan = 134217728,
|
||||
/// <summary>Indicates that the file is accessed randomly. The system can use this as a hint to optimize file caching.</summary>
|
||||
// Token: 0x04000682 RID: 1666
|
||||
RandomAccess = 268435456,
|
||||
/// <summary>Indicates that a file can be used for asynchronous reading and writing. </summary>
|
||||
// Token: 0x04000683 RID: 1667
|
||||
Asynchronous = 1073741824,
|
||||
/// <summary>Indicates that the system should write through any intermediate cache and go directly to disk.</summary>
|
||||
// Token: 0x04000684 RID: 1668
|
||||
WriteThrough = -2147483648
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,33 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
/// <summary>Contains constants for controlling the kind of access other <see cref="T:System.IO.FileStream" /> objects can have to the same file.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x020001BA RID: 442
|
||||
[ComVisible(true)]
|
||||
[Flags]
|
||||
[Serializable]
|
||||
public enum FileShare
|
||||
{
|
||||
/// <summary>Declines sharing of the current file. Any request to open the file (by this process or another process) will fail until the file is closed.</summary>
|
||||
// Token: 0x04000686 RID: 1670
|
||||
None = 0,
|
||||
/// <summary>Allows subsequent opening of the file for reading. If this flag is not specified, any request to open the file for reading (by this process or another process) will fail until the file is closed. However, even if this flag is specified, additional permissions might still be needed to access the file.</summary>
|
||||
// Token: 0x04000687 RID: 1671
|
||||
Read = 1,
|
||||
/// <summary>Allows subsequent opening of the file for writing. If this flag is not specified, any request to open the file for writing (by this process or another process) will fail until the file is closed. However, even if this flag is specified, additional permissions might still be needed to access the file.</summary>
|
||||
// Token: 0x04000688 RID: 1672
|
||||
Write = 2,
|
||||
/// <summary>Allows subsequent opening of the file for reading or writing. If this flag is not specified, any request to open the file for reading or writing (by this process or another process) will fail until the file is closed. However, even if this flag is specified, additional permissions might still be needed to access the file.</summary>
|
||||
// Token: 0x04000689 RID: 1673
|
||||
ReadWrite = 3,
|
||||
/// <summary>Allows subsequent deleting of a file.</summary>
|
||||
// Token: 0x0400068A RID: 1674
|
||||
Delete = 4,
|
||||
/// <summary>Makes the file handle inheritable by child processes. This is not directly supported by Win32.</summary>
|
||||
// Token: 0x0400068B RID: 1675
|
||||
Inheritable = 16
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,1423 @@
|
||||
using System;
|
||||
using System.IO.IsolatedStorage;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Remoting.Messaging;
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
/// <summary>Exposes a <see cref="T:System.IO.Stream" /> around a file, supporting both synchronous and asynchronous read and write operations.</summary>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x020001BB RID: 443
|
||||
[ComVisible(true)]
|
||||
public class FileStream : Stream
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.FileStream" /> class for the specified file handle, with the specified read/write permission.</summary>
|
||||
/// <param name="handle">A file handle for the file that the current FileStream object will encapsulate. </param>
|
||||
/// <param name="access">A constant that sets the <see cref="P:System.IO.FileStream.CanRead" /> and <see cref="P:System.IO.FileStream.CanWrite" /> properties of the FileStream object. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="access" /> is not a field of <see cref="T:System.IO.FileAccess" />. </exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs, such as a disk error.-or-The stream has been closed. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The <paramref name="access" /> requested is not permitted by the operating system for the specified file handle, such as when <paramref name="access" /> is Write or ReadWrite and the file handle is set for read-only access. </exception>
|
||||
// Token: 0x06001699 RID: 5785 RVA: 0x00056D04 File Offset: 0x00054F04
|
||||
[Obsolete("Use FileStream(SafeFileHandle handle, FileAccess access) instead")]
|
||||
public FileStream(IntPtr handle, FileAccess access)
|
||||
: this(handle, access, true, 8192, false)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.FileStream" /> class for the specified file handle, with the specified read/write permission and FileStream instance ownership.</summary>
|
||||
/// <param name="handle">A file handle for the file that the current FileStream object will encapsulate. </param>
|
||||
/// <param name="access">A constant that gets the <see cref="P:System.IO.FileStream.CanRead" /> and <see cref="P:System.IO.FileStream.CanWrite" /> properties of the FileStream object. </param>
|
||||
/// <param name="ownsHandle">true if the file handle will be owned by this FileStream instance; otherwise, false. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="access" /> is not a field of <see cref="T:System.IO.FileAccess" />. </exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs, such as a disk error.-or-The stream has been closed. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The <paramref name="access" /> requested is not permitted by the operating system for the specified file handle, such as when <paramref name="access" /> is Write or ReadWrite and the file handle is set for read-only access. </exception>
|
||||
// Token: 0x0600169A RID: 5786 RVA: 0x00056D18 File Offset: 0x00054F18
|
||||
[Obsolete("Use FileStream(SafeFileHandle handle, FileAccess access) instead")]
|
||||
public FileStream(IntPtr handle, FileAccess access, bool ownsHandle)
|
||||
: this(handle, access, ownsHandle, 8192, false)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.FileStream" /> class for the specified file handle, with the specified read/write permission, FileStream instance ownership, and buffer size.</summary>
|
||||
/// <param name="handle">A file handle for the file that this FileStream object will encapsulate. </param>
|
||||
/// <param name="access">A constant that gets the <see cref="P:System.IO.FileStream.CanRead" /> and <see cref="P:System.IO.FileStream.CanWrite" /> properties of the FileStream object. </param>
|
||||
/// <param name="ownsHandle">true if the file handle will be owned by this FileStream instance; otherwise, false. </param>
|
||||
/// <param name="bufferSize">A positive <see cref="T:System.Int32" /> value greater than 0 indicating the buffer size. For <paramref name="bufferSize" /> values between one and eight, the actual buffer size is set to eight bytes.</param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="bufferSize" /> is negative. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs, such as a disk error.-or-The stream has been closed. </exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The <paramref name="access" /> requested is not permitted by the operating system for the specified file handle, such as when <paramref name="access" /> is Write or ReadWrite and the file handle is set for read-only access. </exception>
|
||||
// Token: 0x0600169B RID: 5787 RVA: 0x00056D2C File Offset: 0x00054F2C
|
||||
[Obsolete("Use FileStream(SafeFileHandle handle, FileAccess access, int bufferSize) instead")]
|
||||
public FileStream(IntPtr handle, FileAccess access, bool ownsHandle, int bufferSize)
|
||||
: this(handle, access, ownsHandle, bufferSize, false)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.FileStream" /> class for the specified file handle, with the specified read/write permission, FileStream instance ownership, buffer size, and synchronous or asynchronous state.</summary>
|
||||
/// <param name="handle">A file handle for the file that this FileStream object will encapsulate. </param>
|
||||
/// <param name="access">A constant that gets the <see cref="P:System.IO.FileStream.CanRead" /> and <see cref="P:System.IO.FileStream.CanWrite" /> properties of the FileStream object. </param>
|
||||
/// <param name="ownsHandle">true if the file handle will be owned by this FileStream instance; otherwise, false. </param>
|
||||
/// <param name="bufferSize">A positive <see cref="T:System.Int32" /> value greater than 0 indicating the buffer size. For <paramref name="bufferSize" /> values between one and eight, the actual buffer size is set to eight bytes.</param>
|
||||
/// <param name="isAsync">true if the handle was opened asynchronously (that is, in overlapped I/O mode); otherwise, false. </param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="access" /> is less than FileAccess.Read or greater than FileAccess.ReadWrite or <paramref name="bufferSize" /> is less than or equal to 0. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">The handle is invalid. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs, such as a disk error.-or-The stream has been closed. </exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The <paramref name="access" /> requested is not permitted by the operating system for the specified file handle, such as when <paramref name="access" /> is Write or ReadWrite and the file handle is set for read-only access. </exception>
|
||||
// Token: 0x0600169C RID: 5788 RVA: 0x00056D3C File Offset: 0x00054F3C
|
||||
[Obsolete("Use FileStream(SafeFileHandle handle, FileAccess access, int bufferSize, bool isAsync) instead")]
|
||||
public FileStream(IntPtr handle, FileAccess access, bool ownsHandle, int bufferSize, bool isAsync)
|
||||
: this(handle, access, ownsHandle, bufferSize, isAsync, false)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x0600169D RID: 5789 RVA: 0x00056D4C File Offset: 0x00054F4C
|
||||
internal FileStream(IntPtr handle, FileAccess access, bool ownsHandle, int bufferSize, bool isAsync, bool noBuffering)
|
||||
{
|
||||
this.name = "[Unknown]";
|
||||
base..ctor();
|
||||
this.handle = MonoIO.InvalidHandle;
|
||||
if (handle == this.handle)
|
||||
{
|
||||
throw new ArgumentException("handle", Locale.GetText("Invalid."));
|
||||
}
|
||||
if (access < FileAccess.Read || access > FileAccess.ReadWrite)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("access");
|
||||
}
|
||||
MonoIOError monoIOError;
|
||||
MonoFileType fileType = MonoIO.GetFileType(handle, out monoIOError);
|
||||
if (monoIOError != MonoIOError.ERROR_SUCCESS)
|
||||
{
|
||||
throw MonoIO.GetException(this.name, monoIOError);
|
||||
}
|
||||
if (fileType == MonoFileType.Unknown)
|
||||
{
|
||||
throw new IOException("Invalid handle.");
|
||||
}
|
||||
if (fileType == MonoFileType.Disk)
|
||||
{
|
||||
this.canseek = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.canseek = false;
|
||||
}
|
||||
this.handle = handle;
|
||||
this.access = access;
|
||||
this.owner = ownsHandle;
|
||||
this.async = isAsync;
|
||||
this.anonymous = false;
|
||||
this.InitBuffer(bufferSize, noBuffering);
|
||||
if (this.canseek)
|
||||
{
|
||||
this.buf_start = MonoIO.Seek(handle, 0L, SeekOrigin.Current, out monoIOError);
|
||||
if (monoIOError != MonoIOError.ERROR_SUCCESS)
|
||||
{
|
||||
throw MonoIO.GetException(this.name, monoIOError);
|
||||
}
|
||||
}
|
||||
this.append_startpos = 0L;
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.FileStream" /> class with the specified path and creation mode.</summary>
|
||||
/// <param name="path">A relative or absolute path for the file that the current FileStream object will encapsulate. </param>
|
||||
/// <param name="mode">A constant that determines how to open or create the file. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is an empty string (""), contains only white space, or contains one or more invalid characters. -or-<paramref name="path" /> refers to a non-file device, such as "con:", "com1:", "lpt1:", etc. in an NTFS environment.</exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> refers to a non-file device, such as "con:", "com1:", "lpt1:", etc. in a non-NTFS environment.</exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file cannot be found, such as when <paramref name="mode" /> is FileMode.Truncate or FileMode.Open, and the file specified by <paramref name="path" /> does not exist. The file must already exist in these modes. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs, such as specifying FileMode.CreateNew and the file specified by <paramref name="path" /> already exists.-or-The stream has been closed. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid, such as being on an unmapped drive. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="mode" /> contains an invalid value. </exception>
|
||||
// Token: 0x0600169E RID: 5790 RVA: 0x00056E60 File Offset: 0x00055060
|
||||
public FileStream(string path, FileMode mode)
|
||||
: this(path, mode, (mode != FileMode.Append) ? FileAccess.ReadWrite : FileAccess.Write, FileShare.Read, 8192, false, FileOptions.None)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.FileStream" /> class with the specified path, creation mode, and read/write permission.</summary>
|
||||
/// <param name="path">A relative or absolute path for the file that the current FileStream object will encapsulate. </param>
|
||||
/// <param name="mode">A constant that determines how to open or create the file. </param>
|
||||
/// <param name="access">A constant that determines how the file can be accessed by the FileStream object. This gets the <see cref="P:System.IO.FileStream.CanRead" /> and <see cref="P:System.IO.FileStream.CanWrite" /> properties of the FileStream object. <see cref="P:System.IO.FileStream.CanSeek" /> is true if <paramref name="path" /> specifies a disk file. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is an empty string (""), contains only white space, or contains one or more invalid characters. -or-<paramref name="path" /> refers to a non-file device, such as "con:", "com1:", "lpt1:", etc. in an NTFS environment.</exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> refers to a non-file device, such as "con:", "com1:", "lpt1:", etc. in a non-NTFS environment.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is an empty string (""), contains only white space, or contains one or more invalid characters. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file cannot be found, such as when <paramref name="mode" /> is FileMode.Truncate or FileMode.Open, and the file specified by <paramref name="path" /> does not exist. The file must already exist in these modes. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs, such as specifying FileMode.CreateNew and the file specified by <paramref name="path" /> already exists. -or-The stream has been closed.</exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid, such as being on an unmapped drive. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The <paramref name="access" /> requested is not permitted by the operating system for the specified <paramref name="path" />, such as when <paramref name="access" /> is Write or ReadWrite and the file or directory is set for read-only access. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="mode" /> contains an invalid value. </exception>
|
||||
// Token: 0x0600169F RID: 5791 RVA: 0x00056E8C File Offset: 0x0005508C
|
||||
public FileStream(string path, FileMode mode, FileAccess access)
|
||||
: this(path, mode, access, (access != FileAccess.Write) ? FileShare.Read : FileShare.None, 8192, false, false)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.FileStream" /> class with the specified path, creation mode, read/write permission, and sharing permission.</summary>
|
||||
/// <param name="path">A relative or absolute path for the file that the current FileStream object will encapsulate. </param>
|
||||
/// <param name="mode">A constant that determines how to open or create the file. </param>
|
||||
/// <param name="access">A constant that determines how the file can be accessed by the FileStream object. This gets the <see cref="P:System.IO.FileStream.CanRead" /> and <see cref="P:System.IO.FileStream.CanWrite" /> properties of the FileStream object. <see cref="P:System.IO.FileStream.CanSeek" /> is true if <paramref name="path" /> specifies a disk file. </param>
|
||||
/// <param name="share">A constant that determines how the file will be shared by processes. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is an empty string (""), contains only white space, or contains one or more invalid characters. -or-<paramref name="path" /> refers to a non-file device, such as "con:", "com1:", "lpt1:", etc. in an NTFS environment.</exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> refers to a non-file device, such as "con:", "com1:", "lpt1:", etc. in a non-NTFS environment.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is an empty string (""), contains only white space, or contains one or more invalid characters. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file cannot be found, such as when <paramref name="mode" /> is FileMode.Truncate or FileMode.Open, and the file specified by <paramref name="path" /> does not exist. The file must already exist in these modes. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs, such as specifying FileMode.CreateNew and the file specified by <paramref name="path" /> already exists. -or-The system is running Windows 98 or Windows 98 Second Edition and <paramref name="share" /> is set to FileShare.Delete.-or-The stream has been closed.</exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid, such as being on an unmapped drive. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The <paramref name="access" /> requested is not permitted by the operating system for the specified <paramref name="path" />, such as when <paramref name="access" /> is Write or ReadWrite and the file or directory is set for read-only access. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="mode" /> contains an invalid value. </exception>
|
||||
// Token: 0x060016A0 RID: 5792 RVA: 0x00056EB8 File Offset: 0x000550B8
|
||||
public FileStream(string path, FileMode mode, FileAccess access, FileShare share)
|
||||
: this(path, mode, access, share, 8192, false, FileOptions.None)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.FileStream" /> class with the specified path, creation mode, read/write and sharing permission, and buffer size.</summary>
|
||||
/// <param name="path">A relative or absolute path for the file that the current FileStream object will encapsulate. </param>
|
||||
/// <param name="mode">A constant that determines how to open or create the file. </param>
|
||||
/// <param name="access">A constant that determines how the file can be accessed by the FileStream object. This gets the <see cref="P:System.IO.FileStream.CanRead" /> and <see cref="P:System.IO.FileStream.CanWrite" /> properties of the FileStream object. <see cref="P:System.IO.FileStream.CanSeek" /> is true if <paramref name="path" /> specifies a disk file. </param>
|
||||
/// <param name="share">A constant that determines how the file will be shared by processes. </param>
|
||||
/// <param name="bufferSize">A positive <see cref="T:System.Int32" /> value greater than 0 indicating the buffer size. For <paramref name="bufferSize" /> values between one and eight, the actual buffer size is set to eight bytes. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is an empty string (""), contains only white space, or contains one or more invalid characters. -or-<paramref name="path" /> refers to a non-file device, such as "con:", "com1:", "lpt1:", etc. in an NTFS environment.</exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> refers to a non-file device, such as "con:", "com1:", "lpt1:", etc. in a non-NTFS environment.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is an empty string (""), contains only white space, or contains one or more invalid characters. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="bufferSize" /> is negative or zero.-or- <paramref name="mode" />, <paramref name="access" />, or <paramref name="share" /> contain an invalid value. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file cannot be found, such as when <paramref name="mode" /> is FileMode.Truncate or FileMode.Open, and the file specified by <paramref name="path" /> does not exist. The file must already exist in these modes. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs, such as specifying FileMode.CreateNew and the file specified by <paramref name="path" /> already exists. -or-The system is running Windows 98 or Windows 98 Second Edition and <paramref name="share" /> is set to FileShare.Delete.-or-The stream has been closed.</exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid, such as being on an unmapped drive. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The <paramref name="access" /> requested is not permitted by the operating system for the specified <paramref name="path" />, such as when <paramref name="access" /> is Write or ReadWrite and the file or directory is set for read-only access. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
// Token: 0x060016A1 RID: 5793 RVA: 0x00056ED8 File Offset: 0x000550D8
|
||||
public FileStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize)
|
||||
: this(path, mode, access, share, bufferSize, false, FileOptions.None)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.FileStream" /> class with the specified path, creation mode, read/write and sharing permission, buffer size, and synchronous or asynchronous state.</summary>
|
||||
/// <param name="path">A relative or absolute path for the file that the current FileStream object will encapsulate. </param>
|
||||
/// <param name="mode">A constant that determines how to open or create the file. </param>
|
||||
/// <param name="access">A <see cref="T:System.IO.FileAccess" /> constant that determines how the file can be accessed by the FileStream object. This gets the <see cref="P:System.IO.FileStream.CanRead" /> and <see cref="P:System.IO.FileStream.CanWrite" /> properties of the FileStream object. <see cref="P:System.IO.FileStream.CanSeek" /> is true if <paramref name="path" /> specifies a disk file. </param>
|
||||
/// <param name="share">A constant that determines how the file will be shared by processes. </param>
|
||||
/// <param name="bufferSize">A positive <see cref="T:System.Int32" /> value greater than 0 indicating the buffer size. For <paramref name="bufferSize" /> values between one and eight, the actual buffer size is set to eight bytes. </param>
|
||||
/// <param name="useAsync">Specifies whether to use asynchronous I/O or synchronous I/O. However, note that the underlying operating system might not support asynchronous I/O, so when specifying true, the handle might be opened synchronously depending on the platform. When opened asynchronously, the <see cref="M:System.IO.FileStream.BeginRead(System.Byte[],System.Int32,System.Int32,System.AsyncCallback,System.Object)" /> and <see cref="M:System.IO.FileStream.BeginWrite(System.Byte[],System.Int32,System.Int32,System.AsyncCallback,System.Object)" /> methods perform better on large reads or writes, but they might be much slower for small reads or writes. If the application is designed to take advantage of asynchronous I/O, set the <paramref name="useAsync" /> parameter to true. Using asynchronous I/O correctly can speed up applications by as much as a factor of 10, but using it without redesigning the application for asynchronous I/O can decrease performance by as much as a factor of 10. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is an empty string (""), contains only white space, or contains one or more invalid characters. -or-<paramref name="path" /> refers to a non-file device, such as "con:", "com1:", "lpt1:", etc. in an NTFS environment.</exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> refers to a non-file device, such as "con:", "com1:", "lpt1:", etc. in a non-NTFS environment.</exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="bufferSize" /> is negative or zero.-or- <paramref name="mode" />, <paramref name="access" />, or <paramref name="share" /> contain an invalid value. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file cannot be found, such as when <paramref name="mode" /> is FileMode.Truncate or FileMode.Open, and the file specified by <paramref name="path" /> does not exist. The file must already exist in these modes. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs, such as specifying FileMode.CreateNew and the file specified by <paramref name="path" /> already exists.-or- The system is running Windows 98 or Windows 98 Second Edition and <paramref name="share" /> is set to FileShare.Delete.-or-The stream has been closed.</exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid, such as being on an unmapped drive. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The <paramref name="access" /> requested is not permitted by the operating system for the specified <paramref name="path" />, such as when <paramref name="access" /> is Write or ReadWrite and the file or directory is set for read-only access. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
// Token: 0x060016A2 RID: 5794 RVA: 0x00056EF4 File Offset: 0x000550F4
|
||||
public FileStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, bool useAsync)
|
||||
: this(path, mode, access, share, bufferSize, useAsync, FileOptions.None)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x060016A3 RID: 5795 RVA: 0x00056F14 File Offset: 0x00055114
|
||||
internal FileStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, bool isAsync, bool anonymous)
|
||||
: this(path, mode, access, share, bufferSize, anonymous, (!isAsync) ? FileOptions.None : FileOptions.Asynchronous)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x060016A4 RID: 5796 RVA: 0x00056F44 File Offset: 0x00055144
|
||||
internal FileStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, bool anonymous, FileOptions options)
|
||||
{
|
||||
this.name = "[Unknown]";
|
||||
base..ctor();
|
||||
if (path == null)
|
||||
{
|
||||
throw new ArgumentNullException("path");
|
||||
}
|
||||
if (path.Length == 0)
|
||||
{
|
||||
throw new ArgumentException("Path is empty");
|
||||
}
|
||||
share &= ~FileShare.Inheritable;
|
||||
if (bufferSize <= 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("bufferSize", "Positive number required.");
|
||||
}
|
||||
if (mode < FileMode.CreateNew || mode > FileMode.Append)
|
||||
{
|
||||
if (anonymous)
|
||||
{
|
||||
throw new ArgumentException("mode", "Enum value was out of legal range.");
|
||||
}
|
||||
throw new ArgumentOutOfRangeException("mode", "Enum value was out of legal range.");
|
||||
}
|
||||
else if (access < FileAccess.Read || access > FileAccess.ReadWrite)
|
||||
{
|
||||
if (anonymous)
|
||||
{
|
||||
throw new IsolatedStorageException("Enum value for FileAccess was out of legal range.");
|
||||
}
|
||||
throw new ArgumentOutOfRangeException("access", "Enum value was out of legal range.");
|
||||
}
|
||||
else if ((share < FileShare.None) || share > (FileShare.Read | FileShare.Write | FileShare.Delete))
|
||||
{
|
||||
if (anonymous)
|
||||
{
|
||||
throw new IsolatedStorageException("Enum value for FileShare was out of legal range.");
|
||||
}
|
||||
throw new ArgumentOutOfRangeException("share", "Enum value was out of legal range.");
|
||||
}
|
||||
else
|
||||
{
|
||||
if (path.IndexOfAny(Path.InvalidPathChars) != -1)
|
||||
{
|
||||
throw new ArgumentException("Name has invalid chars");
|
||||
}
|
||||
if (Directory.Exists(path))
|
||||
{
|
||||
string text = Locale.GetText("Access to the path '{0}' is denied.");
|
||||
throw new UnauthorizedAccessException(string.Format(text, this.GetSecureFileName(path, false)));
|
||||
}
|
||||
if (mode == FileMode.Append && (access & FileAccess.Read) == FileAccess.Read)
|
||||
{
|
||||
throw new ArgumentException("Append access can be requested only in write-only mode.");
|
||||
}
|
||||
if ((access & FileAccess.Write) == (FileAccess)0 && mode != FileMode.Open && mode != FileMode.OpenOrCreate)
|
||||
{
|
||||
string text2 = Locale.GetText("Combining FileMode: {0} with FileAccess: {1} is invalid.");
|
||||
throw new ArgumentException(string.Format(text2, access, mode));
|
||||
}
|
||||
string text3;
|
||||
if (Path.DirectorySeparatorChar != '/' && path.IndexOf('/') >= 0)
|
||||
{
|
||||
text3 = Path.GetDirectoryName(Path.GetFullPath(path));
|
||||
}
|
||||
else
|
||||
{
|
||||
text3 = Path.GetDirectoryName(path);
|
||||
}
|
||||
if (text3.Length > 0)
|
||||
{
|
||||
string fullPath = Path.GetFullPath(text3);
|
||||
if (!Directory.Exists(fullPath))
|
||||
{
|
||||
string text4 = Locale.GetText("Could not find a part of the path \"{0}\".");
|
||||
string text5 = ((!anonymous) ? Path.GetFullPath(path) : text3);
|
||||
throw new IsolatedStorageException(string.Format(text4, text5));
|
||||
}
|
||||
}
|
||||
if (access == FileAccess.Read && mode != FileMode.Create && mode != FileMode.OpenOrCreate && mode != FileMode.CreateNew && !File.Exists(path))
|
||||
{
|
||||
string text6 = Locale.GetText("Could not find file \"{0}\".");
|
||||
string secureFileName = this.GetSecureFileName(path);
|
||||
throw new IsolatedStorageException(string.Format(text6, secureFileName));
|
||||
}
|
||||
if (!anonymous)
|
||||
{
|
||||
this.name = path;
|
||||
}
|
||||
MonoIOError monoIOError;
|
||||
this.handle = MonoIO.Open(path, mode, access, share, options, out monoIOError);
|
||||
if (this.handle == MonoIO.InvalidHandle)
|
||||
{
|
||||
throw MonoIO.GetException(this.GetSecureFileName(path), monoIOError);
|
||||
}
|
||||
this.access = access;
|
||||
this.owner = true;
|
||||
this.anonymous = anonymous;
|
||||
if (MonoIO.GetFileType(this.handle, out monoIOError) == MonoFileType.Disk)
|
||||
{
|
||||
this.canseek = true;
|
||||
this.async = (options & FileOptions.Asynchronous) != FileOptions.None;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.canseek = false;
|
||||
this.async = false;
|
||||
}
|
||||
if (access == FileAccess.Read && this.canseek && bufferSize == 8192)
|
||||
{
|
||||
long length = this.Length;
|
||||
if ((long)bufferSize > length)
|
||||
{
|
||||
bufferSize = (int)((length >= 1000L) ? length : 1000L);
|
||||
}
|
||||
}
|
||||
this.InitBuffer(bufferSize, false);
|
||||
if (mode == FileMode.Append)
|
||||
{
|
||||
this.Seek(0L, SeekOrigin.End);
|
||||
this.append_startpos = this.Position;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.append_startpos = 0L;
|
||||
}
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a value indicating whether the current stream supports reading.</summary>
|
||||
/// <returns>true if the stream supports reading; false if the stream is closed or was opened with write-only access.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x170003F8 RID: 1016
|
||||
// (get) Token: 0x060016A5 RID: 5797 RVA: 0x000572C4 File Offset: 0x000554C4
|
||||
public override bool CanRead
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.access == FileAccess.Read || this.access == FileAccess.ReadWrite;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a value indicating whether the current stream supports writing.</summary>
|
||||
/// <returns>true if the stream supports writing; false if the stream is closed or was opened with read-only access.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x170003F9 RID: 1017
|
||||
// (get) Token: 0x060016A6 RID: 5798 RVA: 0x000572E0 File Offset: 0x000554E0
|
||||
public override bool CanWrite
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.access == FileAccess.Write || this.access == FileAccess.ReadWrite;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a value indicating whether the current stream supports seeking.</summary>
|
||||
/// <returns>true if the stream supports seeking; false if the stream is closed or if the FileStream was constructed from an operating-system handle such as a pipe or output to the console.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x170003FA RID: 1018
|
||||
// (get) Token: 0x060016A7 RID: 5799 RVA: 0x000572FC File Offset: 0x000554FC
|
||||
public override bool CanSeek
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.canseek;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a value indicating whether the FileStream was opened asynchronously or synchronously.</summary>
|
||||
/// <returns>true if the FileStream was opened asynchronously; otherwise, false.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x170003FB RID: 1019
|
||||
// (get) Token: 0x060016A8 RID: 5800 RVA: 0x00057304 File Offset: 0x00055504
|
||||
public virtual bool IsAsync
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.async;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the name of the FileStream that was passed to the constructor.</summary>
|
||||
/// <returns>A string that is the name of the FileStream.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x170003FC RID: 1020
|
||||
// (get) Token: 0x060016A9 RID: 5801 RVA: 0x0005730C File Offset: 0x0005550C
|
||||
public string Name
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.name;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the length in bytes of the stream.</summary>
|
||||
/// <returns>A long value representing the length of the stream in bytes.</returns>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <see cref="P:System.IO.FileStream.CanSeek" /> for this stream is false. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs, such as the file being closed. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x170003FD RID: 1021
|
||||
// (get) Token: 0x060016AA RID: 5802 RVA: 0x00057314 File Offset: 0x00055514
|
||||
public override long Length
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.handle == MonoIO.InvalidHandle)
|
||||
{
|
||||
throw new ObjectDisposedException("Stream has been closed");
|
||||
}
|
||||
if (!this.CanSeek)
|
||||
{
|
||||
throw new NotSupportedException("The stream does not support seeking");
|
||||
}
|
||||
this.FlushBufferIfDirty();
|
||||
MonoIOError monoIOError;
|
||||
long length = MonoIO.GetLength(this.handle, out monoIOError);
|
||||
if (monoIOError != MonoIOError.ERROR_SUCCESS)
|
||||
{
|
||||
throw MonoIO.GetException(this.GetSecureFileName(this.name), monoIOError);
|
||||
}
|
||||
return length;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the current position of this stream.</summary>
|
||||
/// <returns>The current position of this stream.</returns>
|
||||
/// <exception cref="T:System.NotSupportedException">The stream does not support seeking. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. - or -The position was set to a very large value beyond the end of the stream in Windows 98 or earlier.</exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">Attempted to set the position to a negative value. </exception>
|
||||
/// <exception cref="T:System.IO.EndOfStreamException">Attempted seeking past the end of a stream that does not support this. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x170003FE RID: 1022
|
||||
// (get) Token: 0x060016AB RID: 5803 RVA: 0x00057388 File Offset: 0x00055588
|
||||
// (set) Token: 0x060016AC RID: 5804 RVA: 0x000573DC File Offset: 0x000555DC
|
||||
public override long Position
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.handle == MonoIO.InvalidHandle)
|
||||
{
|
||||
throw new ObjectDisposedException("Stream has been closed");
|
||||
}
|
||||
if (!this.CanSeek)
|
||||
{
|
||||
throw new NotSupportedException("The stream does not support seeking");
|
||||
}
|
||||
return this.buf_start + (long)this.buf_offset;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (this.handle == MonoIO.InvalidHandle)
|
||||
{
|
||||
throw new ObjectDisposedException("Stream has been closed");
|
||||
}
|
||||
if (!this.CanSeek)
|
||||
{
|
||||
throw new NotSupportedException("The stream does not support seeking");
|
||||
}
|
||||
if (value < 0L)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("Attempt to set the position to a negative value");
|
||||
}
|
||||
this.Seek(value, SeekOrigin.Begin);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the operating system file handle for the file that the current FileStream object encapsulates.</summary>
|
||||
/// <returns>The operating system file handle for the file encapsulated by this FileStream object, or -1 if the FileStream has been closed.</returns>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x170003FF RID: 1023
|
||||
// (get) Token: 0x060016AD RID: 5805 RVA: 0x0005743C File Offset: 0x0005563C
|
||||
[Obsolete("Use SafeFileHandle instead")]
|
||||
public virtual IntPtr Handle
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.handle;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a <see cref="T:Microsoft.Win32.SafeHandles.SafeFileHandle" /> object that represents the operating system file handle for the file that the current <see cref="T:System.IO.FileStream" /> object encapsulates.</summary>
|
||||
/// <returns>A <see cref="T:Microsoft.Win32.SafeHandles.SafeFileHandle" /> object that represents the operating system file handle for the file that the current <see cref="T:System.IO.FileStream" /> object encapsulates.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x17000400 RID: 1024
|
||||
// (get) Token: 0x060016AE RID: 5806 RVA: 0x00057444 File Offset: 0x00055644
|
||||
public virtual SafeFileHandle SafeFileHandle
|
||||
{
|
||||
get
|
||||
{
|
||||
SafeFileHandle safeFileHandle;
|
||||
if (this.safeHandle != null)
|
||||
{
|
||||
safeFileHandle = this.safeHandle;
|
||||
}
|
||||
else
|
||||
{
|
||||
safeFileHandle = new SafeFileHandle(this.handle, this.owner);
|
||||
}
|
||||
this.FlushBuffer();
|
||||
return safeFileHandle;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Reads a byte from the file and advances the read position one byte.</summary>
|
||||
/// <returns>The byte, cast to an <see cref="T:System.Int32" />, or -1 if the end of the stream has been reached.</returns>
|
||||
/// <exception cref="T:System.NotSupportedException">The current stream does not support reading. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The current stream is closed. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060016AF RID: 5807 RVA: 0x00057484 File Offset: 0x00055684
|
||||
public override int ReadByte()
|
||||
{
|
||||
if (this.handle == MonoIO.InvalidHandle)
|
||||
{
|
||||
throw new ObjectDisposedException("Stream has been closed");
|
||||
}
|
||||
if (!this.CanRead)
|
||||
{
|
||||
throw new NotSupportedException("Stream does not support reading");
|
||||
}
|
||||
if (this.buf_size != 0)
|
||||
{
|
||||
if (this.buf_offset >= this.buf_length)
|
||||
{
|
||||
this.RefillBuffer();
|
||||
if (this.buf_length == 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
return (int)this.buf[this.buf_offset++];
|
||||
}
|
||||
if (this.ReadData(this.handle, this.buf, 0, 1) == 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return (int)this.buf[0];
|
||||
}
|
||||
|
||||
/// <summary>Writes a byte to the current position in the file stream.</summary>
|
||||
/// <param name="value">A byte to write to the stream. </param>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">The stream does not support writing. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060016B0 RID: 5808 RVA: 0x00057534 File Offset: 0x00055734
|
||||
public override void WriteByte(byte value)
|
||||
{
|
||||
if (this.handle == MonoIO.InvalidHandle)
|
||||
{
|
||||
throw new ObjectDisposedException("Stream has been closed");
|
||||
}
|
||||
if (!this.CanWrite)
|
||||
{
|
||||
throw new NotSupportedException("Stream does not support writing");
|
||||
}
|
||||
if (this.buf_offset == this.buf_size)
|
||||
{
|
||||
this.FlushBuffer();
|
||||
}
|
||||
if (this.buf_size == 0)
|
||||
{
|
||||
this.buf[0] = value;
|
||||
this.buf_dirty = true;
|
||||
this.buf_length = 1;
|
||||
this.FlushBuffer();
|
||||
return;
|
||||
}
|
||||
this.buf[this.buf_offset++] = value;
|
||||
if (this.buf_offset > this.buf_length)
|
||||
{
|
||||
this.buf_length = this.buf_offset;
|
||||
}
|
||||
this.buf_dirty = true;
|
||||
}
|
||||
|
||||
/// <summary>Reads a block of bytes from the stream and writes the data in a given buffer.</summary>
|
||||
/// <returns>The total number of bytes read into the buffer. This might be less than the number of bytes requested if that number of bytes are not currently available, or zero if the end of the stream is reached.</returns>
|
||||
/// <param name="array">When this method returns, contains the specified byte array with the values between <paramref name="offset" /> and (<paramref name="offset" /> + <paramref name="count" /> - <paramref name="1)" /> replaced by the bytes read from the current source. </param>
|
||||
/// <param name="offset">The byte offset in <paramref name="array" /> at which the read bytes will be placed. </param>
|
||||
/// <param name="count">The maximum number of bytes to read. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="array" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="offset" /> or <paramref name="count" /> is negative. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">The stream does not support reading. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="offset" /> and <paramref name="count" /> describe an invalid range in <paramref name="array" />. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">Methods were called after the stream was closed. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060016B1 RID: 5809 RVA: 0x000575F4 File Offset: 0x000557F4
|
||||
public override int Read([In] [Out] byte[] array, int offset, int count)
|
||||
{
|
||||
if (this.handle == MonoIO.InvalidHandle)
|
||||
{
|
||||
throw new ObjectDisposedException("Stream has been closed");
|
||||
}
|
||||
if (array == null)
|
||||
{
|
||||
throw new ArgumentNullException("array");
|
||||
}
|
||||
if (!this.CanRead)
|
||||
{
|
||||
throw new NotSupportedException("Stream does not support reading");
|
||||
}
|
||||
int num = array.Length;
|
||||
if (offset < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("offset", "< 0");
|
||||
}
|
||||
if (count < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count", "< 0");
|
||||
}
|
||||
if (offset > num)
|
||||
{
|
||||
throw new ArgumentException("destination offset is beyond array size");
|
||||
}
|
||||
if (offset > num - count)
|
||||
{
|
||||
throw new ArgumentException("Reading would overrun buffer");
|
||||
}
|
||||
if (this.async)
|
||||
{
|
||||
IAsyncResult asyncResult = this.BeginRead(array, offset, count, null, null);
|
||||
return this.EndRead(asyncResult);
|
||||
}
|
||||
return this.ReadInternal(array, offset, count);
|
||||
}
|
||||
|
||||
// Token: 0x060016B2 RID: 5810 RVA: 0x000576C8 File Offset: 0x000558C8
|
||||
private int ReadInternal(byte[] dest, int offset, int count)
|
||||
{
|
||||
int num = 0;
|
||||
int num2 = this.ReadSegment(dest, offset, count);
|
||||
num += num2;
|
||||
count -= num2;
|
||||
if (count == 0)
|
||||
{
|
||||
return num;
|
||||
}
|
||||
if (count > this.buf_size)
|
||||
{
|
||||
this.FlushBuffer();
|
||||
num2 = this.ReadData(this.handle, dest, offset + num, count);
|
||||
this.buf_start += (long)num2;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.RefillBuffer();
|
||||
num2 = this.ReadSegment(dest, offset + num, count);
|
||||
}
|
||||
return num + num2;
|
||||
}
|
||||
|
||||
/// <summary>Begins an asynchronous read.</summary>
|
||||
/// <returns>An object that references the asynchronous read.</returns>
|
||||
/// <param name="array">The buffer to read data into. </param>
|
||||
/// <param name="offset">The byte offset in <paramref name="array" /> at which to begin reading. </param>
|
||||
/// <param name="numBytes">The maximum number of bytes to read. </param>
|
||||
/// <param name="userCallback">The method to be called when the asynchronous read operation is completed. </param>
|
||||
/// <param name="stateObject">A user-provided object that distinguishes this particular asynchronous read request from other requests. </param>
|
||||
/// <exception cref="T:System.ArgumentException">The array length minus <paramref name="offset" /> is less than <paramref name="numBytes" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="array" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="offset" /> or <paramref name="numBytes" /> is negative. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An asynchronous read was attempted past the end of the file. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060016B3 RID: 5811 RVA: 0x00057744 File Offset: 0x00055944
|
||||
public override IAsyncResult BeginRead(byte[] array, int offset, int numBytes, AsyncCallback userCallback, object stateObject)
|
||||
{
|
||||
if (this.handle == MonoIO.InvalidHandle)
|
||||
{
|
||||
throw new ObjectDisposedException("Stream has been closed");
|
||||
}
|
||||
if (!this.CanRead)
|
||||
{
|
||||
throw new NotSupportedException("This stream does not support reading");
|
||||
}
|
||||
if (array == null)
|
||||
{
|
||||
throw new ArgumentNullException("array");
|
||||
}
|
||||
if (numBytes < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("numBytes", "Must be >= 0");
|
||||
}
|
||||
if (offset < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("offset", "Must be >= 0");
|
||||
}
|
||||
if (numBytes > array.Length - offset)
|
||||
{
|
||||
throw new ArgumentException("Buffer too small. numBytes/offset wrong.");
|
||||
}
|
||||
if (!this.async)
|
||||
{
|
||||
return base.BeginRead(array, offset, numBytes, userCallback, stateObject);
|
||||
}
|
||||
FileStream.ReadDelegate readDelegate = new FileStream.ReadDelegate(this.ReadInternal);
|
||||
return readDelegate.BeginInvoke(array, offset, numBytes, userCallback, stateObject);
|
||||
}
|
||||
|
||||
/// <summary>Waits for the pending asynchronous read to complete.</summary>
|
||||
/// <returns>The number of bytes read from the stream, between 0 and the number of bytes you requested. Streams only return 0 at the end of the stream, otherwise, they should block until at least 1 byte is available.</returns>
|
||||
/// <param name="asyncResult">The reference to the pending asynchronous request to wait for. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="asyncResult" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">This <see cref="T:System.IAsyncResult" /> object was not created by calling <see cref="M:System.IO.FileStream.BeginRead(System.Byte[],System.Int32,System.Int32,System.AsyncCallback,System.Object)" /> on this class. </exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <see cref="M:System.IO.FileStream.EndRead(System.IAsyncResult)" /> is called multiple times. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">The stream is closed or an internal error has occurred.</exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060016B4 RID: 5812 RVA: 0x00057810 File Offset: 0x00055A10
|
||||
public override int EndRead(IAsyncResult asyncResult)
|
||||
{
|
||||
if (asyncResult == null)
|
||||
{
|
||||
throw new ArgumentNullException("asyncResult");
|
||||
}
|
||||
if (!this.async)
|
||||
{
|
||||
return base.EndRead(asyncResult);
|
||||
}
|
||||
AsyncResult asyncResult2 = asyncResult as AsyncResult;
|
||||
if (asyncResult2 == null)
|
||||
{
|
||||
throw new ArgumentException("Invalid IAsyncResult", "asyncResult");
|
||||
}
|
||||
FileStream.ReadDelegate readDelegate = asyncResult2.AsyncDelegate as FileStream.ReadDelegate;
|
||||
if (readDelegate == null)
|
||||
{
|
||||
throw new ArgumentException("Invalid IAsyncResult", "asyncResult");
|
||||
}
|
||||
return readDelegate.EndInvoke(asyncResult);
|
||||
}
|
||||
|
||||
/// <summary>Writes a block of bytes to this stream using data from a buffer.</summary>
|
||||
/// <param name="array">The buffer containing data to write to the stream.</param>
|
||||
/// <param name="offset">The zero-based byte offset in <paramref name="array" /> at which to begin copying bytes to the current stream. </param>
|
||||
/// <param name="count">The number of bytes to be written to the current stream. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="array" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="offset" /> and <paramref name="count" /> describe an invalid range in <paramref name="array" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="offset" /> or <paramref name="count" /> is negative. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. - or -Another thread may have caused an unexpected change in the position of the operating system's file handle. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">The current stream instance does not support writing. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060016B5 RID: 5813 RVA: 0x00057888 File Offset: 0x00055A88
|
||||
public override void Write(byte[] array, int offset, int count)
|
||||
{
|
||||
if (this.handle == MonoIO.InvalidHandle)
|
||||
{
|
||||
throw new ObjectDisposedException("Stream has been closed");
|
||||
}
|
||||
if (array == null)
|
||||
{
|
||||
throw new ArgumentNullException("array");
|
||||
}
|
||||
if (offset < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("offset", "< 0");
|
||||
}
|
||||
if (count < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count", "< 0");
|
||||
}
|
||||
if (offset > array.Length - count)
|
||||
{
|
||||
throw new ArgumentException("Reading would overrun buffer");
|
||||
}
|
||||
if (!this.CanWrite)
|
||||
{
|
||||
throw new NotSupportedException("Stream does not support writing");
|
||||
}
|
||||
if (this.async)
|
||||
{
|
||||
IAsyncResult asyncResult = this.BeginWrite(array, offset, count, null, null);
|
||||
this.EndWrite(asyncResult);
|
||||
return;
|
||||
}
|
||||
this.WriteInternal(array, offset, count);
|
||||
}
|
||||
|
||||
// Token: 0x060016B6 RID: 5814 RVA: 0x00057948 File Offset: 0x00055B48
|
||||
private void WriteInternal(byte[] src, int offset, int count)
|
||||
{
|
||||
if (count > this.buf_size)
|
||||
{
|
||||
this.FlushBuffer();
|
||||
int i = count;
|
||||
while (i > 0)
|
||||
{
|
||||
MonoIOError monoIOError;
|
||||
int num = MonoIO.Write(this.handle, src, offset, i, out monoIOError);
|
||||
if (monoIOError != MonoIOError.ERROR_SUCCESS)
|
||||
{
|
||||
throw MonoIO.GetException(this.GetSecureFileName(this.name), monoIOError);
|
||||
}
|
||||
i -= num;
|
||||
offset += num;
|
||||
}
|
||||
this.buf_start += (long)count;
|
||||
}
|
||||
else
|
||||
{
|
||||
int num2 = 0;
|
||||
while (count > 0)
|
||||
{
|
||||
int num3 = this.WriteSegment(src, offset + num2, count);
|
||||
num2 += num3;
|
||||
count -= num3;
|
||||
if (count == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
this.FlushBuffer();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Begins an asynchronous write.</summary>
|
||||
/// <returns>An object that references the asynchronous write.</returns>
|
||||
/// <param name="array">The buffer containing data to write to the current stream.</param>
|
||||
/// <param name="offset">The zero-based byte offset in <paramref name="array" /> at which to begin copying bytes to the current stream.</param>
|
||||
/// <param name="numBytes">The maximum number of bytes to write. </param>
|
||||
/// <param name="userCallback">The method to be called when the asynchronous write operation is completed. </param>
|
||||
/// <param name="stateObject">A user-provided object that distinguishes this particular asynchronous write request from other requests. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="array" /> length minus <paramref name="offset" /> is less than <paramref name="numBytes" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="array" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="offset" /> or <paramref name="numBytes" /> is negative. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">The stream does not support writing. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060016B7 RID: 5815 RVA: 0x000579F4 File Offset: 0x00055BF4
|
||||
public override IAsyncResult BeginWrite(byte[] array, int offset, int numBytes, AsyncCallback userCallback, object stateObject)
|
||||
{
|
||||
if (this.handle == MonoIO.InvalidHandle)
|
||||
{
|
||||
throw new ObjectDisposedException("Stream has been closed");
|
||||
}
|
||||
if (!this.CanWrite)
|
||||
{
|
||||
throw new NotSupportedException("This stream does not support writing");
|
||||
}
|
||||
if (array == null)
|
||||
{
|
||||
throw new ArgumentNullException("array");
|
||||
}
|
||||
if (numBytes < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("numBytes", "Must be >= 0");
|
||||
}
|
||||
if (offset < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("offset", "Must be >= 0");
|
||||
}
|
||||
if (numBytes > array.Length - offset)
|
||||
{
|
||||
throw new ArgumentException("array too small. numBytes/offset wrong.");
|
||||
}
|
||||
if (!this.async)
|
||||
{
|
||||
return base.BeginWrite(array, offset, numBytes, userCallback, stateObject);
|
||||
}
|
||||
FileStreamAsyncResult fileStreamAsyncResult = new FileStreamAsyncResult(userCallback, stateObject);
|
||||
fileStreamAsyncResult.BytesRead = -1;
|
||||
fileStreamAsyncResult.Count = numBytes;
|
||||
fileStreamAsyncResult.OriginalCount = numBytes;
|
||||
if (this.buf_dirty)
|
||||
{
|
||||
MemoryStream memoryStream = new MemoryStream();
|
||||
this.FlushBuffer(memoryStream);
|
||||
memoryStream.Write(array, offset, numBytes);
|
||||
offset = 0;
|
||||
numBytes = (int)memoryStream.Length;
|
||||
}
|
||||
FileStream.WriteDelegate writeDelegate = new FileStream.WriteDelegate(this.WriteInternal);
|
||||
return writeDelegate.BeginInvoke(array, offset, numBytes, userCallback, stateObject);
|
||||
}
|
||||
|
||||
/// <summary>Ends an asynchronous write, blocking until the I/O operation has completed.</summary>
|
||||
/// <param name="asyncResult">The pending asynchronous I/O request. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="asyncResult" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">This <see cref="T:System.IAsyncResult" /> object was not created by calling <see cref="M:System.IO.Stream.BeginWrite(System.Byte[],System.Int32,System.Int32,System.AsyncCallback,System.Object)" /> on this class. </exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">
|
||||
/// <see cref="M:System.IO.FileStream.EndWrite(System.IAsyncResult)" /> is called multiple times. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">The stream is closed or an internal error has occurred.</exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060016B8 RID: 5816 RVA: 0x00057B0C File Offset: 0x00055D0C
|
||||
public override void EndWrite(IAsyncResult asyncResult)
|
||||
{
|
||||
if (asyncResult == null)
|
||||
{
|
||||
throw new ArgumentNullException("asyncResult");
|
||||
}
|
||||
if (!this.async)
|
||||
{
|
||||
base.EndWrite(asyncResult);
|
||||
return;
|
||||
}
|
||||
AsyncResult asyncResult2 = asyncResult as AsyncResult;
|
||||
if (asyncResult2 == null)
|
||||
{
|
||||
throw new ArgumentException("Invalid IAsyncResult", "asyncResult");
|
||||
}
|
||||
FileStream.WriteDelegate writeDelegate = asyncResult2.AsyncDelegate as FileStream.WriteDelegate;
|
||||
if (writeDelegate == null)
|
||||
{
|
||||
throw new ArgumentException("Invalid IAsyncResult", "asyncResult");
|
||||
}
|
||||
writeDelegate.EndInvoke(asyncResult);
|
||||
}
|
||||
|
||||
/// <summary>Sets the current position of this stream to the given value.</summary>
|
||||
/// <returns>The new position in the stream.</returns>
|
||||
/// <param name="offset">The point relative to <paramref name="origin" /> from which to begin seeking. </param>
|
||||
/// <param name="origin">Specifies the beginning, the end, or the current position as a reference point for <paramref name="origin" />, using a value of type <see cref="T:System.IO.SeekOrigin" />. </param>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">The stream does not support seeking, such as if the FileStream is constructed from a pipe or console output. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">Attempted seeking before the beginning of the stream. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">Methods were called after the stream was closed. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060016B9 RID: 5817 RVA: 0x00057B84 File Offset: 0x00055D84
|
||||
public override long Seek(long offset, SeekOrigin origin)
|
||||
{
|
||||
if (this.handle == MonoIO.InvalidHandle)
|
||||
{
|
||||
throw new ObjectDisposedException("Stream has been closed");
|
||||
}
|
||||
if (!this.CanSeek)
|
||||
{
|
||||
throw new NotSupportedException("The stream does not support seeking");
|
||||
}
|
||||
long num;
|
||||
switch (origin)
|
||||
{
|
||||
case SeekOrigin.Begin:
|
||||
num = offset;
|
||||
break;
|
||||
case SeekOrigin.Current:
|
||||
num = this.Position + offset;
|
||||
break;
|
||||
case SeekOrigin.End:
|
||||
num = this.Length + offset;
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException("origin", "Invalid SeekOrigin");
|
||||
}
|
||||
if (num < 0L)
|
||||
{
|
||||
throw new IOException("Attempted to Seek before the beginning of the stream");
|
||||
}
|
||||
if (num < this.append_startpos)
|
||||
{
|
||||
throw new IOException("Can't seek back over pre-existing data in append mode");
|
||||
}
|
||||
this.FlushBuffer();
|
||||
MonoIOError monoIOError;
|
||||
this.buf_start = MonoIO.Seek(this.handle, num, SeekOrigin.Begin, out monoIOError);
|
||||
if (monoIOError != MonoIOError.ERROR_SUCCESS)
|
||||
{
|
||||
throw MonoIO.GetException(this.GetSecureFileName(this.name), monoIOError);
|
||||
}
|
||||
return this.buf_start;
|
||||
}
|
||||
|
||||
/// <summary>Sets the length of this stream to the given value.</summary>
|
||||
/// <param name="value">The new length of the stream. </param>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error has occurred. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">The stream does not support both writing and seeking. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">Attempted to set the <paramref name="value" /> parameter to less than 0. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060016BA RID: 5818 RVA: 0x00057C78 File Offset: 0x00055E78
|
||||
public override void SetLength(long value)
|
||||
{
|
||||
if (this.handle == MonoIO.InvalidHandle)
|
||||
{
|
||||
throw new ObjectDisposedException("Stream has been closed");
|
||||
}
|
||||
if (!this.CanSeek)
|
||||
{
|
||||
throw new NotSupportedException("The stream does not support seeking");
|
||||
}
|
||||
if (!this.CanWrite)
|
||||
{
|
||||
throw new NotSupportedException("The stream does not support writing");
|
||||
}
|
||||
if (value < 0L)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("value is less than 0");
|
||||
}
|
||||
this.Flush();
|
||||
MonoIOError monoIOError;
|
||||
MonoIO.SetLength(this.handle, value, out monoIOError);
|
||||
if (monoIOError != MonoIOError.ERROR_SUCCESS)
|
||||
{
|
||||
throw MonoIO.GetException(this.GetSecureFileName(this.name), monoIOError);
|
||||
}
|
||||
if (this.Position > value)
|
||||
{
|
||||
this.Position = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Clears all buffers for this stream and causes any buffered data to be written to the file system.</summary>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060016BB RID: 5819 RVA: 0x00057D28 File Offset: 0x00055F28
|
||||
public override void Flush()
|
||||
{
|
||||
if (this.handle == MonoIO.InvalidHandle)
|
||||
{
|
||||
throw new ObjectDisposedException("Stream has been closed");
|
||||
}
|
||||
this.FlushBuffer();
|
||||
}
|
||||
|
||||
/// <summary>Prevents other processes from changing the <see cref="T:System.IO.FileStream" />.</summary>
|
||||
/// <param name="position">The beginning of the range to lock. The value of this parameter must be equal to or greater than zero (0). </param>
|
||||
/// <param name="length">The range to be locked. </param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="position" /> or <paramref name="length" /> is negative. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The file is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">The process cannot access the file because another process has locked a portion of the file.</exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060016BC RID: 5820 RVA: 0x00057D5C File Offset: 0x00055F5C
|
||||
public virtual void Lock(long position, long length)
|
||||
{
|
||||
if (this.handle == MonoIO.InvalidHandle)
|
||||
{
|
||||
throw new ObjectDisposedException("Stream has been closed");
|
||||
}
|
||||
if (position < 0L)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("position must not be negative");
|
||||
}
|
||||
if (length < 0L)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("length must not be negative");
|
||||
}
|
||||
if (this.handle == MonoIO.InvalidHandle)
|
||||
{
|
||||
throw new ObjectDisposedException("Stream has been closed");
|
||||
}
|
||||
MonoIOError monoIOError;
|
||||
MonoIO.Lock(this.handle, position, length, out monoIOError);
|
||||
if (monoIOError != MonoIOError.ERROR_SUCCESS)
|
||||
{
|
||||
throw MonoIO.GetException(this.GetSecureFileName(this.name), monoIOError);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Allows access by other processes to all or part of a file that was previously locked.</summary>
|
||||
/// <param name="position">The beginning of the range to unlock. </param>
|
||||
/// <param name="length">The range to be unlocked. </param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="position" /> or <paramref name="length" /> is negative. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060016BD RID: 5821 RVA: 0x00057DF8 File Offset: 0x00055FF8
|
||||
public virtual void Unlock(long position, long length)
|
||||
{
|
||||
if (this.handle == MonoIO.InvalidHandle)
|
||||
{
|
||||
throw new ObjectDisposedException("Stream has been closed");
|
||||
}
|
||||
if (position < 0L)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("position must not be negative");
|
||||
}
|
||||
if (length < 0L)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("length must not be negative");
|
||||
}
|
||||
MonoIOError monoIOError;
|
||||
MonoIO.Unlock(this.handle, position, length, out monoIOError);
|
||||
if (monoIOError != MonoIOError.ERROR_SUCCESS)
|
||||
{
|
||||
throw MonoIO.GetException(this.GetSecureFileName(this.name), monoIOError);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Ensures that resources are freed and other cleanup operations are performed when the garbage collector reclaims the FileStream.</summary>
|
||||
// Token: 0x060016BE RID: 5822 RVA: 0x00057E74 File Offset: 0x00056074
|
||||
~FileStream()
|
||||
{
|
||||
this.Dispose(false);
|
||||
}
|
||||
|
||||
/// <summary>Releases the unmanaged resources used by the <see cref="T:System.IO.FileStream" /> and optionally releases the managed resources.</summary>
|
||||
/// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources. </param>
|
||||
// Token: 0x060016BF RID: 5823 RVA: 0x00057EB0 File Offset: 0x000560B0
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
Exception ex = null;
|
||||
if (this.handle != MonoIO.InvalidHandle)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.FlushBuffer();
|
||||
}
|
||||
catch (Exception ex2)
|
||||
{
|
||||
ex = ex2;
|
||||
}
|
||||
if (this.owner)
|
||||
{
|
||||
MonoIOError monoIOError;
|
||||
MonoIO.Close(this.handle, out monoIOError);
|
||||
if (monoIOError != MonoIOError.ERROR_SUCCESS)
|
||||
{
|
||||
throw MonoIO.GetException(this.GetSecureFileName(this.name), monoIOError);
|
||||
}
|
||||
this.handle = MonoIO.InvalidHandle;
|
||||
}
|
||||
}
|
||||
this.canseek = false;
|
||||
this.access = (FileAccess)0;
|
||||
if (disposing)
|
||||
{
|
||||
this.buf = null;
|
||||
}
|
||||
if (disposing)
|
||||
{
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
if (ex != null)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060016C0 RID: 5824 RVA: 0x00057F70 File Offset: 0x00056170
|
||||
private int ReadSegment(byte[] dest, int dest_offset, int count)
|
||||
{
|
||||
if (count > this.buf_length - this.buf_offset)
|
||||
{
|
||||
count = this.buf_length - this.buf_offset;
|
||||
}
|
||||
if (count > 0)
|
||||
{
|
||||
Buffer.BlockCopy(this.buf, this.buf_offset, dest, dest_offset, count);
|
||||
this.buf_offset += count;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
// Token: 0x060016C1 RID: 5825 RVA: 0x00057FCC File Offset: 0x000561CC
|
||||
private int WriteSegment(byte[] src, int src_offset, int count)
|
||||
{
|
||||
if (count > this.buf_size - this.buf_offset)
|
||||
{
|
||||
count = this.buf_size - this.buf_offset;
|
||||
}
|
||||
if (count > 0)
|
||||
{
|
||||
Buffer.BlockCopy(src, src_offset, this.buf, this.buf_offset, count);
|
||||
this.buf_offset += count;
|
||||
if (this.buf_offset > this.buf_length)
|
||||
{
|
||||
this.buf_length = this.buf_offset;
|
||||
}
|
||||
this.buf_dirty = true;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
// Token: 0x060016C2 RID: 5826 RVA: 0x0005804C File Offset: 0x0005624C
|
||||
private void FlushBuffer(Stream st)
|
||||
{
|
||||
if (this.buf_dirty)
|
||||
{
|
||||
if (this.CanSeek)
|
||||
{
|
||||
MonoIOError monoIOError;
|
||||
MonoIO.Seek(this.handle, this.buf_start, SeekOrigin.Begin, out monoIOError);
|
||||
if (monoIOError != MonoIOError.ERROR_SUCCESS)
|
||||
{
|
||||
throw MonoIO.GetException(this.GetSecureFileName(this.name), monoIOError);
|
||||
}
|
||||
}
|
||||
if (st == null)
|
||||
{
|
||||
MonoIOError monoIOError;
|
||||
MonoIO.Write(this.handle, this.buf, 0, this.buf_length, out monoIOError);
|
||||
if (monoIOError != MonoIOError.ERROR_SUCCESS)
|
||||
{
|
||||
throw MonoIO.GetException(this.GetSecureFileName(this.name), monoIOError);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
st.Write(this.buf, 0, this.buf_length);
|
||||
}
|
||||
}
|
||||
this.buf_start += (long)this.buf_offset;
|
||||
this.buf_offset = (this.buf_length = 0);
|
||||
this.buf_dirty = false;
|
||||
}
|
||||
|
||||
// Token: 0x060016C3 RID: 5827 RVA: 0x0005811C File Offset: 0x0005631C
|
||||
private void FlushBuffer()
|
||||
{
|
||||
this.FlushBuffer(null);
|
||||
}
|
||||
|
||||
// Token: 0x060016C4 RID: 5828 RVA: 0x00058128 File Offset: 0x00056328
|
||||
private void FlushBufferIfDirty()
|
||||
{
|
||||
if (this.buf_dirty)
|
||||
{
|
||||
this.FlushBuffer(null);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060016C5 RID: 5829 RVA: 0x0005813C File Offset: 0x0005633C
|
||||
private void RefillBuffer()
|
||||
{
|
||||
this.FlushBuffer(null);
|
||||
this.buf_length = this.ReadData(this.handle, this.buf, 0, this.buf_size);
|
||||
}
|
||||
|
||||
// Token: 0x060016C6 RID: 5830 RVA: 0x00058170 File Offset: 0x00056370
|
||||
private int ReadData(IntPtr handle, byte[] buf, int offset, int count)
|
||||
{
|
||||
MonoIOError monoIOError;
|
||||
int num = MonoIO.Read(handle, buf, offset, count, out monoIOError);
|
||||
if (monoIOError == MonoIOError.ERROR_BROKEN_PIPE)
|
||||
{
|
||||
num = 0;
|
||||
}
|
||||
else if (monoIOError != MonoIOError.ERROR_SUCCESS)
|
||||
{
|
||||
throw MonoIO.GetException(this.GetSecureFileName(this.name), monoIOError);
|
||||
}
|
||||
if (num == -1)
|
||||
{
|
||||
throw new IOException();
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
// Token: 0x060016C7 RID: 5831 RVA: 0x000581C4 File Offset: 0x000563C4
|
||||
private void InitBuffer(int size, bool noBuffering)
|
||||
{
|
||||
if (noBuffering)
|
||||
{
|
||||
size = 0;
|
||||
this.buf = new byte[1];
|
||||
}
|
||||
else
|
||||
{
|
||||
if (size <= 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("bufferSize", "Positive number required.");
|
||||
}
|
||||
if (size < 8)
|
||||
{
|
||||
size = 8;
|
||||
}
|
||||
this.buf = new byte[size];
|
||||
}
|
||||
this.buf_size = size;
|
||||
this.buf_start = 0L;
|
||||
this.buf_offset = (this.buf_length = 0);
|
||||
this.buf_dirty = false;
|
||||
}
|
||||
|
||||
// Token: 0x060016C8 RID: 5832 RVA: 0x00058240 File Offset: 0x00056440
|
||||
private string GetSecureFileName(string filename)
|
||||
{
|
||||
return (!this.anonymous) ? Path.GetFullPath(filename) : Path.GetFileName(filename);
|
||||
}
|
||||
|
||||
// Token: 0x060016C9 RID: 5833 RVA: 0x00058260 File Offset: 0x00056460
|
||||
private string GetSecureFileName(string filename, bool full)
|
||||
{
|
||||
return (!this.anonymous) ? ((!full) ? filename : Path.GetFullPath(filename)) : Path.GetFileName(filename);
|
||||
}
|
||||
|
||||
// Token: 0x0400068C RID: 1676
|
||||
internal const int DefaultBufferSize = 8192;
|
||||
|
||||
// Token: 0x0400068D RID: 1677
|
||||
private FileAccess access;
|
||||
|
||||
// Token: 0x0400068E RID: 1678
|
||||
private bool owner;
|
||||
|
||||
// Token: 0x0400068F RID: 1679
|
||||
private bool async;
|
||||
|
||||
// Token: 0x04000690 RID: 1680
|
||||
private bool canseek;
|
||||
|
||||
// Token: 0x04000691 RID: 1681
|
||||
private long append_startpos;
|
||||
|
||||
// Token: 0x04000692 RID: 1682
|
||||
private bool anonymous;
|
||||
|
||||
// Token: 0x04000693 RID: 1683
|
||||
private byte[] buf;
|
||||
|
||||
// Token: 0x04000694 RID: 1684
|
||||
private int buf_size;
|
||||
|
||||
// Token: 0x04000695 RID: 1685
|
||||
private int buf_length;
|
||||
|
||||
// Token: 0x04000696 RID: 1686
|
||||
private int buf_offset;
|
||||
|
||||
// Token: 0x04000697 RID: 1687
|
||||
private bool buf_dirty;
|
||||
|
||||
// Token: 0x04000698 RID: 1688
|
||||
private long buf_start;
|
||||
|
||||
// Token: 0x04000699 RID: 1689
|
||||
private string name;
|
||||
|
||||
// Token: 0x0400069A RID: 1690
|
||||
private IntPtr handle;
|
||||
|
||||
// Token: 0x0400069B RID: 1691
|
||||
private SafeFileHandle safeHandle;
|
||||
|
||||
// Token: 0x020006C7 RID: 1735
|
||||
// (Invoke) Token: 0x060041A4 RID: 16804
|
||||
private delegate int ReadDelegate(byte[] buffer, int offset, int count);
|
||||
|
||||
// Token: 0x020006C8 RID: 1736
|
||||
// (Invoke) Token: 0x060041A8 RID: 16808
|
||||
private delegate void WriteDelegate(byte[] buffer, int offset, int count);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,158 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
// Token: 0x020001BC RID: 444
|
||||
internal class FileStreamAsyncResult : IAsyncResult
|
||||
{
|
||||
// Token: 0x060016CA RID: 5834 RVA: 0x00058298 File Offset: 0x00056498
|
||||
public FileStreamAsyncResult(AsyncCallback cb, object state)
|
||||
{
|
||||
this.state = state;
|
||||
this.realcb = cb;
|
||||
if (this.realcb != null)
|
||||
{
|
||||
this.cb = new AsyncCallback(FileStreamAsyncResult.CBWrapper);
|
||||
}
|
||||
this.wh = new ManualResetEvent(false);
|
||||
}
|
||||
|
||||
// Token: 0x060016CB RID: 5835 RVA: 0x000582D8 File Offset: 0x000564D8
|
||||
private static void CBWrapper(IAsyncResult ares)
|
||||
{
|
||||
FileStreamAsyncResult fileStreamAsyncResult = (FileStreamAsyncResult)ares;
|
||||
fileStreamAsyncResult.realcb.BeginInvoke(ares, null, null);
|
||||
}
|
||||
|
||||
// Token: 0x060016CC RID: 5836 RVA: 0x000582FC File Offset: 0x000564FC
|
||||
public void SetComplete(Exception e)
|
||||
{
|
||||
this.exc = e;
|
||||
this.completed = true;
|
||||
this.wh.Set();
|
||||
if (this.cb != null)
|
||||
{
|
||||
this.cb(this);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060016CD RID: 5837 RVA: 0x00058330 File Offset: 0x00056530
|
||||
public void SetComplete(Exception e, int nbytes)
|
||||
{
|
||||
this.BytesRead = nbytes;
|
||||
this.SetComplete(e);
|
||||
}
|
||||
|
||||
// Token: 0x060016CE RID: 5838 RVA: 0x00058340 File Offset: 0x00056540
|
||||
public void SetComplete(Exception e, int nbytes, bool synch)
|
||||
{
|
||||
this.completedSynch = synch;
|
||||
this.SetComplete(e, nbytes);
|
||||
}
|
||||
|
||||
// Token: 0x17000401 RID: 1025
|
||||
// (get) Token: 0x060016CF RID: 5839 RVA: 0x00058354 File Offset: 0x00056554
|
||||
public object AsyncState
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.state;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000402 RID: 1026
|
||||
// (get) Token: 0x060016D0 RID: 5840 RVA: 0x0005835C File Offset: 0x0005655C
|
||||
public bool CompletedSynchronously
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.completedSynch;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000403 RID: 1027
|
||||
// (get) Token: 0x060016D1 RID: 5841 RVA: 0x00058364 File Offset: 0x00056564
|
||||
public WaitHandle AsyncWaitHandle
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.wh;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000404 RID: 1028
|
||||
// (get) Token: 0x060016D2 RID: 5842 RVA: 0x0005836C File Offset: 0x0005656C
|
||||
public bool IsCompleted
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.completed;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000405 RID: 1029
|
||||
// (get) Token: 0x060016D3 RID: 5843 RVA: 0x00058374 File Offset: 0x00056574
|
||||
public Exception Exception
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.exc;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000406 RID: 1030
|
||||
// (get) Token: 0x060016D4 RID: 5844 RVA: 0x0005837C File Offset: 0x0005657C
|
||||
// (set) Token: 0x060016D5 RID: 5845 RVA: 0x00058384 File Offset: 0x00056584
|
||||
public bool Done
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.done;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.done = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0400069C RID: 1692
|
||||
private object state;
|
||||
|
||||
// Token: 0x0400069D RID: 1693
|
||||
private bool completed;
|
||||
|
||||
// Token: 0x0400069E RID: 1694
|
||||
private bool done;
|
||||
|
||||
// Token: 0x0400069F RID: 1695
|
||||
private Exception exc;
|
||||
|
||||
// Token: 0x040006A0 RID: 1696
|
||||
private ManualResetEvent wh;
|
||||
|
||||
// Token: 0x040006A1 RID: 1697
|
||||
private AsyncCallback cb;
|
||||
|
||||
// Token: 0x040006A2 RID: 1698
|
||||
private bool completedSynch;
|
||||
|
||||
// Token: 0x040006A3 RID: 1699
|
||||
public byte[] Buffer;
|
||||
|
||||
// Token: 0x040006A4 RID: 1700
|
||||
public int Offset;
|
||||
|
||||
// Token: 0x040006A5 RID: 1701
|
||||
public int Count;
|
||||
|
||||
// Token: 0x040006A6 RID: 1702
|
||||
public int OriginalCount;
|
||||
|
||||
// Token: 0x040006A7 RID: 1703
|
||||
public int BytesRead;
|
||||
|
||||
// Token: 0x040006A8 RID: 1704
|
||||
private AsyncCallback realcb;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,369 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
/// <summary>Provides the base class for both <see cref="T:System.IO.FileInfo" /> and <see cref="T:System.IO.DirectoryInfo" /> objects.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x020001BD RID: 445
|
||||
[ComVisible(true)]
|
||||
[Serializable]
|
||||
public abstract class FileSystemInfo : MarshalByRefObject, ISerializable
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.FileSystemInfo" /> class.</summary>
|
||||
// Token: 0x060016D6 RID: 5846 RVA: 0x00058390 File Offset: 0x00056590
|
||||
protected FileSystemInfo()
|
||||
{
|
||||
this.valid = false;
|
||||
this.FullPath = null;
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.FileSystemInfo" /> class with serialized data.</summary>
|
||||
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data about the exception being thrown. </param>
|
||||
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">The specified <see cref="T:System.Runtime.Serialization.SerializationInfo" /> is null.</exception>
|
||||
// Token: 0x060016D7 RID: 5847 RVA: 0x000583A8 File Offset: 0x000565A8
|
||||
protected FileSystemInfo(SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
if (info == null)
|
||||
{
|
||||
throw new ArgumentNullException("info");
|
||||
}
|
||||
this.FullPath = info.GetString("FullPath");
|
||||
this.OriginalPath = info.GetString("OriginalPath");
|
||||
}
|
||||
|
||||
/// <summary>Sets the <see cref="T:System.Runtime.Serialization.SerializationInfo" /> object with the file name and additional exception information.</summary>
|
||||
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data about the exception being thrown. </param>
|
||||
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination. </param>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="SerializationFormatter" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x060016D8 RID: 5848 RVA: 0x000583E4 File Offset: 0x000565E4
|
||||
[ComVisible(false)]
|
||||
public virtual void GetObjectData(SerializationInfo info, StreamingContext context)
|
||||
{
|
||||
info.AddValue("OriginalPath", this.OriginalPath, typeof(string));
|
||||
info.AddValue("FullPath", this.FullPath, typeof(string));
|
||||
}
|
||||
|
||||
/// <summary>Gets a value indicating whether the file or directory exists.</summary>
|
||||
/// <returns>true if the file or directory exists; otherwise, false.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x17000407 RID: 1031
|
||||
// (get) Token: 0x060016D9 RID: 5849
|
||||
public abstract bool Exists { get; }
|
||||
|
||||
/// <summary>For files, gets the name of the file. For directories, gets the name of the last directory in the hierarchy if a hierarchy exists. Otherwise, the Name property gets the name of the directory.</summary>
|
||||
/// <returns>A string that is the name of the parent directory, the name of the last directory in the hierarchy, or the name of a file, including the file name extension.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x17000408 RID: 1032
|
||||
// (get) Token: 0x060016DA RID: 5850
|
||||
public abstract string Name { get; }
|
||||
|
||||
/// <summary>Gets the full path of the directory or file.</summary>
|
||||
/// <returns>A string containing the full path.</returns>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The fully qualified path and file name is 260 or more characters.</exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x17000409 RID: 1033
|
||||
// (get) Token: 0x060016DB RID: 5851 RVA: 0x00058428 File Offset: 0x00056628
|
||||
public virtual string FullName
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.FullPath;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the string representing the extension part of the file.</summary>
|
||||
/// <returns>A string containing the <see cref="T:System.IO.FileSystemInfo" /> extension.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x1700040A RID: 1034
|
||||
// (get) Token: 0x060016DC RID: 5852 RVA: 0x00058430 File Offset: 0x00056630
|
||||
public string Extension
|
||||
{
|
||||
get
|
||||
{
|
||||
return Path.GetExtension(this.Name);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the current directory or file.</summary>
|
||||
/// <returns>
|
||||
/// <see cref="T:System.IO.FileAttributes" /> of the current <see cref="T:System.IO.FileSystemInfo" />.</returns>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The specified file does not exist. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid, such as being on an unmapped drive. </exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">The caller attempts to set an invalid file attribute. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">
|
||||
/// <see cref="M:System.IO.FileSystemInfo.Refresh" /> cannot initialize the data. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x1700040B RID: 1035
|
||||
// (get) Token: 0x060016DD RID: 5853 RVA: 0x00058440 File Offset: 0x00056640
|
||||
// (set) Token: 0x060016DE RID: 5854 RVA: 0x00058454 File Offset: 0x00056654
|
||||
public FileAttributes Attributes
|
||||
{
|
||||
get
|
||||
{
|
||||
this.Refresh(false);
|
||||
return this.stat.Attributes;
|
||||
}
|
||||
set
|
||||
{
|
||||
MonoIOError monoIOError;
|
||||
if (!MonoIO.SetFileAttributes(this.FullName, value, out monoIOError))
|
||||
{
|
||||
throw MonoIO.GetException(this.FullName, monoIOError);
|
||||
}
|
||||
this.Refresh(true);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the creation time of the current directory or file.</summary>
|
||||
/// <returns>The creation date and time of the current <see cref="T:System.IO.FileSystemInfo" /> object.</returns>
|
||||
/// <exception cref="T:System.IO.IOException">
|
||||
/// <see cref="M:System.IO.FileSystemInfo.Refresh" /> cannot initialize the data. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid, such as being on an unmapped drive. </exception>
|
||||
/// <exception cref="T:System.PlatformNotSupportedException">The current operating system is not Microsoft Windows NT or later.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x1700040C RID: 1036
|
||||
// (get) Token: 0x060016DF RID: 5855 RVA: 0x00058488 File Offset: 0x00056688
|
||||
// (set) Token: 0x060016E0 RID: 5856 RVA: 0x000584A4 File Offset: 0x000566A4
|
||||
public DateTime CreationTime
|
||||
{
|
||||
get
|
||||
{
|
||||
this.Refresh(false);
|
||||
return DateTime.FromFileTime(this.stat.CreationTime);
|
||||
}
|
||||
set
|
||||
{
|
||||
long num = value.ToFileTime();
|
||||
MonoIOError monoIOError;
|
||||
if (!MonoIO.SetFileTime(this.FullName, num, -1L, -1L, out monoIOError))
|
||||
{
|
||||
throw MonoIO.GetException(this.FullName, monoIOError);
|
||||
}
|
||||
this.Refresh(true);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the creation time, in coordinated universal time (UTC), of the current directory or file.</summary>
|
||||
/// <returns>The creation date and time in UTC format of the current <see cref="T:System.IO.FileSystemInfo" /> object.</returns>
|
||||
/// <exception cref="T:System.IO.IOException">
|
||||
/// <see cref="M:System.IO.FileSystemInfo.Refresh" /> cannot initialize the data. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid, such as being on an unmapped drive. </exception>
|
||||
/// <exception cref="T:System.PlatformNotSupportedException">The current operating system is not Microsoft Windows NT or later.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x1700040D RID: 1037
|
||||
// (get) Token: 0x060016E1 RID: 5857 RVA: 0x000584E4 File Offset: 0x000566E4
|
||||
// (set) Token: 0x060016E2 RID: 5858 RVA: 0x00058500 File Offset: 0x00056700
|
||||
[ComVisible(false)]
|
||||
public DateTime CreationTimeUtc
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.CreationTime.ToUniversalTime();
|
||||
}
|
||||
set
|
||||
{
|
||||
this.CreationTime = value.ToLocalTime();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the time the current file or directory was last accessed.</summary>
|
||||
/// <returns>The time that the current file or directory was last accessed.</returns>
|
||||
/// <exception cref="T:System.IO.IOException">
|
||||
/// <see cref="M:System.IO.FileSystemInfo.Refresh" /> cannot initialize the data. </exception>
|
||||
/// <exception cref="T:System.PlatformNotSupportedException">The current operating system is not Microsoft Windows NT or later.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x1700040E RID: 1038
|
||||
// (get) Token: 0x060016E3 RID: 5859 RVA: 0x00058510 File Offset: 0x00056710
|
||||
// (set) Token: 0x060016E4 RID: 5860 RVA: 0x0005852C File Offset: 0x0005672C
|
||||
public DateTime LastAccessTime
|
||||
{
|
||||
get
|
||||
{
|
||||
this.Refresh(false);
|
||||
return DateTime.FromFileTime(this.stat.LastAccessTime);
|
||||
}
|
||||
set
|
||||
{
|
||||
long num = value.ToFileTime();
|
||||
MonoIOError monoIOError;
|
||||
if (!MonoIO.SetFileTime(this.FullName, -1L, num, -1L, out monoIOError))
|
||||
{
|
||||
throw MonoIO.GetException(this.FullName, monoIOError);
|
||||
}
|
||||
this.Refresh(true);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the time, in coordinated universal time (UTC), that the current file or directory was last accessed.</summary>
|
||||
/// <returns>The UTC time that the current file or directory was last accessed.</returns>
|
||||
/// <exception cref="T:System.IO.IOException">
|
||||
/// <see cref="M:System.IO.FileSystemInfo.Refresh" /> cannot initialize the data. </exception>
|
||||
/// <exception cref="T:System.PlatformNotSupportedException">The current operating system is not Microsoft Windows NT or later.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x1700040F RID: 1039
|
||||
// (get) Token: 0x060016E5 RID: 5861 RVA: 0x0005856C File Offset: 0x0005676C
|
||||
// (set) Token: 0x060016E6 RID: 5862 RVA: 0x00058590 File Offset: 0x00056790
|
||||
[ComVisible(false)]
|
||||
public DateTime LastAccessTimeUtc
|
||||
{
|
||||
get
|
||||
{
|
||||
this.Refresh(false);
|
||||
return this.LastAccessTime.ToUniversalTime();
|
||||
}
|
||||
set
|
||||
{
|
||||
this.LastAccessTime = value.ToLocalTime();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the time when the current file or directory was last written to.</summary>
|
||||
/// <returns>The time the current file was last written.</returns>
|
||||
/// <exception cref="T:System.IO.IOException">
|
||||
/// <see cref="M:System.IO.FileSystemInfo.Refresh" /> cannot initialize the data. </exception>
|
||||
/// <exception cref="T:System.PlatformNotSupportedException">The current operating system is not Microsoft Windows NT or later.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x17000410 RID: 1040
|
||||
// (get) Token: 0x060016E7 RID: 5863 RVA: 0x000585A0 File Offset: 0x000567A0
|
||||
// (set) Token: 0x060016E8 RID: 5864 RVA: 0x000585BC File Offset: 0x000567BC
|
||||
public DateTime LastWriteTime
|
||||
{
|
||||
get
|
||||
{
|
||||
this.Refresh(false);
|
||||
return DateTime.FromFileTime(this.stat.LastWriteTime);
|
||||
}
|
||||
set
|
||||
{
|
||||
long num = value.ToFileTime();
|
||||
MonoIOError monoIOError;
|
||||
if (!MonoIO.SetFileTime(this.FullName, -1L, -1L, num, out monoIOError))
|
||||
{
|
||||
throw MonoIO.GetException(this.FullName, monoIOError);
|
||||
}
|
||||
this.Refresh(true);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the time, in coordinated universal time (UTC), when the current file or directory was last written to.</summary>
|
||||
/// <returns>The UTC time when the current file was last written to.</returns>
|
||||
/// <exception cref="T:System.IO.IOException">
|
||||
/// <see cref="M:System.IO.FileSystemInfo.Refresh" /> cannot initialize the data. </exception>
|
||||
/// <exception cref="T:System.PlatformNotSupportedException">The current operating system is not Microsoft Windows NT or later.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x17000411 RID: 1041
|
||||
// (get) Token: 0x060016E9 RID: 5865 RVA: 0x000585FC File Offset: 0x000567FC
|
||||
// (set) Token: 0x060016EA RID: 5866 RVA: 0x00058620 File Offset: 0x00056820
|
||||
[ComVisible(false)]
|
||||
public DateTime LastWriteTimeUtc
|
||||
{
|
||||
get
|
||||
{
|
||||
this.Refresh(false);
|
||||
return this.LastWriteTime.ToUniversalTime();
|
||||
}
|
||||
set
|
||||
{
|
||||
this.LastWriteTime = value.ToLocalTime();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Deletes a file or directory.</summary>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid; for example, it is on an unmapped drive. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060016EB RID: 5867
|
||||
public abstract void Delete();
|
||||
|
||||
/// <summary>Refreshes the state of the object.</summary>
|
||||
/// <exception cref="T:System.IO.IOException">A device such as a disk drive is not ready. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060016EC RID: 5868 RVA: 0x00058630 File Offset: 0x00056830
|
||||
public void Refresh()
|
||||
{
|
||||
this.Refresh(true);
|
||||
}
|
||||
|
||||
// Token: 0x060016ED RID: 5869 RVA: 0x0005863C File Offset: 0x0005683C
|
||||
internal void Refresh(bool force)
|
||||
{
|
||||
if (this.valid && !force)
|
||||
{
|
||||
return;
|
||||
}
|
||||
MonoIOError monoIOError;
|
||||
MonoIO.GetFileStat(this.FullName, out this.stat, out monoIOError);
|
||||
this.valid = true;
|
||||
this.InternalRefresh();
|
||||
}
|
||||
|
||||
// Token: 0x060016EE RID: 5870 RVA: 0x0005867C File Offset: 0x0005687C
|
||||
internal virtual void InternalRefresh()
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x060016EF RID: 5871 RVA: 0x00058680 File Offset: 0x00056880
|
||||
internal void CheckPath(string path)
|
||||
{
|
||||
if (path == null)
|
||||
{
|
||||
throw new ArgumentNullException("path");
|
||||
}
|
||||
if (path.Length == 0)
|
||||
{
|
||||
throw new ArgumentException("An empty file name is not valid.");
|
||||
}
|
||||
if (path.IndexOfAny(Path.InvalidPathChars) != -1)
|
||||
{
|
||||
throw new ArgumentException("Illegal characters in path.");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Represents the fully qualified path of the directory or file.</summary>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The fully qualified path is 260 or more characters.</exception>
|
||||
// Token: 0x040006A9 RID: 1705
|
||||
protected string FullPath;
|
||||
|
||||
/// <summary>The path originally specified by the user, whether relative or absolute.</summary>
|
||||
// Token: 0x040006AA RID: 1706
|
||||
protected string OriginalPath;
|
||||
|
||||
// Token: 0x040006AB RID: 1707
|
||||
internal MonoIOStat stat;
|
||||
|
||||
// Token: 0x040006AC RID: 1708
|
||||
internal bool valid;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
/// <summary>The exception that is thrown when an I/O error occurs.</summary>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x020001BE RID: 446
|
||||
[ComVisible(true)]
|
||||
[Serializable]
|
||||
public class IOException : SystemException
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.IOException" /> class with its message string set to the empty string (""), its HRESULT set to COR_E_IO, and its inner exception set to a null reference.</summary>
|
||||
// Token: 0x060016F0 RID: 5872 RVA: 0x000586D0 File Offset: 0x000568D0
|
||||
public IOException()
|
||||
: base("I/O Error")
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.IOException" /> class with its message string set to <paramref name="message" />, its HRESULT set to COR_E_IO, and its inner exception set to null.</summary>
|
||||
/// <param name="message">A <see cref="T:System.String" /> that describes the error. The content of <paramref name="message" /> is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture. </param>
|
||||
// Token: 0x060016F1 RID: 5873 RVA: 0x000586E0 File Offset: 0x000568E0
|
||||
public IOException(string message)
|
||||
: base(message)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.IOException" /> class with a specified error message and a reference to the inner exception that is the cause of this exception.</summary>
|
||||
/// <param name="message">The error message that explains the reason for the exception. </param>
|
||||
/// <param name="innerException">The exception that is the cause of the current exception. If the <paramref name="innerException" /> parameter is not null, the current exception is raised in a catch block that handles the inner exception. </param>
|
||||
// Token: 0x060016F2 RID: 5874 RVA: 0x000586EC File Offset: 0x000568EC
|
||||
public IOException(string message, Exception innerException)
|
||||
: base(message, innerException)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.IOException" /> class with the specified serialization and context information.</summary>
|
||||
/// <param name="info">The data for serializing or deserializing the object. </param>
|
||||
/// <param name="context">The source and destination for the object. </param>
|
||||
// Token: 0x060016F3 RID: 5875 RVA: 0x000586F8 File Offset: 0x000568F8
|
||||
protected IOException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.IOException" /> class with its message string set to <paramref name="message" /> and its HRESULT user-defined.</summary>
|
||||
/// <param name="message">A <see cref="T:System.String" /> that describes the error. The content of <paramref name="message" /> is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture. </param>
|
||||
/// <param name="hresult">An integer identifying the error that has occurred. </param>
|
||||
// Token: 0x060016F4 RID: 5876 RVA: 0x00058704 File Offset: 0x00056904
|
||||
public IOException(string message, int hresult)
|
||||
: base(message)
|
||||
{
|
||||
base.HResult = hresult;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace System.IO.IsolatedStorage
|
||||
{
|
||||
/// <summary>Enables comparisons between an isolated store and an application domain and assembly's evidence.</summary>
|
||||
// Token: 0x0200019F RID: 415
|
||||
[ComVisible(true)]
|
||||
public interface INormalizeForIsolatedStorage
|
||||
{
|
||||
/// <summary>When overridden in a derived class, returns a normalized copy of the object on which it is called.</summary>
|
||||
/// <returns>A normalized object that represents the instance on which this method was called. This instance can be a string, stream, or any serializable object.</returns>
|
||||
// Token: 0x0600152F RID: 5423
|
||||
object Normalize();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,211 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
using System.Security.Permissions;
|
||||
|
||||
namespace System.IO.IsolatedStorage
|
||||
{
|
||||
/// <summary>Represents the abstract base class from which all isolated storage implementations must derive.</summary>
|
||||
// Token: 0x020001A0 RID: 416
|
||||
[ComVisible(true)]
|
||||
public abstract class IsolatedStorage : MarshalByRefObject
|
||||
{
|
||||
/// <summary>Gets an application identity that scopes isolated storage.</summary>
|
||||
/// <returns>An <see cref="T:System.Object" /> that represents the <see cref="F:System.IO.IsolatedStorage.IsolatedStorageScope.Application" /> identity.</returns>
|
||||
/// <exception cref="T:System.Security.SecurityException">The code lacks the required <see cref="T:System.Security.Permissions.SecurityPermission" /> to access this object. These permissions are granted by the runtime based on security policy. </exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">The <see cref="T:System.IO.IsolatedStorage.IsolatedStorage" /> object is not isolated by the application <see cref="T:System.IO.IsolatedStorage.IsolatedStorageScope" />. </exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlPolicy" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x170003C3 RID: 963
|
||||
// (get) Token: 0x06001531 RID: 5425 RVA: 0x00051404 File Offset: 0x0004F604
|
||||
[ComVisible(false)]
|
||||
[MonoTODO("requires manifest support")]
|
||||
public object ApplicationIdentity
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((this.storage_scope & IsolatedStorageScope.Application) == IsolatedStorageScope.None)
|
||||
{
|
||||
throw new InvalidOperationException(Locale.GetText("Invalid Isolation Scope."));
|
||||
}
|
||||
if (this._applicationIdentity == null)
|
||||
{
|
||||
throw new InvalidOperationException(Locale.GetText("Identity unavailable."));
|
||||
}
|
||||
throw new NotImplementedException(Locale.GetText("CAS related"));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets an assembly identity used to scope isolated storage.</summary>
|
||||
/// <returns>An <see cref="T:System.Object" /> that represents the <see cref="T:System.Reflection.Assembly" /> identity.</returns>
|
||||
/// <exception cref="T:System.Security.SecurityException">The code lacks the required <see cref="T:System.Security.Permissions.SecurityPermission" /> to access this object. </exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">The assembly is not defined.</exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlPolicy" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x170003C4 RID: 964
|
||||
// (get) Token: 0x06001532 RID: 5426 RVA: 0x0005145C File Offset: 0x0004F65C
|
||||
public object AssemblyIdentity
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((this.storage_scope & IsolatedStorageScope.Assembly) == IsolatedStorageScope.None)
|
||||
{
|
||||
throw new InvalidOperationException(Locale.GetText("Invalid Isolation Scope."));
|
||||
}
|
||||
if (this._assemblyIdentity == null)
|
||||
{
|
||||
throw new InvalidOperationException(Locale.GetText("Identity unavailable."));
|
||||
}
|
||||
return this._assemblyIdentity;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a value representing the current size of isolated storage.</summary>
|
||||
/// <returns>The number of storage units currently used within the isolated storage scope.</returns>
|
||||
/// <exception cref="T:System.InvalidOperationException">The current size of the isolated store is undefined. </exception>
|
||||
// Token: 0x170003C5 RID: 965
|
||||
// (get) Token: 0x06001533 RID: 5427 RVA: 0x000514A8 File Offset: 0x0004F6A8
|
||||
[CLSCompliant(false)]
|
||||
public virtual ulong CurrentSize
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new InvalidOperationException(Locale.GetText("IsolatedStorage does not have a preset CurrentSize."));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a domain identity that scopes isolated storage.</summary>
|
||||
/// <returns>An <see cref="T:System.Object" /> that represents the <see cref="F:System.IO.IsolatedStorage.IsolatedStorageScope.Domain" /> identity.</returns>
|
||||
/// <exception cref="T:System.Security.SecurityException">The code lacks the required <see cref="T:System.Security.Permissions.SecurityPermission" /> to access this object. These permissions are granted by the runtime based on security policy. </exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">The <see cref="T:System.IO.IsolatedStorage.IsolatedStorage" /> object is not isolated by the domain <see cref="T:System.IO.IsolatedStorage.IsolatedStorageScope" />. </exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="ControlPolicy" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x170003C6 RID: 966
|
||||
// (get) Token: 0x06001534 RID: 5428 RVA: 0x000514BC File Offset: 0x0004F6BC
|
||||
public object DomainIdentity
|
||||
{
|
||||
get
|
||||
{
|
||||
if ((this.storage_scope & IsolatedStorageScope.Domain) == IsolatedStorageScope.None)
|
||||
{
|
||||
throw new InvalidOperationException(Locale.GetText("Invalid Isolation Scope."));
|
||||
}
|
||||
if (this._domainIdentity == null)
|
||||
{
|
||||
throw new InvalidOperationException(Locale.GetText("Identity unavailable."));
|
||||
}
|
||||
return this._domainIdentity;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a value representing the maximum amount of space available for isolated storage. When overridden in a derived class, this value can take different units of measure.</summary>
|
||||
/// <returns>The maximum amount of isolated storage space in bytes. Derived classes can return different units of value.</returns>
|
||||
/// <exception cref="T:System.InvalidOperationException">The quota has not been defined. </exception>
|
||||
// Token: 0x170003C7 RID: 967
|
||||
// (get) Token: 0x06001535 RID: 5429 RVA: 0x00051508 File Offset: 0x0004F708
|
||||
[CLSCompliant(false)]
|
||||
public virtual ulong MaximumSize
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new InvalidOperationException(Locale.GetText("IsolatedStorage does not have a preset MaximumSize."));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets an <see cref="T:System.IO.IsolatedStorage.IsolatedStorageScope" /> enumeration value specifying the scope used to isolate the store.</summary>
|
||||
/// <returns>A bitwise combination of <see cref="T:System.IO.IsolatedStorage.IsolatedStorageScope" /> values specifying the scope used to isolate the store.</returns>
|
||||
// Token: 0x170003C8 RID: 968
|
||||
// (get) Token: 0x06001536 RID: 5430 RVA: 0x0005151C File Offset: 0x0004F71C
|
||||
public IsolatedStorageScope Scope
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.storage_scope;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a backslash character that can be used in a directory string. When overridden in a derived class, another character might be returned.</summary>
|
||||
/// <returns>The default implementation returns the '\' (backslash) character.</returns>
|
||||
// Token: 0x170003C9 RID: 969
|
||||
// (get) Token: 0x06001537 RID: 5431 RVA: 0x00051524 File Offset: 0x0004F724
|
||||
protected virtual char SeparatorExternal
|
||||
{
|
||||
get
|
||||
{
|
||||
return Path.DirectorySeparatorChar;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a period character that can be used in a directory string. When overridden in a derived class, another character might be returned.</summary>
|
||||
/// <returns>The default implementation returns the '.' (period) character.</returns>
|
||||
// Token: 0x170003CA RID: 970
|
||||
// (get) Token: 0x06001538 RID: 5432 RVA: 0x0005152C File Offset: 0x0004F72C
|
||||
protected virtual char SeparatorInternal
|
||||
{
|
||||
get
|
||||
{
|
||||
return '.';
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>When implemented by a derived class, returns a permission that represents access to isolated storage from within a permission set.</summary>
|
||||
/// <returns>An <see cref="T:System.Security.Permissions.IsolatedStoragePermission" /> object.</returns>
|
||||
/// <param name="ps">The <see cref="T:System.Security.PermissionSet" /> object that contains the set of permissions granted to code attempting to use isolated storage. </param>
|
||||
// Token: 0x06001539 RID: 5433
|
||||
protected abstract IsolatedStoragePermission GetPermission(PermissionSet ps);
|
||||
|
||||
/// <summary>Initializes a new <see cref="T:System.IO.IsolatedStorage.IsolatedStorage" /> object.</summary>
|
||||
/// <param name="scope">A bitwise combination of the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageScope" /> values. </param>
|
||||
/// <param name="domainEvidenceType">The type of <see cref="T:System.Security.Policy.Evidence" /> that you can choose from the list of <see cref="T:System.Security.Policy.Evidence" /> present in the domain of the calling application. null lets the <see cref="T:System.IO.IsolatedStorage.IsolatedStorage" /> object choose the evidence. </param>
|
||||
/// <param name="assemblyEvidenceType">The type of <see cref="T:System.Security.Policy.Evidence" /> that you can choose from the list of <see cref="T:System.Security.Policy.Evidence" /> present in the assembly of the calling application. null lets the <see cref="T:System.IO.IsolatedStorage.IsolatedStorage" /> object choose the evidence. </param>
|
||||
/// <exception cref="T:System.IO.IsolatedStorage.IsolatedStorageException">The assembly specified has insufficient permissions to create isolated stores. </exception>
|
||||
// Token: 0x0600153A RID: 5434 RVA: 0x00051530 File Offset: 0x0004F730
|
||||
protected void InitStore(IsolatedStorageScope scope, Type domainEvidenceType, Type assemblyEvidenceType)
|
||||
{
|
||||
switch (scope)
|
||||
{
|
||||
case IsolatedStorageScope.User | IsolatedStorageScope.Assembly:
|
||||
case IsolatedStorageScope.User | IsolatedStorageScope.Domain | IsolatedStorageScope.Assembly:
|
||||
throw new NotImplementedException(scope.ToString());
|
||||
}
|
||||
throw new ArgumentException(scope.ToString());
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new <see cref="T:System.IO.IsolatedStorage.IsolatedStorage" /> object.</summary>
|
||||
/// <param name="scope">A bitwise combination of the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageScope" /> values. </param>
|
||||
/// <param name="appEvidenceType">The type of <see cref="T:System.Security.Policy.Evidence" /> that you can choose from the list of <see cref="T:System.Security.Policy.Evidence" /> for the calling application. null lets the <see cref="T:System.IO.IsolatedStorage.IsolatedStorage" /> object choose the evidence. </param>
|
||||
/// <exception cref="T:System.IO.IsolatedStorage.IsolatedStorageException">The assembly specified has insufficient permissions to create isolated stores. </exception>
|
||||
// Token: 0x0600153B RID: 5435 RVA: 0x0005157C File Offset: 0x0004F77C
|
||||
[MonoTODO("requires manifest support")]
|
||||
protected void InitStore(IsolatedStorageScope scope, Type appEvidenceType)
|
||||
{
|
||||
if (AppDomain.CurrentDomain.ApplicationIdentity == null)
|
||||
{
|
||||
throw new IsolatedStorageException(Locale.GetText("No ApplicationIdentity available for AppDomain."));
|
||||
}
|
||||
if (appEvidenceType == null)
|
||||
{
|
||||
}
|
||||
this.storage_scope = scope;
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, removes the individual isolated store and all contained data.</summary>
|
||||
// Token: 0x0600153C RID: 5436
|
||||
public abstract void Remove();
|
||||
|
||||
// Token: 0x0400061D RID: 1565
|
||||
internal IsolatedStorageScope storage_scope;
|
||||
|
||||
// Token: 0x0400061E RID: 1566
|
||||
internal object _assemblyIdentity;
|
||||
|
||||
// Token: 0x0400061F RID: 1567
|
||||
internal object _domainIdentity;
|
||||
|
||||
// Token: 0x04000620 RID: 1568
|
||||
internal object _applicationIdentity;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace System.IO.IsolatedStorage
|
||||
{
|
||||
/// <summary>The exception that is thrown when an operation in isolated storage fails.</summary>
|
||||
// Token: 0x020001A1 RID: 417
|
||||
[ComVisible(true)]
|
||||
[Serializable]
|
||||
public class IsolatedStorageException : Exception
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageException" /> class with default properties.</summary>
|
||||
// Token: 0x0600153D RID: 5437 RVA: 0x000515B8 File Offset: 0x0004F7B8
|
||||
public IsolatedStorageException()
|
||||
: base(Locale.GetText("An Isolated storage operation failed."))
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageException" /> class with a specified error message.</summary>
|
||||
/// <param name="message">The error message that explains the reason for the exception. </param>
|
||||
// Token: 0x0600153E RID: 5438 RVA: 0x000515CC File Offset: 0x0004F7CC
|
||||
public IsolatedStorageException(string message)
|
||||
: base(message)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageException" /> class with a specified error message and a reference to the inner exception that is the cause of this exception.</summary>
|
||||
/// <param name="message">The error message that explains the reason for the exception. </param>
|
||||
/// <param name="inner">The exception that is the cause of the current exception. If the <paramref name="inner" /> parameter is not null, the current exception is raised in a catch block that handles the inner exception. </param>
|
||||
// Token: 0x0600153F RID: 5439 RVA: 0x000515D8 File Offset: 0x0004F7D8
|
||||
public IsolatedStorageException(string message, Exception inner)
|
||||
: base(message, inner)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageException" /> class with serialized data.</summary>
|
||||
/// <param name="info">The object that holds the serialized object data. </param>
|
||||
/// <param name="context">The contextual information about the source or destination. </param>
|
||||
// Token: 0x06001540 RID: 5440 RVA: 0x000515E4 File Offset: 0x0004F7E4
|
||||
protected IsolatedStorageException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,918 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Reflection;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Serialization.Formatters.Binary;
|
||||
using System.Security;
|
||||
using System.Security.Cryptography;
|
||||
using System.Security.Permissions;
|
||||
using System.Security.Policy;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using Mono.Security.Cryptography;
|
||||
|
||||
namespace System.IO.IsolatedStorage
|
||||
{
|
||||
/// <summary>Represents an isolated storage area containing files and directories.</summary>
|
||||
// Token: 0x020001A2 RID: 418
|
||||
[ComVisible(true)]
|
||||
public sealed class IsolatedStorageFile : IsolatedStorage, IDisposable
|
||||
{
|
||||
// Token: 0x06001541 RID: 5441 RVA: 0x000515F0 File Offset: 0x0004F7F0
|
||||
private IsolatedStorageFile(IsolatedStorageScope scope)
|
||||
{
|
||||
this.storage_scope = scope;
|
||||
}
|
||||
|
||||
// Token: 0x06001542 RID: 5442 RVA: 0x00051600 File Offset: 0x0004F800
|
||||
internal IsolatedStorageFile(IsolatedStorageScope scope, string location)
|
||||
{
|
||||
this.storage_scope = scope;
|
||||
this.directory = new DirectoryInfo(location);
|
||||
if (!this.directory.Exists)
|
||||
{
|
||||
string text = Locale.GetText("Invalid storage.");
|
||||
throw new IsolatedStorageException(text);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the enumerator for the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFile" /> stores within an isolated storage scope.</summary>
|
||||
/// <returns>Enumerator for the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFile" /> stores within the specified isolated storage scope.</returns>
|
||||
/// <param name="scope">Represents the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageScope" /> for which to return isolated stores. User and User|Roaming are the only IsolatedStorageScope combinations supported. </param>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.IsolatedStorageFilePermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001544 RID: 5444 RVA: 0x00051654 File Offset: 0x0004F854
|
||||
public static IEnumerator GetEnumerator(IsolatedStorageScope scope)
|
||||
{
|
||||
IsolatedStorageFile.Demand(scope);
|
||||
if (scope != IsolatedStorageScope.User && scope != (IsolatedStorageScope.User | IsolatedStorageScope.Roaming) && scope != IsolatedStorageScope.Machine)
|
||||
{
|
||||
string text = Locale.GetText("Invalid scope, only User, User|Roaming and Machine are valid");
|
||||
throw new ArgumentException(text);
|
||||
}
|
||||
return new IsolatedStorageFileEnumerator(scope, IsolatedStorageFile.GetIsolatedStorageRoot(scope));
|
||||
}
|
||||
|
||||
/// <summary>Obtains isolated storage corresponding to the given application domain and the assembly evidence objects and types.</summary>
|
||||
/// <returns>An <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFile" /> object representing the parameters.</returns>
|
||||
/// <param name="scope">A bitwise combination of the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageScope" /> values. </param>
|
||||
/// <param name="domainEvidence">An <see cref="T:System.Security.Policy.Evidence" /> object containing the application domain identity. </param>
|
||||
/// <param name="domainEvidenceType">The identity <see cref="T:System.Type" /> to choose from the application domain evidence. </param>
|
||||
/// <param name="assemblyEvidence">An <see cref="T:System.Security.Policy.Evidence" /> object containing the code assembly identity. </param>
|
||||
/// <param name="assemblyEvidenceType">The identity <see cref="T:System.Type" /> to choose from the application code assembly evidence. </param>
|
||||
/// <exception cref="T:System.Security.SecurityException">Sufficient isolated storage permissions have not been granted. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">The <paramref name="domainEvidence" /> or <paramref name="assemblyEvidence" /> identity has not been passed in. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">The <paramref name="scope" /> is invalid. </exception>
|
||||
/// <exception cref="T:System.IO.IsolatedStorage.IsolatedStorageException">An isolated storage location cannot be initialized.</exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.IsolatedStorageFilePermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="MemberAccess" />
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode, ControlEvidence" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001545 RID: 5445 RVA: 0x000516A8 File Offset: 0x0004F8A8
|
||||
public static IsolatedStorageFile GetStore(IsolatedStorageScope scope, Evidence domainEvidence, Type domainEvidenceType, Evidence assemblyEvidence, Type assemblyEvidenceType)
|
||||
{
|
||||
IsolatedStorageFile.Demand(scope);
|
||||
bool flag = (scope & IsolatedStorageScope.Domain) != IsolatedStorageScope.None;
|
||||
if (flag && domainEvidence == null)
|
||||
{
|
||||
throw new ArgumentNullException("domainEvidence");
|
||||
}
|
||||
bool flag2 = (scope & IsolatedStorageScope.Assembly) != IsolatedStorageScope.None;
|
||||
if (flag2 && assemblyEvidence == null)
|
||||
{
|
||||
throw new ArgumentNullException("assemblyEvidence");
|
||||
}
|
||||
IsolatedStorageFile isolatedStorageFile = new IsolatedStorageFile(scope);
|
||||
if (flag)
|
||||
{
|
||||
if (domainEvidenceType == null)
|
||||
{
|
||||
isolatedStorageFile._domainIdentity = IsolatedStorageFile.GetDomainIdentityFromEvidence(domainEvidence);
|
||||
}
|
||||
else
|
||||
{
|
||||
isolatedStorageFile._domainIdentity = IsolatedStorageFile.GetTypeFromEvidence(domainEvidence, domainEvidenceType);
|
||||
}
|
||||
if (isolatedStorageFile._domainIdentity == null)
|
||||
{
|
||||
throw new IsolatedStorageException(Locale.GetText("Couldn't find domain identity."));
|
||||
}
|
||||
}
|
||||
if (flag2)
|
||||
{
|
||||
if (assemblyEvidenceType == null)
|
||||
{
|
||||
isolatedStorageFile._assemblyIdentity = IsolatedStorageFile.GetAssemblyIdentityFromEvidence(assemblyEvidence);
|
||||
}
|
||||
else
|
||||
{
|
||||
isolatedStorageFile._assemblyIdentity = IsolatedStorageFile.GetTypeFromEvidence(assemblyEvidence, assemblyEvidenceType);
|
||||
}
|
||||
if (isolatedStorageFile._assemblyIdentity == null)
|
||||
{
|
||||
throw new IsolatedStorageException(Locale.GetText("Couldn't find assembly identity."));
|
||||
}
|
||||
}
|
||||
isolatedStorageFile.PostInit();
|
||||
return isolatedStorageFile;
|
||||
}
|
||||
|
||||
/// <summary>Obtains the isolated storage corresponding to the given application domain and assembly evidence objects.</summary>
|
||||
/// <returns>An <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFile" /> representing the parameters.</returns>
|
||||
/// <param name="scope">A bitwise combination of the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageScope" /> values. </param>
|
||||
/// <param name="domainIdentity">An <see cref="T:System.Object" /> that contains evidence for the application domain identity. </param>
|
||||
/// <param name="assemblyIdentity">An <see cref="T:System.Object" /> that contains evidence for the code assembly identity. </param>
|
||||
/// <exception cref="T:System.Security.SecurityException">Sufficient isolated storage permissions have not been granted. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">Neither the <paramref name="domainIdentity" /> nor <paramref name="assemblyIdentity" /> have been passed in. This verifies that the correct constructor is being used.-or- Either <paramref name="domainIdentity" /> or <paramref name="assemblyIdentity" /> are null. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">The <paramref name="scope" /> is invalid. </exception>
|
||||
/// <exception cref="T:System.IO.IsolatedStorage.IsolatedStorageException">An isolated storage location cannot be initialized.</exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.IsolatedStorageFilePermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="MemberAccess" />
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001546 RID: 5446 RVA: 0x00051798 File Offset: 0x0004F998
|
||||
public static IsolatedStorageFile GetStore(IsolatedStorageScope scope, object domainIdentity, object assemblyIdentity)
|
||||
{
|
||||
IsolatedStorageFile.Demand(scope);
|
||||
if ((scope & IsolatedStorageScope.Domain) != IsolatedStorageScope.None && domainIdentity == null)
|
||||
{
|
||||
throw new ArgumentNullException("domainIdentity");
|
||||
}
|
||||
bool flag = (scope & IsolatedStorageScope.Assembly) != IsolatedStorageScope.None;
|
||||
if (flag && assemblyIdentity == null)
|
||||
{
|
||||
throw new ArgumentNullException("assemblyIdentity");
|
||||
}
|
||||
IsolatedStorageFile isolatedStorageFile = new IsolatedStorageFile(scope);
|
||||
if (flag)
|
||||
{
|
||||
isolatedStorageFile._fullEvidences = Assembly.GetCallingAssembly().UnprotectedGetEvidence();
|
||||
}
|
||||
isolatedStorageFile._domainIdentity = domainIdentity;
|
||||
isolatedStorageFile._assemblyIdentity = assemblyIdentity;
|
||||
isolatedStorageFile.PostInit();
|
||||
return isolatedStorageFile;
|
||||
}
|
||||
|
||||
/// <summary>Obtains isolated storage corresponding to the isolated storage scope given the application domain and assembly evidence types.</summary>
|
||||
/// <returns>An <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFile" /> object representing the parameters.</returns>
|
||||
/// <param name="scope">A bitwise combination of the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageScope" /> values. </param>
|
||||
/// <param name="domainEvidenceType">The type of the <see cref="T:System.Security.Policy.Evidence" /> that you can chose from the list of <see cref="T:System.Security.Policy.Evidence" /> present in the domain of the calling application. null lets the <see cref="T:System.IO.IsolatedStorage.IsolatedStorage" /> object choose the evidence. </param>
|
||||
/// <param name="assemblyEvidenceType">The type of the <see cref="T:System.Security.Policy.Evidence" /> that you can chose from the list of <see cref="T:System.Security.Policy.Evidence" /> present in the domain of the calling application. null lets the <see cref="T:System.IO.IsolatedStorage.IsolatedStorage" /> object choose the evidence. </param>
|
||||
/// <exception cref="T:System.Security.SecurityException">Sufficient isolated storage permissions have not been granted. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">The <paramref name="scope" /> is invalid. </exception>
|
||||
/// <exception cref="T:System.IO.IsolatedStorage.IsolatedStorageException">The evidence type provided is missing in the assembly evidence list. -or-An isolated storage location cannot be initialized.</exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.IsolatedStorageFilePermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="MemberAccess" />
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001547 RID: 5447 RVA: 0x00051818 File Offset: 0x0004FA18
|
||||
public static IsolatedStorageFile GetStore(IsolatedStorageScope scope, Type domainEvidenceType, Type assemblyEvidenceType)
|
||||
{
|
||||
IsolatedStorageFile.Demand(scope);
|
||||
IsolatedStorageFile isolatedStorageFile = new IsolatedStorageFile(scope);
|
||||
if ((scope & IsolatedStorageScope.Domain) != IsolatedStorageScope.None)
|
||||
{
|
||||
if (domainEvidenceType == null)
|
||||
{
|
||||
domainEvidenceType = typeof(Url);
|
||||
}
|
||||
isolatedStorageFile._domainIdentity = IsolatedStorageFile.GetTypeFromEvidence(AppDomain.CurrentDomain.Evidence, domainEvidenceType);
|
||||
}
|
||||
if ((scope & IsolatedStorageScope.Assembly) != IsolatedStorageScope.None)
|
||||
{
|
||||
Evidence evidence = Assembly.GetCallingAssembly().UnprotectedGetEvidence();
|
||||
isolatedStorageFile._fullEvidences = evidence;
|
||||
if ((scope & IsolatedStorageScope.Domain) != IsolatedStorageScope.None)
|
||||
{
|
||||
if (assemblyEvidenceType == null)
|
||||
{
|
||||
assemblyEvidenceType = typeof(Url);
|
||||
}
|
||||
isolatedStorageFile._assemblyIdentity = IsolatedStorageFile.GetTypeFromEvidence(evidence, assemblyEvidenceType);
|
||||
}
|
||||
else
|
||||
{
|
||||
isolatedStorageFile._assemblyIdentity = IsolatedStorageFile.GetAssemblyIdentityFromEvidence(evidence);
|
||||
}
|
||||
}
|
||||
isolatedStorageFile.PostInit();
|
||||
return isolatedStorageFile;
|
||||
}
|
||||
|
||||
/// <summary>Obtains isolated storage corresponding to the given application identity.</summary>
|
||||
/// <returns>An <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFile" /> object representing the parameters.</returns>
|
||||
/// <param name="scope">A bitwise combination of the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageScope" /> values. </param>
|
||||
/// <param name="applicationIdentity">An <see cref="T:System.Object" /> that contains evidence for the application identity. </param>
|
||||
/// <exception cref="T:System.Security.SecurityException">Sufficient isolated storage permissions have not been granted. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">The <paramref name="applicationEvidence" /> identity has not been passed in. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">The <paramref name="scope" /> is invalid. </exception>
|
||||
/// <exception cref="T:System.IO.IsolatedStorage.IsolatedStorageException">An isolated storage location cannot be initialized.</exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.IsolatedStorageFilePermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="MemberAccess" />
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001548 RID: 5448 RVA: 0x000518BC File Offset: 0x0004FABC
|
||||
public static IsolatedStorageFile GetStore(IsolatedStorageScope scope, object applicationIdentity)
|
||||
{
|
||||
IsolatedStorageFile.Demand(scope);
|
||||
if (applicationIdentity == null)
|
||||
{
|
||||
throw new ArgumentNullException("applicationIdentity");
|
||||
}
|
||||
IsolatedStorageFile isolatedStorageFile = new IsolatedStorageFile(scope);
|
||||
isolatedStorageFile._applicationIdentity = applicationIdentity;
|
||||
isolatedStorageFile._fullEvidences = Assembly.GetCallingAssembly().UnprotectedGetEvidence();
|
||||
isolatedStorageFile.PostInit();
|
||||
return isolatedStorageFile;
|
||||
}
|
||||
|
||||
/// <summary>Obtains isolated storage corresponding to the isolation scope and the application identity object.</summary>
|
||||
/// <returns>An <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFile" /> object representing the parameters.</returns>
|
||||
/// <param name="scope">A bitwise combination of the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageScope" /> values. </param>
|
||||
/// <param name="applicationEvidenceType">An <see cref="T:System.Security.Policy.Evidence" /> object containing the application identity. </param>
|
||||
/// <exception cref="T:System.Security.SecurityException">Sufficient isolated storage permissions have not been granted. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">The <paramref name="domainEvidence" /> or <paramref name="assemblyEvidence" /> identity has not been passed in. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">The <paramref name="scope" /> is invalid. </exception>
|
||||
/// <exception cref="T:System.IO.IsolatedStorage.IsolatedStorageException">An isolated storage location cannot be initialized.</exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.IsolatedStorageFilePermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="MemberAccess" />
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001549 RID: 5449 RVA: 0x00051908 File Offset: 0x0004FB08
|
||||
public static IsolatedStorageFile GetStore(IsolatedStorageScope scope, Type applicationEvidenceType)
|
||||
{
|
||||
IsolatedStorageFile.Demand(scope);
|
||||
IsolatedStorageFile isolatedStorageFile = new IsolatedStorageFile(scope);
|
||||
isolatedStorageFile.InitStore(scope, applicationEvidenceType);
|
||||
isolatedStorageFile._fullEvidences = Assembly.GetCallingAssembly().UnprotectedGetEvidence();
|
||||
isolatedStorageFile.PostInit();
|
||||
return isolatedStorageFile;
|
||||
}
|
||||
|
||||
/// <summary>Obtains machine-scoped isolated storage corresponding to the calling code's application identity.</summary>
|
||||
/// <returns>An <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFile" /> object corresponding to the isolated storage scope based on the calling code's application identity.</returns>
|
||||
/// <exception cref="T:System.Security.SecurityException">Sufficient isolated storage permissions have not been granted. </exception>
|
||||
/// <exception cref="T:System.IO.IsolatedStorage.IsolatedStorageException">The application identity of the caller cannot be determined.-or- The granted permission set for the <see cref="T:System.AppDomain" /> cannot be determined.-or-An isolated storage location cannot be initialized.</exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.IsolatedStorageFilePermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="MemberAccess" />
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600154A RID: 5450 RVA: 0x00051944 File Offset: 0x0004FB44
|
||||
public static IsolatedStorageFile GetMachineStoreForApplication()
|
||||
{
|
||||
IsolatedStorageScope isolatedStorageScope = IsolatedStorageScope.Machine | IsolatedStorageScope.Application;
|
||||
IsolatedStorageFile isolatedStorageFile = new IsolatedStorageFile(isolatedStorageScope);
|
||||
isolatedStorageFile.InitStore(isolatedStorageScope, null);
|
||||
isolatedStorageFile._fullEvidences = Assembly.GetCallingAssembly().UnprotectedGetEvidence();
|
||||
isolatedStorageFile.PostInit();
|
||||
return isolatedStorageFile;
|
||||
}
|
||||
|
||||
/// <summary>Obtains machine-scoped isolated storage corresponding to the calling code's assembly identity.</summary>
|
||||
/// <returns>An <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFile" /> object corresponding to the isolated storage scope based on the calling code's assembly identity.</returns>
|
||||
/// <exception cref="T:System.Security.SecurityException">Sufficient isolated storage permissions have not been granted. </exception>
|
||||
/// <exception cref="T:System.IO.IsolatedStorage.IsolatedStorageException">An isolated storage location cannot be initialized.</exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.IsolatedStorageFilePermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="MemberAccess" />
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600154B RID: 5451 RVA: 0x0005197C File Offset: 0x0004FB7C
|
||||
public static IsolatedStorageFile GetMachineStoreForAssembly()
|
||||
{
|
||||
IsolatedStorageScope isolatedStorageScope = IsolatedStorageScope.Assembly | IsolatedStorageScope.Machine;
|
||||
IsolatedStorageFile isolatedStorageFile = new IsolatedStorageFile(isolatedStorageScope);
|
||||
Evidence evidence = Assembly.GetCallingAssembly().UnprotectedGetEvidence();
|
||||
isolatedStorageFile._fullEvidences = evidence;
|
||||
isolatedStorageFile._assemblyIdentity = IsolatedStorageFile.GetAssemblyIdentityFromEvidence(evidence);
|
||||
isolatedStorageFile.PostInit();
|
||||
return isolatedStorageFile;
|
||||
}
|
||||
|
||||
/// <summary>Obtains machine-scoped isolated storage corresponding to the application domain identity and the assembly identity.</summary>
|
||||
/// <returns>An <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFile" /> object corresponding to the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageScope" />, based on a combination of the application domain identity and the assembly identity.</returns>
|
||||
/// <exception cref="T:System.Security.SecurityException">Sufficient isolated storage permissions have not been granted. </exception>
|
||||
/// <exception cref="T:System.IO.IsolatedStorage.IsolatedStorageException">The store failed to open.-or- The assembly specified has insufficient permissions to create isolated stores.-or-An isolated storage location cannot be initialized. </exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.IsolatedStorageFilePermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="MemberAccess" />
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600154C RID: 5452 RVA: 0x000519B8 File Offset: 0x0004FBB8
|
||||
public static IsolatedStorageFile GetMachineStoreForDomain()
|
||||
{
|
||||
IsolatedStorageScope isolatedStorageScope = IsolatedStorageScope.Domain | IsolatedStorageScope.Assembly | IsolatedStorageScope.Machine;
|
||||
IsolatedStorageFile isolatedStorageFile = new IsolatedStorageFile(isolatedStorageScope);
|
||||
isolatedStorageFile._domainIdentity = IsolatedStorageFile.GetDomainIdentityFromEvidence(AppDomain.CurrentDomain.Evidence);
|
||||
Evidence evidence = Assembly.GetCallingAssembly().UnprotectedGetEvidence();
|
||||
isolatedStorageFile._fullEvidences = evidence;
|
||||
isolatedStorageFile._assemblyIdentity = IsolatedStorageFile.GetAssemblyIdentityFromEvidence(evidence);
|
||||
isolatedStorageFile.PostInit();
|
||||
return isolatedStorageFile;
|
||||
}
|
||||
|
||||
/// <summary>Obtains user-scoped isolated storage corresponding to the calling code's application identity.</summary>
|
||||
/// <returns>An <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFile" /> object corresponding to the isolated storage scope based on the calling code's assembly identity.</returns>
|
||||
/// <exception cref="T:System.Security.SecurityException">Sufficient isolated storage permissions have not been granted. </exception>
|
||||
/// <exception cref="T:System.IO.IsolatedStorage.IsolatedStorageException">An isolated storage location cannot be initialized.</exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.IsolatedStorageFilePermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="MemberAccess" />
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600154D RID: 5453 RVA: 0x00051A0C File Offset: 0x0004FC0C
|
||||
public static IsolatedStorageFile GetUserStoreForApplication()
|
||||
{
|
||||
IsolatedStorageScope isolatedStorageScope = IsolatedStorageScope.User | IsolatedStorageScope.Application;
|
||||
IsolatedStorageFile isolatedStorageFile = new IsolatedStorageFile(isolatedStorageScope);
|
||||
isolatedStorageFile.InitStore(isolatedStorageScope, null);
|
||||
isolatedStorageFile._fullEvidences = Assembly.GetCallingAssembly().UnprotectedGetEvidence();
|
||||
isolatedStorageFile.PostInit();
|
||||
return isolatedStorageFile;
|
||||
}
|
||||
|
||||
/// <summary>Obtains user-scoped isolated storage corresponding to the calling code's assembly identity.</summary>
|
||||
/// <returns>An <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFile" /> object corresponding to the isolated storage scope based on the calling code's assembly identity.</returns>
|
||||
/// <exception cref="T:System.Security.SecurityException">Sufficient isolated storage permissions have not been granted. </exception>
|
||||
/// <exception cref="T:System.IO.IsolatedStorage.IsolatedStorageException">An isolated storage location cannot be initialized.</exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.IsolatedStorageFilePermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="MemberAccess" />
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600154E RID: 5454 RVA: 0x00051A44 File Offset: 0x0004FC44
|
||||
public static IsolatedStorageFile GetUserStoreForAssembly()
|
||||
{
|
||||
IsolatedStorageScope isolatedStorageScope = IsolatedStorageScope.User | IsolatedStorageScope.Assembly;
|
||||
IsolatedStorageFile isolatedStorageFile = new IsolatedStorageFile(isolatedStorageScope);
|
||||
Evidence evidence = Assembly.GetCallingAssembly().UnprotectedGetEvidence();
|
||||
isolatedStorageFile._fullEvidences = evidence;
|
||||
isolatedStorageFile._assemblyIdentity = IsolatedStorageFile.GetAssemblyIdentityFromEvidence(evidence);
|
||||
isolatedStorageFile.PostInit();
|
||||
return isolatedStorageFile;
|
||||
}
|
||||
|
||||
/// <summary>Obtains user-scoped isolated storage corresponding to the application domain identity and assembly identity.</summary>
|
||||
/// <returns>An <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFile" /> object corresponding to the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageScope" />, based on a combination of the application domain identity and the assembly identity.</returns>
|
||||
/// <exception cref="T:System.Security.SecurityException">Sufficient isolated storage permissions have not been granted. </exception>
|
||||
/// <exception cref="T:System.IO.IsolatedStorage.IsolatedStorageException">The store failed to open.-or- The assembly specified has insufficient permissions to create isolated stores. -or-An isolated storage location cannot be initialized.</exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.IsolatedStorageFilePermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.ReflectionPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="MemberAccess" />
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600154F RID: 5455 RVA: 0x00051A80 File Offset: 0x0004FC80
|
||||
public static IsolatedStorageFile GetUserStoreForDomain()
|
||||
{
|
||||
IsolatedStorageScope isolatedStorageScope = IsolatedStorageScope.User | IsolatedStorageScope.Domain | IsolatedStorageScope.Assembly;
|
||||
IsolatedStorageFile isolatedStorageFile = new IsolatedStorageFile(isolatedStorageScope);
|
||||
isolatedStorageFile._domainIdentity = IsolatedStorageFile.GetDomainIdentityFromEvidence(AppDomain.CurrentDomain.Evidence);
|
||||
Evidence evidence = Assembly.GetCallingAssembly().UnprotectedGetEvidence();
|
||||
isolatedStorageFile._fullEvidences = evidence;
|
||||
isolatedStorageFile._assemblyIdentity = IsolatedStorageFile.GetAssemblyIdentityFromEvidence(evidence);
|
||||
isolatedStorageFile.PostInit();
|
||||
return isolatedStorageFile;
|
||||
}
|
||||
|
||||
/// <summary>Removes the specified isolated storage scope for all identities.</summary>
|
||||
/// <param name="scope">A bitwise combination of the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageScope" /> values. </param>
|
||||
/// <exception cref="T:System.IO.IsolatedStorage.IsolatedStorageException">The isolated store cannot be removed. </exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.IsolatedStorageFilePermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001550 RID: 5456 RVA: 0x00051AD0 File Offset: 0x0004FCD0
|
||||
public static void Remove(IsolatedStorageScope scope)
|
||||
{
|
||||
string isolatedStorageRoot = IsolatedStorageFile.GetIsolatedStorageRoot(scope);
|
||||
Directory.Delete(isolatedStorageRoot, true);
|
||||
}
|
||||
|
||||
// Token: 0x06001551 RID: 5457 RVA: 0x00051AEC File Offset: 0x0004FCEC
|
||||
internal static string GetIsolatedStorageRoot(IsolatedStorageScope scope)
|
||||
{
|
||||
string text = null;
|
||||
if ((scope & IsolatedStorageScope.User) != IsolatedStorageScope.None)
|
||||
{
|
||||
if ((scope & IsolatedStorageScope.Roaming) != IsolatedStorageScope.None)
|
||||
{
|
||||
text = Environment.InternalGetFolderPath(Environment.SpecialFolder.LocalApplicationData);
|
||||
}
|
||||
else
|
||||
{
|
||||
text = Environment.InternalGetFolderPath(Environment.SpecialFolder.ApplicationData);
|
||||
}
|
||||
}
|
||||
else if ((scope & IsolatedStorageScope.Machine) != IsolatedStorageScope.None)
|
||||
{
|
||||
text = Environment.InternalGetFolderPath(Environment.SpecialFolder.CommonApplicationData);
|
||||
}
|
||||
if (text == null)
|
||||
{
|
||||
string text2 = Locale.GetText("Couldn't access storage location for '{0}'.");
|
||||
throw new IsolatedStorageException(string.Format(text2, scope));
|
||||
}
|
||||
return Path.Combine(text, ".isolated-storage");
|
||||
}
|
||||
|
||||
// Token: 0x06001552 RID: 5458 RVA: 0x00051B64 File Offset: 0x0004FD64
|
||||
private static void Demand(IsolatedStorageScope scope)
|
||||
{
|
||||
if (SecurityManager.SecurityEnabled)
|
||||
{
|
||||
new IsolatedStorageFilePermission(PermissionState.None)
|
||||
{
|
||||
UsageAllowed = IsolatedStorageFile.ScopeToContainment(scope)
|
||||
}.Demand();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001553 RID: 5459 RVA: 0x00051B94 File Offset: 0x0004FD94
|
||||
private static IsolatedStorageContainment ScopeToContainment(IsolatedStorageScope scope)
|
||||
{
|
||||
switch (scope)
|
||||
{
|
||||
case IsolatedStorageScope.User | IsolatedStorageScope.Assembly:
|
||||
return IsolatedStorageContainment.AssemblyIsolationByUser;
|
||||
default:
|
||||
switch (scope)
|
||||
{
|
||||
case IsolatedStorageScope.User | IsolatedStorageScope.Assembly | IsolatedStorageScope.Roaming:
|
||||
return IsolatedStorageContainment.AssemblyIsolationByRoamingUser;
|
||||
default:
|
||||
switch (scope)
|
||||
{
|
||||
case IsolatedStorageScope.Assembly | IsolatedStorageScope.Machine:
|
||||
return IsolatedStorageContainment.AssemblyIsolationByMachine;
|
||||
default:
|
||||
if (scope == (IsolatedStorageScope.User | IsolatedStorageScope.Application))
|
||||
{
|
||||
return IsolatedStorageContainment.ApplicationIsolationByUser;
|
||||
}
|
||||
if (scope == (IsolatedStorageScope.User | IsolatedStorageScope.Roaming | IsolatedStorageScope.Application))
|
||||
{
|
||||
return IsolatedStorageContainment.ApplicationIsolationByRoamingUser;
|
||||
}
|
||||
if (scope != (IsolatedStorageScope.Machine | IsolatedStorageScope.Application))
|
||||
{
|
||||
return IsolatedStorageContainment.UnrestrictedIsolatedStorage;
|
||||
}
|
||||
return IsolatedStorageContainment.ApplicationIsolationByMachine;
|
||||
case IsolatedStorageScope.Domain | IsolatedStorageScope.Assembly | IsolatedStorageScope.Machine:
|
||||
return IsolatedStorageContainment.DomainIsolationByMachine;
|
||||
}
|
||||
break;
|
||||
case IsolatedStorageScope.User | IsolatedStorageScope.Domain | IsolatedStorageScope.Assembly | IsolatedStorageScope.Roaming:
|
||||
return IsolatedStorageContainment.DomainIsolationByRoamingUser;
|
||||
}
|
||||
break;
|
||||
case IsolatedStorageScope.User | IsolatedStorageScope.Domain | IsolatedStorageScope.Assembly:
|
||||
return IsolatedStorageContainment.DomainIsolationByUser;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001554 RID: 5460 RVA: 0x00051C20 File Offset: 0x0004FE20
|
||||
internal static ulong GetDirectorySize(DirectoryInfo di)
|
||||
{
|
||||
ulong num = 0UL;
|
||||
foreach (FileInfo fileInfo in di.GetFiles())
|
||||
{
|
||||
num += (ulong)fileInfo.Length;
|
||||
}
|
||||
foreach (DirectoryInfo directoryInfo in di.GetDirectories())
|
||||
{
|
||||
num += IsolatedStorageFile.GetDirectorySize(directoryInfo);
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
// Token: 0x06001555 RID: 5461 RVA: 0x00051C8C File Offset: 0x0004FE8C
|
||||
~IsolatedStorageFile()
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06001556 RID: 5462 RVA: 0x00051CC4 File Offset: 0x0004FEC4
|
||||
private void PostInit()
|
||||
{
|
||||
string text = IsolatedStorageFile.GetIsolatedStorageRoot(base.Scope);
|
||||
string text2;
|
||||
if (this._applicationIdentity != null)
|
||||
{
|
||||
text2 = string.Format("a{0}{1}", this.SeparatorInternal, this.GetNameFromIdentity(this._applicationIdentity));
|
||||
}
|
||||
else if (this._domainIdentity != null)
|
||||
{
|
||||
text2 = string.Format("d{0}{1}{0}{2}", this.SeparatorInternal, this.GetNameFromIdentity(this._domainIdentity), this.GetNameFromIdentity(this._assemblyIdentity));
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this._assemblyIdentity == null)
|
||||
{
|
||||
throw new IsolatedStorageException(Locale.GetText("No code identity available."));
|
||||
}
|
||||
text2 = string.Format("d{0}none{0}{1}", this.SeparatorInternal, this.GetNameFromIdentity(this._assemblyIdentity));
|
||||
}
|
||||
text = Path.Combine(text, text2);
|
||||
this.directory = new DirectoryInfo(text);
|
||||
if (!this.directory.Exists)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.directory.Create();
|
||||
this.SaveIdentities(text);
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the current size of the isolated storage.</summary>
|
||||
/// <returns>The total number of bytes of storage currently in use within the isolated storage scope.</returns>
|
||||
/// <exception cref="T:System.InvalidOperationException">The property is unavailable. The current store has a roaming scope or is not open. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The current object size is undefined.</exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x170003CB RID: 971
|
||||
// (get) Token: 0x06001557 RID: 5463 RVA: 0x00051DF0 File Offset: 0x0004FFF0
|
||||
[CLSCompliant(false)]
|
||||
public override ulong CurrentSize
|
||||
{
|
||||
get
|
||||
{
|
||||
return IsolatedStorageFile.GetDirectorySize(this.directory);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a value representing the maximum amount of space available for isolated storage within the limits established by the quota.</summary>
|
||||
/// <returns>The limit of isolated storage space in bytes.</returns>
|
||||
/// <exception cref="T:System.InvalidOperationException">The property is unavailable. <see cref="P:System.IO.IsolatedStorage.IsolatedStorageFile.MaximumSize" /> cannot be determined without evidence from the assembly's creation. The evidence could not be determined when the object was created. </exception>
|
||||
// Token: 0x170003CC RID: 972
|
||||
// (get) Token: 0x06001558 RID: 5464 RVA: 0x00051E00 File Offset: 0x00050000
|
||||
[CLSCompliant(false)]
|
||||
public override ulong MaximumSize
|
||||
{
|
||||
get
|
||||
{
|
||||
if (!SecurityManager.SecurityEnabled)
|
||||
{
|
||||
return 9223372036854775807UL;
|
||||
}
|
||||
if (this._resolved)
|
||||
{
|
||||
return this._maxSize;
|
||||
}
|
||||
Evidence evidence;
|
||||
if (this._fullEvidences != null)
|
||||
{
|
||||
evidence = this._fullEvidences;
|
||||
}
|
||||
else
|
||||
{
|
||||
evidence = new Evidence();
|
||||
if (this._assemblyIdentity != null)
|
||||
{
|
||||
evidence.AddHost(this._assemblyIdentity);
|
||||
}
|
||||
}
|
||||
if (evidence.Count < 1)
|
||||
{
|
||||
throw new InvalidOperationException(Locale.GetText("Couldn't get the quota from the available evidences."));
|
||||
}
|
||||
PermissionSet permissionSet = null;
|
||||
PermissionSet permissionSet2 = SecurityManager.ResolvePolicy(evidence, null, null, null, out permissionSet);
|
||||
IsolatedStoragePermission permission = this.GetPermission(permissionSet2);
|
||||
if (permission == null)
|
||||
{
|
||||
if (!permissionSet2.IsUnrestricted())
|
||||
{
|
||||
throw new InvalidOperationException(Locale.GetText("No quota from the available evidences."));
|
||||
}
|
||||
this._maxSize = 9223372036854775807UL;
|
||||
}
|
||||
else
|
||||
{
|
||||
this._maxSize = (ulong)permission.UserQuota;
|
||||
}
|
||||
this._resolved = true;
|
||||
return this._maxSize;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x170003CD RID: 973
|
||||
// (get) Token: 0x06001559 RID: 5465 RVA: 0x00051EF0 File Offset: 0x000500F0
|
||||
internal string Root
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.directory.FullName;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Closes a store previously opened with <see cref="M:System.IO.IsolatedStorage.IsolatedStorageFile.GetStore(System.IO.IsolatedStorage.IsolatedStorageScope,System.Type,System.Type)" />, <see cref="M:System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForAssembly" />, or <see cref="M:System.IO.IsolatedStorage.IsolatedStorageFile.GetUserStoreForDomain" />.</summary>
|
||||
// Token: 0x0600155A RID: 5466 RVA: 0x00051F00 File Offset: 0x00050100
|
||||
public void Close()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Creates a directory in the isolated storage scope.</summary>
|
||||
/// <param name="dir">The relative path of the directory to create within the isolated storage scope. </param>
|
||||
/// <exception cref="T:System.IO.IsolatedStorage.IsolatedStorageException">The current code has insufficient permissions to create isolated storage directory. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">The directory path is null. </exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600155B RID: 5467 RVA: 0x00051F04 File Offset: 0x00050104
|
||||
public void CreateDirectory(string dir)
|
||||
{
|
||||
if (dir == null)
|
||||
{
|
||||
throw new ArgumentNullException("dir");
|
||||
}
|
||||
if (dir.IndexOfAny(Path.PathSeparatorChars) < 0)
|
||||
{
|
||||
if (this.directory.GetFiles(dir).Length > 0)
|
||||
{
|
||||
throw new IOException(Locale.GetText("Directory name already exists as a file."));
|
||||
}
|
||||
this.directory.CreateSubdirectory(dir);
|
||||
}
|
||||
else
|
||||
{
|
||||
string[] array = dir.Split(Path.PathSeparatorChars);
|
||||
DirectoryInfo directoryInfo = this.directory;
|
||||
for (int i = 0; i < array.Length; i++)
|
||||
{
|
||||
if (directoryInfo.GetFiles(array[i]).Length > 0)
|
||||
{
|
||||
throw new IOException(Locale.GetText("Part of the directory name already exists as a file."));
|
||||
}
|
||||
directoryInfo = directoryInfo.CreateSubdirectory(array[i]);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Deletes a directory in the isolated storage scope.</summary>
|
||||
/// <param name="dir">The relative path of the directory to delete within the isolated storage scope. </param>
|
||||
/// <exception cref="T:System.IO.IsolatedStorage.IsolatedStorageException">The directory could not be deleted. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">The directory path was null. </exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600155C RID: 5468 RVA: 0x00051FBC File Offset: 0x000501BC
|
||||
public void DeleteDirectory(string dir)
|
||||
{
|
||||
try
|
||||
{
|
||||
DirectoryInfo directoryInfo = this.directory.CreateSubdirectory(dir);
|
||||
directoryInfo.Delete();
|
||||
}
|
||||
catch
|
||||
{
|
||||
throw new IsolatedStorageException(Locale.GetText("Could not delete directory '{0}'", new object[] { dir }));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Deletes a file in the isolated storage scope.</summary>
|
||||
/// <param name="file">The relative path of the file to delete within the isolated storage scope. </param>
|
||||
/// <exception cref="T:System.IO.IsolatedStorage.IsolatedStorageException">The target file is open or the path is incorrect. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">The file path is null. </exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600155D RID: 5469 RVA: 0x00052020 File Offset: 0x00050220
|
||||
public void DeleteFile(string file)
|
||||
{
|
||||
File.Delete(Path.Combine(this.directory.FullName, file));
|
||||
}
|
||||
|
||||
/// <summary>Releases all resources used by the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFile" />. </summary>
|
||||
// Token: 0x0600155E RID: 5470 RVA: 0x00052038 File Offset: 0x00050238
|
||||
public void Dispose()
|
||||
{
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
/// <summary>Enumerates directories in an isolated storage scope that match a given pattern.</summary>
|
||||
/// <returns>An <see cref="T:System.Array" /> of the relative paths of directories in the isolated storage scope that match <paramref name="searchPattern" />. A zero-length array specifies that there are no directories that match.</returns>
|
||||
/// <param name="searchPattern">A search pattern. Both single-character ("?") and multi-character ("*") wildcards are supported. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">The <paramref name="searchPattern" /> was null. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The caller does not have permission to enumerate directories resolved from <paramref name="searchPattern" />.</exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The isolated store has been disposed.</exception>
|
||||
/// <exception cref="T:System.InvalidOperationException">The isolated store is closed.</exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The directory or directories specified by <paramref name="searchPattern" /> are not found.</exception>
|
||||
/// <exception cref="T:System.IO.IsolatedStorage.IsolatedStorageException">The isolated store has been removed. </exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600155F RID: 5471 RVA: 0x00052040 File Offset: 0x00050240
|
||||
public string[] GetDirectoryNames(string searchPattern)
|
||||
{
|
||||
if (searchPattern == null)
|
||||
{
|
||||
throw new ArgumentNullException("searchPattern");
|
||||
}
|
||||
string directoryName = Path.GetDirectoryName(searchPattern);
|
||||
string fileName = Path.GetFileName(searchPattern);
|
||||
DirectoryInfo[] array;
|
||||
if (directoryName == null || directoryName.Length == 0)
|
||||
{
|
||||
array = this.directory.GetDirectories(searchPattern);
|
||||
}
|
||||
else
|
||||
{
|
||||
DirectoryInfo[] directories = this.directory.GetDirectories(directoryName);
|
||||
if (directories.Length != 1 || !(directories[0].Name == directoryName) || directories[0].FullName.IndexOf(this.directory.FullName) < 0)
|
||||
{
|
||||
throw new SecurityException();
|
||||
}
|
||||
array = directories[0].GetDirectories(fileName);
|
||||
}
|
||||
return this.GetNames(array);
|
||||
}
|
||||
|
||||
// Token: 0x06001560 RID: 5472 RVA: 0x000520F4 File Offset: 0x000502F4
|
||||
private string[] GetNames(FileSystemInfo[] afsi)
|
||||
{
|
||||
string[] array = new string[afsi.Length];
|
||||
for (int num = 0; num != afsi.Length; num++)
|
||||
{
|
||||
array[num] = afsi[num].Name;
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
/// <summary>Enumerates files in isolated storage scope that match a given pattern.</summary>
|
||||
/// <returns>An <see cref="T:System.Array" /> of relative paths of files in the isolated storage scope that match <paramref name="searchPattern" />. A zero-length array specifies that there are no files that match.</returns>
|
||||
/// <param name="searchPattern">A search pattern. Both single-character ("?") and multi-character ("*") wildcards are supported. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">The <paramref name="searchPattern" /> was null. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The file path specified by <paramref name="searchPattern" /> cannot be found.</exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001561 RID: 5473 RVA: 0x0005212C File Offset: 0x0005032C
|
||||
public string[] GetFileNames(string searchPattern)
|
||||
{
|
||||
if (searchPattern == null)
|
||||
{
|
||||
throw new ArgumentNullException("searchPattern");
|
||||
}
|
||||
string directoryName = Path.GetDirectoryName(searchPattern);
|
||||
string fileName = Path.GetFileName(searchPattern);
|
||||
FileInfo[] array;
|
||||
if (directoryName == null || directoryName.Length == 0)
|
||||
{
|
||||
array = this.directory.GetFiles(searchPattern);
|
||||
}
|
||||
else
|
||||
{
|
||||
DirectoryInfo[] directories = this.directory.GetDirectories(directoryName);
|
||||
if (directories.Length != 1 || !(directories[0].Name == directoryName) || directories[0].FullName.IndexOf(this.directory.FullName) < 0)
|
||||
{
|
||||
throw new SecurityException();
|
||||
}
|
||||
array = directories[0].GetFiles(fileName);
|
||||
}
|
||||
return this.GetNames(array);
|
||||
}
|
||||
|
||||
/// <summary>Removes the isolated storage scope and all its contents.</summary>
|
||||
/// <exception cref="T:System.IO.IsolatedStorage.IsolatedStorageException">The isolated store cannot be deleted. </exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001562 RID: 5474 RVA: 0x000521E0 File Offset: 0x000503E0
|
||||
public override void Remove()
|
||||
{
|
||||
this.directory.Delete(true);
|
||||
}
|
||||
|
||||
// Token: 0x06001563 RID: 5475 RVA: 0x000521F0 File Offset: 0x000503F0
|
||||
protected override IsolatedStoragePermission GetPermission(PermissionSet ps)
|
||||
{
|
||||
if (ps == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return (IsolatedStoragePermission)ps.GetPermission(typeof(IsolatedStorageFilePermission));
|
||||
}
|
||||
|
||||
// Token: 0x06001564 RID: 5476 RVA: 0x00052210 File Offset: 0x00050410
|
||||
private string GetNameFromIdentity(object identity)
|
||||
{
|
||||
byte[] bytes = Encoding.UTF8.GetBytes(identity.ToString());
|
||||
SHA1 sha = SHA1.Create();
|
||||
byte[] array = sha.ComputeHash(bytes, 0, bytes.Length);
|
||||
byte[] array2 = new byte[10];
|
||||
Buffer.BlockCopy(array, 0, array2, 0, array2.Length);
|
||||
return CryptoConvert.ToHex(array2);
|
||||
}
|
||||
|
||||
// Token: 0x06001565 RID: 5477 RVA: 0x0005225C File Offset: 0x0005045C
|
||||
private static object GetTypeFromEvidence(Evidence e, Type t)
|
||||
{
|
||||
foreach (object obj in e)
|
||||
{
|
||||
if (obj.GetType() == t)
|
||||
{
|
||||
return obj;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
// Token: 0x06001566 RID: 5478 RVA: 0x000522D0 File Offset: 0x000504D0
|
||||
internal static object GetAssemblyIdentityFromEvidence(Evidence e)
|
||||
{
|
||||
object obj = IsolatedStorageFile.GetTypeFromEvidence(e, typeof(Publisher));
|
||||
if (obj != null)
|
||||
{
|
||||
return obj;
|
||||
}
|
||||
obj = IsolatedStorageFile.GetTypeFromEvidence(e, typeof(StrongName));
|
||||
if (obj != null)
|
||||
{
|
||||
return obj;
|
||||
}
|
||||
return IsolatedStorageFile.GetTypeFromEvidence(e, typeof(Url));
|
||||
}
|
||||
|
||||
// Token: 0x06001567 RID: 5479 RVA: 0x00052320 File Offset: 0x00050520
|
||||
internal static object GetDomainIdentityFromEvidence(Evidence e)
|
||||
{
|
||||
object typeFromEvidence = IsolatedStorageFile.GetTypeFromEvidence(e, typeof(ApplicationDirectory));
|
||||
if (typeFromEvidence != null)
|
||||
{
|
||||
return typeFromEvidence;
|
||||
}
|
||||
return IsolatedStorageFile.GetTypeFromEvidence(e, typeof(Url));
|
||||
}
|
||||
|
||||
// Token: 0x06001568 RID: 5480 RVA: 0x00052358 File Offset: 0x00050558
|
||||
private void SaveIdentities(string root)
|
||||
{
|
||||
IsolatedStorageFile.Identities identities = new IsolatedStorageFile.Identities(this._applicationIdentity, this._assemblyIdentity, this._domainIdentity);
|
||||
BinaryFormatter binaryFormatter = new BinaryFormatter();
|
||||
IsolatedStorageFile.mutex.WaitOne();
|
||||
try
|
||||
{
|
||||
using (FileStream fileStream = File.Create(root + ".storage"))
|
||||
{
|
||||
binaryFormatter.Serialize(fileStream, identities);
|
||||
}
|
||||
}
|
||||
finally
|
||||
{
|
||||
IsolatedStorageFile.mutex.ReleaseMutex();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x04000621 RID: 1569
|
||||
private bool _resolved;
|
||||
|
||||
// Token: 0x04000622 RID: 1570
|
||||
private ulong _maxSize;
|
||||
|
||||
// Token: 0x04000623 RID: 1571
|
||||
private Evidence _fullEvidences;
|
||||
|
||||
// Token: 0x04000624 RID: 1572
|
||||
private static Mutex mutex = new Mutex();
|
||||
|
||||
// Token: 0x04000625 RID: 1573
|
||||
private DirectoryInfo directory;
|
||||
|
||||
// Token: 0x020001A3 RID: 419
|
||||
[Serializable]
|
||||
private struct Identities
|
||||
{
|
||||
// Token: 0x06001569 RID: 5481 RVA: 0x00052404 File Offset: 0x00050604
|
||||
public Identities(object application, object assembly, object domain)
|
||||
{
|
||||
this.Application = application;
|
||||
this.Assembly = assembly;
|
||||
this.Domain = domain;
|
||||
}
|
||||
|
||||
// Token: 0x04000626 RID: 1574
|
||||
public object Application;
|
||||
|
||||
// Token: 0x04000627 RID: 1575
|
||||
public object Assembly;
|
||||
|
||||
// Token: 0x04000628 RID: 1576
|
||||
public object Domain;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
|
||||
namespace System.IO.IsolatedStorage
|
||||
{
|
||||
// Token: 0x020001A4 RID: 420
|
||||
internal class IsolatedStorageFileEnumerator : IEnumerator
|
||||
{
|
||||
// Token: 0x0600156A RID: 5482 RVA: 0x0005241C File Offset: 0x0005061C
|
||||
public IsolatedStorageFileEnumerator(IsolatedStorageScope scope, string root)
|
||||
{
|
||||
this._scope = scope;
|
||||
if (Directory.Exists(root))
|
||||
{
|
||||
this._storages = Directory.GetDirectories(root, "d.*");
|
||||
}
|
||||
this._pos = -1;
|
||||
}
|
||||
|
||||
// Token: 0x170003CE RID: 974
|
||||
// (get) Token: 0x0600156B RID: 5483 RVA: 0x0005245C File Offset: 0x0005065C
|
||||
public object Current
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this._pos < 0 || this._storages == null || this._pos >= this._storages.Length)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
return new IsolatedStorageFile(this._scope, this._storages[this._pos]);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600156C RID: 5484 RVA: 0x000524B0 File Offset: 0x000506B0
|
||||
public bool MoveNext()
|
||||
{
|
||||
return this._storages != null && ++this._pos < this._storages.Length;
|
||||
}
|
||||
|
||||
// Token: 0x0600156D RID: 5485 RVA: 0x000524E8 File Offset: 0x000506E8
|
||||
public void Reset()
|
||||
{
|
||||
this._pos = -1;
|
||||
}
|
||||
|
||||
// Token: 0x04000629 RID: 1577
|
||||
private IsolatedStorageScope _scope;
|
||||
|
||||
// Token: 0x0400062A RID: 1578
|
||||
private string[] _storages;
|
||||
|
||||
// Token: 0x0400062B RID: 1579
|
||||
private int _pos;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,425 @@
|
||||
using System;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.InteropServices;
|
||||
using Microsoft.Win32.SafeHandles;
|
||||
|
||||
namespace System.IO.IsolatedStorage
|
||||
{
|
||||
/// <summary>Exposes a file within isolated storage.</summary>
|
||||
// Token: 0x020001A5 RID: 421
|
||||
[ComVisible(true)]
|
||||
public class IsolatedStorageFileStream : FileStream
|
||||
{
|
||||
/// <summary>Initializes a new instance of an <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFileStream" /> object giving access to the file designated by <paramref name="path" /> in the specified <paramref name="mode" />.</summary>
|
||||
/// <param name="path">The relative path of the file within isolated storage. </param>
|
||||
/// <param name="mode">One of the <see cref="T:System.IO.FileMode" /> values. </param>
|
||||
/// <exception cref="T:System.ArgumentException">The <paramref name="path" /> is badly formed. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">The <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The directory in <paramref name="path" /> does not exist. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">No file was found and the <paramref name="mode" /> is set to <see cref="F:System.IO.FileMode.Open" /></exception>
|
||||
// Token: 0x0600156E RID: 5486 RVA: 0x000524F4 File Offset: 0x000506F4
|
||||
public IsolatedStorageFileStream(string path, FileMode mode)
|
||||
: this(path, mode, (mode != FileMode.Append) ? FileAccess.ReadWrite : FileAccess.Write, FileShare.Read, 8192, null)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFileStream" /> class giving access to the file designated by <paramref name="path" />, in the specified <paramref name="mode" />, with the kind of <paramref name="access" /> requested.</summary>
|
||||
/// <param name="path">The relative path of the file within isolated storage. </param>
|
||||
/// <param name="mode">One of the <see cref="T:System.IO.FileMode" /> values. </param>
|
||||
/// <param name="access">A bitwise combination of the <see cref="T:System.IO.FileAccess" /> values. </param>
|
||||
/// <exception cref="T:System.ArgumentException">The <paramref name="path" /> is badly formed. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">The <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">No file was found and the <paramref name="mode" /> is set to <see cref="F:System.IO.FileMode.Open" />. </exception>
|
||||
// Token: 0x0600156F RID: 5487 RVA: 0x00052520 File Offset: 0x00050720
|
||||
public IsolatedStorageFileStream(string path, FileMode mode, FileAccess access)
|
||||
: this(path, mode, access, (access != FileAccess.Write) ? FileShare.Read : FileShare.None, 8192, null)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFileStream" /> class giving access to the file designated by <paramref name="path" />, in the specified <paramref name="mode" />, with the specified file <paramref name="access" />, using the file sharing mode specified by <paramref name="share" />.</summary>
|
||||
/// <param name="path">The relative path of the file within isolated storage. </param>
|
||||
/// <param name="mode">One of the <see cref="T:System.IO.FileMode" /> values. </param>
|
||||
/// <param name="access">A bitwise combination of the <see cref="T:System.IO.FileAccess" /> values. </param>
|
||||
/// <param name="share">A bitwise combination of the <see cref="T:System.IO.FileShare" /> values. </param>
|
||||
/// <exception cref="T:System.ArgumentException">The <paramref name="path" /> is badly formed. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">The <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">No file was found and the <paramref name="mode" /> is set to <see cref="F:System.IO.FileMode.Open" />. </exception>
|
||||
// Token: 0x06001570 RID: 5488 RVA: 0x0005254C File Offset: 0x0005074C
|
||||
public IsolatedStorageFileStream(string path, FileMode mode, FileAccess access, FileShare share)
|
||||
: this(path, mode, access, share, 8192, null)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFileStream" /> class giving access to the file designated by <paramref name="path" />, in the specified <paramref name="mode" />, with the specified file <paramref name="access" />, using the file sharing mode specified by <paramref name="share" />, with the <paramref name="buffersize" /> specified.</summary>
|
||||
/// <param name="path">The relative path of the file within isolated storage. </param>
|
||||
/// <param name="mode">One of the <see cref="T:System.IO.FileMode" /> values. </param>
|
||||
/// <param name="access">A bitwise combination of the <see cref="T:System.IO.FileAccess" /> values. </param>
|
||||
/// <param name="share">A bitwise combination of the <see cref="T:System.IO.FileShare" /> values. </param>
|
||||
/// <param name="bufferSize">The <see cref="T:System.IO.FileStream" /> buffer size. </param>
|
||||
/// <exception cref="T:System.ArgumentException">The <paramref name="path" /> is badly formed. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">The <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">No file was found and the <paramref name="mode" /> is set to <see cref="F:System.IO.FileMode.Open" />. </exception>
|
||||
// Token: 0x06001571 RID: 5489 RVA: 0x00052560 File Offset: 0x00050760
|
||||
public IsolatedStorageFileStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize)
|
||||
: this(path, mode, access, share, bufferSize, null)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFileStream" /> class giving access to the file designated by <paramref name="path" />, in the specified <paramref name="mode" />, with the specified file <paramref name="access" />, using the file sharing mode specified by <paramref name="share" />, with the <paramref name="buffersize" /> specified, and in the context of the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFile" /> specified by <paramref name="isf" />.</summary>
|
||||
/// <param name="path">The relative path of the file within isolated storage. </param>
|
||||
/// <param name="mode">One of the <see cref="T:System.IO.FileMode" /> values. </param>
|
||||
/// <param name="access">A bitwise combination of the <see cref="T:System.IO.FileAccess" /> values. </param>
|
||||
/// <param name="share">A bitwise combination of the <see cref="T:System.IO.FileShare" /> values </param>
|
||||
/// <param name="bufferSize">The <see cref="T:System.IO.FileStream" /> buffer size. </param>
|
||||
/// <param name="isf">The <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFile" /> in which to open the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFileStream" />. </param>
|
||||
/// <exception cref="T:System.ArgumentException">The <paramref name="path" /> is badly formed. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">The <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">No file was found and the <paramref name="mode" /> is set to <see cref="F:System.IO.FileMode.Open" />. </exception>
|
||||
/// <exception cref="T:System.IO.IsolatedStorage.IsolatedStorageException">
|
||||
/// <paramref name="isf" /> does not have a quota. </exception>
|
||||
// Token: 0x06001572 RID: 5490 RVA: 0x00052570 File Offset: 0x00050770
|
||||
public IsolatedStorageFileStream(string path, FileMode mode, FileAccess access, FileShare share, int bufferSize, IsolatedStorageFile isf)
|
||||
: base(IsolatedStorageFileStream.CreateIsolatedPath(isf, path, mode), mode, access, share, bufferSize, false, true)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFileStream" /> class giving access to the file designated by <paramref name="path" />, in the specified <paramref name="mode" />, with the specified file <paramref name="access" />, using the file sharing mode specified by <paramref name="share" />, and in the context of the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFile" /> specified by <paramref name="isf" />.</summary>
|
||||
/// <param name="path">The relative path of the file within isolated storage. </param>
|
||||
/// <param name="mode">One of the <see cref="T:System.IO.FileMode" /> values. </param>
|
||||
/// <param name="access">A bitwise combination of the <see cref="T:System.IO.FileAccess" /> values. </param>
|
||||
/// <param name="share">A bitwise combination of the <see cref="T:System.IO.FileShare" /> values. </param>
|
||||
/// <param name="isf">The <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFile" /> in which to open the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFileStream" />. </param>
|
||||
/// <exception cref="T:System.ArgumentException">The <paramref name="path" /> is badly formed. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">The <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">No file was found and the <paramref name="mode" /> is set to <see cref="F:System.IO.FileMode.Open" />. </exception>
|
||||
/// <exception cref="T:System.IO.IsolatedStorage.IsolatedStorageException">
|
||||
/// <paramref name="isf" /> does not have a quota. </exception>
|
||||
// Token: 0x06001573 RID: 5491 RVA: 0x00052594 File Offset: 0x00050794
|
||||
public IsolatedStorageFileStream(string path, FileMode mode, FileAccess access, FileShare share, IsolatedStorageFile isf)
|
||||
: this(path, mode, access, share, 8192, isf)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFileStream" /> class giving access to the file designated by <paramref name="path" /> in the specified <paramref name="mode" />, with the specified file <paramref name="access" />, and in the context of the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFile" /> specified by <paramref name="isf" />.</summary>
|
||||
/// <param name="path">The relative path of the file within isolated storage. </param>
|
||||
/// <param name="mode">One of the <see cref="T:System.IO.FileMode" /> values. </param>
|
||||
/// <param name="access">A bitwise combination of the <see cref="T:System.IO.FileAccess" /> values. </param>
|
||||
/// <param name="isf">The <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFile" /> in which to open the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFileStream" />. </param>
|
||||
/// <exception cref="T:System.ArgumentException">The <paramref name="path" /> is badly formed. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">The <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The isolated store is closed.</exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">No file was found and the <paramref name="mode" /> is set to <see cref="F:System.IO.FileMode.Open" />. </exception>
|
||||
/// <exception cref="T:System.IO.IsolatedStorage.IsolatedStorageException">
|
||||
/// <paramref name="isf" /> does not have a quota. </exception>
|
||||
// Token: 0x06001574 RID: 5492 RVA: 0x000525A8 File Offset: 0x000507A8
|
||||
public IsolatedStorageFileStream(string path, FileMode mode, FileAccess access, IsolatedStorageFile isf)
|
||||
: this(path, mode, access, (access != FileAccess.Write) ? FileShare.Read : FileShare.None, 8192, isf)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFileStream" /> class giving access to the file designated by <paramref name="path" />, in the specified <paramref name="mode" />, and in the context of the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFile" /> specified by <paramref name="isf" />.</summary>
|
||||
/// <param name="path">The relative path of the file within isolated storage. </param>
|
||||
/// <param name="mode">One of the <see cref="T:System.IO.FileMode" /> values. </param>
|
||||
/// <param name="isf">The <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFile" /> in which to open the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFileStream" />. </param>
|
||||
/// <exception cref="T:System.ArgumentException">The <paramref name="path" /> is badly formed. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">The <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">No file was found and the <paramref name="mode" /> is set to <see cref="F:System.IO.FileMode.Open" />. </exception>
|
||||
/// <exception cref="T:System.IO.IsolatedStorage.IsolatedStorageException">
|
||||
/// <paramref name="isf" /> does not have a quota. </exception>
|
||||
// Token: 0x06001575 RID: 5493 RVA: 0x000525D4 File Offset: 0x000507D4
|
||||
public IsolatedStorageFileStream(string path, FileMode mode, IsolatedStorageFile isf)
|
||||
: this(path, mode, (mode != FileMode.Append) ? FileAccess.ReadWrite : FileAccess.Write, FileShare.Read, 8192, isf)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06001576 RID: 5494 RVA: 0x00052600 File Offset: 0x00050800
|
||||
private static string CreateIsolatedPath(IsolatedStorageFile isf, string path, FileMode mode)
|
||||
{
|
||||
if (path == null)
|
||||
{
|
||||
throw new ArgumentNullException("path");
|
||||
}
|
||||
if (!Enum.IsDefined(typeof(FileMode), mode))
|
||||
{
|
||||
throw new ArgumentException("mode");
|
||||
}
|
||||
if (isf == null)
|
||||
{
|
||||
StackFrame stackFrame = new StackFrame(3);
|
||||
isf = IsolatedStorageFile.GetStore(IsolatedStorageScope.User | IsolatedStorageScope.Domain | IsolatedStorageScope.Assembly, IsolatedStorageFile.GetDomainIdentityFromEvidence(AppDomain.CurrentDomain.Evidence), IsolatedStorageFile.GetAssemblyIdentityFromEvidence(stackFrame.GetMethod().ReflectedType.Assembly.UnprotectedGetEvidence()));
|
||||
}
|
||||
FileInfo fileInfo = new FileInfo(isf.Root);
|
||||
if (!fileInfo.Directory.Exists)
|
||||
{
|
||||
fileInfo.Directory.Create();
|
||||
}
|
||||
if (Path.IsPathRooted(path))
|
||||
{
|
||||
string pathRoot = Path.GetPathRoot(path);
|
||||
path = path.Remove(0, pathRoot.Length);
|
||||
}
|
||||
string text = Path.Combine(isf.Root, path);
|
||||
string text2 = Path.GetFullPath(text);
|
||||
text2 = Path.GetFullPath(text);
|
||||
if (!text2.StartsWith(isf.Root))
|
||||
{
|
||||
throw new IsolatedStorageException();
|
||||
}
|
||||
fileInfo = new FileInfo(text);
|
||||
if (!fileInfo.Directory.Exists)
|
||||
{
|
||||
string text3 = Locale.GetText("Could not find a part of the path \"{0}\".");
|
||||
throw new DirectoryNotFoundException(string.Format(text3, path));
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
/// <summary>Gets a Boolean value indicating whether the file can be read.</summary>
|
||||
/// <returns>true if an <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFileStream" /> object can be read; otherwise, false.</returns>
|
||||
// Token: 0x170003CF RID: 975
|
||||
// (get) Token: 0x06001577 RID: 5495 RVA: 0x00052730 File Offset: 0x00050930
|
||||
public override bool CanRead
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.CanRead;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a Boolean value indicating whether seek operations are supported.</summary>
|
||||
/// <returns>true if an <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFileStream" /> object supports seek operations; otherwise, false.</returns>
|
||||
// Token: 0x170003D0 RID: 976
|
||||
// (get) Token: 0x06001578 RID: 5496 RVA: 0x00052738 File Offset: 0x00050938
|
||||
public override bool CanSeek
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.CanSeek;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a Boolean value indicating whether you can write to the file.</summary>
|
||||
/// <returns>true if an <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFileStream" /> object can be written; otherwise, false.</returns>
|
||||
// Token: 0x170003D1 RID: 977
|
||||
// (get) Token: 0x06001579 RID: 5497 RVA: 0x00052740 File Offset: 0x00050940
|
||||
public override bool CanWrite
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.CanWrite;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a <see cref="T:Microsoft.Win32.SafeHandles.SafeFileHandle" /> object that represents the operating system file handle for the file that the current <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFileStream" /> object encapsulates.</summary>
|
||||
/// <returns>A <see cref="T:Microsoft.Win32.SafeHandles.SafeFileHandle" /> object that represents the operating system file handle for the file that the current <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFileStream" /> object encapsulates.</returns>
|
||||
/// <exception cref="T:System.IO.IsolatedStorage.IsolatedStorageException">The <see cref="P:System.IO.IsolatedStorage.IsolatedStorageFileStream.SafeFileHandle" /> property always generates this exception. </exception>
|
||||
/// <exception cref="F:System.Security.Permissions.SecurityAction.LinkDemand">for full trust for the immediate caller. This member cannot be used by partially trusted code.</exception>
|
||||
/// <exception cref="F:System.Security.Permissions.SecurityAction.InheritanceDemand">for full trust for inheritors. This class cannot be inherited by partially trusted code. Associated enumeration: <see cref="F:System.Security.Permissions.SecurityPermissionFlag.UnmanagedCode" /></exception>
|
||||
// Token: 0x170003D2 RID: 978
|
||||
// (get) Token: 0x0600157A RID: 5498 RVA: 0x00052748 File Offset: 0x00050948
|
||||
public override SafeFileHandle SafeFileHandle
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new IsolatedStorageException(Locale.GetText("Information is restricted"));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the file handle for the file that the current <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFileStream" /> object encapsulates. Accessing this property is not permitted on an <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFileStream" /> object, and throws an <see cref="T:System.IO.IsolatedStorage.IsolatedStorageException" />.</summary>
|
||||
/// <returns>The file handle for the file that the current <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFileStream" /> object encapsulates.</returns>
|
||||
/// <exception cref="T:System.IO.IsolatedStorage.IsolatedStorageException">The <see cref="P:System.IO.IsolatedStorage.IsolatedStorageFileStream.Handle" /> property always generates this exception.</exception>
|
||||
/// <exception cref="F:System.Security.Permissions.SecurityAction.LinkDemand">for full trust for the immediate caller. This member cannot be used by partially trusted code.</exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x170003D3 RID: 979
|
||||
// (get) Token: 0x0600157B RID: 5499 RVA: 0x0005275C File Offset: 0x0005095C
|
||||
[Obsolete("Use SafeFileHandle - once available")]
|
||||
public override IntPtr Handle
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new IsolatedStorageException(Locale.GetText("Information is restricted"));
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a Boolean value indicating whether the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFileStream" /> object was opened asynchronously or synchronously.</summary>
|
||||
/// <returns>true if the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFileStream" /> object supports asynchronous access; otherwise, false.</returns>
|
||||
// Token: 0x170003D4 RID: 980
|
||||
// (get) Token: 0x0600157C RID: 5500 RVA: 0x00052770 File Offset: 0x00050970
|
||||
public override bool IsAsync
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.IsAsync;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the length of the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFileStream" /> object.</summary>
|
||||
/// <returns>The length of the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFileStream" /> object in bytes.</returns>
|
||||
// Token: 0x170003D5 RID: 981
|
||||
// (get) Token: 0x0600157D RID: 5501 RVA: 0x00052778 File Offset: 0x00050978
|
||||
public override long Length
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Length;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the current position of the current <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFileStream" /> object.</summary>
|
||||
/// <returns>The current position of this <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFileStream" /> object.</returns>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">The position cannot be set to a negative number. </exception>
|
||||
// Token: 0x170003D6 RID: 982
|
||||
// (get) Token: 0x0600157E RID: 5502 RVA: 0x00052780 File Offset: 0x00050980
|
||||
// (set) Token: 0x0600157F RID: 5503 RVA: 0x00052788 File Offset: 0x00050988
|
||||
public override long Position
|
||||
{
|
||||
get
|
||||
{
|
||||
return base.Position;
|
||||
}
|
||||
set
|
||||
{
|
||||
base.Position = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Begins an asynchronous read.</summary>
|
||||
/// <returns>An <see cref="T:System.IAsyncResult" /> object that represents the asynchronous read, which is possibly still pending. This <see cref="T:System.IAsyncResult" /> must be passed to this stream's <see cref="M:System.IO.IsolatedStorage.IsolatedStorageFileStream.EndRead(System.IAsyncResult)" /> method to determine how many bytes were read. This can be done either by the same code that called <see cref="M:System.IO.IsolatedStorage.IsolatedStorageFileStream.BeginRead(System.Byte[],System.Int32,System.Int32,System.AsyncCallback,System.Object)" /> or in a callback passed to <see cref="M:System.IO.IsolatedStorage.IsolatedStorageFileStream.BeginRead(System.Byte[],System.Int32,System.Int32,System.AsyncCallback,System.Object)" />.</returns>
|
||||
/// <param name="buffer">The buffer to read data into. </param>
|
||||
/// <param name="offset">The byte offset in <paramref name="buffer" /> at which to begin reading. </param>
|
||||
/// <param name="numBytes">The maximum number of bytes to read. </param>
|
||||
/// <param name="userCallback">The method to call when the asynchronous read operation is completed. This parameter is optional. </param>
|
||||
/// <param name="stateObject">The status of the asynchronous read. </param>
|
||||
/// <exception cref="T:System.IO.IOException">An asynchronous read was attempted past the end of the file. </exception>
|
||||
// Token: 0x06001580 RID: 5504 RVA: 0x00052794 File Offset: 0x00050994
|
||||
public override IAsyncResult BeginRead(byte[] buffer, int offset, int numBytes, AsyncCallback userCallback, object stateObject)
|
||||
{
|
||||
return base.BeginRead(buffer, offset, numBytes, userCallback, stateObject);
|
||||
}
|
||||
|
||||
/// <summary>Begins an asynchronous write.</summary>
|
||||
/// <returns>An <see cref="T:System.IAsyncResult" /> that represents the asynchronous write, which is possibly still pending. This <see cref="T:System.IAsyncResult" /> must be passed to this stream's <see cref="M:System.IO.Stream.EndWrite(System.IAsyncResult)" /> method to ensure that the write is complete, then frees resources appropriately. This can be done either by the same code that called <see cref="M:System.IO.Stream.BeginWrite(System.Byte[],System.Int32,System.Int32,System.AsyncCallback,System.Object)" /> or in a callback passed to <see cref="M:System.IO.Stream.BeginWrite(System.Byte[],System.Int32,System.Int32,System.AsyncCallback,System.Object)" />.</returns>
|
||||
/// <param name="buffer">The buffer to write data to. </param>
|
||||
/// <param name="offset">The byte offset in <paramref name="buffer" /> at which to begin writing. </param>
|
||||
/// <param name="numBytes">The maximum number of bytes to write. </param>
|
||||
/// <param name="userCallback">The method to call when the asynchronous write operation is completed. This parameter is optional. </param>
|
||||
/// <param name="stateObject">The status of the asynchronous write. </param>
|
||||
/// <exception cref="T:System.IO.IOException">An asynchronous write was attempted past the end of the file. </exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001581 RID: 5505 RVA: 0x000527A4 File Offset: 0x000509A4
|
||||
public override IAsyncResult BeginWrite(byte[] buffer, int offset, int numBytes, AsyncCallback userCallback, object stateObject)
|
||||
{
|
||||
return base.BeginWrite(buffer, offset, numBytes, userCallback, stateObject);
|
||||
}
|
||||
|
||||
/// <summary>Ends a pending asynchronous read request.</summary>
|
||||
/// <returns>The number of bytes read from the stream, between zero and the number of requested bytes. Streams will only return zero at the end of the stream. Otherwise, they will block until at least one byte is available.</returns>
|
||||
/// <param name="asyncResult">The pending asynchronous request. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">The <paramref name="asyncResult" /> is null. </exception>
|
||||
// Token: 0x06001582 RID: 5506 RVA: 0x000527B4 File Offset: 0x000509B4
|
||||
public override int EndRead(IAsyncResult asyncResult)
|
||||
{
|
||||
return base.EndRead(asyncResult);
|
||||
}
|
||||
|
||||
/// <summary>Ends an asynchronous write.</summary>
|
||||
/// <param name="asyncResult">The pending asynchronous I/O request to end. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">The <paramref name="asyncResult" /> parameter is null. </exception>
|
||||
// Token: 0x06001583 RID: 5507 RVA: 0x000527C0 File Offset: 0x000509C0
|
||||
public override void EndWrite(IAsyncResult asyncResult)
|
||||
{
|
||||
base.EndWrite(asyncResult);
|
||||
}
|
||||
|
||||
/// <summary>Updates the file with the current state of the buffer then clears the buffer.</summary>
|
||||
// Token: 0x06001584 RID: 5508 RVA: 0x000527CC File Offset: 0x000509CC
|
||||
public override void Flush()
|
||||
{
|
||||
base.Flush();
|
||||
}
|
||||
|
||||
/// <summary>Copies bytes from the current buffered <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFileStream" /> object to an array.</summary>
|
||||
/// <returns>The total number of bytes read into the <paramref name="buffer" />. This can be less than the number of bytes requested if that many bytes are not currently available, or zero if the end of the stream is reached.</returns>
|
||||
/// <param name="buffer">The buffer to read. </param>
|
||||
/// <param name="offset">The offset in the buffer at which to begin writing. </param>
|
||||
/// <param name="count">The maximum number of bytes to read. </param>
|
||||
// Token: 0x06001585 RID: 5509 RVA: 0x000527D4 File Offset: 0x000509D4
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
return base.Read(buffer, offset, count);
|
||||
}
|
||||
|
||||
/// <summary>Reads a single byte from the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFileStream" /> object in isolated storage.</summary>
|
||||
/// <returns>The 8-bit unsigned integer value read from the isolated storage file.</returns>
|
||||
// Token: 0x06001586 RID: 5510 RVA: 0x000527E0 File Offset: 0x000509E0
|
||||
public override int ReadByte()
|
||||
{
|
||||
return base.ReadByte();
|
||||
}
|
||||
|
||||
/// <summary>Sets the current position of this <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFileStream" /> object to the specified value.</summary>
|
||||
/// <returns>The new position in the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFileStream" /> object.</returns>
|
||||
/// <param name="offset">The new position of the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFileStream" /> object. </param>
|
||||
/// <param name="origin">One of the <see cref="T:System.IO.SeekOrigin" /> values. </param>
|
||||
/// <exception cref="T:System.ArgumentException">The <paramref name="origin" /> must be one of the <see cref="T:System.IO.SeekOrigin" /> values. </exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001587 RID: 5511 RVA: 0x000527E8 File Offset: 0x000509E8
|
||||
public override long Seek(long offset, SeekOrigin origin)
|
||||
{
|
||||
return base.Seek(offset, origin);
|
||||
}
|
||||
|
||||
/// <summary>Sets the length of this <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFileStream" /> object to the specified <paramref name="value" />.</summary>
|
||||
/// <param name="value">The new length of the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFileStream" /> object. </param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="value" /> is a negative number.</exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001588 RID: 5512 RVA: 0x000527F4 File Offset: 0x000509F4
|
||||
public override void SetLength(long value)
|
||||
{
|
||||
base.SetLength(value);
|
||||
}
|
||||
|
||||
/// <summary>Writes a block of bytes to the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFileStream" /> object using data read from a byte array.</summary>
|
||||
/// <param name="buffer">The buffer to write. </param>
|
||||
/// <param name="offset">The byte offset in buffer from which to begin. </param>
|
||||
/// <param name="count">The maximum number of bytes to write. </param>
|
||||
/// <exception cref="T:System.IO.IsolatedStorage.IsolatedStorageException">The write attempt exceeds the quota for the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFileStream" /> object. </exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001589 RID: 5513 RVA: 0x00052800 File Offset: 0x00050A00
|
||||
public override void Write(byte[] buffer, int offset, int count)
|
||||
{
|
||||
base.Write(buffer, offset, count);
|
||||
}
|
||||
|
||||
/// <summary>Writes a single byte to the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFileStream" /> object.</summary>
|
||||
/// <param name="value">The byte value to write to the isolated storage file. </param>
|
||||
/// <exception cref="T:System.IO.IsolatedStorage.IsolatedStorageException">The write attempt exceeds the quota for the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFileStream" /> object. </exception>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600158A RID: 5514 RVA: 0x0005280C File Offset: 0x00050A0C
|
||||
public override void WriteByte(byte value)
|
||||
{
|
||||
base.WriteByte(value);
|
||||
}
|
||||
|
||||
/// <summary>Releases the unmanaged resources used by the <see cref="T:System.IO.IsolatedStorage.IsolatedStorageFileStream" /> and optionally releases the managed resources.</summary>
|
||||
/// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources </param>
|
||||
// Token: 0x0600158B RID: 5515 RVA: 0x00052818 File Offset: 0x00050A18
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace System.IO.IsolatedStorage
|
||||
{
|
||||
/// <summary>Enumerates the levels of isolated storage scope that are supported by <see cref="T:System.IO.IsolatedStorage.IsolatedStorage" />.</summary>
|
||||
// Token: 0x020001A6 RID: 422
|
||||
[ComVisible(true)]
|
||||
[Flags]
|
||||
[Serializable]
|
||||
public enum IsolatedStorageScope
|
||||
{
|
||||
/// <summary>No isolated storage usage.</summary>
|
||||
// Token: 0x0400062D RID: 1581
|
||||
None = 0,
|
||||
/// <summary>Isolated storage scoped by user identity.</summary>
|
||||
// Token: 0x0400062E RID: 1582
|
||||
User = 1,
|
||||
/// <summary>Isolated storage scoped to the application domain identity.</summary>
|
||||
// Token: 0x0400062F RID: 1583
|
||||
Domain = 2,
|
||||
/// <summary>Isolated storage scoped to the identity of the assembly.</summary>
|
||||
// Token: 0x04000630 RID: 1584
|
||||
Assembly = 4,
|
||||
/// <summary>The isolated store can be placed in a location on the file system that might roam (if roaming user data is enabled on the underlying operating system).</summary>
|
||||
// Token: 0x04000631 RID: 1585
|
||||
Roaming = 8,
|
||||
/// <summary>Isolated storage scoped to the machine.</summary>
|
||||
// Token: 0x04000632 RID: 1586
|
||||
Machine = 16,
|
||||
/// <summary>Isolated storage scoped to the application.</summary>
|
||||
// Token: 0x04000633 RID: 1587
|
||||
Application = 32
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,605 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
/// <summary>Creates a stream whose backing store is memory.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x020001BF RID: 447
|
||||
[ComVisible(true)]
|
||||
[MonoTODO("Serialization format not compatible with .NET")]
|
||||
[Serializable]
|
||||
public class MemoryStream : Stream
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.MemoryStream" /> class with an expandable capacity initialized to zero.</summary>
|
||||
// Token: 0x060016F5 RID: 5877 RVA: 0x00058714 File Offset: 0x00056914
|
||||
public MemoryStream()
|
||||
: this(0)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.MemoryStream" /> class with an expandable capacity initialized as specified.</summary>
|
||||
/// <param name="capacity">The initial size of the internal array in bytes. </param>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="capacity" /> is negative. </exception>
|
||||
// Token: 0x060016F6 RID: 5878 RVA: 0x00058720 File Offset: 0x00056920
|
||||
public MemoryStream(int capacity)
|
||||
{
|
||||
if (capacity < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("capacity");
|
||||
}
|
||||
this.canWrite = true;
|
||||
this.capacity = capacity;
|
||||
this.internalBuffer = new byte[capacity];
|
||||
this.expandable = true;
|
||||
this.allowGetBuffer = true;
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new non-resizable instance of the <see cref="T:System.IO.MemoryStream" /> class based on the specified byte array.</summary>
|
||||
/// <param name="buffer">The array of unsigned bytes from which to create the current stream. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="buffer" /> is null. </exception>
|
||||
// Token: 0x060016F7 RID: 5879 RVA: 0x00058770 File Offset: 0x00056970
|
||||
public MemoryStream(byte[] buffer)
|
||||
{
|
||||
if (buffer == null)
|
||||
{
|
||||
throw new ArgumentNullException("buffer");
|
||||
}
|
||||
this.InternalConstructor(buffer, 0, buffer.Length, true, false);
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new non-resizable instance of the <see cref="T:System.IO.MemoryStream" /> class based on the specified byte array with the <see cref="P:System.IO.MemoryStream.CanWrite" /> property set as specified.</summary>
|
||||
/// <param name="buffer">The array of unsigned bytes from which to create this stream. </param>
|
||||
/// <param name="writable">The setting of the <see cref="P:System.IO.MemoryStream.CanWrite" /> property, which determines whether the stream supports writing. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="buffer" /> is null. </exception>
|
||||
// Token: 0x060016F8 RID: 5880 RVA: 0x000587A4 File Offset: 0x000569A4
|
||||
public MemoryStream(byte[] buffer, bool writable)
|
||||
{
|
||||
if (buffer == null)
|
||||
{
|
||||
throw new ArgumentNullException("buffer");
|
||||
}
|
||||
this.InternalConstructor(buffer, 0, buffer.Length, writable, false);
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new non-resizable instance of the <see cref="T:System.IO.MemoryStream" /> class based on the specified region (index) of a byte array.</summary>
|
||||
/// <param name="buffer">The array of unsigned bytes from which to create this stream. </param>
|
||||
/// <param name="index">The index into <paramref name="buffer" /> at which the stream begins. </param>
|
||||
/// <param name="count">The length of the stream in bytes. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="buffer" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> or <paramref name="count" /> is less than zero. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">The sum of <paramref name="index" /> and <paramref name="count" /> is greater than the length of <paramref name="buffer" />. </exception>
|
||||
// Token: 0x060016F9 RID: 5881 RVA: 0x000587D8 File Offset: 0x000569D8
|
||||
public MemoryStream(byte[] buffer, int index, int count)
|
||||
{
|
||||
this.InternalConstructor(buffer, index, count, true, false);
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new non-resizable instance of the <see cref="T:System.IO.MemoryStream" /> class based on the specified region of a byte array, with the <see cref="P:System.IO.MemoryStream.CanWrite" /> property set as specified.</summary>
|
||||
/// <param name="buffer">The array of unsigned bytes from which to create this stream. </param>
|
||||
/// <param name="index">The index in <paramref name="buffer" /> at which the stream begins. </param>
|
||||
/// <param name="count">The length of the stream in bytes. </param>
|
||||
/// <param name="writable">The setting of the <see cref="P:System.IO.MemoryStream.CanWrite" /> property, which determines whether the stream supports writing. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="buffer" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> or <paramref name="count" /> are negative. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">The sum of <paramref name="index" /> and <paramref name="count" /> is greater than the length of <paramref name="buffer" />. </exception>
|
||||
// Token: 0x060016FA RID: 5882 RVA: 0x000587F8 File Offset: 0x000569F8
|
||||
public MemoryStream(byte[] buffer, int index, int count, bool writable)
|
||||
{
|
||||
this.InternalConstructor(buffer, index, count, writable, false);
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.MemoryStream" /> class based on the specified region of a byte array, with the <see cref="P:System.IO.MemoryStream.CanWrite" /> property set as specified, and the ability to call <see cref="M:System.IO.MemoryStream.GetBuffer" /> set as specified.</summary>
|
||||
/// <param name="buffer">The array of unsigned bytes from which to create this stream. </param>
|
||||
/// <param name="index">The index into <paramref name="buffer" /> at which the stream begins. </param>
|
||||
/// <param name="count">The length of the stream in bytes. </param>
|
||||
/// <param name="writable">The setting of the <see cref="P:System.IO.MemoryStream.CanWrite" /> property, which determines whether the stream supports writing. </param>
|
||||
/// <param name="publiclyVisible">true to enable <see cref="M:System.IO.MemoryStream.GetBuffer" />, which returns the unsigned byte array from which the stream was created; otherwise, false. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="buffer" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> or <paramref name="count" /> is negative. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">The buffer length minus <paramref name="index" /> is less than <paramref name="count" />. </exception>
|
||||
// Token: 0x060016FB RID: 5883 RVA: 0x00058818 File Offset: 0x00056A18
|
||||
public MemoryStream(byte[] buffer, int index, int count, bool writable, bool publiclyVisible)
|
||||
{
|
||||
this.InternalConstructor(buffer, index, count, writable, publiclyVisible);
|
||||
}
|
||||
|
||||
// Token: 0x060016FC RID: 5884 RVA: 0x00058838 File Offset: 0x00056A38
|
||||
private void InternalConstructor(byte[] buffer, int index, int count, bool writable, bool publicallyVisible)
|
||||
{
|
||||
if (buffer == null)
|
||||
{
|
||||
throw new ArgumentNullException("buffer");
|
||||
}
|
||||
if (index < 0 || count < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("index or count is less than 0.");
|
||||
}
|
||||
if (buffer.Length - index < count)
|
||||
{
|
||||
throw new ArgumentException("index+count", "The size of the buffer is less than index + count.");
|
||||
}
|
||||
this.canWrite = writable;
|
||||
this.internalBuffer = buffer;
|
||||
this.capacity = count + index;
|
||||
this.length = this.capacity;
|
||||
this.position = index;
|
||||
this.initialIndex = index;
|
||||
this.allowGetBuffer = publicallyVisible;
|
||||
this.expandable = false;
|
||||
}
|
||||
|
||||
// Token: 0x060016FD RID: 5885 RVA: 0x000588CC File Offset: 0x00056ACC
|
||||
private void CheckIfClosedThrowDisposed()
|
||||
{
|
||||
if (this.streamClosed)
|
||||
{
|
||||
throw new ObjectDisposedException("MemoryStream");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a value indicating whether the current stream supports reading.</summary>
|
||||
/// <returns>true if the stream is open.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000412 RID: 1042
|
||||
// (get) Token: 0x060016FE RID: 5886 RVA: 0x000588E4 File Offset: 0x00056AE4
|
||||
public override bool CanRead
|
||||
{
|
||||
get
|
||||
{
|
||||
return !this.streamClosed;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a value indicating whether the current stream supports seeking.</summary>
|
||||
/// <returns>true if the stream is open.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000413 RID: 1043
|
||||
// (get) Token: 0x060016FF RID: 5887 RVA: 0x000588F0 File Offset: 0x00056AF0
|
||||
public override bool CanSeek
|
||||
{
|
||||
get
|
||||
{
|
||||
return !this.streamClosed;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a value indicating whether the current stream supports writing.</summary>
|
||||
/// <returns>true if the stream supports writing; otherwise, false.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000414 RID: 1044
|
||||
// (get) Token: 0x06001700 RID: 5888 RVA: 0x000588FC File Offset: 0x00056AFC
|
||||
public override bool CanWrite
|
||||
{
|
||||
get
|
||||
{
|
||||
return !this.streamClosed && this.canWrite;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the number of bytes allocated for this stream.</summary>
|
||||
/// <returns>The length of the usable portion of the buffer for the stream.</returns>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">A capacity is set that is negative or less than the current length of the stream. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The current stream is closed. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">set is invoked on a stream whose capacity cannot be modified. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000415 RID: 1045
|
||||
// (get) Token: 0x06001701 RID: 5889 RVA: 0x00058914 File Offset: 0x00056B14
|
||||
// (set) Token: 0x06001702 RID: 5890 RVA: 0x0005892C File Offset: 0x00056B2C
|
||||
public virtual int Capacity
|
||||
{
|
||||
get
|
||||
{
|
||||
this.CheckIfClosedThrowDisposed();
|
||||
return this.capacity - this.initialIndex;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.CheckIfClosedThrowDisposed();
|
||||
if (value == this.capacity)
|
||||
{
|
||||
return;
|
||||
}
|
||||
if (!this.expandable)
|
||||
{
|
||||
throw new NotSupportedException("Cannot expand this MemoryStream");
|
||||
}
|
||||
if (value < 0 || value < this.length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("value", string.Concat(new object[] { "New capacity cannot be negative or less than the current capacity ", value, " ", this.capacity }));
|
||||
}
|
||||
byte[] array = null;
|
||||
if (value != 0)
|
||||
{
|
||||
array = new byte[value];
|
||||
Buffer.BlockCopy(this.internalBuffer, 0, array, 0, this.length);
|
||||
}
|
||||
this.dirty_bytes = 0;
|
||||
this.internalBuffer = array;
|
||||
this.capacity = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the length of the stream in bytes.</summary>
|
||||
/// <returns>The length of the stream in bytes.</returns>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000416 RID: 1046
|
||||
// (get) Token: 0x06001703 RID: 5891 RVA: 0x000589EC File Offset: 0x00056BEC
|
||||
public override long Length
|
||||
{
|
||||
get
|
||||
{
|
||||
this.CheckIfClosedThrowDisposed();
|
||||
return (long)(this.length - this.initialIndex);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the current position within the stream.</summary>
|
||||
/// <returns>The current position within the stream.</returns>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">The position is set to a negative value or a value greater than <see cref="F:System.Int32.MaxValue" />. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000417 RID: 1047
|
||||
// (get) Token: 0x06001704 RID: 5892 RVA: 0x00058A04 File Offset: 0x00056C04
|
||||
// (set) Token: 0x06001705 RID: 5893 RVA: 0x00058A1C File Offset: 0x00056C1C
|
||||
public override long Position
|
||||
{
|
||||
get
|
||||
{
|
||||
this.CheckIfClosedThrowDisposed();
|
||||
return (long)(this.position - this.initialIndex);
|
||||
}
|
||||
set
|
||||
{
|
||||
this.CheckIfClosedThrowDisposed();
|
||||
if (value < 0L)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("value", "Position cannot be negative");
|
||||
}
|
||||
if (value > 2147483647L)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("value", "Position must be non-negative and less than 2^31 - 1 - origin");
|
||||
}
|
||||
this.position = this.initialIndex + (int)value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Releases the unmanaged resources used by the <see cref="T:System.IO.MemoryStream" /> class and optionally releases the managed resources.</summary>
|
||||
/// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
|
||||
// Token: 0x06001706 RID: 5894 RVA: 0x00058A74 File Offset: 0x00056C74
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
this.streamClosed = true;
|
||||
this.expandable = false;
|
||||
}
|
||||
|
||||
/// <summary>Overrides <see cref="M:System.IO.Stream.Flush" /> so that no action is performed.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06001707 RID: 5895 RVA: 0x00058A84 File Offset: 0x00056C84
|
||||
public override void Flush()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Returns the array of unsigned bytes from which this stream was created.</summary>
|
||||
/// <returns>The byte array from which this stream was created, or the underlying array if a byte array was not provided to the <see cref="T:System.IO.MemoryStream" /> constructor during construction of the current instance.</returns>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">The MemoryStream instance was not created with a publicly visible buffer. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06001708 RID: 5896 RVA: 0x00058A88 File Offset: 0x00056C88
|
||||
public virtual byte[] GetBuffer()
|
||||
{
|
||||
if (!this.allowGetBuffer)
|
||||
{
|
||||
throw new UnauthorizedAccessException();
|
||||
}
|
||||
return this.internalBuffer;
|
||||
}
|
||||
|
||||
/// <summary>Reads a block of bytes from the current stream and writes the data to <paramref name="buffer" />.</summary>
|
||||
/// <returns>The total number of bytes written into the buffer. This can be less than the number of bytes requested if that number of bytes are not currently available, or zero if the end of the stream is reached before any bytes are read.</returns>
|
||||
/// <param name="buffer">When this method returns, contains the specified byte array with the values between <paramref name="offset" /> and (<paramref name="offset" /> + <paramref name="count" /> - 1) replaced by the characters read from the current stream. </param>
|
||||
/// <param name="offset">The byte offset in <paramref name="buffer" /> at which to begin reading. </param>
|
||||
/// <param name="count">The maximum number of bytes to read. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="buffer" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="offset" /> or <paramref name="count" /> is negative. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="offset" /> subtracted from the buffer length is less than <paramref name="count" />. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The current stream instance is closed. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06001709 RID: 5897 RVA: 0x00058AA4 File Offset: 0x00056CA4
|
||||
public override int Read([In] [Out] byte[] buffer, int offset, int count)
|
||||
{
|
||||
this.CheckIfClosedThrowDisposed();
|
||||
if (buffer == null)
|
||||
{
|
||||
throw new ArgumentNullException("buffer");
|
||||
}
|
||||
if (offset < 0 || count < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("offset or count less than zero.");
|
||||
}
|
||||
if (buffer.Length - offset < count)
|
||||
{
|
||||
throw new ArgumentException("offset+count", "The size of the buffer is less than offset + count.");
|
||||
}
|
||||
if (this.position >= this.length || count == 0)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (this.position > this.length - count)
|
||||
{
|
||||
count = this.length - this.position;
|
||||
}
|
||||
Buffer.BlockCopy(this.internalBuffer, this.position, buffer, offset, count);
|
||||
this.position += count;
|
||||
return count;
|
||||
}
|
||||
|
||||
/// <summary>Reads a byte from the current stream.</summary>
|
||||
/// <returns>The byte cast to a <see cref="T:System.Int32" />, or -1 if the end of the stream has been reached.</returns>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The current stream instance is closed. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x0600170A RID: 5898 RVA: 0x00058B5C File Offset: 0x00056D5C
|
||||
public override int ReadByte()
|
||||
{
|
||||
this.CheckIfClosedThrowDisposed();
|
||||
if (this.position >= this.length)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return (int)this.internalBuffer[this.position++];
|
||||
}
|
||||
|
||||
/// <summary>Sets the position within the current stream to the specified value.</summary>
|
||||
/// <returns>The new position within the stream, calculated by combining the initial reference point and the offset.</returns>
|
||||
/// <param name="offset">The new position within the stream. This is relative to the <paramref name="loc" /> parameter, and can be positive or negative. </param>
|
||||
/// <param name="loc">A value of type <see cref="T:System.IO.SeekOrigin" />, which acts as the seek reference point. </param>
|
||||
/// <exception cref="T:System.IO.IOException">Seeking is attempted before the beginning of the stream. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="offset" /> is greater than <see cref="F:System.Int32.MaxValue" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">There is an invalid <see cref="T:System.IO.SeekOrigin" />. -or-<paramref name="offset" /> caused an arithmetic overflow.</exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The current stream instance is closed. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x0600170B RID: 5899 RVA: 0x00058B9C File Offset: 0x00056D9C
|
||||
public override long Seek(long offset, SeekOrigin loc)
|
||||
{
|
||||
this.CheckIfClosedThrowDisposed();
|
||||
if (offset > 2147483647L)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("Offset out of range. " + offset);
|
||||
}
|
||||
int num;
|
||||
switch (loc)
|
||||
{
|
||||
case SeekOrigin.Begin:
|
||||
if (offset < 0L)
|
||||
{
|
||||
throw new IOException("Attempted to seek before start of MemoryStream.");
|
||||
}
|
||||
num = this.initialIndex;
|
||||
break;
|
||||
case SeekOrigin.Current:
|
||||
num = this.position;
|
||||
break;
|
||||
case SeekOrigin.End:
|
||||
num = this.length;
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException("loc", "Invalid SeekOrigin");
|
||||
}
|
||||
num += (int)offset;
|
||||
if (num < this.initialIndex)
|
||||
{
|
||||
throw new IOException("Attempted to seek before start of MemoryStream.");
|
||||
}
|
||||
this.position = num;
|
||||
return (long)this.position;
|
||||
}
|
||||
|
||||
// Token: 0x0600170C RID: 5900 RVA: 0x00058C5C File Offset: 0x00056E5C
|
||||
private int CalculateNewCapacity(int minimum)
|
||||
{
|
||||
if (minimum < 256)
|
||||
{
|
||||
minimum = 256;
|
||||
}
|
||||
if (minimum < this.capacity * 2)
|
||||
{
|
||||
minimum = this.capacity * 2;
|
||||
}
|
||||
return minimum;
|
||||
}
|
||||
|
||||
// Token: 0x0600170D RID: 5901 RVA: 0x00058C8C File Offset: 0x00056E8C
|
||||
private void Expand(int newSize)
|
||||
{
|
||||
if (newSize > this.capacity)
|
||||
{
|
||||
this.Capacity = this.CalculateNewCapacity(newSize);
|
||||
}
|
||||
else if (this.dirty_bytes > 0)
|
||||
{
|
||||
Array.Clear(this.internalBuffer, this.length, this.dirty_bytes);
|
||||
this.dirty_bytes = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Sets the length of the current stream to the specified value.</summary>
|
||||
/// <param name="value">The value at which to set the length. </param>
|
||||
/// <exception cref="T:System.NotSupportedException">The current stream is not resizable and <paramref name="value" /> is larger than the current capacity.-or- The current stream does not support writing. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="value" /> is negative or is greater than the maximum length of the <see cref="T:System.IO.MemoryStream" />, where the maximum length is(<see cref="F:System.Int32.MaxValue" /> - origin), and origin is the index into the underlying buffer at which the stream starts. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x0600170E RID: 5902 RVA: 0x00058CE4 File Offset: 0x00056EE4
|
||||
public override void SetLength(long value)
|
||||
{
|
||||
if (!this.expandable && value > (long)this.capacity)
|
||||
{
|
||||
throw new NotSupportedException("Expanding this MemoryStream is not supported");
|
||||
}
|
||||
this.CheckIfClosedThrowDisposed();
|
||||
if (!this.canWrite)
|
||||
{
|
||||
throw new NotSupportedException(Locale.GetText("Cannot write to this MemoryStream"));
|
||||
}
|
||||
if (value < 0L || value + (long)this.initialIndex > 2147483647L)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
int num = (int)value + this.initialIndex;
|
||||
if (num > this.length)
|
||||
{
|
||||
this.Expand(num);
|
||||
}
|
||||
else if (num < this.length)
|
||||
{
|
||||
this.dirty_bytes += this.length - num;
|
||||
}
|
||||
this.length = num;
|
||||
if (this.position > this.length)
|
||||
{
|
||||
this.position = this.length;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Writes the stream contents to a byte array, regardless of the <see cref="P:System.IO.MemoryStream.Position" /> property.</summary>
|
||||
/// <returns>A new byte array.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x0600170F RID: 5903 RVA: 0x00058DC0 File Offset: 0x00056FC0
|
||||
public virtual byte[] ToArray()
|
||||
{
|
||||
int num = this.length - this.initialIndex;
|
||||
byte[] array = new byte[num];
|
||||
if (this.internalBuffer != null)
|
||||
{
|
||||
Buffer.BlockCopy(this.internalBuffer, this.initialIndex, array, 0, num);
|
||||
}
|
||||
return array;
|
||||
}
|
||||
|
||||
/// <summary>Writes a block of bytes to the current stream using data read from buffer.</summary>
|
||||
/// <param name="buffer">The buffer to write data from. </param>
|
||||
/// <param name="offset">The byte offset in <paramref name="buffer" /> at which to begin writing from. </param>
|
||||
/// <param name="count">The maximum number of bytes to write. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="buffer" /> is null. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">The stream does not support writing. For additional information see <see cref="P:System.IO.Stream.CanWrite" />.-or- The current position is closer than <paramref name="count" /> bytes to the end of the stream, and the capacity cannot be modified. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="offset" /> subtracted from the buffer length is less than <paramref name="count" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="offset" /> or <paramref name="count" /> are negative. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The current stream instance is closed. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06001710 RID: 5904 RVA: 0x00058E04 File Offset: 0x00057004
|
||||
public override void Write(byte[] buffer, int offset, int count)
|
||||
{
|
||||
this.CheckIfClosedThrowDisposed();
|
||||
if (!this.canWrite)
|
||||
{
|
||||
throw new NotSupportedException("Cannot write to this stream.");
|
||||
}
|
||||
if (buffer == null)
|
||||
{
|
||||
throw new ArgumentNullException("buffer");
|
||||
}
|
||||
if (offset < 0 || count < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
if (buffer.Length - offset < count)
|
||||
{
|
||||
throw new ArgumentException("offset+count", "The size of the buffer is less than offset + count.");
|
||||
}
|
||||
if (this.position > this.length - count)
|
||||
{
|
||||
this.Expand(this.position + count);
|
||||
}
|
||||
Buffer.BlockCopy(buffer, offset, this.internalBuffer, this.position, count);
|
||||
this.position += count;
|
||||
if (this.position >= this.length)
|
||||
{
|
||||
this.length = this.position;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Writes a byte to the current stream at the current position.</summary>
|
||||
/// <param name="value">The byte to write. </param>
|
||||
/// <exception cref="T:System.NotSupportedException">The stream does not support writing. For additional information see <see cref="P:System.IO.Stream.CanWrite" />.-or- The current position is at the end of the stream, and the capacity cannot be modified. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The current stream is closed. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06001711 RID: 5905 RVA: 0x00058ED0 File Offset: 0x000570D0
|
||||
public override void WriteByte(byte value)
|
||||
{
|
||||
this.CheckIfClosedThrowDisposed();
|
||||
if (!this.canWrite)
|
||||
{
|
||||
throw new NotSupportedException("Cannot write to this stream.");
|
||||
}
|
||||
if (this.position >= this.length)
|
||||
{
|
||||
this.Expand(this.position + 1);
|
||||
this.length = this.position + 1;
|
||||
}
|
||||
this.internalBuffer[this.position++] = value;
|
||||
}
|
||||
|
||||
/// <summary>Writes the entire contents of this memory stream to another stream.</summary>
|
||||
/// <param name="stream">The stream to write this memory stream to. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="stream" /> is null. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The current or target stream is closed. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06001712 RID: 5906 RVA: 0x00058F40 File Offset: 0x00057140
|
||||
public virtual void WriteTo(Stream stream)
|
||||
{
|
||||
this.CheckIfClosedThrowDisposed();
|
||||
if (stream == null)
|
||||
{
|
||||
throw new ArgumentNullException("stream");
|
||||
}
|
||||
stream.Write(this.internalBuffer, this.initialIndex, this.length - this.initialIndex);
|
||||
}
|
||||
|
||||
// Token: 0x040006AD RID: 1709
|
||||
private bool canWrite;
|
||||
|
||||
// Token: 0x040006AE RID: 1710
|
||||
private bool allowGetBuffer;
|
||||
|
||||
// Token: 0x040006AF RID: 1711
|
||||
private int capacity;
|
||||
|
||||
// Token: 0x040006B0 RID: 1712
|
||||
private int length;
|
||||
|
||||
// Token: 0x040006B1 RID: 1713
|
||||
private byte[] internalBuffer;
|
||||
|
||||
// Token: 0x040006B2 RID: 1714
|
||||
private int initialIndex;
|
||||
|
||||
// Token: 0x040006B3 RID: 1715
|
||||
private bool expandable;
|
||||
|
||||
// Token: 0x040006B4 RID: 1716
|
||||
private bool streamClosed;
|
||||
|
||||
// Token: 0x040006B5 RID: 1717
|
||||
private int position;
|
||||
|
||||
// Token: 0x040006B6 RID: 1718
|
||||
private int dirty_bytes;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
// Token: 0x020001C0 RID: 448
|
||||
internal enum MonoFileType
|
||||
{
|
||||
// Token: 0x040006B8 RID: 1720
|
||||
Unknown,
|
||||
// Token: 0x040006B9 RID: 1721
|
||||
Disk,
|
||||
// Token: 0x040006BA RID: 1722
|
||||
Char,
|
||||
// Token: 0x040006BB RID: 1723
|
||||
Pipe,
|
||||
// Token: 0x040006BC RID: 1724
|
||||
Remote = 32768
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,389 @@
|
||||
using System;
|
||||
using System.IO.IsolatedStorage;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
// Token: 0x020001C1 RID: 449
|
||||
internal sealed class MonoIO
|
||||
{
|
||||
// Token: 0x06001715 RID: 5909 RVA: 0x00058FA0 File Offset: 0x000571A0
|
||||
public static Exception GetException(MonoIOError error)
|
||||
{
|
||||
if (error == MonoIOError.ERROR_ACCESS_DENIED)
|
||||
{
|
||||
return new UnauthorizedAccessException("Access to the path is denied.");
|
||||
}
|
||||
if (error != MonoIOError.ERROR_FILE_EXISTS)
|
||||
{
|
||||
return MonoIO.GetException(string.Empty, error);
|
||||
}
|
||||
string text = "Cannot create a file that already exist.";
|
||||
return new IOException(text, (int)((MonoIOError)(-2147024896) | error));
|
||||
}
|
||||
|
||||
// Token: 0x06001716 RID: 5910 RVA: 0x00058FF0 File Offset: 0x000571F0
|
||||
public static Exception GetException(string path, MonoIOError error)
|
||||
{
|
||||
switch (error)
|
||||
{
|
||||
case MonoIOError.ERROR_FILE_NOT_FOUND:
|
||||
{
|
||||
string text = string.Format("Could not find file \"{0}\"", path);
|
||||
return new IsolatedStorageException(text);
|
||||
}
|
||||
case MonoIOError.ERROR_PATH_NOT_FOUND:
|
||||
{
|
||||
string text = string.Format("Could not find a part of the path \"{0}\"", path);
|
||||
return new IsolatedStorageException(text);
|
||||
}
|
||||
case MonoIOError.ERROR_TOO_MANY_OPEN_FILES:
|
||||
return new IOException("Too many open files", (int)((MonoIOError)(-2147024896) | error));
|
||||
case MonoIOError.ERROR_ACCESS_DENIED:
|
||||
{
|
||||
string text = string.Format("Access to the path \"{0}\" is denied.", path);
|
||||
return new UnauthorizedAccessException(text);
|
||||
}
|
||||
case MonoIOError.ERROR_INVALID_HANDLE:
|
||||
{
|
||||
string text = string.Format("Invalid handle to path \"{0}\"", path);
|
||||
return new IOException(text, (int)((MonoIOError)(-2147024896) | error));
|
||||
}
|
||||
default:
|
||||
switch (error)
|
||||
{
|
||||
case MonoIOError.ERROR_WRITE_FAULT:
|
||||
{
|
||||
string text = string.Format("Write fault on path {0}", path);
|
||||
return new IOException(text, (int)((MonoIOError)(-2147024896) | error));
|
||||
}
|
||||
default:
|
||||
switch (error)
|
||||
{
|
||||
case MonoIOError.ERROR_INVALID_DRIVE:
|
||||
{
|
||||
string text = string.Format("Could not find the drive '{0}'. The drive might not be ready or might not be mapped.", path);
|
||||
return new IOException(text, (int)((MonoIOError)(-2147024896) | error));
|
||||
}
|
||||
default:
|
||||
switch (error)
|
||||
{
|
||||
case MonoIOError.ERROR_FILE_EXISTS:
|
||||
{
|
||||
string text = string.Format("Could not create file \"{0}\". File already exists.", path);
|
||||
return new IOException(text, (int)((MonoIOError)(-2147024896) | error));
|
||||
}
|
||||
default:
|
||||
if (error == MonoIOError.ERROR_HANDLE_DISK_FULL)
|
||||
{
|
||||
string text = string.Format("Disk full. Path {0}", path);
|
||||
return new IOException(text, (int)((MonoIOError)(-2147024896) | error));
|
||||
}
|
||||
if (error == MonoIOError.ERROR_INVALID_PARAMETER)
|
||||
{
|
||||
string text = string.Format("Invalid parameter", new object[0]);
|
||||
return new IOException(text, (int)((MonoIOError)(-2147024896) | error));
|
||||
}
|
||||
if (error == MonoIOError.ERROR_DIR_NOT_EMPTY)
|
||||
{
|
||||
string text = string.Format("Directory {0} is not empty", path);
|
||||
return new IOException(text, (int)((MonoIOError)(-2147024896) | error));
|
||||
}
|
||||
if (error == MonoIOError.ERROR_FILENAME_EXCED_RANGE)
|
||||
{
|
||||
string text = string.Format("Path is too long. Path: {0}", path);
|
||||
return new PathTooLongException(text);
|
||||
}
|
||||
if (error != MonoIOError.ERROR_ENCRYPTION_FAILED)
|
||||
{
|
||||
string text = string.Format("Win32 IO returned {0}. Path: {1}", error, path);
|
||||
return new IOException(text, (int)((MonoIOError)(-2147024896) | error));
|
||||
}
|
||||
return new IOException("Encryption failed", (int)((MonoIOError)(-2147024896) | error));
|
||||
case MonoIOError.ERROR_CANNOT_MAKE:
|
||||
{
|
||||
string text = string.Format("Path {0} is a directory", path);
|
||||
return new IOException(text, (int)((MonoIOError)(-2147024896) | error));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MonoIOError.ERROR_NOT_SAME_DEVICE:
|
||||
{
|
||||
string text = "Source and destination are not on the same device";
|
||||
return new IOException(text, (int)((MonoIOError)(-2147024896) | error));
|
||||
}
|
||||
}
|
||||
break;
|
||||
case MonoIOError.ERROR_SHARING_VIOLATION:
|
||||
{
|
||||
string text = string.Format("Sharing violation on path {0}", path);
|
||||
return new IOException(text, (int)((MonoIOError)(-2147024896) | error));
|
||||
}
|
||||
case MonoIOError.ERROR_LOCK_VIOLATION:
|
||||
{
|
||||
string text = string.Format("Lock violation on path {0}", path);
|
||||
return new IOException(text, (int)((MonoIOError)(-2147024896) | error));
|
||||
}
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001717 RID: 5911
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
public static extern bool CreateDirectory(string path, out MonoIOError error);
|
||||
|
||||
// Token: 0x06001718 RID: 5912
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
public static extern bool RemoveDirectory(string path, out MonoIOError error);
|
||||
|
||||
// Token: 0x06001719 RID: 5913
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
public static extern string[] GetFileSystemEntries(string path, string path_with_pattern, int attrs, int mask, out MonoIOError error);
|
||||
|
||||
// Token: 0x0600171A RID: 5914
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
public static extern string GetCurrentDirectory(out MonoIOError error);
|
||||
|
||||
// Token: 0x0600171B RID: 5915
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
public static extern bool SetCurrentDirectory(string path, out MonoIOError error);
|
||||
|
||||
// Token: 0x0600171C RID: 5916
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
public static extern bool MoveFile(string path, string dest, out MonoIOError error);
|
||||
|
||||
// Token: 0x0600171D RID: 5917
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
public static extern bool CopyFile(string path, string dest, bool overwrite, out MonoIOError error);
|
||||
|
||||
// Token: 0x0600171E RID: 5918
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
public static extern bool DeleteFile(string path, out MonoIOError error);
|
||||
|
||||
// Token: 0x0600171F RID: 5919
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
public static extern bool ReplaceFile(string sourceFileName, string destinationFileName, string destinationBackupFileName, bool ignoreMetadataErrors, out MonoIOError error);
|
||||
|
||||
// Token: 0x06001720 RID: 5920
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
public static extern FileAttributes GetFileAttributes(string path, out MonoIOError error);
|
||||
|
||||
// Token: 0x06001721 RID: 5921
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
public static extern bool SetFileAttributes(string path, FileAttributes attrs, out MonoIOError error);
|
||||
|
||||
// Token: 0x06001722 RID: 5922
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
public static extern MonoFileType GetFileType(IntPtr handle, out MonoIOError error);
|
||||
|
||||
// Token: 0x06001723 RID: 5923 RVA: 0x00059244 File Offset: 0x00057444
|
||||
public static bool Exists(string path, out MonoIOError error)
|
||||
{
|
||||
FileAttributes fileAttributes = MonoIO.GetFileAttributes(path, out error);
|
||||
return fileAttributes != MonoIO.InvalidFileAttributes;
|
||||
}
|
||||
|
||||
// Token: 0x06001724 RID: 5924 RVA: 0x00059268 File Offset: 0x00057468
|
||||
public static bool ExistsFile(string path, out MonoIOError error)
|
||||
{
|
||||
FileAttributes fileAttributes = MonoIO.GetFileAttributes(path, out error);
|
||||
return fileAttributes != MonoIO.InvalidFileAttributes && (fileAttributes & FileAttributes.Directory) == (FileAttributes)0;
|
||||
}
|
||||
|
||||
// Token: 0x06001725 RID: 5925 RVA: 0x00059298 File Offset: 0x00057498
|
||||
public static bool ExistsDirectory(string path, out MonoIOError error)
|
||||
{
|
||||
FileAttributes fileAttributes = MonoIO.GetFileAttributes(path, out error);
|
||||
if (error == MonoIOError.ERROR_FILE_NOT_FOUND)
|
||||
{
|
||||
error = MonoIOError.ERROR_PATH_NOT_FOUND;
|
||||
}
|
||||
return fileAttributes != MonoIO.InvalidFileAttributes && (fileAttributes & FileAttributes.Directory) != (FileAttributes)0;
|
||||
}
|
||||
|
||||
// Token: 0x06001726 RID: 5926 RVA: 0x000592D4 File Offset: 0x000574D4
|
||||
public static bool ExistsSymlink(string path, out MonoIOError error)
|
||||
{
|
||||
FileAttributes fileAttributes = MonoIO.GetFileAttributes(path, out error);
|
||||
return fileAttributes != MonoIO.InvalidFileAttributes && (fileAttributes & FileAttributes.ReparsePoint) != (FileAttributes)0;
|
||||
}
|
||||
|
||||
// Token: 0x06001727 RID: 5927
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
public static extern bool GetFileStat(string path, out MonoIOStat stat, out MonoIOError error);
|
||||
|
||||
// Token: 0x06001728 RID: 5928
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
public static extern IntPtr Open(string filename, FileMode mode, FileAccess access, FileShare share, FileOptions options, out MonoIOError error);
|
||||
|
||||
// Token: 0x06001729 RID: 5929
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
public static extern bool Close(IntPtr handle, out MonoIOError error);
|
||||
|
||||
// Token: 0x0600172A RID: 5930
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
public static extern int Read(IntPtr handle, byte[] dest, int dest_offset, int count, out MonoIOError error);
|
||||
|
||||
// Token: 0x0600172B RID: 5931
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
public static extern int Write(IntPtr handle, [In] byte[] src, int src_offset, int count, out MonoIOError error);
|
||||
|
||||
// Token: 0x0600172C RID: 5932
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
public static extern long Seek(IntPtr handle, long offset, SeekOrigin origin, out MonoIOError error);
|
||||
|
||||
// Token: 0x0600172D RID: 5933
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
public static extern bool Flush(IntPtr handle, out MonoIOError error);
|
||||
|
||||
// Token: 0x0600172E RID: 5934
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
public static extern long GetLength(IntPtr handle, out MonoIOError error);
|
||||
|
||||
// Token: 0x0600172F RID: 5935
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
public static extern bool SetLength(IntPtr handle, long length, out MonoIOError error);
|
||||
|
||||
// Token: 0x06001730 RID: 5936
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
public static extern bool SetFileTime(IntPtr handle, long creation_time, long last_access_time, long last_write_time, out MonoIOError error);
|
||||
|
||||
// Token: 0x06001731 RID: 5937 RVA: 0x00059308 File Offset: 0x00057508
|
||||
public static bool SetFileTime(string path, long creation_time, long last_access_time, long last_write_time, out MonoIOError error)
|
||||
{
|
||||
return MonoIO.SetFileTime(path, 0, creation_time, last_access_time, last_write_time, DateTime.MinValue, out error);
|
||||
}
|
||||
|
||||
// Token: 0x06001732 RID: 5938 RVA: 0x0005931C File Offset: 0x0005751C
|
||||
public static bool SetCreationTime(string path, DateTime dateTime, out MonoIOError error)
|
||||
{
|
||||
return MonoIO.SetFileTime(path, 1, -1L, -1L, -1L, dateTime, out error);
|
||||
}
|
||||
|
||||
// Token: 0x06001733 RID: 5939 RVA: 0x00059330 File Offset: 0x00057530
|
||||
public static bool SetLastAccessTime(string path, DateTime dateTime, out MonoIOError error)
|
||||
{
|
||||
return MonoIO.SetFileTime(path, 2, -1L, -1L, -1L, dateTime, out error);
|
||||
}
|
||||
|
||||
// Token: 0x06001734 RID: 5940 RVA: 0x00059344 File Offset: 0x00057544
|
||||
public static bool SetLastWriteTime(string path, DateTime dateTime, out MonoIOError error)
|
||||
{
|
||||
return MonoIO.SetFileTime(path, 3, -1L, -1L, -1L, dateTime, out error);
|
||||
}
|
||||
|
||||
// Token: 0x06001735 RID: 5941 RVA: 0x00059358 File Offset: 0x00057558
|
||||
public static bool SetFileTime(string path, int type, long creation_time, long last_access_time, long last_write_time, DateTime dateTime, out MonoIOError error)
|
||||
{
|
||||
IntPtr intPtr = MonoIO.Open(path, FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite, FileOptions.None, out error);
|
||||
if (intPtr == MonoIO.InvalidHandle)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
switch (type)
|
||||
{
|
||||
case 1:
|
||||
creation_time = dateTime.ToFileTime();
|
||||
break;
|
||||
case 2:
|
||||
last_access_time = dateTime.ToFileTime();
|
||||
break;
|
||||
case 3:
|
||||
last_write_time = dateTime.ToFileTime();
|
||||
break;
|
||||
}
|
||||
bool flag = MonoIO.SetFileTime(intPtr, creation_time, last_access_time, last_write_time, out error);
|
||||
MonoIOError monoIOError;
|
||||
MonoIO.Close(intPtr, out monoIOError);
|
||||
return flag;
|
||||
}
|
||||
|
||||
// Token: 0x06001736 RID: 5942
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
public static extern void Lock(IntPtr handle, long position, long length, out MonoIOError error);
|
||||
|
||||
// Token: 0x06001737 RID: 5943
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
public static extern void Unlock(IntPtr handle, long position, long length, out MonoIOError error);
|
||||
|
||||
// Token: 0x17000418 RID: 1048
|
||||
// (get) Token: 0x06001738 RID: 5944
|
||||
public static extern IntPtr ConsoleOutput
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
get;
|
||||
}
|
||||
|
||||
// Token: 0x17000419 RID: 1049
|
||||
// (get) Token: 0x06001739 RID: 5945
|
||||
public static extern IntPtr ConsoleInput
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
get;
|
||||
}
|
||||
|
||||
// Token: 0x1700041A RID: 1050
|
||||
// (get) Token: 0x0600173A RID: 5946
|
||||
public static extern IntPtr ConsoleError
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
get;
|
||||
}
|
||||
|
||||
// Token: 0x0600173B RID: 5947
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
public static extern bool CreatePipe(out IntPtr read_handle, out IntPtr write_handle);
|
||||
|
||||
// Token: 0x0600173C RID: 5948
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
public static extern bool DuplicateHandle(IntPtr source_process_handle, IntPtr source_handle, IntPtr target_process_handle, out IntPtr target_handle, int access, int inherit, int options);
|
||||
|
||||
// Token: 0x1700041B RID: 1051
|
||||
// (get) Token: 0x0600173D RID: 5949
|
||||
public static extern char VolumeSeparatorChar
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
get;
|
||||
}
|
||||
|
||||
// Token: 0x1700041C RID: 1052
|
||||
// (get) Token: 0x0600173E RID: 5950
|
||||
public static extern char DirectorySeparatorChar
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
get;
|
||||
}
|
||||
|
||||
// Token: 0x1700041D RID: 1053
|
||||
// (get) Token: 0x0600173F RID: 5951
|
||||
public static extern char AltDirectorySeparatorChar
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
get;
|
||||
}
|
||||
|
||||
// Token: 0x1700041E RID: 1054
|
||||
// (get) Token: 0x06001740 RID: 5952
|
||||
public static extern char PathSeparator
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
get;
|
||||
}
|
||||
|
||||
// Token: 0x06001741 RID: 5953
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
public static extern int GetTempPath(out string path);
|
||||
|
||||
// Token: 0x06001742 RID: 5954
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
public static extern bool RemapPath(string path, out string newPath);
|
||||
|
||||
// Token: 0x040006BD RID: 1725
|
||||
public static readonly FileAttributes InvalidFileAttributes = (FileAttributes)(-1);
|
||||
|
||||
// Token: 0x040006BE RID: 1726
|
||||
public static readonly IntPtr InvalidHandle = (IntPtr)(-1L);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
using System;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
// Token: 0x020001C2 RID: 450
|
||||
internal enum MonoIOError
|
||||
{
|
||||
// Token: 0x040006C0 RID: 1728
|
||||
ERROR_SUCCESS,
|
||||
// Token: 0x040006C1 RID: 1729
|
||||
ERROR_FILE_NOT_FOUND = 2,
|
||||
// Token: 0x040006C2 RID: 1730
|
||||
ERROR_PATH_NOT_FOUND,
|
||||
// Token: 0x040006C3 RID: 1731
|
||||
ERROR_TOO_MANY_OPEN_FILES,
|
||||
// Token: 0x040006C4 RID: 1732
|
||||
ERROR_ACCESS_DENIED,
|
||||
// Token: 0x040006C5 RID: 1733
|
||||
ERROR_INVALID_HANDLE,
|
||||
// Token: 0x040006C6 RID: 1734
|
||||
ERROR_INVALID_DRIVE = 15,
|
||||
// Token: 0x040006C7 RID: 1735
|
||||
ERROR_NOT_SAME_DEVICE = 17,
|
||||
// Token: 0x040006C8 RID: 1736
|
||||
ERROR_NO_MORE_FILES,
|
||||
// Token: 0x040006C9 RID: 1737
|
||||
ERROR_WRITE_FAULT = 29,
|
||||
// Token: 0x040006CA RID: 1738
|
||||
ERROR_READ_FAULT,
|
||||
// Token: 0x040006CB RID: 1739
|
||||
ERROR_GEN_FAILURE,
|
||||
// Token: 0x040006CC RID: 1740
|
||||
ERROR_SHARING_VIOLATION,
|
||||
// Token: 0x040006CD RID: 1741
|
||||
ERROR_LOCK_VIOLATION,
|
||||
// Token: 0x040006CE RID: 1742
|
||||
ERROR_HANDLE_DISK_FULL = 39,
|
||||
// Token: 0x040006CF RID: 1743
|
||||
ERROR_FILE_EXISTS = 80,
|
||||
// Token: 0x040006D0 RID: 1744
|
||||
ERROR_CANNOT_MAKE = 82,
|
||||
// Token: 0x040006D1 RID: 1745
|
||||
ERROR_INVALID_PARAMETER = 87,
|
||||
// Token: 0x040006D2 RID: 1746
|
||||
ERROR_BROKEN_PIPE = 109,
|
||||
// Token: 0x040006D3 RID: 1747
|
||||
ERROR_INVALID_NAME = 123,
|
||||
// Token: 0x040006D4 RID: 1748
|
||||
ERROR_DIR_NOT_EMPTY = 145,
|
||||
// Token: 0x040006D5 RID: 1749
|
||||
ERROR_ALREADY_EXISTS = 183,
|
||||
// Token: 0x040006D6 RID: 1750
|
||||
ERROR_FILENAME_EXCED_RANGE = 206,
|
||||
// Token: 0x040006D7 RID: 1751
|
||||
ERROR_ENCRYPTION_FAILED = 6000
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
using System;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
// Token: 0x020001C3 RID: 451
|
||||
internal struct MonoIOStat
|
||||
{
|
||||
// Token: 0x040006D8 RID: 1752
|
||||
public string Name;
|
||||
|
||||
// Token: 0x040006D9 RID: 1753
|
||||
public FileAttributes Attributes;
|
||||
|
||||
// Token: 0x040006DA RID: 1754
|
||||
public long Length;
|
||||
|
||||
// Token: 0x040006DB RID: 1755
|
||||
public long CreationTime;
|
||||
|
||||
// Token: 0x040006DC RID: 1756
|
||||
public long LastAccessTime;
|
||||
|
||||
// Token: 0x040006DD RID: 1757
|
||||
public long LastWriteTime;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
using System;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
// Token: 0x020001CC RID: 460
|
||||
internal class NullStream : Stream
|
||||
{
|
||||
// Token: 0x17000427 RID: 1063
|
||||
// (get) Token: 0x06001786 RID: 6022 RVA: 0x0005ABD4 File Offset: 0x00058DD4
|
||||
public override bool CanRead
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000428 RID: 1064
|
||||
// (get) Token: 0x06001787 RID: 6023 RVA: 0x0005ABD8 File Offset: 0x00058DD8
|
||||
public override bool CanSeek
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000429 RID: 1065
|
||||
// (get) Token: 0x06001788 RID: 6024 RVA: 0x0005ABDC File Offset: 0x00058DDC
|
||||
public override bool CanWrite
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700042A RID: 1066
|
||||
// (get) Token: 0x06001789 RID: 6025 RVA: 0x0005ABE0 File Offset: 0x00058DE0
|
||||
public override long Length
|
||||
{
|
||||
get
|
||||
{
|
||||
return 0L;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700042B RID: 1067
|
||||
// (get) Token: 0x0600178A RID: 6026 RVA: 0x0005ABE4 File Offset: 0x00058DE4
|
||||
// (set) Token: 0x0600178B RID: 6027 RVA: 0x0005ABE8 File Offset: 0x00058DE8
|
||||
public override long Position
|
||||
{
|
||||
get
|
||||
{
|
||||
return 0L;
|
||||
}
|
||||
set
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600178C RID: 6028 RVA: 0x0005ABEC File Offset: 0x00058DEC
|
||||
public override void Flush()
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x0600178D RID: 6029 RVA: 0x0005ABF0 File Offset: 0x00058DF0
|
||||
public override int Read(byte[] buffer, int offset, int count)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Token: 0x0600178E RID: 6030 RVA: 0x0005ABF4 File Offset: 0x00058DF4
|
||||
public override int ReadByte()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Token: 0x0600178F RID: 6031 RVA: 0x0005ABF8 File Offset: 0x00058DF8
|
||||
public override long Seek(long offset, SeekOrigin origin)
|
||||
{
|
||||
return 0L;
|
||||
}
|
||||
|
||||
// Token: 0x06001790 RID: 6032 RVA: 0x0005ABFC File Offset: 0x00058DFC
|
||||
public override void SetLength(long value)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06001791 RID: 6033 RVA: 0x0005AC00 File Offset: 0x00058E00
|
||||
public override void Write(byte[] buffer, int offset, int count)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06001792 RID: 6034 RVA: 0x0005AC04 File Offset: 0x00058E04
|
||||
public override void WriteByte(byte value)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,854 @@
|
||||
using System;
|
||||
using System.Globalization;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Security;
|
||||
using System.Security.Cryptography;
|
||||
using System.Text;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
/// <summary>Performs operations on <see cref="T:System.String" /> instances that contain file or directory path information. These operations are performed in a cross-platform manner.</summary>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x020001C4 RID: 452
|
||||
[ComVisible(true)]
|
||||
public static class Path
|
||||
{
|
||||
/// <summary>Changes the extension of a path string.</summary>
|
||||
/// <returns>A string containing the modified path information.On Windows-based desktop platforms, if <paramref name="path" /> is null or an empty string (""), the path information is returned unmodified. If <paramref name="extension" /> is null, the returned string contains the specified path with its extension removed. If <paramref name="path" /> has no extension, and <paramref name="extension" /> is not null, the returned path string contains <paramref name="extension" /> appended to the end of <paramref name="path" />.</returns>
|
||||
/// <param name="path">The path information to modify. The path cannot contain any of the characters defined in <see cref="M:System.IO.Path.GetInvalidPathChars" />. </param>
|
||||
/// <param name="extension">The new extension (with or without a leading period). Specify null to remove an existing extension from <paramref name="path" />. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> contains one or more of the invalid characters defined in <see cref="M:System.IO.Path.GetInvalidPathChars" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06001744 RID: 5956 RVA: 0x00059464 File Offset: 0x00057664
|
||||
public static string ChangeExtension(string path, string extension)
|
||||
{
|
||||
if (path == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (path.IndexOfAny(Path.InvalidPathChars) != -1)
|
||||
{
|
||||
throw new ArgumentException("Illegal characters in path.");
|
||||
}
|
||||
int num = Path.findExtension(path);
|
||||
if (extension == null)
|
||||
{
|
||||
return (num >= 0) ? path.Substring(0, num) : path;
|
||||
}
|
||||
if (extension.Length == 0)
|
||||
{
|
||||
return (num >= 0) ? path.Substring(0, num + 1) : (path + '.');
|
||||
}
|
||||
if (path.Length != 0)
|
||||
{
|
||||
if (extension.Length > 0 && extension[0] != '.')
|
||||
{
|
||||
extension = "." + extension;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
extension = string.Empty;
|
||||
}
|
||||
if (num < 0)
|
||||
{
|
||||
return path + extension;
|
||||
}
|
||||
if (num > 0)
|
||||
{
|
||||
string text = path.Substring(0, num);
|
||||
return text + extension;
|
||||
}
|
||||
return extension;
|
||||
}
|
||||
|
||||
/// <summary>Combines two path strings.</summary>
|
||||
/// <returns>A string containing the combined paths. If one of the specified paths is a zero-length string, this method returns the other path. If <paramref name="path2" /> contains an absolute path, this method returns <paramref name="path2" />.</returns>
|
||||
/// <param name="path1">The first path. </param>
|
||||
/// <param name="path2">The second path. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path1" /> or <paramref name="path2" /> contain one or more of the invalid characters defined in <see cref="M:System.IO.Path.GetInvalidPathChars" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path1" /> or <paramref name="path2" /> is null. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06001745 RID: 5957 RVA: 0x00059550 File Offset: 0x00057750
|
||||
public static string Combine(string path1, string path2)
|
||||
{
|
||||
if (path1 == null)
|
||||
{
|
||||
throw new ArgumentNullException("path1");
|
||||
}
|
||||
if (path2 == null)
|
||||
{
|
||||
throw new ArgumentNullException("path2");
|
||||
}
|
||||
if (path1.Length == 0)
|
||||
{
|
||||
return path2;
|
||||
}
|
||||
if (path2.Length == 0)
|
||||
{
|
||||
return path1;
|
||||
}
|
||||
if (path1.IndexOfAny(Path.InvalidPathChars) != -1)
|
||||
{
|
||||
throw new ArgumentException("Illegal characters in path.");
|
||||
}
|
||||
if (path2.IndexOfAny(Path.InvalidPathChars) != -1)
|
||||
{
|
||||
throw new ArgumentException("Illegal characters in path.");
|
||||
}
|
||||
if (Path.IsPathRooted(path2))
|
||||
{
|
||||
return path2;
|
||||
}
|
||||
char c = path1[path1.Length - 1];
|
||||
if (c != Path.DirectorySeparatorChar && c != Path.AltDirectorySeparatorChar && c != Path.VolumeSeparatorChar)
|
||||
{
|
||||
return path1 + Path.DirectorySeparatorStr + path2;
|
||||
}
|
||||
return path1 + path2;
|
||||
}
|
||||
|
||||
// Token: 0x06001746 RID: 5958 RVA: 0x00059624 File Offset: 0x00057824
|
||||
internal static string CleanPath(string s)
|
||||
{
|
||||
int length = s.Length;
|
||||
int num = 0;
|
||||
int num2 = 0;
|
||||
char c = s[0];
|
||||
if (length > 2 && c == '\\' && s[1] == '\\')
|
||||
{
|
||||
num2 = 2;
|
||||
}
|
||||
if (length == 1 && (c == Path.DirectorySeparatorChar || c == Path.AltDirectorySeparatorChar))
|
||||
{
|
||||
return s;
|
||||
}
|
||||
for (int i = num2; i < length; i++)
|
||||
{
|
||||
char c2 = s[i];
|
||||
if (c2 == Path.DirectorySeparatorChar || c2 == Path.AltDirectorySeparatorChar)
|
||||
{
|
||||
if (i + 1 == length)
|
||||
{
|
||||
num++;
|
||||
}
|
||||
else
|
||||
{
|
||||
c2 = s[i + 1];
|
||||
if (c2 == Path.DirectorySeparatorChar || c2 == Path.AltDirectorySeparatorChar)
|
||||
{
|
||||
num++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (num == 0)
|
||||
{
|
||||
return s;
|
||||
}
|
||||
char[] array = new char[length - num];
|
||||
if (num2 != 0)
|
||||
{
|
||||
array[0] = '\\';
|
||||
array[1] = '\\';
|
||||
}
|
||||
int j = num2;
|
||||
int num3 = num2;
|
||||
while (j < length && num3 < array.Length)
|
||||
{
|
||||
char c3 = s[j];
|
||||
if (c3 != Path.DirectorySeparatorChar && c3 != Path.AltDirectorySeparatorChar)
|
||||
{
|
||||
array[num3++] = c3;
|
||||
}
|
||||
else if (num3 + 1 != array.Length)
|
||||
{
|
||||
array[num3++] = Path.DirectorySeparatorChar;
|
||||
while (j < length - 1)
|
||||
{
|
||||
c3 = s[j + 1];
|
||||
if (c3 != Path.DirectorySeparatorChar && c3 != Path.AltDirectorySeparatorChar)
|
||||
{
|
||||
break;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
}
|
||||
j++;
|
||||
}
|
||||
return new string(array);
|
||||
}
|
||||
|
||||
/// <summary>Returns the directory information for the specified path string.</summary>
|
||||
/// <returns>A <see cref="T:System.String" /> containing directory information for <paramref name="path" />, or null if <paramref name="path" /> denotes a root directory or is null. Returns <see cref="F:System.String.Empty" /> if <paramref name="path" /> does not contain directory information.</returns>
|
||||
/// <param name="path">The path of a file or directory. </param>
|
||||
/// <exception cref="T:System.ArgumentException">The <paramref name="path" /> parameter contains invalid characters, is empty, or contains only white spaces. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The <paramref name="path" /> parameter is longer than the system-defined maximum length.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06001747 RID: 5959 RVA: 0x000597D8 File Offset: 0x000579D8
|
||||
public static string GetDirectoryName(string path)
|
||||
{
|
||||
if (path == string.Empty)
|
||||
{
|
||||
throw new ArgumentException("Invalid path");
|
||||
}
|
||||
if (path == null || Path.GetPathRoot(path) == path)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (path.Trim().Length == 0)
|
||||
{
|
||||
throw new ArgumentException("Argument string consists of whitespace characters only.");
|
||||
}
|
||||
if (path.IndexOfAny(Path.InvalidPathChars) > -1)
|
||||
{
|
||||
throw new ArgumentException("Path contains invalid characters");
|
||||
}
|
||||
int num = path.LastIndexOfAny(Path.PathSeparatorChars);
|
||||
if (num == 0)
|
||||
{
|
||||
num++;
|
||||
}
|
||||
if (num <= 0)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
string text = path.Substring(0, num);
|
||||
int length = text.Length;
|
||||
if (length >= 2 && Path.DirectorySeparatorChar == '\\' && text[length - 1] == Path.VolumeSeparatorChar)
|
||||
{
|
||||
return text + Path.DirectorySeparatorChar;
|
||||
}
|
||||
return Path.CleanPath(text);
|
||||
}
|
||||
|
||||
/// <summary>Returns the extension of the specified path string.</summary>
|
||||
/// <returns>A <see cref="T:System.String" /> containing the extension of the specified path (including the "."), null, or <see cref="F:System.String.Empty" />. If <paramref name="path" /> is null, GetExtension returns null. If <paramref name="path" /> does not have extension information, GetExtension returns Empty.</returns>
|
||||
/// <param name="path">The path string from which to get the extension. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> contains one or more of the invalid characters defined in <see cref="M:System.IO.Path.GetInvalidPathChars" />. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06001748 RID: 5960 RVA: 0x000598C0 File Offset: 0x00057AC0
|
||||
public static string GetExtension(string path)
|
||||
{
|
||||
if (path == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (path.IndexOfAny(Path.InvalidPathChars) != -1)
|
||||
{
|
||||
throw new ArgumentException("Illegal characters in path.");
|
||||
}
|
||||
int num = Path.findExtension(path);
|
||||
if (num > -1 && num < path.Length - 1)
|
||||
{
|
||||
return path.Substring(num);
|
||||
}
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>Returns the file name and extension of the specified path string.</summary>
|
||||
/// <returns>A <see cref="T:System.String" /> consisting of the characters after the last directory character in <paramref name="path" />. If the last character of <paramref name="path" /> is a directory or volume separator character, this method returns <see cref="F:System.String.Empty" />. If <paramref name="path" /> is null, this method returns null.</returns>
|
||||
/// <param name="path">The path string from which to obtain the file name and extension. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> contains one or more of the invalid characters defined in <see cref="M:System.IO.Path.GetInvalidPathChars" />. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06001749 RID: 5961 RVA: 0x0005991C File Offset: 0x00057B1C
|
||||
public static string GetFileName(string path)
|
||||
{
|
||||
if (path == null || path.Length == 0)
|
||||
{
|
||||
return path;
|
||||
}
|
||||
if (path.IndexOfAny(Path.InvalidPathChars) != -1)
|
||||
{
|
||||
throw new ArgumentException("Illegal characters in path.");
|
||||
}
|
||||
int num = path.LastIndexOfAny(Path.PathSeparatorChars);
|
||||
if (num >= 0)
|
||||
{
|
||||
return path.Substring(num + 1);
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
/// <summary>Returns the file name of the specified path string without the extension.</summary>
|
||||
/// <returns>A <see cref="T:System.String" /> containing the string returned by <see cref="M:System.IO.Path.GetFileName(System.String)" />, minus the last period (.) and all characters following it.</returns>
|
||||
/// <param name="path">The path of the file. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> contains one or more of the invalid characters defined in <see cref="M:System.IO.Path.GetInvalidPathChars" />.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600174A RID: 5962 RVA: 0x00059978 File Offset: 0x00057B78
|
||||
public static string GetFileNameWithoutExtension(string path)
|
||||
{
|
||||
return Path.ChangeExtension(Path.GetFileName(path), null);
|
||||
}
|
||||
|
||||
/// <summary>Returns the absolute path for the specified path string.</summary>
|
||||
/// <returns>A string containing the fully qualified location of <paramref name="path" />, such as "C:\MyFile.txt".</returns>
|
||||
/// <param name="path">The file or directory for which to obtain absolute path information. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is a zero-length string, contains only white space, or contains one or more of the invalid characters defined in <see cref="M:System.IO.Path.GetInvalidPathChars" />.-or- The system could not retrieve the absolute path. </exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permissions. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> contains a colon (":") that is not part of a volume identifier (for example, "c:\"). </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" PathDiscovery="*AllFiles*" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x0600174B RID: 5963 RVA: 0x00059988 File Offset: 0x00057B88
|
||||
public static string GetFullPath(string path)
|
||||
{
|
||||
return Path.InsecureGetFullPath(path);
|
||||
}
|
||||
|
||||
// Token: 0x0600174C RID: 5964 RVA: 0x000599A0 File Offset: 0x00057BA0
|
||||
internal static string WindowsDriveAdjustment(string path)
|
||||
{
|
||||
if (path.Length < 2)
|
||||
{
|
||||
return path;
|
||||
}
|
||||
if (path[1] != ':' || !char.IsLetter(path[0]))
|
||||
{
|
||||
return path;
|
||||
}
|
||||
string currentDirectory = Directory.GetCurrentDirectory();
|
||||
if (path.Length == 2)
|
||||
{
|
||||
if (currentDirectory[0] == path[0])
|
||||
{
|
||||
path = currentDirectory;
|
||||
}
|
||||
else
|
||||
{
|
||||
path += '\\';
|
||||
}
|
||||
}
|
||||
else if (path[2] != Path.DirectorySeparatorChar && path[2] != Path.AltDirectorySeparatorChar)
|
||||
{
|
||||
if (currentDirectory[0] == path[0])
|
||||
{
|
||||
path = Path.Combine(currentDirectory, path.Substring(2, path.Length - 2));
|
||||
}
|
||||
else
|
||||
{
|
||||
path = path.Substring(0, 2) + Path.DirectorySeparatorStr + path.Substring(2, path.Length - 2);
|
||||
}
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
// Token: 0x0600174D RID: 5965 RVA: 0x00059A94 File Offset: 0x00057C94
|
||||
internal static string InsecureGetFullPath(string path)
|
||||
{
|
||||
if (path == null)
|
||||
{
|
||||
throw new ArgumentNullException("path");
|
||||
}
|
||||
if (path.Trim().Length == 0)
|
||||
{
|
||||
string text = Locale.GetText("The specified path is not of a legal form (empty).");
|
||||
throw new ArgumentException(text);
|
||||
}
|
||||
if (Environment.IsRunningOnWindows)
|
||||
{
|
||||
path = Path.WindowsDriveAdjustment(path);
|
||||
}
|
||||
char c = path[path.Length - 1];
|
||||
if (path.Length >= 2 && Path.IsDsc(path[0]) && Path.IsDsc(path[1]))
|
||||
{
|
||||
if (path.Length == 2 || path.IndexOf(path[0], 2) < 0)
|
||||
{
|
||||
throw new ArgumentException("UNC paths should be of the form \\\\server\\share.");
|
||||
}
|
||||
if (path[0] != Path.DirectorySeparatorChar)
|
||||
{
|
||||
path = path.Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
|
||||
}
|
||||
path = Path.CanonicalizePath(path);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!Path.IsPathRooted(path))
|
||||
{
|
||||
path = Directory.GetCurrentDirectory() + Path.DirectorySeparatorStr + path;
|
||||
}
|
||||
else if (Path.DirectorySeparatorChar == '\\' && path.Length >= 2 && Path.IsDsc(path[0]) && !Path.IsDsc(path[1]))
|
||||
{
|
||||
string currentDirectory = Directory.GetCurrentDirectory();
|
||||
if (currentDirectory[1] == Path.VolumeSeparatorChar)
|
||||
{
|
||||
path = currentDirectory.Substring(0, 2) + path;
|
||||
}
|
||||
else
|
||||
{
|
||||
path = currentDirectory.Substring(0, currentDirectory.IndexOf('\\', currentDirectory.IndexOf("\\\\") + 1));
|
||||
}
|
||||
}
|
||||
path = Path.CanonicalizePath(path);
|
||||
}
|
||||
if (Path.IsDsc(c) && path[path.Length - 1] != Path.DirectorySeparatorChar)
|
||||
{
|
||||
path += Path.DirectorySeparatorChar;
|
||||
}
|
||||
string text2;
|
||||
if (MonoIO.RemapPath(path, out text2))
|
||||
{
|
||||
path = text2;
|
||||
}
|
||||
return path;
|
||||
}
|
||||
|
||||
// Token: 0x0600174E RID: 5966 RVA: 0x00059C74 File Offset: 0x00057E74
|
||||
private static bool IsDsc(char c)
|
||||
{
|
||||
return c == Path.DirectorySeparatorChar || c == Path.AltDirectorySeparatorChar;
|
||||
}
|
||||
|
||||
/// <summary>Gets the root directory information of the specified path.</summary>
|
||||
/// <returns>A string containing the root directory of <paramref name="path" />, such as "C:\", or null if <paramref name="path" /> is null, or an empty string if <paramref name="path" /> does not contain root directory information.</returns>
|
||||
/// <param name="path">The path from which to obtain root directory information. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> contains one or more of the invalid characters defined in <see cref="M:System.IO.Path.GetInvalidPathChars" />.-or- <see cref="F:System.String.Empty" /> was passed to <paramref name="path" />. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600174F RID: 5967 RVA: 0x00059C8C File Offset: 0x00057E8C
|
||||
public static string GetPathRoot(string path)
|
||||
{
|
||||
if (path == null)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
if (path.Trim().Length == 0)
|
||||
{
|
||||
throw new ArgumentException("The specified path is not of a legal form.");
|
||||
}
|
||||
if (!Path.IsPathRooted(path))
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
if (Path.DirectorySeparatorChar == '/')
|
||||
{
|
||||
return (!Path.IsDsc(path[0])) ? string.Empty : Path.DirectorySeparatorStr;
|
||||
}
|
||||
int num = 2;
|
||||
if (path.Length == 1 && Path.IsDsc(path[0]))
|
||||
{
|
||||
return Path.DirectorySeparatorStr;
|
||||
}
|
||||
if (path.Length < 2)
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
if (Path.IsDsc(path[0]) && Path.IsDsc(path[1]))
|
||||
{
|
||||
while (num < path.Length && !Path.IsDsc(path[num]))
|
||||
{
|
||||
num++;
|
||||
}
|
||||
if (num < path.Length)
|
||||
{
|
||||
num++;
|
||||
while (num < path.Length && !Path.IsDsc(path[num]))
|
||||
{
|
||||
num++;
|
||||
}
|
||||
}
|
||||
return Path.DirectorySeparatorStr + Path.DirectorySeparatorStr + path.Substring(2, num - 2).Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
|
||||
}
|
||||
if (Path.IsDsc(path[0]))
|
||||
{
|
||||
return Path.DirectorySeparatorStr;
|
||||
}
|
||||
if (path[1] == Path.VolumeSeparatorChar)
|
||||
{
|
||||
if (path.Length >= 3 && Path.IsDsc(path[2]))
|
||||
{
|
||||
num++;
|
||||
}
|
||||
return path.Substring(0, num);
|
||||
}
|
||||
return Directory.GetCurrentDirectory().Substring(0, 2);
|
||||
}
|
||||
|
||||
/// <summary>Creates a uniquely named, zero-byte temporary file on disk and returns the full path of that file.</summary>
|
||||
/// <returns>A <see cref="T:System.String" /> containing the full path of the temporary file.</returns>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs, such as no unique temporary file name is available.- or -This method was unable to create a temporary file.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// <IPermission class="System.Security.Permissions.FileIOPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001750 RID: 5968 RVA: 0x00059E3C File Offset: 0x0005803C
|
||||
public static string GetTempFileName()
|
||||
{
|
||||
FileStream fileStream = null;
|
||||
Random random = new Random();
|
||||
string text;
|
||||
do
|
||||
{
|
||||
int num = random.Next();
|
||||
num++;
|
||||
text = Path.Combine(Path.GetTempPath(), "tmp" + num.ToString("x") + ".tmp");
|
||||
try
|
||||
{
|
||||
fileStream = new FileStream(text, FileMode.CreateNew, FileAccess.ReadWrite, FileShare.Read, 8192, false, (FileOptions)1);
|
||||
}
|
||||
catch (SecurityException)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch (UnauthorizedAccessException)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch (DirectoryNotFoundException)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
catch
|
||||
{
|
||||
}
|
||||
}
|
||||
while (fileStream == null);
|
||||
fileStream.Close();
|
||||
return text;
|
||||
}
|
||||
|
||||
/// <summary>Returns the path of the current system's temporary folder.</summary>
|
||||
/// <returns>A <see cref="T:System.String" /> containing the path information of a temporary directory.</returns>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permissions. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.EnvironmentPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Unrestricted="true" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x06001751 RID: 5969 RVA: 0x00059F2C File Offset: 0x0005812C
|
||||
public static string GetTempPath()
|
||||
{
|
||||
string temp_path = Path.get_temp_path();
|
||||
if (temp_path.Length > 0 && temp_path[temp_path.Length - 1] != Path.DirectorySeparatorChar)
|
||||
{
|
||||
return temp_path + Path.DirectorySeparatorChar;
|
||||
}
|
||||
return temp_path;
|
||||
}
|
||||
|
||||
// Token: 0x06001752 RID: 5970
|
||||
[MethodImpl(MethodImplOptions.InternalCall)]
|
||||
private static extern string get_temp_path();
|
||||
|
||||
/// <summary>Determines whether a path includes a file name extension.</summary>
|
||||
/// <returns>true if the characters that follow the last directory separator (\\ or /) or volume separator (:) in the path include a period (.) followed by one or more characters; otherwise, false.</returns>
|
||||
/// <param name="path">The path to search for an extension. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> contains one or more of the invalid characters defined in <see cref="M:System.IO.Path.GetInvalidPathChars" />. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06001753 RID: 5971 RVA: 0x00059F78 File Offset: 0x00058178
|
||||
public static bool HasExtension(string path)
|
||||
{
|
||||
if (path == null || path.Trim().Length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (path.IndexOfAny(Path.InvalidPathChars) != -1)
|
||||
{
|
||||
throw new ArgumentException("Illegal characters in path.");
|
||||
}
|
||||
int num = Path.findExtension(path);
|
||||
return 0 <= num && num < path.Length - 1;
|
||||
}
|
||||
|
||||
/// <summary>Gets a value indicating whether the specified path string contains absolute or relative path information.</summary>
|
||||
/// <returns>true if <paramref name="path" /> contains an absolute path; otherwise, false.</returns>
|
||||
/// <param name="path">The path to test. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> contains one or more of the invalid characters defined in <see cref="M:System.IO.Path.GetInvalidPathChars" />. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06001754 RID: 5972 RVA: 0x00059FD8 File Offset: 0x000581D8
|
||||
public static bool IsPathRooted(string path)
|
||||
{
|
||||
if (path == null || path.Length == 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (path.IndexOfAny(Path.InvalidPathChars) != -1)
|
||||
{
|
||||
throw new ArgumentException("Illegal characters in path.");
|
||||
}
|
||||
char c = path[0];
|
||||
return c == Path.DirectorySeparatorChar || c == Path.AltDirectorySeparatorChar || (!Path.dirEqualsVolume && path.Length > 1 && path[1] == Path.VolumeSeparatorChar);
|
||||
}
|
||||
|
||||
/// <summary>Gets an array containing the characters that are not allowed in file names.</summary>
|
||||
/// <returns>An array containing the characters that are not allowed in file names.</returns>
|
||||
// Token: 0x06001755 RID: 5973 RVA: 0x0005A05C File Offset: 0x0005825C
|
||||
public static char[] GetInvalidFileNameChars()
|
||||
{
|
||||
if (Environment.IsRunningOnWindows)
|
||||
{
|
||||
return new char[]
|
||||
{
|
||||
'\0', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005', '\u0006', '\a', '\b', '\t',
|
||||
'\n', '\v', '\f', '\r', '\u000e', '\u000f', '\u0010', '\u0011', '\u0012', '\u0013',
|
||||
'\u0014', '\u0015', '\u0016', '\u0017', '\u0018', '\u0019', '\u001a', '\u001b', '\u001c', '\u001d',
|
||||
'\u001e', '\u001f', '"', '<', '>', '|', ':', '*', '?', '\\',
|
||||
'/'
|
||||
};
|
||||
}
|
||||
return new char[] { '\0', '/' };
|
||||
}
|
||||
|
||||
/// <summary>Gets an array containing the characters that are not allowed in path names.</summary>
|
||||
/// <returns>An array containing the characters that are not allowed in path names.</returns>
|
||||
// Token: 0x06001756 RID: 5974 RVA: 0x0005A094 File Offset: 0x00058294
|
||||
public static char[] GetInvalidPathChars()
|
||||
{
|
||||
if (Environment.IsRunningOnWindows)
|
||||
{
|
||||
return new char[]
|
||||
{
|
||||
'"', '<', '>', '|', '\0', '\u0001', '\u0002', '\u0003', '\u0004', '\u0005',
|
||||
'\u0006', '\a', '\b', '\t', '\n', '\v', '\f', '\r', '\u000e', '\u000f',
|
||||
'\u0010', '\u0011', '\u0012', '\u0013', '\u0014', '\u0015', '\u0016', '\u0017', '\u0018', '\u0019',
|
||||
'\u001a', '\u001b', '\u001c', '\u001d', '\u001e', '\u001f'
|
||||
};
|
||||
}
|
||||
return new char[1];
|
||||
}
|
||||
|
||||
/// <summary>Returns a random folder name or file name.</summary>
|
||||
/// <returns>A random folder name or file name.</returns>
|
||||
// Token: 0x06001757 RID: 5975 RVA: 0x0005A0BC File Offset: 0x000582BC
|
||||
public static string GetRandomFileName()
|
||||
{
|
||||
StringBuilder stringBuilder = new StringBuilder(12);
|
||||
RandomNumberGenerator randomNumberGenerator = RandomNumberGenerator.Create();
|
||||
byte[] array = new byte[11];
|
||||
randomNumberGenerator.GetBytes(array);
|
||||
for (int i = 0; i < array.Length; i++)
|
||||
{
|
||||
if (stringBuilder.Length == 8)
|
||||
{
|
||||
stringBuilder.Append('.');
|
||||
}
|
||||
int num = (int)(array[i] % 36);
|
||||
char c = (char)((num >= 26) ? (num - 26 + 48) : (num + 97));
|
||||
stringBuilder.Append(c);
|
||||
}
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
|
||||
// Token: 0x06001758 RID: 5976 RVA: 0x0005A144 File Offset: 0x00058344
|
||||
private static int findExtension(string path)
|
||||
{
|
||||
if (path != null)
|
||||
{
|
||||
int num = path.LastIndexOf('.');
|
||||
int num2 = path.LastIndexOfAny(Path.PathSeparatorChars);
|
||||
if (num > num2)
|
||||
{
|
||||
return num;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Token: 0x06001759 RID: 5977 RVA: 0x0005A178 File Offset: 0x00058378
|
||||
private static string GetServerAndShare(string path)
|
||||
{
|
||||
int num = 2;
|
||||
while (num < path.Length && !Path.IsDsc(path[num]))
|
||||
{
|
||||
num++;
|
||||
}
|
||||
if (num < path.Length)
|
||||
{
|
||||
num++;
|
||||
while (num < path.Length && !Path.IsDsc(path[num]))
|
||||
{
|
||||
num++;
|
||||
}
|
||||
}
|
||||
return path.Substring(2, num - 2).Replace(Path.AltDirectorySeparatorChar, Path.DirectorySeparatorChar);
|
||||
}
|
||||
|
||||
// Token: 0x0600175A RID: 5978 RVA: 0x0005A1FC File Offset: 0x000583FC
|
||||
private static bool SameRoot(string root, string path)
|
||||
{
|
||||
if (root.Length < 2 || path.Length < 2)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
if (!Path.IsDsc(root[0]) || !Path.IsDsc(root[1]))
|
||||
{
|
||||
return root[0].Equals(path[0]) && path[1] == Path.VolumeSeparatorChar && (root.Length <= 2 || path.Length <= 2 || (Path.IsDsc(root[2]) && Path.IsDsc(path[2])));
|
||||
}
|
||||
if (!Path.IsDsc(path[0]) || !Path.IsDsc(path[1]))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
string serverAndShare = Path.GetServerAndShare(root);
|
||||
string serverAndShare2 = Path.GetServerAndShare(path);
|
||||
return string.Compare(serverAndShare, serverAndShare2, true, CultureInfo.InvariantCulture) == 0;
|
||||
}
|
||||
|
||||
// Token: 0x0600175B RID: 5979 RVA: 0x0005A2F4 File Offset: 0x000584F4
|
||||
private static string CanonicalizePath(string path)
|
||||
{
|
||||
if (path == null)
|
||||
{
|
||||
return path;
|
||||
}
|
||||
if (Environment.IsRunningOnWindows)
|
||||
{
|
||||
path = path.Trim();
|
||||
}
|
||||
if (path.Length == 0)
|
||||
{
|
||||
return path;
|
||||
}
|
||||
string pathRoot = Path.GetPathRoot(path);
|
||||
string[] array = path.Split(new char[]
|
||||
{
|
||||
Path.DirectorySeparatorChar,
|
||||
Path.AltDirectorySeparatorChar
|
||||
});
|
||||
int num = 0;
|
||||
bool flag = Environment.IsRunningOnWindows && pathRoot.Length > 2 && Path.IsDsc(pathRoot[0]) && Path.IsDsc(pathRoot[1]);
|
||||
int num2 = ((!flag) ? 0 : 3);
|
||||
for (int i = 0; i < array.Length; i++)
|
||||
{
|
||||
if (Environment.IsRunningOnWindows)
|
||||
{
|
||||
array[i] = array[i].TrimEnd(new char[0]);
|
||||
}
|
||||
if (!(array[i] == ".") && (i == 0 || array[i].Length != 0))
|
||||
{
|
||||
if (array[i] == "..")
|
||||
{
|
||||
if (num > num2)
|
||||
{
|
||||
num--;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
array[num++] = array[i];
|
||||
}
|
||||
}
|
||||
}
|
||||
if (num == 0 || (num == 1 && array[0] == string.Empty))
|
||||
{
|
||||
return pathRoot;
|
||||
}
|
||||
string text = string.Join(Path.DirectorySeparatorStr, array, 0, num);
|
||||
if (!Environment.IsRunningOnWindows)
|
||||
{
|
||||
return text;
|
||||
}
|
||||
if (flag)
|
||||
{
|
||||
text = Path.DirectorySeparatorStr + text;
|
||||
}
|
||||
if (!Path.SameRoot(pathRoot, text))
|
||||
{
|
||||
text = pathRoot + text;
|
||||
}
|
||||
if (flag)
|
||||
{
|
||||
return text;
|
||||
}
|
||||
if (!Path.IsDsc(path[0]) && Path.SameRoot(pathRoot, path))
|
||||
{
|
||||
if (text.Length <= 2 && !text.EndsWith(Path.DirectorySeparatorStr))
|
||||
{
|
||||
text += Path.DirectorySeparatorChar;
|
||||
}
|
||||
return text;
|
||||
}
|
||||
string currentDirectory = Directory.GetCurrentDirectory();
|
||||
if (currentDirectory.Length > 1 && currentDirectory[1] == Path.VolumeSeparatorChar)
|
||||
{
|
||||
if (text.Length == 0 || Path.IsDsc(text[0]))
|
||||
{
|
||||
text += '\\';
|
||||
}
|
||||
return currentDirectory.Substring(0, 2) + text;
|
||||
}
|
||||
if (Path.IsDsc(currentDirectory[currentDirectory.Length - 1]) && Path.IsDsc(text[0]))
|
||||
{
|
||||
return currentDirectory + text.Substring(1);
|
||||
}
|
||||
return currentDirectory + text;
|
||||
}
|
||||
|
||||
// Token: 0x0600175C RID: 5980 RVA: 0x0005A594 File Offset: 0x00058794
|
||||
internal static bool IsPathSubsetOf(string subset, string path)
|
||||
{
|
||||
if (subset.Length > path.Length)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
int num = subset.LastIndexOfAny(Path.PathSeparatorChars);
|
||||
if (string.Compare(subset, 0, path, 0, num) != 0)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
num++;
|
||||
int num2 = path.IndexOfAny(Path.PathSeparatorChars, num);
|
||||
if (num2 >= num)
|
||||
{
|
||||
return string.Compare(subset, num, path, num, path.Length - num2) == 0;
|
||||
}
|
||||
return subset.Length == path.Length && string.Compare(subset, num, path, num, subset.Length - num) == 0;
|
||||
}
|
||||
|
||||
/// <summary>Provides a platform-specific array of characters that cannot be specified in path string arguments passed to members of the <see cref="T:System.IO.Path" /> class.</summary>
|
||||
/// <returns>A character array of invalid path characters for the current platform.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x040006DE RID: 1758
|
||||
[Obsolete("see GetInvalidPathChars and GetInvalidFileNameChars methods.")]
|
||||
public static readonly char[] InvalidPathChars = Path.GetInvalidPathChars();
|
||||
|
||||
/// <summary>Provides a platform-specific alternate character used to separate directory levels in a path string that reflects a hierarchical file system organization.</summary>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x040006DF RID: 1759
|
||||
public static readonly char AltDirectorySeparatorChar = MonoIO.AltDirectorySeparatorChar;
|
||||
|
||||
/// <summary>Provides a platform-specific character used to separate directory levels in a path string that reflects a hierarchical file system organization.</summary>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x040006E0 RID: 1760
|
||||
public static readonly char DirectorySeparatorChar = MonoIO.DirectorySeparatorChar;
|
||||
|
||||
/// <summary>A platform-specific separator character used to separate path strings in environment variables.</summary>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x040006E1 RID: 1761
|
||||
public static readonly char PathSeparator = MonoIO.PathSeparator;
|
||||
|
||||
// Token: 0x040006E2 RID: 1762
|
||||
internal static readonly string DirectorySeparatorStr = Path.DirectorySeparatorChar.ToString();
|
||||
|
||||
/// <summary>Provides a platform-specific volume separator character.</summary>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x040006E3 RID: 1763
|
||||
public static readonly char VolumeSeparatorChar = MonoIO.VolumeSeparatorChar;
|
||||
|
||||
// Token: 0x040006E4 RID: 1764
|
||||
internal static readonly char[] PathSeparatorChars = new char[]
|
||||
{
|
||||
Path.DirectorySeparatorChar,
|
||||
Path.AltDirectorySeparatorChar,
|
||||
Path.VolumeSeparatorChar
|
||||
};
|
||||
|
||||
// Token: 0x040006E5 RID: 1765
|
||||
private static readonly bool dirEqualsVolume = Path.DirectorySeparatorChar == Path.VolumeSeparatorChar;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Runtime.Serialization;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
/// <summary>The exception that is thrown when a pathname or filename is longer than the system-defined maximum length.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x020001C5 RID: 453
|
||||
[ComVisible(true)]
|
||||
[Serializable]
|
||||
public class PathTooLongException : IOException
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.PathTooLongException" /> class with its HRESULT set to COR_E_PATHTOOLONG.</summary>
|
||||
// Token: 0x0600175D RID: 5981 RVA: 0x0005A628 File Offset: 0x00058828
|
||||
public PathTooLongException()
|
||||
: base(Locale.GetText("Pathname is longer than the maximum length"))
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.PathTooLongException" /> class with its message string set to <paramref name="message" /> and its HRESULT set to COR_E_PATHTOOLONG.</summary>
|
||||
/// <param name="message">A <see cref="T:System.String" /> that describes the error. The content of <paramref name="message" /> is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture. </param>
|
||||
// Token: 0x0600175E RID: 5982 RVA: 0x0005A63C File Offset: 0x0005883C
|
||||
public PathTooLongException(string message)
|
||||
: base(message)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.PathTooLongException" /> class with the specified serialization and context information.</summary>
|
||||
/// <param name="info">The <see cref="T:System.Runtime.Serialization.SerializationInfo" /> that holds the serialized object data about the exception being thrown. </param>
|
||||
/// <param name="context">The <see cref="T:System.Runtime.Serialization.StreamingContext" /> that contains contextual information about the source or destination. </param>
|
||||
// Token: 0x0600175F RID: 5983 RVA: 0x0005A648 File Offset: 0x00058848
|
||||
protected PathTooLongException(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.PathTooLongException" /> class with a specified error message and a reference to the inner exception that is the cause of this exception.</summary>
|
||||
/// <param name="message">A <see cref="T:System.String" /> that describes the error. The content of <paramref name="message" /> is intended to be understood by humans. The caller of this constructor is required to ensure that this string has been localized for the current system culture. </param>
|
||||
/// <param name="innerException">The exception that is the cause of the current exception. If the <paramref name="innerException" /> parameter is not null, the current exception is raised in a catch block that handles the inner exception. </param>
|
||||
// Token: 0x06001760 RID: 5984 RVA: 0x0005A654 File Offset: 0x00058854
|
||||
public PathTooLongException(string message, Exception innerException)
|
||||
: base(message, innerException)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
/// <summary>Specifies whether to search the current directory, or the current directory and all subdirectories. </summary>
|
||||
// Token: 0x020001C6 RID: 454
|
||||
[ComVisible(true)]
|
||||
[Serializable]
|
||||
public enum SearchOption
|
||||
{
|
||||
/// <summary>Includes only the current directory in a search.</summary>
|
||||
// Token: 0x040006E7 RID: 1767
|
||||
TopDirectoryOnly,
|
||||
/// <summary>Includes the current directory and all the subdirectories in a search operation. This option includes reparse points like mounted drives and symbolic links in the search.</summary>
|
||||
// Token: 0x040006E8 RID: 1768
|
||||
AllDirectories
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,198 @@
|
||||
using System;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
// Token: 0x020001C7 RID: 455
|
||||
internal class SearchPattern
|
||||
{
|
||||
// Token: 0x06001761 RID: 5985 RVA: 0x0005A660 File Offset: 0x00058860
|
||||
public SearchPattern(string pattern)
|
||||
: this(pattern, false)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06001762 RID: 5986 RVA: 0x0005A66C File Offset: 0x0005886C
|
||||
public SearchPattern(string pattern, bool ignore)
|
||||
{
|
||||
this.ignore = ignore;
|
||||
this.Compile(pattern);
|
||||
}
|
||||
|
||||
// Token: 0x06001764 RID: 5988 RVA: 0x0005A6C4 File Offset: 0x000588C4
|
||||
public bool IsMatch(string text)
|
||||
{
|
||||
return this.Match(this.ops, text, 0);
|
||||
}
|
||||
|
||||
// Token: 0x06001765 RID: 5989 RVA: 0x0005A6D4 File Offset: 0x000588D4
|
||||
private void Compile(string pattern)
|
||||
{
|
||||
if (pattern == null || pattern.IndexOfAny(SearchPattern.InvalidChars) >= 0)
|
||||
{
|
||||
throw new ArgumentException("Invalid search pattern.");
|
||||
}
|
||||
if (pattern == "*")
|
||||
{
|
||||
this.ops = new SearchPattern.Op(SearchPattern.OpCode.True);
|
||||
return;
|
||||
}
|
||||
this.ops = null;
|
||||
int i = 0;
|
||||
SearchPattern.Op op = null;
|
||||
while (i < pattern.Length)
|
||||
{
|
||||
char c = pattern[i];
|
||||
SearchPattern.Op op2;
|
||||
if (c != '*')
|
||||
{
|
||||
if (c != '?')
|
||||
{
|
||||
op2 = new SearchPattern.Op(SearchPattern.OpCode.ExactString);
|
||||
int num = pattern.IndexOfAny(SearchPattern.WildcardChars, i);
|
||||
if (num < 0)
|
||||
{
|
||||
num = pattern.Length;
|
||||
}
|
||||
op2.Argument = pattern.Substring(i, num - i);
|
||||
if (this.ignore)
|
||||
{
|
||||
op2.Argument = op2.Argument.ToLowerInvariant();
|
||||
}
|
||||
i = num;
|
||||
}
|
||||
else
|
||||
{
|
||||
op2 = new SearchPattern.Op(SearchPattern.OpCode.AnyChar);
|
||||
i++;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
op2 = new SearchPattern.Op(SearchPattern.OpCode.AnyString);
|
||||
i++;
|
||||
}
|
||||
if (op == null)
|
||||
{
|
||||
this.ops = op2;
|
||||
}
|
||||
else
|
||||
{
|
||||
op.Next = op2;
|
||||
}
|
||||
op = op2;
|
||||
}
|
||||
if (op == null)
|
||||
{
|
||||
this.ops = new SearchPattern.Op(SearchPattern.OpCode.End);
|
||||
}
|
||||
else
|
||||
{
|
||||
op.Next = new SearchPattern.Op(SearchPattern.OpCode.End);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001766 RID: 5990 RVA: 0x0005A810 File Offset: 0x00058A10
|
||||
private bool Match(SearchPattern.Op op, string text, int ptr)
|
||||
{
|
||||
while (op != null)
|
||||
{
|
||||
switch (op.Code)
|
||||
{
|
||||
case SearchPattern.OpCode.ExactString:
|
||||
{
|
||||
int length = op.Argument.Length;
|
||||
if (ptr + length > text.Length)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
string text2 = text.Substring(ptr, length);
|
||||
if (this.ignore)
|
||||
{
|
||||
text2 = text2.ToLowerInvariant();
|
||||
}
|
||||
if (text2 != op.Argument)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
ptr += length;
|
||||
break;
|
||||
}
|
||||
case SearchPattern.OpCode.AnyChar:
|
||||
if (++ptr > text.Length)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
break;
|
||||
case SearchPattern.OpCode.AnyString:
|
||||
while (ptr <= text.Length)
|
||||
{
|
||||
if (this.Match(op.Next, text, ptr))
|
||||
{
|
||||
return true;
|
||||
}
|
||||
ptr++;
|
||||
}
|
||||
return false;
|
||||
case SearchPattern.OpCode.End:
|
||||
return ptr == text.Length;
|
||||
case SearchPattern.OpCode.True:
|
||||
return true;
|
||||
}
|
||||
op = op.Next;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
// Token: 0x040006E9 RID: 1769
|
||||
private SearchPattern.Op ops;
|
||||
|
||||
// Token: 0x040006EA RID: 1770
|
||||
private bool ignore;
|
||||
|
||||
// Token: 0x040006EB RID: 1771
|
||||
internal static readonly char[] WildcardChars = new char[] { '*', '?' };
|
||||
|
||||
// Token: 0x040006EC RID: 1772
|
||||
internal static readonly char[] InvalidChars = new char[]
|
||||
{
|
||||
Path.DirectorySeparatorChar,
|
||||
Path.AltDirectorySeparatorChar
|
||||
};
|
||||
|
||||
// Token: 0x020001C8 RID: 456
|
||||
private class Op
|
||||
{
|
||||
// Token: 0x06001767 RID: 5991 RVA: 0x0005A904 File Offset: 0x00058B04
|
||||
public Op(SearchPattern.OpCode code)
|
||||
{
|
||||
this.Code = code;
|
||||
this.Argument = null;
|
||||
this.Next = null;
|
||||
}
|
||||
|
||||
// Token: 0x040006ED RID: 1773
|
||||
public SearchPattern.OpCode Code;
|
||||
|
||||
// Token: 0x040006EE RID: 1774
|
||||
public string Argument;
|
||||
|
||||
// Token: 0x040006EF RID: 1775
|
||||
public SearchPattern.Op Next;
|
||||
}
|
||||
|
||||
// Token: 0x020001C9 RID: 457
|
||||
private enum OpCode
|
||||
{
|
||||
// Token: 0x040006F1 RID: 1777
|
||||
ExactString,
|
||||
// Token: 0x040006F2 RID: 1778
|
||||
AnyChar,
|
||||
// Token: 0x040006F3 RID: 1779
|
||||
AnyString,
|
||||
// Token: 0x040006F4 RID: 1780
|
||||
End,
|
||||
// Token: 0x040006F5 RID: 1781
|
||||
True
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
/// <summary>Provides the fields that represent reference points in streams for seeking.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x020001CA RID: 458
|
||||
[ComVisible(true)]
|
||||
[Serializable]
|
||||
public enum SeekOrigin
|
||||
{
|
||||
/// <summary>Specifies the beginning of a stream.</summary>
|
||||
// Token: 0x040006F7 RID: 1783
|
||||
Begin,
|
||||
/// <summary>Specifies the current position within a stream.</summary>
|
||||
// Token: 0x040006F8 RID: 1784
|
||||
Current,
|
||||
/// <summary>Specifies the end of a stream.</summary>
|
||||
// Token: 0x040006F9 RID: 1785
|
||||
End
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,371 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Threading;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
/// <summary>Provides a generic view of a sequence of bytes.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x020001CB RID: 459
|
||||
[ComVisible(true)]
|
||||
[Serializable]
|
||||
public abstract class Stream : IDisposable
|
||||
{
|
||||
/// <summary>When overridden in a derived class, gets a value indicating whether the current stream supports reading.</summary>
|
||||
/// <returns>true if the stream supports reading; otherwise, false.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x1700041F RID: 1055
|
||||
// (get) Token: 0x0600176A RID: 5994
|
||||
public abstract bool CanRead { get; }
|
||||
|
||||
/// <summary>When overridden in a derived class, gets a value indicating whether the current stream supports seeking.</summary>
|
||||
/// <returns>true if the stream supports seeking; otherwise, false.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x17000420 RID: 1056
|
||||
// (get) Token: 0x0600176B RID: 5995
|
||||
public abstract bool CanSeek { get; }
|
||||
|
||||
/// <summary>When overridden in a derived class, gets a value indicating whether the current stream supports writing.</summary>
|
||||
/// <returns>true if the stream supports writing; otherwise, false.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x17000421 RID: 1057
|
||||
// (get) Token: 0x0600176C RID: 5996
|
||||
public abstract bool CanWrite { get; }
|
||||
|
||||
/// <summary>Gets a value that determines whether the current stream can time out.</summary>
|
||||
/// <returns>A value that determines whether the current stream can time out.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000422 RID: 1058
|
||||
// (get) Token: 0x0600176D RID: 5997 RVA: 0x0005A938 File Offset: 0x00058B38
|
||||
[ComVisible(false)]
|
||||
public virtual bool CanTimeout
|
||||
{
|
||||
get
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, gets the length in bytes of the stream.</summary>
|
||||
/// <returns>A long value representing the length of the stream in bytes.</returns>
|
||||
/// <exception cref="T:System.NotSupportedException">A class derived from Stream does not support seeking. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">Methods were called after the stream was closed. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x17000423 RID: 1059
|
||||
// (get) Token: 0x0600176E RID: 5998
|
||||
public abstract long Length { get; }
|
||||
|
||||
/// <summary>When overridden in a derived class, gets or sets the position within the current stream.</summary>
|
||||
/// <returns>The current position within the stream.</returns>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">The stream does not support seeking. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">Methods were called after the stream was closed. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x17000424 RID: 1060
|
||||
// (get) Token: 0x0600176F RID: 5999
|
||||
// (set) Token: 0x06001770 RID: 6000
|
||||
public abstract long Position { get; set; }
|
||||
|
||||
/// <summary>Releases all resources used by the <see cref="T:System.IO.Stream" />.</summary>
|
||||
// Token: 0x06001771 RID: 6001 RVA: 0x0005A93C File Offset: 0x00058B3C
|
||||
public void Dispose()
|
||||
{
|
||||
this.Close();
|
||||
}
|
||||
|
||||
/// <summary>Releases the unmanaged resources used by the <see cref="T:System.IO.Stream" /> and optionally releases the managed resources.</summary>
|
||||
/// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
|
||||
// Token: 0x06001772 RID: 6002 RVA: 0x0005A944 File Offset: 0x00058B44
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Closes the current stream and releases any resources (such as sockets and file handles) associated with the current stream.</summary>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06001773 RID: 6003 RVA: 0x0005A948 File Offset: 0x00058B48
|
||||
public virtual void Close()
|
||||
{
|
||||
this.Dispose(true);
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets a value, in miliseconds, that determines how long the stream will attempt to read before timing out. </summary>
|
||||
/// <returns>A value, in miliseconds, that determines how long the stream will attempt to read before timing out.</returns>
|
||||
/// <exception cref="T:System.InvalidOperationException">The <see cref="P:System.IO.Stream.ReadTimeout" /> method always throws an <see cref="T:System.InvalidOperationException" />. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000425 RID: 1061
|
||||
// (get) Token: 0x06001774 RID: 6004 RVA: 0x0005A954 File Offset: 0x00058B54
|
||||
// (set) Token: 0x06001775 RID: 6005 RVA: 0x0005A960 File Offset: 0x00058B60
|
||||
[ComVisible(false)]
|
||||
public virtual int ReadTimeout
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new InvalidOperationException("Timeouts are not supported on this stream.");
|
||||
}
|
||||
set
|
||||
{
|
||||
throw new InvalidOperationException("Timeouts are not supported on this stream.");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets a value, in miliseconds, that determines how long the stream will attempt to write before timing out. </summary>
|
||||
/// <returns>A value, in miliseconds, that determines how long the stream will attempt to write before timing out.</returns>
|
||||
/// <exception cref="T:System.InvalidOperationException">The <see cref="P:System.IO.Stream.WriteTimeout" /> method always throws an <see cref="T:System.InvalidOperationException" />. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000426 RID: 1062
|
||||
// (get) Token: 0x06001776 RID: 6006 RVA: 0x0005A96C File Offset: 0x00058B6C
|
||||
// (set) Token: 0x06001777 RID: 6007 RVA: 0x0005A978 File Offset: 0x00058B78
|
||||
[ComVisible(false)]
|
||||
public virtual int WriteTimeout
|
||||
{
|
||||
get
|
||||
{
|
||||
throw new InvalidOperationException("Timeouts are not supported on this stream.");
|
||||
}
|
||||
set
|
||||
{
|
||||
throw new InvalidOperationException("Timeouts are not supported on this stream.");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Creates a thread-safe (synchronized) wrapper around the specified <see cref="T:System.IO.Stream" /> object.</summary>
|
||||
/// <returns>A thread-safe <see cref="T:System.IO.Stream" /> object.</returns>
|
||||
/// <param name="stream">The <see cref="T:System.IO.Stream" /> object to synchronize.</param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="stream" /> is null.</exception>
|
||||
// Token: 0x06001778 RID: 6008 RVA: 0x0005A984 File Offset: 0x00058B84
|
||||
public static Stream Synchronized(Stream stream)
|
||||
{
|
||||
throw new NotImplementedException();
|
||||
}
|
||||
|
||||
/// <summary>Allocates a <see cref="T:System.Threading.WaitHandle" /> object.</summary>
|
||||
/// <returns>A reference to the allocated WaitHandle.</returns>
|
||||
// Token: 0x06001779 RID: 6009 RVA: 0x0005A98C File Offset: 0x00058B8C
|
||||
[Obsolete("CreateWaitHandle is due for removal. Use \"new ManualResetEvent(false)\" instead.")]
|
||||
protected virtual WaitHandle CreateWaitHandle()
|
||||
{
|
||||
return new ManualResetEvent(false);
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, clears all buffers for this stream and causes any buffered data to be written to the underlying device.</summary>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x0600177A RID: 6010
|
||||
public abstract void Flush();
|
||||
|
||||
/// <summary>When overridden in a derived class, reads a sequence of bytes from the current stream and advances the position within the stream by the number of bytes read.</summary>
|
||||
/// <returns>The total number of bytes read into the buffer. This can be less than the number of bytes requested if that many bytes are not currently available, or zero (0) if the end of the stream has been reached. </returns>
|
||||
/// <param name="buffer">An array of bytes. When this method returns, the buffer contains the specified byte array with the values between <paramref name="offset" /> and (<paramref name="offset" /> + <paramref name="count" /> - 1) replaced by the bytes read from the current source. </param>
|
||||
/// <param name="offset">The zero-based byte offset in <paramref name="buffer" /> at which to begin storing the data read from the current stream. </param>
|
||||
/// <param name="count">The maximum number of bytes to be read from the current stream. </param>
|
||||
/// <exception cref="T:System.ArgumentException">The sum of <paramref name="offset" /> and <paramref name="count" /> is larger than the buffer length. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="buffer" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="offset" /> or <paramref name="count" /> is negative. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">The stream does not support reading. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">Methods were called after the stream was closed. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600177B RID: 6011
|
||||
public abstract int Read([In] [Out] byte[] buffer, int offset, int count);
|
||||
|
||||
/// <summary>Reads a byte from the stream and advances the position within the stream by one byte, or returns -1 if at the end of the stream.</summary>
|
||||
/// <returns>The unsigned byte cast to an Int32, or -1 if at the end of the stream.</returns>
|
||||
/// <exception cref="T:System.NotSupportedException">The stream does not support reading. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">Methods were called after the stream was closed. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x0600177C RID: 6012 RVA: 0x0005A994 File Offset: 0x00058B94
|
||||
public virtual int ReadByte()
|
||||
{
|
||||
byte[] array = new byte[1];
|
||||
if (this.Read(array, 0, 1) == 1)
|
||||
{
|
||||
return (int)array[0];
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, sets the position within the current stream.</summary>
|
||||
/// <returns>The new position within the current stream.</returns>
|
||||
/// <param name="offset">A byte offset relative to the <paramref name="origin" /> parameter. </param>
|
||||
/// <param name="origin">A value of type <see cref="T:System.IO.SeekOrigin" /> indicating the reference point used to obtain the new position. </param>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">The stream does not support seeking, such as if the stream is constructed from a pipe or console output. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">Methods were called after the stream was closed. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600177D RID: 6013
|
||||
public abstract long Seek(long offset, SeekOrigin origin);
|
||||
|
||||
/// <summary>When overridden in a derived class, sets the length of the current stream.</summary>
|
||||
/// <param name="value">The desired length of the current stream in bytes. </param>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">The stream does not support both writing and seeking, such as if the stream is constructed from a pipe or console output. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">Methods were called after the stream was closed. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x0600177E RID: 6014
|
||||
public abstract void SetLength(long value);
|
||||
|
||||
/// <summary>When overridden in a derived class, writes a sequence of bytes to the current stream and advances the current position within this stream by the number of bytes written.</summary>
|
||||
/// <param name="buffer">An array of bytes. This method copies <paramref name="count" /> bytes from <paramref name="buffer" /> to the current stream. </param>
|
||||
/// <param name="offset">The zero-based byte offset in <paramref name="buffer" /> at which to begin copying bytes to the current stream. </param>
|
||||
/// <param name="count">The number of bytes to be written to the current stream. </param>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600177F RID: 6015
|
||||
public abstract void Write(byte[] buffer, int offset, int count);
|
||||
|
||||
/// <summary>Writes a byte to the current position in the stream and advances the position within the stream by one byte.</summary>
|
||||
/// <param name="value">The byte to write to the stream. </param>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">The stream does not support writing, or the stream is already closed. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">Methods were called after the stream was closed. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06001780 RID: 6016 RVA: 0x0005A9BC File Offset: 0x00058BBC
|
||||
public virtual void WriteByte(byte value)
|
||||
{
|
||||
this.Write(new byte[] { value }, 0, 1);
|
||||
}
|
||||
|
||||
/// <summary>Begins an asynchronous read operation.</summary>
|
||||
/// <returns>An <see cref="T:System.IAsyncResult" /> that represents the asynchronous read, which could still be pending.</returns>
|
||||
/// <param name="buffer">The buffer to read the data into. </param>
|
||||
/// <param name="offset">The byte offset in <paramref name="buffer" /> at which to begin writing data read from the stream. </param>
|
||||
/// <param name="count">The maximum number of bytes to read. </param>
|
||||
/// <param name="callback">An optional asynchronous callback, to be called when the read is complete. </param>
|
||||
/// <param name="state">A user-provided object that distinguishes this particular asynchronous read request from other requests. </param>
|
||||
/// <exception cref="T:System.IO.IOException">Attempted an asynchronous read past the end of the stream, or a disk error occurs. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">One or more of the arguments is invalid. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">Methods were called after the stream was closed. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">The current Stream implementation does not support the read operation. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06001781 RID: 6017 RVA: 0x0005A9E0 File Offset: 0x00058BE0
|
||||
public virtual IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
|
||||
{
|
||||
if (!this.CanRead)
|
||||
{
|
||||
throw new NotSupportedException("This stream does not support reading");
|
||||
}
|
||||
StreamAsyncResult streamAsyncResult = new StreamAsyncResult(state);
|
||||
try
|
||||
{
|
||||
int num = this.Read(buffer, offset, count);
|
||||
streamAsyncResult.SetComplete(null, num);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
streamAsyncResult.SetComplete(ex, 0);
|
||||
}
|
||||
if (callback != null)
|
||||
{
|
||||
callback(streamAsyncResult);
|
||||
}
|
||||
return streamAsyncResult;
|
||||
}
|
||||
|
||||
/// <summary>Begins an asynchronous write operation.</summary>
|
||||
/// <returns>An IAsyncResult that represents the asynchronous write, which could still be pending.</returns>
|
||||
/// <param name="buffer">The buffer to write data from. </param>
|
||||
/// <param name="offset">The byte offset in <paramref name="buffer" /> from which to begin writing. </param>
|
||||
/// <param name="count">The maximum number of bytes to write. </param>
|
||||
/// <param name="callback">An optional asynchronous callback, to be called when the write is complete. </param>
|
||||
/// <param name="state">A user-provided object that distinguishes this particular asynchronous write request from other requests. </param>
|
||||
/// <exception cref="T:System.IO.IOException">Attempted an asynchronous write past the end of the stream, or a disk error occurs. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">One or more of the arguments is invalid. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">Methods were called after the stream was closed. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">The current Stream implementation does not support the write operation. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06001782 RID: 6018 RVA: 0x0005AA5C File Offset: 0x00058C5C
|
||||
public virtual IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback callback, object state)
|
||||
{
|
||||
if (!this.CanWrite)
|
||||
{
|
||||
throw new NotSupportedException("This stream does not support writing");
|
||||
}
|
||||
StreamAsyncResult streamAsyncResult = new StreamAsyncResult(state);
|
||||
try
|
||||
{
|
||||
this.Write(buffer, offset, count);
|
||||
streamAsyncResult.SetComplete(null);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
streamAsyncResult.SetComplete(ex);
|
||||
}
|
||||
if (callback != null)
|
||||
{
|
||||
callback.BeginInvoke(streamAsyncResult, null, null);
|
||||
}
|
||||
return streamAsyncResult;
|
||||
}
|
||||
|
||||
/// <summary>Waits for the pending asynchronous read to complete.</summary>
|
||||
/// <returns>The number of bytes read from the stream, between zero (0) and the number of bytes you requested. Streams return zero (0) only at the end of the stream, otherwise, they should block until at least one byte is available.</returns>
|
||||
/// <param name="asyncResult">The reference to the pending asynchronous request to finish. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="asyncResult" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="asyncResult" /> did not originate from a <see cref="M:System.IO.Stream.BeginRead(System.Byte[],System.Int32,System.Int32,System.AsyncCallback,System.Object)" /> method on the current stream. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">The stream is closed or an internal error has occurred.</exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06001783 RID: 6019 RVA: 0x0005AAD8 File Offset: 0x00058CD8
|
||||
public virtual int EndRead(IAsyncResult asyncResult)
|
||||
{
|
||||
if (asyncResult == null)
|
||||
{
|
||||
throw new ArgumentNullException("asyncResult");
|
||||
}
|
||||
StreamAsyncResult streamAsyncResult = asyncResult as StreamAsyncResult;
|
||||
if (streamAsyncResult == null || streamAsyncResult.NBytes == -1)
|
||||
{
|
||||
throw new ArgumentException("Invalid IAsyncResult", "asyncResult");
|
||||
}
|
||||
if (streamAsyncResult.Done)
|
||||
{
|
||||
throw new InvalidOperationException("EndRead already called.");
|
||||
}
|
||||
streamAsyncResult.Done = true;
|
||||
if (streamAsyncResult.Exception != null)
|
||||
{
|
||||
throw streamAsyncResult.Exception;
|
||||
}
|
||||
return streamAsyncResult.NBytes;
|
||||
}
|
||||
|
||||
/// <summary>Ends an asynchronous write operation.</summary>
|
||||
/// <param name="asyncResult">A reference to the outstanding asynchronous I/O request. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="asyncResult" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="asyncResult" /> did not originate from a <see cref="M:System.IO.Stream.BeginWrite(System.Byte[],System.Int32,System.Int32,System.AsyncCallback,System.Object)" /> method on the current stream. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">The stream is closed or an internal error has occurred.</exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06001784 RID: 6020 RVA: 0x0005AB54 File Offset: 0x00058D54
|
||||
public virtual void EndWrite(IAsyncResult asyncResult)
|
||||
{
|
||||
if (asyncResult == null)
|
||||
{
|
||||
throw new ArgumentNullException("asyncResult");
|
||||
}
|
||||
StreamAsyncResult streamAsyncResult = asyncResult as StreamAsyncResult;
|
||||
if (streamAsyncResult == null || streamAsyncResult.NBytes != -1)
|
||||
{
|
||||
throw new ArgumentException("Invalid IAsyncResult", "asyncResult");
|
||||
}
|
||||
if (streamAsyncResult.Done)
|
||||
{
|
||||
throw new InvalidOperationException("EndWrite already called.");
|
||||
}
|
||||
streamAsyncResult.Done = true;
|
||||
if (streamAsyncResult.Exception != null)
|
||||
{
|
||||
throw streamAsyncResult.Exception;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>A Stream with no backing store.</summary>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x040006FA RID: 1786
|
||||
public static readonly Stream Null = new NullStream();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
using System;
|
||||
using System.Threading;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
// Token: 0x020001CD RID: 461
|
||||
internal class StreamAsyncResult : IAsyncResult
|
||||
{
|
||||
// Token: 0x06001793 RID: 6035 RVA: 0x0005AC08 File Offset: 0x00058E08
|
||||
public StreamAsyncResult(object state)
|
||||
{
|
||||
this.state = state;
|
||||
}
|
||||
|
||||
// Token: 0x06001794 RID: 6036 RVA: 0x0005AC20 File Offset: 0x00058E20
|
||||
public void SetComplete(Exception e)
|
||||
{
|
||||
this.exc = e;
|
||||
this.completed = true;
|
||||
lock (this)
|
||||
{
|
||||
if (this.wh != null)
|
||||
{
|
||||
this.wh.Set();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001795 RID: 6037 RVA: 0x0005AC84 File Offset: 0x00058E84
|
||||
public void SetComplete(Exception e, int nbytes)
|
||||
{
|
||||
this.nbytes = nbytes;
|
||||
this.SetComplete(e);
|
||||
}
|
||||
|
||||
// Token: 0x1700042C RID: 1068
|
||||
// (get) Token: 0x06001796 RID: 6038 RVA: 0x0005AC94 File Offset: 0x00058E94
|
||||
public object AsyncState
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.state;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700042D RID: 1069
|
||||
// (get) Token: 0x06001797 RID: 6039 RVA: 0x0005AC9C File Offset: 0x00058E9C
|
||||
public WaitHandle AsyncWaitHandle
|
||||
{
|
||||
get
|
||||
{
|
||||
WaitHandle waitHandle;
|
||||
lock (this)
|
||||
{
|
||||
if (this.wh == null)
|
||||
{
|
||||
this.wh = new ManualResetEvent(this.completed);
|
||||
}
|
||||
waitHandle = this.wh;
|
||||
}
|
||||
return waitHandle;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700042E RID: 1070
|
||||
// (get) Token: 0x06001798 RID: 6040 RVA: 0x0005AD04 File Offset: 0x00058F04
|
||||
public virtual bool CompletedSynchronously
|
||||
{
|
||||
get
|
||||
{
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x1700042F RID: 1071
|
||||
// (get) Token: 0x06001799 RID: 6041 RVA: 0x0005AD08 File Offset: 0x00058F08
|
||||
public bool IsCompleted
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.completed;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000430 RID: 1072
|
||||
// (get) Token: 0x0600179A RID: 6042 RVA: 0x0005AD10 File Offset: 0x00058F10
|
||||
public Exception Exception
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.exc;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000431 RID: 1073
|
||||
// (get) Token: 0x0600179B RID: 6043 RVA: 0x0005AD18 File Offset: 0x00058F18
|
||||
public int NBytes
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.nbytes;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000432 RID: 1074
|
||||
// (get) Token: 0x0600179C RID: 6044 RVA: 0x0005AD20 File Offset: 0x00058F20
|
||||
// (set) Token: 0x0600179D RID: 6045 RVA: 0x0005AD28 File Offset: 0x00058F28
|
||||
public bool Done
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.done;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.done = value;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x040006FB RID: 1787
|
||||
private object state;
|
||||
|
||||
// Token: 0x040006FC RID: 1788
|
||||
private bool completed;
|
||||
|
||||
// Token: 0x040006FD RID: 1789
|
||||
private bool done;
|
||||
|
||||
// Token: 0x040006FE RID: 1790
|
||||
private Exception exc;
|
||||
|
||||
// Token: 0x040006FF RID: 1791
|
||||
private int nbytes = -1;
|
||||
|
||||
// Token: 0x04000700 RID: 1792
|
||||
private ManualResetEvent wh;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,765 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
/// <summary>Implements a <see cref="T:System.IO.TextReader" /> that reads characters from a byte stream in a particular encoding.</summary>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x020001CE RID: 462
|
||||
[ComVisible(true)]
|
||||
[Serializable]
|
||||
public class StreamReader : TextReader
|
||||
{
|
||||
// Token: 0x0600179E RID: 6046 RVA: 0x0005AD34 File Offset: 0x00058F34
|
||||
internal StreamReader()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.StreamReader" /> class for the specified stream.</summary>
|
||||
/// <param name="stream">The stream to be read. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="stream" /> does not support reading. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="stream" /> is null. </exception>
|
||||
// Token: 0x0600179F RID: 6047 RVA: 0x0005AD3C File Offset: 0x00058F3C
|
||||
public StreamReader(Stream stream)
|
||||
: this(stream, Encoding.UTF8Unmarked, true, 1024)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.StreamReader" /> class for the specified stream, with the specified byte order mark detection option.</summary>
|
||||
/// <param name="stream">The stream to be read. </param>
|
||||
/// <param name="detectEncodingFromByteOrderMarks">Indicates whether to look for byte order marks at the beginning of the file. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="stream" /> does not support reading. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="stream" /> is null. </exception>
|
||||
// Token: 0x060017A0 RID: 6048 RVA: 0x0005AD50 File Offset: 0x00058F50
|
||||
public StreamReader(Stream stream, bool detectEncodingFromByteOrderMarks)
|
||||
: this(stream, Encoding.UTF8Unmarked, detectEncodingFromByteOrderMarks, 1024)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.StreamReader" /> class for the specified stream, with the specified character encoding.</summary>
|
||||
/// <param name="stream">The stream to be read. </param>
|
||||
/// <param name="encoding">The character encoding to use. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="stream" /> does not support reading. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="stream" /> or <paramref name="encoding" /> is null. </exception>
|
||||
// Token: 0x060017A1 RID: 6049 RVA: 0x0005AD64 File Offset: 0x00058F64
|
||||
public StreamReader(Stream stream, Encoding encoding)
|
||||
: this(stream, encoding, true, 1024)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.StreamReader" /> class for the specified stream, with the specified character encoding and byte order mark detection option.</summary>
|
||||
/// <param name="stream">The stream to be read. </param>
|
||||
/// <param name="encoding">The character encoding to use. </param>
|
||||
/// <param name="detectEncodingFromByteOrderMarks">Indicates whether to look for byte order marks at the beginning of the file. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="stream" /> does not support reading. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="stream" /> or <paramref name="encoding" /> is null. </exception>
|
||||
// Token: 0x060017A2 RID: 6050 RVA: 0x0005AD74 File Offset: 0x00058F74
|
||||
public StreamReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks)
|
||||
: this(stream, encoding, detectEncodingFromByteOrderMarks, 1024)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.StreamReader" /> class for the specified stream, with the specified character encoding, byte order mark detection option, and buffer size.</summary>
|
||||
/// <param name="stream">The stream to be read. </param>
|
||||
/// <param name="encoding">The character encoding to use. </param>
|
||||
/// <param name="detectEncodingFromByteOrderMarks">Indicates whether to look for byte order marks at the beginning of the file. </param>
|
||||
/// <param name="bufferSize">The minimum buffer size. </param>
|
||||
/// <exception cref="T:System.ArgumentException">The stream does not support reading. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="stream" /> or <paramref name="encoding" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="bufferSize" /> is less than or equal to zero. </exception>
|
||||
// Token: 0x060017A3 RID: 6051 RVA: 0x0005AD84 File Offset: 0x00058F84
|
||||
public StreamReader(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize)
|
||||
{
|
||||
this.Initialize(stream, encoding, detectEncodingFromByteOrderMarks, bufferSize);
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.StreamReader" /> class for the specified file name.</summary>
|
||||
/// <param name="path">The complete file path to be read. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is an empty string (""). </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file cannot be found. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid, such as being on an unmapped drive. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">
|
||||
/// <paramref name="path" /> includes an incorrect or invalid syntax for file name, directory name, or volume label. </exception>
|
||||
// Token: 0x060017A4 RID: 6052 RVA: 0x0005AD98 File Offset: 0x00058F98
|
||||
public StreamReader(string path)
|
||||
: this(path, Encoding.UTF8Unmarked, true, 4096)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.StreamReader" /> class for the specified file name, with the specified byte order mark detection option.</summary>
|
||||
/// <param name="path">The complete file path to be read. </param>
|
||||
/// <param name="detectEncodingFromByteOrderMarks">Indicates whether to look for byte order marks at the beginning of the file. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is an empty string (""). </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file cannot be found. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid, such as being on an unmapped drive. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">
|
||||
/// <paramref name="path" /> includes an incorrect or invalid syntax for file name, directory name, or volume label. </exception>
|
||||
// Token: 0x060017A5 RID: 6053 RVA: 0x0005ADAC File Offset: 0x00058FAC
|
||||
public StreamReader(string path, bool detectEncodingFromByteOrderMarks)
|
||||
: this(path, Encoding.UTF8Unmarked, detectEncodingFromByteOrderMarks, 4096)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.StreamReader" /> class for the specified file name, with the specified character encoding.</summary>
|
||||
/// <param name="path">The complete file path to be read. </param>
|
||||
/// <param name="encoding">The character encoding to use. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is an empty string (""). </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> or <paramref name="encoding" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file cannot be found. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid, such as being on an unmapped drive. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> includes an incorrect or invalid syntax for file name, directory name, or volume label. </exception>
|
||||
// Token: 0x060017A6 RID: 6054 RVA: 0x0005ADC0 File Offset: 0x00058FC0
|
||||
public StreamReader(string path, Encoding encoding)
|
||||
: this(path, encoding, true, 4096)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.StreamReader" /> class for the specified file name, with the specified character encoding and byte order mark detection option.</summary>
|
||||
/// <param name="path">The complete file path to be read. </param>
|
||||
/// <param name="encoding">The character encoding to use. </param>
|
||||
/// <param name="detectEncodingFromByteOrderMarks">Indicates whether to look for byte order marks at the beginning of the file. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is an empty string (""). </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> or <paramref name="encoding" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file cannot be found. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid, such as being on an unmapped drive. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> includes an incorrect or invalid syntax for file name, directory name, or volume label. </exception>
|
||||
// Token: 0x060017A7 RID: 6055 RVA: 0x0005ADD0 File Offset: 0x00058FD0
|
||||
public StreamReader(string path, Encoding encoding, bool detectEncodingFromByteOrderMarks)
|
||||
: this(path, encoding, detectEncodingFromByteOrderMarks, 4096)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.StreamReader" /> class for the specified file name, with the specified character encoding, byte order mark detection option, and buffer size.</summary>
|
||||
/// <param name="path">The complete file path to be read. </param>
|
||||
/// <param name="encoding">The character encoding to use. </param>
|
||||
/// <param name="detectEncodingFromByteOrderMarks">Indicates whether to look for byte order marks at the beginning of the file. </param>
|
||||
/// <param name="bufferSize">The minimum buffer size, in number of 16-bit characters. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is an empty string (""). </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> or <paramref name="encoding" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.FileNotFoundException">The file cannot be found. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid, such as being on an unmapped drive. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <paramref name="path" /> includes an incorrect or invalid syntax for file name, directory name, or volume label. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="buffersize" /> is less than or equal to zero. </exception>
|
||||
// Token: 0x060017A8 RID: 6056 RVA: 0x0005ADE0 File Offset: 0x00058FE0
|
||||
public StreamReader(string path, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize)
|
||||
{
|
||||
if (path == null)
|
||||
{
|
||||
throw new ArgumentNullException("path");
|
||||
}
|
||||
if (string.Empty == path)
|
||||
{
|
||||
throw new ArgumentException("Empty path not allowed");
|
||||
}
|
||||
if (path.IndexOfAny(Path.InvalidPathChars) != -1)
|
||||
{
|
||||
throw new ArgumentException("path contains invalid characters");
|
||||
}
|
||||
if (encoding == null)
|
||||
{
|
||||
throw new ArgumentNullException("encoding");
|
||||
}
|
||||
if (bufferSize <= 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("bufferSize", "The minimum size of the buffer must be positive");
|
||||
}
|
||||
Stream stream = File.OpenRead(path);
|
||||
this.Initialize(stream, encoding, detectEncodingFromByteOrderMarks, bufferSize);
|
||||
}
|
||||
|
||||
// Token: 0x060017AA RID: 6058 RVA: 0x0005AE84 File Offset: 0x00059084
|
||||
internal void Initialize(Stream stream, Encoding encoding, bool detectEncodingFromByteOrderMarks, int bufferSize)
|
||||
{
|
||||
if (stream == null)
|
||||
{
|
||||
throw new ArgumentNullException("stream");
|
||||
}
|
||||
if (encoding == null)
|
||||
{
|
||||
throw new ArgumentNullException("encoding");
|
||||
}
|
||||
if (!stream.CanRead)
|
||||
{
|
||||
throw new ArgumentException("Cannot read stream");
|
||||
}
|
||||
if (bufferSize <= 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("bufferSize", "The minimum size of the buffer must be positive");
|
||||
}
|
||||
if (bufferSize < 128)
|
||||
{
|
||||
bufferSize = 128;
|
||||
}
|
||||
this.base_stream = stream;
|
||||
this.input_buffer = new byte[bufferSize];
|
||||
this.buffer_size = bufferSize;
|
||||
this.encoding = encoding;
|
||||
this.decoder = encoding.GetDecoder();
|
||||
byte[] preamble = encoding.GetPreamble();
|
||||
this.do_checks = ((!detectEncodingFromByteOrderMarks) ? 0 : 1);
|
||||
this.do_checks += ((preamble.Length != 0) ? 2 : 0);
|
||||
this.decoded_buffer = new char[encoding.GetMaxCharCount(bufferSize) + 1];
|
||||
this.decoded_count = 0;
|
||||
this.pos = 0;
|
||||
}
|
||||
|
||||
/// <summary>Returns the underlying stream.</summary>
|
||||
/// <returns>The underlying stream.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000433 RID: 1075
|
||||
// (get) Token: 0x060017AB RID: 6059 RVA: 0x0005AF7C File Offset: 0x0005917C
|
||||
public virtual Stream BaseStream
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.base_stream;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the current character encoding that the current <see cref="T:System.IO.StreamReader" /> object is using.</summary>
|
||||
/// <returns>The current character encoding used by the current reader. The value can be different after the first call to any <see cref="Overload:System.IO.StreamReader.Read" /> method of <see cref="T:System.IO.StreamReader" />, since encoding autodetection is not done until the first call to a <see cref="Overload:System.IO.StreamReader.Read" /> method.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000434 RID: 1076
|
||||
// (get) Token: 0x060017AC RID: 6060 RVA: 0x0005AF84 File Offset: 0x00059184
|
||||
public virtual Encoding CurrentEncoding
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.encoding == null)
|
||||
{
|
||||
throw new Exception();
|
||||
}
|
||||
return this.encoding;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a value that indicates whether the current stream position is at the end of the stream.</summary>
|
||||
/// <returns>true if the current stream position is at the end of the stream; otherwise false.</returns>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The underlying stream has been disposed.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x17000435 RID: 1077
|
||||
// (get) Token: 0x060017AD RID: 6061 RVA: 0x0005AFA0 File Offset: 0x000591A0
|
||||
public bool EndOfStream
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.Peek() < 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Closes the <see cref="T:System.IO.StreamReader" /> object and the underlying stream, and releases any system resources associated with the reader.</summary>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060017AE RID: 6062 RVA: 0x0005AFAC File Offset: 0x000591AC
|
||||
public override void Close()
|
||||
{
|
||||
this.Dispose(true);
|
||||
}
|
||||
|
||||
/// <summary>Closes the underlying stream, releases the unmanaged resources used by the <see cref="T:System.IO.StreamReader" />, and optionally releases the managed resources.</summary>
|
||||
/// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources. </param>
|
||||
// Token: 0x060017AF RID: 6063 RVA: 0x0005AFB8 File Offset: 0x000591B8
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing && this.base_stream != null)
|
||||
{
|
||||
this.base_stream.Close();
|
||||
}
|
||||
this.input_buffer = null;
|
||||
this.decoded_buffer = null;
|
||||
this.encoding = null;
|
||||
this.decoder = null;
|
||||
this.base_stream = null;
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
// Token: 0x060017B0 RID: 6064 RVA: 0x0005B00C File Offset: 0x0005920C
|
||||
private int DoChecks(int count)
|
||||
{
|
||||
if ((this.do_checks & 2) == 2)
|
||||
{
|
||||
byte[] preamble = this.encoding.GetPreamble();
|
||||
int num = preamble.Length;
|
||||
if (count >= num)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < num; i++)
|
||||
{
|
||||
if (this.input_buffer[i] != preamble[i])
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (i == num)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
}
|
||||
}
|
||||
if ((this.do_checks & 1) == 1)
|
||||
{
|
||||
if (count < 2)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (this.input_buffer[0] == 254 && this.input_buffer[1] == 255)
|
||||
{
|
||||
this.encoding = Encoding.BigEndianUnicode;
|
||||
return 2;
|
||||
}
|
||||
if (count < 3)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
if (this.input_buffer[0] == 239 && this.input_buffer[1] == 187 && this.input_buffer[2] == 191)
|
||||
{
|
||||
this.encoding = Encoding.UTF8Unmarked;
|
||||
return 3;
|
||||
}
|
||||
if (count < 4)
|
||||
{
|
||||
if (this.input_buffer[0] == 255 && this.input_buffer[1] == 254 && this.input_buffer[2] != 0)
|
||||
{
|
||||
this.encoding = Encoding.Unicode;
|
||||
return 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
if (this.input_buffer[0] == 0 && this.input_buffer[1] == 0 && this.input_buffer[2] == 254 && this.input_buffer[3] == 255)
|
||||
{
|
||||
this.encoding = Encoding.BigEndianUTF32;
|
||||
return 4;
|
||||
}
|
||||
if (this.input_buffer[0] == 255 && this.input_buffer[1] == 254)
|
||||
{
|
||||
if (this.input_buffer[2] == 0 && this.input_buffer[3] == 0)
|
||||
{
|
||||
this.encoding = Encoding.UTF32;
|
||||
return 4;
|
||||
}
|
||||
this.encoding = Encoding.Unicode;
|
||||
return 2;
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
/// <summary>Clears the internal buffer.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060017B1 RID: 6065 RVA: 0x0005B1F0 File Offset: 0x000593F0
|
||||
public void DiscardBufferedData()
|
||||
{
|
||||
this.pos = (this.decoded_count = 0);
|
||||
this.mayBlock = false;
|
||||
this.decoder = this.encoding.GetDecoder();
|
||||
}
|
||||
|
||||
// Token: 0x060017B2 RID: 6066 RVA: 0x0005B228 File Offset: 0x00059428
|
||||
private int ReadBuffer()
|
||||
{
|
||||
this.pos = 0;
|
||||
this.decoded_count = 0;
|
||||
int num = 0;
|
||||
for (;;)
|
||||
{
|
||||
int num2 = this.base_stream.Read(this.input_buffer, 0, this.buffer_size);
|
||||
if (num2 <= 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
this.mayBlock = num2 < this.buffer_size;
|
||||
if (this.do_checks > 0)
|
||||
{
|
||||
Encoding encoding = this.encoding;
|
||||
num = this.DoChecks(num2);
|
||||
if (encoding != this.encoding)
|
||||
{
|
||||
int num3 = encoding.GetMaxCharCount(this.buffer_size) + 1;
|
||||
int num4 = this.encoding.GetMaxCharCount(this.buffer_size) + 1;
|
||||
if (num3 != num4)
|
||||
{
|
||||
this.decoded_buffer = new char[num4];
|
||||
}
|
||||
this.decoder = this.encoding.GetDecoder();
|
||||
}
|
||||
this.do_checks = 0;
|
||||
num2 -= num;
|
||||
}
|
||||
this.decoded_count += this.decoder.GetChars(this.input_buffer, num, num2, this.decoded_buffer, 0);
|
||||
num = 0;
|
||||
if (this.decoded_count != 0)
|
||||
{
|
||||
goto Block_5;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
Block_5:
|
||||
return this.decoded_count;
|
||||
}
|
||||
|
||||
/// <summary>Returns the next available character but does not consume it.</summary>
|
||||
/// <returns>An integer representing the next character to be read, or -1 if there are no characters to be read or if the stream does not support seeking.</returns>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060017B3 RID: 6067 RVA: 0x0005B330 File Offset: 0x00059530
|
||||
public override int Peek()
|
||||
{
|
||||
if (this.base_stream == null)
|
||||
{
|
||||
throw new ObjectDisposedException("StreamReader", "Cannot read from a closed StreamReader");
|
||||
}
|
||||
if (this.pos >= this.decoded_count && this.ReadBuffer() == 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return (int)this.decoded_buffer[this.pos];
|
||||
}
|
||||
|
||||
// Token: 0x060017B4 RID: 6068 RVA: 0x0005B384 File Offset: 0x00059584
|
||||
internal bool DataAvailable()
|
||||
{
|
||||
return this.pos < this.decoded_count;
|
||||
}
|
||||
|
||||
/// <summary>Reads the next character from the input stream and advances the character position by one character.</summary>
|
||||
/// <returns>The next character from the input stream represented as an <see cref="T:System.Int32" /> object, or -1 if no more characters are available.</returns>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060017B5 RID: 6069 RVA: 0x0005B394 File Offset: 0x00059594
|
||||
public override int Read()
|
||||
{
|
||||
if (this.base_stream == null)
|
||||
{
|
||||
throw new ObjectDisposedException("StreamReader", "Cannot read from a closed StreamReader");
|
||||
}
|
||||
if (this.pos >= this.decoded_count && this.ReadBuffer() == 0)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return (int)this.decoded_buffer[this.pos++];
|
||||
}
|
||||
|
||||
/// <summary>Reads a specified maximum number of characters from the current stream into a buffer, beginning at the specified index.</summary>
|
||||
/// <returns>The number of characters that have been read, or 0 if at the end of the stream and no data was read. The number will be less than or equal to the <paramref name="count" /> parameter, depending on whether the data is available within the stream.</returns>
|
||||
/// <param name="buffer">When this method returns, contains the specified character array with the values between <paramref name="index" /> and (<paramref name="index + count - 1" />) replaced by the characters read from the current source. </param>
|
||||
/// <param name="index">The index of <paramref name="buffer" /> at which to begin writing. </param>
|
||||
/// <param name="count">The maximum number of characters to read. </param>
|
||||
/// <exception cref="T:System.ArgumentException">The buffer length minus <paramref name="index" /> is less than <paramref name="count" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="buffer" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> or <paramref name="count" /> is negative. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs, such as the stream is closed. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060017B6 RID: 6070 RVA: 0x0005B3F4 File Offset: 0x000595F4
|
||||
public override int Read([In] [Out] char[] buffer, int index, int count)
|
||||
{
|
||||
if (this.base_stream == null)
|
||||
{
|
||||
throw new ObjectDisposedException("StreamReader", "Cannot read from a closed StreamReader");
|
||||
}
|
||||
if (buffer == null)
|
||||
{
|
||||
throw new ArgumentNullException("buffer");
|
||||
}
|
||||
if (index < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("index", "< 0");
|
||||
}
|
||||
if (count < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count", "< 0");
|
||||
}
|
||||
if (index > buffer.Length - count)
|
||||
{
|
||||
throw new ArgumentException("index + count > buffer.Length");
|
||||
}
|
||||
int num = 0;
|
||||
while (count > 0)
|
||||
{
|
||||
if (this.pos >= this.decoded_count && this.ReadBuffer() == 0)
|
||||
{
|
||||
return (num <= 0) ? 0 : num;
|
||||
}
|
||||
int num2 = Math.Min(this.decoded_count - this.pos, count);
|
||||
Array.Copy(this.decoded_buffer, this.pos, buffer, index, num2);
|
||||
this.pos += num2;
|
||||
index += num2;
|
||||
count -= num2;
|
||||
num += num2;
|
||||
if (this.mayBlock)
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
// Token: 0x060017B7 RID: 6071 RVA: 0x0005B500 File Offset: 0x00059700
|
||||
private int FindNextEOL()
|
||||
{
|
||||
while (this.pos < this.decoded_count)
|
||||
{
|
||||
char c = this.decoded_buffer[this.pos];
|
||||
if (c == '\n')
|
||||
{
|
||||
this.pos++;
|
||||
int num = ((!this.foundCR) ? (this.pos - 1) : (this.pos - 2));
|
||||
if (num < 0)
|
||||
{
|
||||
num = 0;
|
||||
}
|
||||
this.foundCR = false;
|
||||
return num;
|
||||
}
|
||||
if (this.foundCR)
|
||||
{
|
||||
this.foundCR = false;
|
||||
if (this.pos == 0)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
return this.pos - 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.foundCR = c == '\r';
|
||||
this.pos++;
|
||||
}
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/// <summary>Reads a line of characters from the current stream and returns the data as a string.</summary>
|
||||
/// <returns>The next line from the input stream, or null if the end of the input stream is reached.</returns>
|
||||
/// <exception cref="T:System.OutOfMemoryException">There is insufficient memory to allocate a buffer for the returned string. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060017B8 RID: 6072 RVA: 0x0005B5C0 File Offset: 0x000597C0
|
||||
public override string ReadLine()
|
||||
{
|
||||
if (this.base_stream == null)
|
||||
{
|
||||
throw new ObjectDisposedException("StreamReader", "Cannot read from a closed StreamReader");
|
||||
}
|
||||
if (this.pos >= this.decoded_count && this.ReadBuffer() == 0)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
int num = this.pos;
|
||||
int num2 = this.FindNextEOL();
|
||||
if (num2 < this.decoded_count && num2 >= num)
|
||||
{
|
||||
return new string(this.decoded_buffer, num, num2 - num);
|
||||
}
|
||||
if (num2 == -2)
|
||||
{
|
||||
return this.line_builder.ToString(0, this.line_builder.Length);
|
||||
}
|
||||
if (this.line_builder == null)
|
||||
{
|
||||
this.line_builder = new StringBuilder();
|
||||
}
|
||||
else
|
||||
{
|
||||
this.line_builder.Length = 0;
|
||||
}
|
||||
for (;;)
|
||||
{
|
||||
if (this.foundCR)
|
||||
{
|
||||
this.decoded_count--;
|
||||
}
|
||||
this.line_builder.Append(this.decoded_buffer, num, this.decoded_count - num);
|
||||
if (this.ReadBuffer() == 0)
|
||||
{
|
||||
break;
|
||||
}
|
||||
num = this.pos;
|
||||
num2 = this.FindNextEOL();
|
||||
if (num2 < this.decoded_count && num2 >= num)
|
||||
{
|
||||
goto Block_12;
|
||||
}
|
||||
if (num2 == -2)
|
||||
{
|
||||
goto Block_14;
|
||||
}
|
||||
}
|
||||
if (this.line_builder.Capacity > 32768)
|
||||
{
|
||||
StringBuilder stringBuilder = this.line_builder;
|
||||
this.line_builder = null;
|
||||
return stringBuilder.ToString(0, stringBuilder.Length);
|
||||
}
|
||||
return this.line_builder.ToString(0, this.line_builder.Length);
|
||||
Block_12:
|
||||
this.line_builder.Append(this.decoded_buffer, num, num2 - num);
|
||||
if (this.line_builder.Capacity > 32768)
|
||||
{
|
||||
StringBuilder stringBuilder2 = this.line_builder;
|
||||
this.line_builder = null;
|
||||
return stringBuilder2.ToString(0, stringBuilder2.Length);
|
||||
}
|
||||
return this.line_builder.ToString(0, this.line_builder.Length);
|
||||
Block_14:
|
||||
return this.line_builder.ToString(0, this.line_builder.Length);
|
||||
}
|
||||
|
||||
/// <summary>Reads the stream from the current position to the end of the stream.</summary>
|
||||
/// <returns>The rest of the stream as a string, from the current position to the end. If the current position is at the end of the stream, returns an empty string ("").</returns>
|
||||
/// <exception cref="T:System.OutOfMemoryException">There is insufficient memory to allocate a buffer for the returned string. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060017B9 RID: 6073 RVA: 0x0005B7AC File Offset: 0x000599AC
|
||||
public override string ReadToEnd()
|
||||
{
|
||||
if (this.base_stream == null)
|
||||
{
|
||||
throw new ObjectDisposedException("StreamReader", "Cannot read from a closed StreamReader");
|
||||
}
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
int num = this.decoded_buffer.Length;
|
||||
char[] array = new char[num];
|
||||
int num2;
|
||||
while ((num2 = this.Read(array, 0, num)) > 0)
|
||||
{
|
||||
stringBuilder.Append(array, 0, num2);
|
||||
}
|
||||
return stringBuilder.ToString();
|
||||
}
|
||||
|
||||
// Token: 0x04000701 RID: 1793
|
||||
private const int DefaultBufferSize = 1024;
|
||||
|
||||
// Token: 0x04000702 RID: 1794
|
||||
private const int DefaultFileBufferSize = 4096;
|
||||
|
||||
// Token: 0x04000703 RID: 1795
|
||||
private const int MinimumBufferSize = 128;
|
||||
|
||||
// Token: 0x04000704 RID: 1796
|
||||
private byte[] input_buffer;
|
||||
|
||||
// Token: 0x04000705 RID: 1797
|
||||
private char[] decoded_buffer;
|
||||
|
||||
// Token: 0x04000706 RID: 1798
|
||||
private int decoded_count;
|
||||
|
||||
// Token: 0x04000707 RID: 1799
|
||||
private int pos;
|
||||
|
||||
// Token: 0x04000708 RID: 1800
|
||||
private int buffer_size;
|
||||
|
||||
// Token: 0x04000709 RID: 1801
|
||||
private int do_checks;
|
||||
|
||||
// Token: 0x0400070A RID: 1802
|
||||
private Encoding encoding;
|
||||
|
||||
// Token: 0x0400070B RID: 1803
|
||||
private Decoder decoder;
|
||||
|
||||
// Token: 0x0400070C RID: 1804
|
||||
private Stream base_stream;
|
||||
|
||||
// Token: 0x0400070D RID: 1805
|
||||
private bool mayBlock;
|
||||
|
||||
// Token: 0x0400070E RID: 1806
|
||||
private StringBuilder line_builder;
|
||||
|
||||
/// <summary>A <see cref="T:System.IO.StreamReader" /> object around an empty stream.</summary>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0400070F RID: 1807
|
||||
public new static readonly StreamReader Null = new StreamReader.NullStreamReader();
|
||||
|
||||
// Token: 0x04000710 RID: 1808
|
||||
private bool foundCR;
|
||||
|
||||
// Token: 0x020001CF RID: 463
|
||||
private class NullStreamReader : StreamReader
|
||||
{
|
||||
// Token: 0x060017BB RID: 6075 RVA: 0x0005B818 File Offset: 0x00059A18
|
||||
public override int Peek()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Token: 0x060017BC RID: 6076 RVA: 0x0005B81C File Offset: 0x00059A1C
|
||||
public override int Read()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
// Token: 0x060017BD RID: 6077 RVA: 0x0005B820 File Offset: 0x00059A20
|
||||
public override int Read([In] [Out] char[] buffer, int index, int count)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
|
||||
// Token: 0x060017BE RID: 6078 RVA: 0x0005B824 File Offset: 0x00059A24
|
||||
public override string ReadLine()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
// Token: 0x060017BF RID: 6079 RVA: 0x0005B828 File Offset: 0x00059A28
|
||||
public override string ReadToEnd()
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
// Token: 0x17000436 RID: 1078
|
||||
// (get) Token: 0x060017C0 RID: 6080 RVA: 0x0005B830 File Offset: 0x00059A30
|
||||
public override Stream BaseStream
|
||||
{
|
||||
get
|
||||
{
|
||||
return Stream.Null;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000437 RID: 1079
|
||||
// (get) Token: 0x060017C1 RID: 6081 RVA: 0x0005B838 File Offset: 0x00059A38
|
||||
public override Encoding CurrentEncoding
|
||||
{
|
||||
get
|
||||
{
|
||||
return Encoding.Unicode;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,558 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
/// <summary>Implements a <see cref="T:System.IO.TextWriter" /> for writing characters to a stream in a particular encoding.</summary>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x020001D0 RID: 464
|
||||
[ComVisible(true)]
|
||||
[Serializable]
|
||||
public class StreamWriter : TextWriter
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.StreamWriter" /> class for the specified stream, using UTF-8 encoding and the default buffer size.</summary>
|
||||
/// <param name="stream">The stream to write to. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="stream" /> is not writable. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="stream" /> is null. </exception>
|
||||
// Token: 0x060017C2 RID: 6082 RVA: 0x0005B840 File Offset: 0x00059A40
|
||||
public StreamWriter(Stream stream)
|
||||
: this(stream, Encoding.UTF8Unmarked, 1024)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.StreamWriter" /> class for the specified stream, using the specified encoding and the default buffer size.</summary>
|
||||
/// <param name="stream">The stream to write to. </param>
|
||||
/// <param name="encoding">The character encoding to use. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="stream" /> or <paramref name="encoding" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="stream" /> is not writable. </exception>
|
||||
// Token: 0x060017C3 RID: 6083 RVA: 0x0005B854 File Offset: 0x00059A54
|
||||
public StreamWriter(Stream stream, Encoding encoding)
|
||||
: this(stream, encoding, 1024)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.StreamWriter" /> class for the specified stream, using the specified encoding and buffer size.</summary>
|
||||
/// <param name="stream">The stream to write to. </param>
|
||||
/// <param name="encoding">The character encoding to use. </param>
|
||||
/// <param name="bufferSize">Sets the buffer size. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="stream" /> or <paramref name="encoding" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="bufferSize" /> is negative. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="stream" /> is not writable. </exception>
|
||||
// Token: 0x060017C4 RID: 6084 RVA: 0x0005B864 File Offset: 0x00059A64
|
||||
public StreamWriter(Stream stream, Encoding encoding, int bufferSize)
|
||||
{
|
||||
if (stream == null)
|
||||
{
|
||||
throw new ArgumentNullException("stream");
|
||||
}
|
||||
if (encoding == null)
|
||||
{
|
||||
throw new ArgumentNullException("encoding");
|
||||
}
|
||||
if (bufferSize <= 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("bufferSize");
|
||||
}
|
||||
if (!stream.CanWrite)
|
||||
{
|
||||
throw new ArgumentException("Can not write to stream");
|
||||
}
|
||||
this.internalStream = stream;
|
||||
this.Initialize(encoding, bufferSize);
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.StreamWriter" /> class for the specified file on the specified path, using the default encoding and buffer size.</summary>
|
||||
/// <param name="path">The complete file path to write to. <paramref name="path" /> can be a file name. </param>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">Access is denied. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is an empty string(""). -or-<paramref name="path" /> contains the name of a system device (com1, com2, and so on).</exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid, such as being on an unmapped drive. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">
|
||||
/// <paramref name="path" /> includes an incorrect or invalid syntax for file name, directory name, or volume label syntax. </exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
// Token: 0x060017C5 RID: 6085 RVA: 0x0005B8D0 File Offset: 0x00059AD0
|
||||
public StreamWriter(string path)
|
||||
: this(path, false, Encoding.UTF8Unmarked, 4096)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.StreamWriter" /> class for the specified file on the specified path, using the default encoding and buffer size. If the file exists, it can be either overwritten or appended to. If the file does not exist, this constructor creates a new file.</summary>
|
||||
/// <param name="path">The complete file path to write to. </param>
|
||||
/// <param name="append">Determines whether data is to be appended to the file. If the file exists and <paramref name="append" /> is false, the file is overwritten. If the file exists and <paramref name="append" /> is true, the data is appended to the file. Otherwise, a new file is created. </param>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">Access is denied. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is empty. -or-<paramref name="path" /> contains the name of a system device (com1, com2, and so on).</exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid, such as being on an unmapped drive. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">
|
||||
/// <paramref name="path" /> includes an incorrect or invalid syntax for file name, directory name, or volume label syntax. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
// Token: 0x060017C6 RID: 6086 RVA: 0x0005B8E4 File Offset: 0x00059AE4
|
||||
public StreamWriter(string path, bool append)
|
||||
: this(path, append, Encoding.UTF8Unmarked, 4096)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.StreamWriter" /> class for the specified file on the specified path, using the specified encoding and default buffer size. If the file exists, it can be either overwritten or appended to. If the file does not exist, this constructor creates a new file.</summary>
|
||||
/// <param name="path">The complete file path to write to. </param>
|
||||
/// <param name="append">Determines whether data is to be appended to the file. If the file exists and <paramref name="append" /> is false, the file is overwritten. If the file exists and <paramref name="append" /> is true, the data is appended to the file. Otherwise, a new file is created. </param>
|
||||
/// <param name="encoding">The character encoding to use. </param>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">Access is denied. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is empty. -or-<paramref name="path" /> contains the name of a system device (com1, com2, etc).</exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> is null. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid, such as being on an unmapped drive. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">
|
||||
/// <paramref name="path" /> includes an incorrect or invalid syntax for file name, directory name, or volume label syntax. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
// Token: 0x060017C7 RID: 6087 RVA: 0x0005B8F8 File Offset: 0x00059AF8
|
||||
public StreamWriter(string path, bool append, Encoding encoding)
|
||||
: this(path, append, encoding, 4096)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.StreamWriter" /> class for the specified file on the specified path, using the specified encoding and buffer size. If the file exists, it can be either overwritten or appended to. If the file does not exist, this constructor creates a new file.</summary>
|
||||
/// <param name="path">The complete file path to write to. </param>
|
||||
/// <param name="append">Determines whether data is to be appended to the file. If the file exists and <paramref name="append" /> is false, the file is overwritten. If the file exists and <paramref name="append" /> is true, the data is appended to the file. Otherwise, a new file is created. </param>
|
||||
/// <param name="encoding">The character encoding to use. </param>
|
||||
/// <param name="bufferSize">Sets the buffer size. </param>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="path" /> is an empty string (""). -or-<paramref name="path" /> contains the name of a system device (com1, com2, etc).</exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="path" /> or <paramref name="encoding" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="bufferSize" /> is negative. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">
|
||||
/// <paramref name="path" /> includes an incorrect or invalid syntax for file name, directory name, or volume label syntax. </exception>
|
||||
/// <exception cref="T:System.Security.SecurityException">The caller does not have the required permission. </exception>
|
||||
/// <exception cref="T:System.UnauthorizedAccessException">Access is denied. </exception>
|
||||
/// <exception cref="T:System.IO.DirectoryNotFoundException">The specified path is invalid, such as being on an unmapped drive. </exception>
|
||||
/// <exception cref="T:System.IO.PathTooLongException">The specified path, file name, or both exceed the system-defined maximum length. For example, on Windows-based platforms, paths must be less than 248 characters, and file names must be less than 260 characters. </exception>
|
||||
// Token: 0x060017C8 RID: 6088 RVA: 0x0005B908 File Offset: 0x00059B08
|
||||
public StreamWriter(string path, bool append, Encoding encoding, int bufferSize)
|
||||
{
|
||||
if (encoding == null)
|
||||
{
|
||||
throw new ArgumentNullException("encoding");
|
||||
}
|
||||
if (bufferSize <= 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("bufferSize");
|
||||
}
|
||||
FileMode fileMode;
|
||||
if (append)
|
||||
{
|
||||
fileMode = FileMode.Append;
|
||||
}
|
||||
else
|
||||
{
|
||||
fileMode = FileMode.Create;
|
||||
}
|
||||
this.internalStream = new FileStream(path, fileMode, FileAccess.Write, FileShare.Read);
|
||||
if (append)
|
||||
{
|
||||
this.internalStream.Position = this.internalStream.Length;
|
||||
}
|
||||
else
|
||||
{
|
||||
this.internalStream.SetLength(0L);
|
||||
}
|
||||
this.Initialize(encoding, bufferSize);
|
||||
}
|
||||
|
||||
// Token: 0x060017CA RID: 6090 RVA: 0x0005B9AC File Offset: 0x00059BAC
|
||||
internal void Initialize(Encoding encoding, int bufferSize)
|
||||
{
|
||||
this.internalEncoding = encoding;
|
||||
this.decode_pos = (this.byte_pos = 0);
|
||||
int num = Math.Max(bufferSize, 256);
|
||||
this.decode_buf = new char[num];
|
||||
this.byte_buf = new byte[encoding.GetMaxByteCount(num)];
|
||||
if (this.internalStream.CanSeek && this.internalStream.Position > 0L)
|
||||
{
|
||||
this.preamble_done = true;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets a value indicating whether the <see cref="T:System.IO.StreamWriter" /> will flush its buffer to the underlying stream after every call to <see cref="M:System.IO.StreamWriter.Write(System.Char)" />.</summary>
|
||||
/// <returns>true to force <see cref="T:System.IO.StreamWriter" /> to flush its buffer; otherwise, false.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x17000438 RID: 1080
|
||||
// (get) Token: 0x060017CB RID: 6091 RVA: 0x0005BA24 File Offset: 0x00059C24
|
||||
// (set) Token: 0x060017CC RID: 6092 RVA: 0x0005BA2C File Offset: 0x00059C2C
|
||||
public virtual bool AutoFlush
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.iflush;
|
||||
}
|
||||
set
|
||||
{
|
||||
this.iflush = value;
|
||||
if (this.iflush)
|
||||
{
|
||||
this.Flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the underlying stream that interfaces with a backing store.</summary>
|
||||
/// <returns>The stream this StreamWriter is writing to.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000439 RID: 1081
|
||||
// (get) Token: 0x060017CD RID: 6093 RVA: 0x0005BA48 File Offset: 0x00059C48
|
||||
public virtual Stream BaseStream
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.internalStream;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the <see cref="T:System.Text.Encoding" /> in which the output is written.</summary>
|
||||
/// <returns>The <see cref="T:System.Text.Encoding" /> specified in the constructor for the current instance, or <see cref="T:System.Text.UTF8Encoding" /> if an encoding was not specified.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x1700043A RID: 1082
|
||||
// (get) Token: 0x060017CE RID: 6094 RVA: 0x0005BA50 File Offset: 0x00059C50
|
||||
public override Encoding Encoding
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.internalEncoding;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Releases the unmanaged resources used by the <see cref="T:System.IO.StreamWriter" /> and optionally releases the managed resources.</summary>
|
||||
/// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources. </param>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">The current encoding does not support displaying half of a Unicode surrogate pair.</exception>
|
||||
// Token: 0x060017CF RID: 6095 RVA: 0x0005BA58 File Offset: 0x00059C58
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
Exception ex = null;
|
||||
if (!this.DisposedAlready && disposing && this.internalStream != null)
|
||||
{
|
||||
try
|
||||
{
|
||||
this.Flush();
|
||||
}
|
||||
catch (Exception ex2)
|
||||
{
|
||||
ex = ex2;
|
||||
}
|
||||
this.DisposedAlready = true;
|
||||
try
|
||||
{
|
||||
this.internalStream.Close();
|
||||
}
|
||||
catch (Exception ex3)
|
||||
{
|
||||
if (ex == null)
|
||||
{
|
||||
ex = ex3;
|
||||
}
|
||||
}
|
||||
}
|
||||
this.internalStream = null;
|
||||
this.byte_buf = null;
|
||||
this.internalEncoding = null;
|
||||
this.decode_buf = null;
|
||||
if (ex != null)
|
||||
{
|
||||
throw ex;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Clears all buffers for the current writer and causes any buffered data to be written to the underlying stream.</summary>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The current writer is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error has occurred. </exception>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">The current encoding does not support displaying half of a Unicode surrogate pair. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060017D0 RID: 6096 RVA: 0x0005BB14 File Offset: 0x00059D14
|
||||
public override void Flush()
|
||||
{
|
||||
if (this.DisposedAlready)
|
||||
{
|
||||
throw new ObjectDisposedException("StreamWriter");
|
||||
}
|
||||
this.Decode();
|
||||
if (this.byte_pos > 0)
|
||||
{
|
||||
this.FlushBytes();
|
||||
this.internalStream.Flush();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060017D1 RID: 6097 RVA: 0x0005BB5C File Offset: 0x00059D5C
|
||||
private void FlushBytes()
|
||||
{
|
||||
if (!this.preamble_done && this.byte_pos > 0)
|
||||
{
|
||||
byte[] preamble = this.internalEncoding.GetPreamble();
|
||||
if (preamble.Length > 0)
|
||||
{
|
||||
this.internalStream.Write(preamble, 0, preamble.Length);
|
||||
}
|
||||
this.preamble_done = true;
|
||||
}
|
||||
this.internalStream.Write(this.byte_buf, 0, this.byte_pos);
|
||||
this.byte_pos = 0;
|
||||
}
|
||||
|
||||
// Token: 0x060017D2 RID: 6098 RVA: 0x0005BBCC File Offset: 0x00059DCC
|
||||
private void Decode()
|
||||
{
|
||||
if (this.byte_pos > 0)
|
||||
{
|
||||
this.FlushBytes();
|
||||
}
|
||||
if (this.decode_pos > 0)
|
||||
{
|
||||
int bytes = this.internalEncoding.GetBytes(this.decode_buf, 0, this.decode_pos, this.byte_buf, this.byte_pos);
|
||||
this.byte_pos += bytes;
|
||||
this.decode_pos = 0;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Writes a subarray of characters to the stream.</summary>
|
||||
/// <param name="buffer">A character array containing the data to write. </param>
|
||||
/// <param name="index">The index into <paramref name="buffer" /> at which to begin writing. </param>
|
||||
/// <param name="count">The number of characters to read from <paramref name="buffer" />. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="buffer" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">The buffer length minus <paramref name="index" /> is less than <paramref name="count" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> or <paramref name="count" /> is negative. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">
|
||||
/// <see cref="P:System.IO.StreamWriter.AutoFlush" /> is true or the <see cref="T:System.IO.StreamWriter" /> buffer is full, and current writer is closed. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <see cref="P:System.IO.StreamWriter.AutoFlush" /> is true or the <see cref="T:System.IO.StreamWriter" /> buffer is full, and the contents of the buffer cannot be written to the underlying fixed size stream because the <see cref="T:System.IO.StreamWriter" /> is at the end the stream. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060017D3 RID: 6099 RVA: 0x0005BC34 File Offset: 0x00059E34
|
||||
public override void Write(char[] buffer, int index, int count)
|
||||
{
|
||||
if (this.DisposedAlready)
|
||||
{
|
||||
throw new ObjectDisposedException("StreamWriter");
|
||||
}
|
||||
if (buffer == null)
|
||||
{
|
||||
throw new ArgumentNullException("buffer");
|
||||
}
|
||||
if (index < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("index", "< 0");
|
||||
}
|
||||
if (count < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count", "< 0");
|
||||
}
|
||||
if (index > buffer.Length - count)
|
||||
{
|
||||
throw new ArgumentException("index + count > buffer.Length");
|
||||
}
|
||||
this.LowLevelWrite(buffer, index, count);
|
||||
if (this.iflush)
|
||||
{
|
||||
this.Flush();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060017D4 RID: 6100 RVA: 0x0005BCC8 File Offset: 0x00059EC8
|
||||
private void LowLevelWrite(char[] buffer, int index, int count)
|
||||
{
|
||||
while (count > 0)
|
||||
{
|
||||
int num = this.decode_buf.Length - this.decode_pos;
|
||||
if (num == 0)
|
||||
{
|
||||
this.Decode();
|
||||
num = this.decode_buf.Length;
|
||||
}
|
||||
if (num > count)
|
||||
{
|
||||
num = count;
|
||||
}
|
||||
Buffer.BlockCopy(buffer, index * 2, this.decode_buf, this.decode_pos * 2, num * 2);
|
||||
count -= num;
|
||||
index += num;
|
||||
this.decode_pos += num;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x060017D5 RID: 6101 RVA: 0x0005BD44 File Offset: 0x00059F44
|
||||
private void LowLevelWrite(string s)
|
||||
{
|
||||
int i = s.Length;
|
||||
int num = 0;
|
||||
while (i > 0)
|
||||
{
|
||||
int num2 = this.decode_buf.Length - this.decode_pos;
|
||||
if (num2 == 0)
|
||||
{
|
||||
this.Decode();
|
||||
num2 = this.decode_buf.Length;
|
||||
}
|
||||
if (num2 > i)
|
||||
{
|
||||
num2 = i;
|
||||
}
|
||||
for (int j = 0; j < num2; j++)
|
||||
{
|
||||
this.decode_buf[j + this.decode_pos] = s[j + num];
|
||||
}
|
||||
i -= num2;
|
||||
num += num2;
|
||||
this.decode_pos += num2;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Writes a character to the stream.</summary>
|
||||
/// <param name="value">The character to write to the text stream. </param>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">
|
||||
/// <see cref="P:System.IO.StreamWriter.AutoFlush" /> is true or the <see cref="T:System.IO.StreamWriter" /> buffer is full, and current writer is closed. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <see cref="P:System.IO.StreamWriter.AutoFlush" /> is true or the <see cref="T:System.IO.StreamWriter" /> buffer is full, and the contents of the buffer cannot be written to the underlying fixed size stream because the <see cref="T:System.IO.StreamWriter" /> is at the end the stream. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060017D6 RID: 6102 RVA: 0x0005BDD4 File Offset: 0x00059FD4
|
||||
public override void Write(char value)
|
||||
{
|
||||
if (this.DisposedAlready)
|
||||
{
|
||||
throw new ObjectDisposedException("StreamWriter");
|
||||
}
|
||||
if (this.decode_pos >= this.decode_buf.Length)
|
||||
{
|
||||
this.Decode();
|
||||
}
|
||||
this.decode_buf[this.decode_pos++] = value;
|
||||
if (this.iflush)
|
||||
{
|
||||
this.Flush();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Writes a character array to the stream.</summary>
|
||||
/// <param name="buffer">A character array containing the data to write. If <paramref name="buffer" /> is null, nothing is written. </param>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">
|
||||
/// <see cref="P:System.IO.StreamWriter.AutoFlush" /> is true or the <see cref="T:System.IO.StreamWriter" /> buffer is full, and current writer is closed. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <see cref="P:System.IO.StreamWriter.AutoFlush" /> is true or the <see cref="T:System.IO.StreamWriter" /> buffer is full, and the contents of the buffer cannot be written to the underlying fixed size stream because the <see cref="T:System.IO.StreamWriter" /> is at the end the stream. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060017D7 RID: 6103 RVA: 0x0005BE3C File Offset: 0x0005A03C
|
||||
public override void Write(char[] buffer)
|
||||
{
|
||||
if (this.DisposedAlready)
|
||||
{
|
||||
throw new ObjectDisposedException("StreamWriter");
|
||||
}
|
||||
if (buffer != null)
|
||||
{
|
||||
this.LowLevelWrite(buffer, 0, buffer.Length);
|
||||
}
|
||||
if (this.iflush)
|
||||
{
|
||||
this.Flush();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Writes a string to the stream.</summary>
|
||||
/// <param name="value">The string to write to the stream. If <paramref name="value" /> is null, nothing is written. </param>
|
||||
/// <exception cref="T:System.ObjectDisposedException">
|
||||
/// <see cref="P:System.IO.StreamWriter.AutoFlush" /> is true or the <see cref="T:System.IO.StreamWriter" /> buffer is full, and current writer is closed. </exception>
|
||||
/// <exception cref="T:System.NotSupportedException">
|
||||
/// <see cref="P:System.IO.StreamWriter.AutoFlush" /> is true or the <see cref="T:System.IO.StreamWriter" /> buffer is full, and the contents of the buffer cannot be written to the underlying fixed size stream because the <see cref="T:System.IO.StreamWriter" /> is at the end the stream. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060017D8 RID: 6104 RVA: 0x0005BE84 File Offset: 0x0005A084
|
||||
public override void Write(string value)
|
||||
{
|
||||
if (this.DisposedAlready)
|
||||
{
|
||||
throw new ObjectDisposedException("StreamWriter");
|
||||
}
|
||||
if (value != null)
|
||||
{
|
||||
this.LowLevelWrite(value);
|
||||
}
|
||||
if (this.iflush)
|
||||
{
|
||||
this.Flush();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Closes the current StreamWriter object and the underlying stream.</summary>
|
||||
/// <exception cref="T:System.Text.EncoderFallbackException">The current encoding does not support displaying half of a Unicode surrogate pair.</exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060017D9 RID: 6105 RVA: 0x0005BEC8 File Offset: 0x0005A0C8
|
||||
public override void Close()
|
||||
{
|
||||
this.Dispose(true);
|
||||
}
|
||||
|
||||
/// <summary>Frees the resources of the current <see cref="T:System.IO.StreamWriter" /> before it is reclaimed by the garbage collector.</summary>
|
||||
// Token: 0x060017DA RID: 6106 RVA: 0x0005BED4 File Offset: 0x0005A0D4
|
||||
~StreamWriter()
|
||||
{
|
||||
this.Dispose(false);
|
||||
}
|
||||
|
||||
// Token: 0x04000711 RID: 1809
|
||||
private const int DefaultBufferSize = 1024;
|
||||
|
||||
// Token: 0x04000712 RID: 1810
|
||||
private const int DefaultFileBufferSize = 4096;
|
||||
|
||||
// Token: 0x04000713 RID: 1811
|
||||
private const int MinimumBufferSize = 256;
|
||||
|
||||
// Token: 0x04000714 RID: 1812
|
||||
private Encoding internalEncoding;
|
||||
|
||||
// Token: 0x04000715 RID: 1813
|
||||
private Stream internalStream;
|
||||
|
||||
// Token: 0x04000716 RID: 1814
|
||||
private bool iflush;
|
||||
|
||||
// Token: 0x04000717 RID: 1815
|
||||
private byte[] byte_buf;
|
||||
|
||||
// Token: 0x04000718 RID: 1816
|
||||
private int byte_pos;
|
||||
|
||||
// Token: 0x04000719 RID: 1817
|
||||
private char[] decode_buf;
|
||||
|
||||
// Token: 0x0400071A RID: 1818
|
||||
private int decode_pos;
|
||||
|
||||
// Token: 0x0400071B RID: 1819
|
||||
private bool DisposedAlready;
|
||||
|
||||
// Token: 0x0400071C RID: 1820
|
||||
private bool preamble_done;
|
||||
|
||||
/// <summary>Provides a StreamWriter with no backing store that can be written to, but not read from.</summary>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0400071D RID: 1821
|
||||
public new static readonly StreamWriter Null = new StreamWriter(Stream.Null, Encoding.UTF8Unmarked, 1);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,182 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
/// <summary>Implements a <see cref="T:System.IO.TextReader" /> that reads from a string.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x020001D1 RID: 465
|
||||
[ComVisible(true)]
|
||||
[Serializable]
|
||||
public class StringReader : TextReader
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.StringReader" /> class that reads from the specified string.</summary>
|
||||
/// <param name="s">The string to which the <see cref="T:System.IO.StringReader" /> should be initialized. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">The <paramref name="s" /> parameter is null. </exception>
|
||||
// Token: 0x060017DB RID: 6107 RVA: 0x0005BF10 File Offset: 0x0005A110
|
||||
public StringReader(string s)
|
||||
{
|
||||
if (s == null)
|
||||
{
|
||||
throw new ArgumentNullException("s");
|
||||
}
|
||||
this.source = s;
|
||||
this.nextChar = 0;
|
||||
this.sourceLength = s.Length;
|
||||
}
|
||||
|
||||
/// <summary>Closes the <see cref="T:System.IO.StringReader" />.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060017DC RID: 6108 RVA: 0x0005BF44 File Offset: 0x0005A144
|
||||
public override void Close()
|
||||
{
|
||||
this.Dispose(true);
|
||||
}
|
||||
|
||||
/// <summary>Releases the unmanaged resources used by the <see cref="T:System.IO.StringReader" /> and optionally releases the managed resources.</summary>
|
||||
/// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources. </param>
|
||||
// Token: 0x060017DD RID: 6109 RVA: 0x0005BF50 File Offset: 0x0005A150
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
this.source = null;
|
||||
base.Dispose(disposing);
|
||||
}
|
||||
|
||||
/// <summary>Returns the next available character but does not consume it.</summary>
|
||||
/// <returns>An integer representing the next character to be read, or -1 if no more characters are available or the stream does not support seeking.</returns>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The current reader is closed. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060017DE RID: 6110 RVA: 0x0005BF60 File Offset: 0x0005A160
|
||||
public override int Peek()
|
||||
{
|
||||
this.CheckObjectDisposedException();
|
||||
if (this.nextChar >= this.sourceLength)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return (int)this.source[this.nextChar];
|
||||
}
|
||||
|
||||
/// <summary>Reads the next character from the input string and advances the character position by one character.</summary>
|
||||
/// <returns>The next character from the underlying string, or -1 if no more characters are available.</returns>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The current reader is closed. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060017DF RID: 6111 RVA: 0x0005BF98 File Offset: 0x0005A198
|
||||
public override int Read()
|
||||
{
|
||||
this.CheckObjectDisposedException();
|
||||
if (this.nextChar >= this.sourceLength)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return (int)this.source[this.nextChar++];
|
||||
}
|
||||
|
||||
/// <summary>Reads a block of characters from the input string and advances the character position by <paramref name="count" />.</summary>
|
||||
/// <returns>The total number of characters read into the buffer. This can be less than the number of characters requested if that many characters are not currently available, or zero if the end of the underlying string has been reached.</returns>
|
||||
/// <param name="buffer">When this method returns, contains the specified character array with the values between <paramref name="index" /> and (<paramref name="index" /> + <paramref name="count" /> - 1) replaced by the characters read from the current source. </param>
|
||||
/// <param name="index">The starting index in the buffer. </param>
|
||||
/// <param name="count">The number of characters to read. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="buffer" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">The buffer length minus <paramref name="index" /> is less than <paramref name="count" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> or <paramref name="count" /> is negative. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The current reader is closed. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060017E0 RID: 6112 RVA: 0x0005BFDC File Offset: 0x0005A1DC
|
||||
public override int Read([In] [Out] char[] buffer, int index, int count)
|
||||
{
|
||||
this.CheckObjectDisposedException();
|
||||
if (buffer == null)
|
||||
{
|
||||
throw new ArgumentNullException("buffer");
|
||||
}
|
||||
if (buffer.Length - index < count)
|
||||
{
|
||||
throw new ArgumentException();
|
||||
}
|
||||
if (index < 0 || count < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException();
|
||||
}
|
||||
int num;
|
||||
if (this.nextChar > this.sourceLength - count)
|
||||
{
|
||||
num = this.sourceLength - this.nextChar;
|
||||
}
|
||||
else
|
||||
{
|
||||
num = count;
|
||||
}
|
||||
this.source.CopyTo(this.nextChar, buffer, index, num);
|
||||
this.nextChar += num;
|
||||
return num;
|
||||
}
|
||||
|
||||
/// <summary>Reads a line from the underlying string.</summary>
|
||||
/// <returns>The next line from the underlying string, or null if the end of the underlying string is reached.</returns>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The current reader is closed. </exception>
|
||||
/// <exception cref="T:System.OutOfMemoryException">There is insufficient memory to allocate a buffer for the returned string. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060017E1 RID: 6113 RVA: 0x0005C070 File Offset: 0x0005A270
|
||||
public override string ReadLine()
|
||||
{
|
||||
this.CheckObjectDisposedException();
|
||||
int i;
|
||||
for (i = this.nextChar; i < this.sourceLength; i++)
|
||||
{
|
||||
char c = this.source[i];
|
||||
if (c == '\r' || c == '\n')
|
||||
{
|
||||
string text = this.source.Substring(this.nextChar, i - this.nextChar);
|
||||
this.nextChar = i + 1;
|
||||
if (c == '\r' && this.nextChar < this.sourceLength && this.source[this.nextChar] == '\n')
|
||||
{
|
||||
this.nextChar++;
|
||||
}
|
||||
return text;
|
||||
}
|
||||
}
|
||||
if (i > this.nextChar)
|
||||
{
|
||||
string text2 = this.source.Substring(this.nextChar, i - this.nextChar);
|
||||
this.nextChar = i;
|
||||
return text2;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// <summary>Reads the stream as a string, either in its entirety or from the current position to the end of the stream.</summary>
|
||||
/// <returns>The content from the current position to the end of the underlying string.</returns>
|
||||
/// <exception cref="T:System.OutOfMemoryException">There is insufficient memory to allocate a buffer for the returned string. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The current reader is closed. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060017E2 RID: 6114 RVA: 0x0005C150 File Offset: 0x0005A350
|
||||
public override string ReadToEnd()
|
||||
{
|
||||
this.CheckObjectDisposedException();
|
||||
string text = this.source.Substring(this.nextChar, this.sourceLength - this.nextChar);
|
||||
this.nextChar = this.sourceLength;
|
||||
return text;
|
||||
}
|
||||
|
||||
// Token: 0x060017E3 RID: 6115 RVA: 0x0005C190 File Offset: 0x0005A390
|
||||
private void CheckObjectDisposedException()
|
||||
{
|
||||
if (this.source == null)
|
||||
{
|
||||
throw new ObjectDisposedException("StringReader", Locale.GetText("Cannot read from a closed StringReader"));
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0400071E RID: 1822
|
||||
private string source;
|
||||
|
||||
// Token: 0x0400071F RID: 1823
|
||||
private int nextChar;
|
||||
|
||||
// Token: 0x04000720 RID: 1824
|
||||
private int sourceLength;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,176 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
/// <summary>Implements a <see cref="T:System.IO.TextWriter" /> for writing information to a string. The information is stored in an underlying <see cref="T:System.Text.StringBuilder" />.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x020001D2 RID: 466
|
||||
[MonoTODO("Serialization format not compatible with .NET")]
|
||||
[ComVisible(true)]
|
||||
[Serializable]
|
||||
public class StringWriter : TextWriter
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.StringWriter" /> class.</summary>
|
||||
// Token: 0x060017E4 RID: 6116 RVA: 0x0005C1C0 File Offset: 0x0005A3C0
|
||||
public StringWriter()
|
||||
: this(new StringBuilder())
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.StringWriter" /> class with the specified format control.</summary>
|
||||
/// <param name="formatProvider">An <see cref="T:System.IFormatProvider" /> object that controls formatting. </param>
|
||||
// Token: 0x060017E5 RID: 6117 RVA: 0x0005C1D0 File Offset: 0x0005A3D0
|
||||
public StringWriter(IFormatProvider formatProvider)
|
||||
: this(new StringBuilder(), formatProvider)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.StringWriter" /> class that writes to the specified <see cref="T:System.Text.StringBuilder" />.</summary>
|
||||
/// <param name="sb">The StringBuilder to write to. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="sb" /> is null. </exception>
|
||||
// Token: 0x060017E6 RID: 6118 RVA: 0x0005C1E0 File Offset: 0x0005A3E0
|
||||
public StringWriter(StringBuilder sb)
|
||||
: this(sb, null)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.StringWriter" /> class that writes to the specified <see cref="T:System.Text.StringBuilder" /> and has the specified format provider.</summary>
|
||||
/// <param name="sb">The StringBuilder to write to. </param>
|
||||
/// <param name="formatProvider">An <see cref="T:System.IFormatProvider" /> object that controls formatting. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="sb" /> is null. </exception>
|
||||
// Token: 0x060017E7 RID: 6119 RVA: 0x0005C1EC File Offset: 0x0005A3EC
|
||||
public StringWriter(StringBuilder sb, IFormatProvider formatProvider)
|
||||
{
|
||||
if (sb == null)
|
||||
{
|
||||
throw new ArgumentNullException("sb");
|
||||
}
|
||||
this.internalString = sb;
|
||||
this.internalFormatProvider = formatProvider;
|
||||
}
|
||||
|
||||
/// <summary>Gets the <see cref="T:System.Text.Encoding" /> in which the output is written.</summary>
|
||||
/// <returns>The Encoding in which the output is written.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x1700043B RID: 1083
|
||||
// (get) Token: 0x060017E8 RID: 6120 RVA: 0x0005C214 File Offset: 0x0005A414
|
||||
public override Encoding Encoding
|
||||
{
|
||||
get
|
||||
{
|
||||
return Encoding.Unicode;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Closes the current <see cref="T:System.IO.StringWriter" /> and the underlying stream.</summary>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060017E9 RID: 6121 RVA: 0x0005C21C File Offset: 0x0005A41C
|
||||
public override void Close()
|
||||
{
|
||||
this.Dispose(true);
|
||||
this.disposed = true;
|
||||
}
|
||||
|
||||
/// <summary>Releases the unmanaged resources used by the <see cref="T:System.IO.StringWriter" /> and optionally releases the managed resources.</summary>
|
||||
/// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources. </param>
|
||||
// Token: 0x060017EA RID: 6122 RVA: 0x0005C22C File Offset: 0x0005A42C
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
base.Dispose(disposing);
|
||||
this.disposed = true;
|
||||
}
|
||||
|
||||
/// <summary>Returns the underlying <see cref="T:System.Text.StringBuilder" />.</summary>
|
||||
/// <returns>The underlying StringBuilder.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060017EB RID: 6123 RVA: 0x0005C23C File Offset: 0x0005A43C
|
||||
public virtual StringBuilder GetStringBuilder()
|
||||
{
|
||||
return this.internalString;
|
||||
}
|
||||
|
||||
/// <summary>Returns a string containing the characters written to the current StringWriter so far.</summary>
|
||||
/// <returns>The string containing the characters written to the current StringWriter.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060017EC RID: 6124 RVA: 0x0005C244 File Offset: 0x0005A444
|
||||
public override string ToString()
|
||||
{
|
||||
return this.internalString.ToString();
|
||||
}
|
||||
|
||||
/// <summary>Writes a character to this instance of the StringWriter.</summary>
|
||||
/// <param name="value">The character to write. </param>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The writer is closed. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060017ED RID: 6125 RVA: 0x0005C254 File Offset: 0x0005A454
|
||||
public override void Write(char value)
|
||||
{
|
||||
if (this.disposed)
|
||||
{
|
||||
throw new ObjectDisposedException("StringReader", Locale.GetText("Cannot write to a closed StringWriter"));
|
||||
}
|
||||
this.internalString.Append(value);
|
||||
}
|
||||
|
||||
/// <summary>Writes a string to this instance of the StringWriter.</summary>
|
||||
/// <param name="value">The string to write. </param>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The writer is closed. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060017EE RID: 6126 RVA: 0x0005C284 File Offset: 0x0005A484
|
||||
public override void Write(string value)
|
||||
{
|
||||
if (this.disposed)
|
||||
{
|
||||
throw new ObjectDisposedException("StringReader", Locale.GetText("Cannot write to a closed StringWriter"));
|
||||
}
|
||||
this.internalString.Append(value);
|
||||
}
|
||||
|
||||
/// <summary>Writes the specified region of a character array to this instance of the StringWriter.</summary>
|
||||
/// <param name="buffer">The character array to read data from. </param>
|
||||
/// <param name="index">The index at which to begin reading from <paramref name="buffer" />. </param>
|
||||
/// <param name="count">The maximum number of characters to write. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="buffer" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> or <paramref name="count" /> is negative. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">(<paramref name="index" /> + <paramref name="count" />)> <paramref name="buffer" />. Length. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The writer is closed. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060017EF RID: 6127 RVA: 0x0005C2B4 File Offset: 0x0005A4B4
|
||||
public override void Write(char[] buffer, int index, int count)
|
||||
{
|
||||
if (this.disposed)
|
||||
{
|
||||
throw new ObjectDisposedException("StringReader", Locale.GetText("Cannot write to a closed StringWriter"));
|
||||
}
|
||||
if (buffer == null)
|
||||
{
|
||||
throw new ArgumentNullException("buffer");
|
||||
}
|
||||
if (index < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("index", "< 0");
|
||||
}
|
||||
if (count < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count", "< 0");
|
||||
}
|
||||
if (index > buffer.Length - count)
|
||||
{
|
||||
throw new ArgumentException("index + count > buffer.Length");
|
||||
}
|
||||
this.internalString.Append(buffer, index, count);
|
||||
}
|
||||
|
||||
// Token: 0x04000721 RID: 1825
|
||||
private StringBuilder internalString;
|
||||
|
||||
// Token: 0x04000722 RID: 1826
|
||||
private bool disposed;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,93 @@
|
||||
using System;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
// Token: 0x020001D5 RID: 469
|
||||
[Serializable]
|
||||
internal class SynchronizedReader : TextReader
|
||||
{
|
||||
// Token: 0x060017FE RID: 6142 RVA: 0x0005C44C File Offset: 0x0005A64C
|
||||
public SynchronizedReader(TextReader reader)
|
||||
{
|
||||
this.reader = reader;
|
||||
}
|
||||
|
||||
// Token: 0x060017FF RID: 6143 RVA: 0x0005C45C File Offset: 0x0005A65C
|
||||
public override void Close()
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
this.reader.Close();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001800 RID: 6144 RVA: 0x0005C4A4 File Offset: 0x0005A6A4
|
||||
public override int Peek()
|
||||
{
|
||||
int num;
|
||||
lock (this)
|
||||
{
|
||||
num = this.reader.Peek();
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
// Token: 0x06001801 RID: 6145 RVA: 0x0005C4F4 File Offset: 0x0005A6F4
|
||||
public override int ReadBlock(char[] buffer, int index, int count)
|
||||
{
|
||||
int num;
|
||||
lock (this)
|
||||
{
|
||||
num = this.reader.ReadBlock(buffer, index, count);
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
// Token: 0x06001802 RID: 6146 RVA: 0x0005C548 File Offset: 0x0005A748
|
||||
public override string ReadLine()
|
||||
{
|
||||
string text;
|
||||
lock (this)
|
||||
{
|
||||
text = this.reader.ReadLine();
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
// Token: 0x06001803 RID: 6147 RVA: 0x0005C598 File Offset: 0x0005A798
|
||||
public override string ReadToEnd()
|
||||
{
|
||||
string text;
|
||||
lock (this)
|
||||
{
|
||||
text = this.reader.ReadToEnd();
|
||||
}
|
||||
return text;
|
||||
}
|
||||
|
||||
// Token: 0x06001804 RID: 6148 RVA: 0x0005C5E8 File Offset: 0x0005A7E8
|
||||
public override int Read()
|
||||
{
|
||||
int num;
|
||||
lock (this)
|
||||
{
|
||||
num = this.reader.Read();
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
// Token: 0x06001805 RID: 6149 RVA: 0x0005C638 File Offset: 0x0005A838
|
||||
public override int Read(char[] buffer, int index, int count)
|
||||
{
|
||||
int num;
|
||||
lock (this)
|
||||
{
|
||||
num = this.reader.Read(buffer, index, count);
|
||||
}
|
||||
return num;
|
||||
}
|
||||
|
||||
// Token: 0x04000724 RID: 1828
|
||||
private TextReader reader;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,410 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
// Token: 0x020001D8 RID: 472
|
||||
[Serializable]
|
||||
internal class SynchronizedWriter : TextWriter
|
||||
{
|
||||
// Token: 0x0600183B RID: 6203 RVA: 0x0005CA64 File Offset: 0x0005AC64
|
||||
public SynchronizedWriter(TextWriter writer)
|
||||
: this(writer, false)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x0600183C RID: 6204 RVA: 0x0005CA70 File Offset: 0x0005AC70
|
||||
public SynchronizedWriter(TextWriter writer, bool neverClose)
|
||||
{
|
||||
this.writer = writer;
|
||||
this.neverClose = neverClose;
|
||||
}
|
||||
|
||||
// Token: 0x0600183D RID: 6205 RVA: 0x0005CA88 File Offset: 0x0005AC88
|
||||
public override void Close()
|
||||
{
|
||||
if (this.neverClose)
|
||||
{
|
||||
return;
|
||||
}
|
||||
lock (this)
|
||||
{
|
||||
this.writer.Close();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600183E RID: 6206 RVA: 0x0005CADC File Offset: 0x0005ACDC
|
||||
public override void Flush()
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
this.writer.Flush();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600183F RID: 6207 RVA: 0x0005CB24 File Offset: 0x0005AD24
|
||||
public override void Write(bool value)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
this.writer.Write(value);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001840 RID: 6208 RVA: 0x0005CB70 File Offset: 0x0005AD70
|
||||
public override void Write(char value)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
this.writer.Write(value);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001841 RID: 6209 RVA: 0x0005CBBC File Offset: 0x0005ADBC
|
||||
public override void Write(char[] value)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
this.writer.Write(value);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001842 RID: 6210 RVA: 0x0005CC08 File Offset: 0x0005AE08
|
||||
public override void Write(decimal value)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
this.writer.Write(value);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001843 RID: 6211 RVA: 0x0005CC54 File Offset: 0x0005AE54
|
||||
public override void Write(int value)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
this.writer.Write(value);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001844 RID: 6212 RVA: 0x0005CCA0 File Offset: 0x0005AEA0
|
||||
public override void Write(long value)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
this.writer.Write(value);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001845 RID: 6213 RVA: 0x0005CCEC File Offset: 0x0005AEEC
|
||||
public override void Write(object value)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
this.writer.Write(value);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001846 RID: 6214 RVA: 0x0005CD38 File Offset: 0x0005AF38
|
||||
public override void Write(float value)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
this.writer.Write(value);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001847 RID: 6215 RVA: 0x0005CD84 File Offset: 0x0005AF84
|
||||
public override void Write(string value)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
this.writer.Write(value);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001848 RID: 6216 RVA: 0x0005CDD0 File Offset: 0x0005AFD0
|
||||
public override void Write(uint value)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
this.writer.Write(value);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001849 RID: 6217 RVA: 0x0005CE1C File Offset: 0x0005B01C
|
||||
public override void Write(ulong value)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
this.writer.Write(value);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600184A RID: 6218 RVA: 0x0005CE68 File Offset: 0x0005B068
|
||||
public override void Write(string format, object value)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
this.writer.Write(format, value);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600184B RID: 6219 RVA: 0x0005CEB4 File Offset: 0x0005B0B4
|
||||
public override void Write(string format, object[] value)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
this.writer.Write(format, value);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600184C RID: 6220 RVA: 0x0005CF00 File Offset: 0x0005B100
|
||||
public override void Write(char[] buffer, int index, int count)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
this.writer.Write(buffer, index, count);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600184D RID: 6221 RVA: 0x0005CF4C File Offset: 0x0005B14C
|
||||
public override void Write(string format, object arg0, object arg1)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
this.writer.Write(format, arg0, arg1);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600184E RID: 6222 RVA: 0x0005CF98 File Offset: 0x0005B198
|
||||
public override void Write(string format, object arg0, object arg1, object arg2)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
this.writer.Write(format, arg0, arg1, arg2);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600184F RID: 6223 RVA: 0x0005CFE8 File Offset: 0x0005B1E8
|
||||
public override void WriteLine()
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
this.writer.WriteLine();
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001850 RID: 6224 RVA: 0x0005D030 File Offset: 0x0005B230
|
||||
public override void WriteLine(bool value)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
this.writer.WriteLine(value);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001851 RID: 6225 RVA: 0x0005D07C File Offset: 0x0005B27C
|
||||
public override void WriteLine(char value)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
this.writer.WriteLine(value);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001852 RID: 6226 RVA: 0x0005D0C8 File Offset: 0x0005B2C8
|
||||
public override void WriteLine(char[] value)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
this.writer.WriteLine(value);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001853 RID: 6227 RVA: 0x0005D114 File Offset: 0x0005B314
|
||||
public override void WriteLine(decimal value)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
this.writer.WriteLine(value);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001854 RID: 6228 RVA: 0x0005D160 File Offset: 0x0005B360
|
||||
public override void WriteLine(double value)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
this.writer.WriteLine(value);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001855 RID: 6229 RVA: 0x0005D1AC File Offset: 0x0005B3AC
|
||||
public override void WriteLine(int value)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
this.writer.WriteLine(value);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001856 RID: 6230 RVA: 0x0005D1F8 File Offset: 0x0005B3F8
|
||||
public override void WriteLine(long value)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
this.writer.WriteLine(value);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001857 RID: 6231 RVA: 0x0005D244 File Offset: 0x0005B444
|
||||
public override void WriteLine(object value)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
this.writer.WriteLine(value);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001858 RID: 6232 RVA: 0x0005D290 File Offset: 0x0005B490
|
||||
public override void WriteLine(float value)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
this.writer.WriteLine(value);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001859 RID: 6233 RVA: 0x0005D2DC File Offset: 0x0005B4DC
|
||||
public override void WriteLine(string value)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
this.writer.WriteLine(value);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600185A RID: 6234 RVA: 0x0005D328 File Offset: 0x0005B528
|
||||
public override void WriteLine(uint value)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
this.writer.WriteLine(value);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600185B RID: 6235 RVA: 0x0005D374 File Offset: 0x0005B574
|
||||
public override void WriteLine(ulong value)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
this.writer.WriteLine(value);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600185C RID: 6236 RVA: 0x0005D3C0 File Offset: 0x0005B5C0
|
||||
public override void WriteLine(string format, object value)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
this.writer.WriteLine(format, value);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600185D RID: 6237 RVA: 0x0005D40C File Offset: 0x0005B60C
|
||||
public override void WriteLine(string format, object[] value)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
this.writer.WriteLine(format, value);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600185E RID: 6238 RVA: 0x0005D458 File Offset: 0x0005B658
|
||||
public override void WriteLine(char[] buffer, int index, int count)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
this.writer.WriteLine(buffer, index, count);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600185F RID: 6239 RVA: 0x0005D4A4 File Offset: 0x0005B6A4
|
||||
public override void WriteLine(string format, object arg0, object arg1)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
this.writer.WriteLine(format, arg0, arg1);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001860 RID: 6240 RVA: 0x0005D4F0 File Offset: 0x0005B6F0
|
||||
public override void WriteLine(string format, object arg0, object arg1, object arg2)
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
this.writer.WriteLine(format, arg0, arg1, arg2);
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000440 RID: 1088
|
||||
// (get) Token: 0x06001861 RID: 6241 RVA: 0x0005D540 File Offset: 0x0005B740
|
||||
public override Encoding Encoding
|
||||
{
|
||||
get
|
||||
{
|
||||
Encoding encoding;
|
||||
lock (this)
|
||||
{
|
||||
encoding = this.writer.Encoding;
|
||||
}
|
||||
return encoding;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000441 RID: 1089
|
||||
// (get) Token: 0x06001862 RID: 6242 RVA: 0x0005D590 File Offset: 0x0005B790
|
||||
public override IFormatProvider FormatProvider
|
||||
{
|
||||
get
|
||||
{
|
||||
IFormatProvider formatProvider;
|
||||
lock (this)
|
||||
{
|
||||
formatProvider = this.writer.FormatProvider;
|
||||
}
|
||||
return formatProvider;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x17000442 RID: 1090
|
||||
// (get) Token: 0x06001863 RID: 6243 RVA: 0x0005D5E0 File Offset: 0x0005B7E0
|
||||
// (set) Token: 0x06001864 RID: 6244 RVA: 0x0005D630 File Offset: 0x0005B830
|
||||
public override string NewLine
|
||||
{
|
||||
get
|
||||
{
|
||||
string newLine;
|
||||
lock (this)
|
||||
{
|
||||
newLine = this.writer.NewLine;
|
||||
}
|
||||
return newLine;
|
||||
}
|
||||
set
|
||||
{
|
||||
lock (this)
|
||||
{
|
||||
this.writer.NewLine = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x04000728 RID: 1832
|
||||
private TextWriter writer;
|
||||
|
||||
// Token: 0x04000729 RID: 1833
|
||||
private bool neverClose;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,180 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
/// <summary>Represents a reader that can read a sequential series of characters.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x020001D3 RID: 467
|
||||
[ComVisible(true)]
|
||||
[Serializable]
|
||||
public abstract class TextReader : IDisposable
|
||||
{
|
||||
/// <summary>Closes the <see cref="T:System.IO.TextReader" /> and releases any system resources associated with the TextReader.</summary>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060017F2 RID: 6130 RVA: 0x0005C35C File Offset: 0x0005A55C
|
||||
public virtual void Close()
|
||||
{
|
||||
this.Dispose(true);
|
||||
}
|
||||
|
||||
/// <summary>Releases all resources used by the <see cref="T:System.IO.TextReader" /> object.</summary>
|
||||
// Token: 0x060017F3 RID: 6131 RVA: 0x0005C368 File Offset: 0x0005A568
|
||||
public void Dispose()
|
||||
{
|
||||
this.Dispose(true);
|
||||
}
|
||||
|
||||
/// <summary>Releases the unmanaged resources used by the <see cref="T:System.IO.TextReader" /> and optionally releases the managed resources.</summary>
|
||||
/// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources. </param>
|
||||
// Token: 0x060017F4 RID: 6132 RVA: 0x0005C374 File Offset: 0x0005A574
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Reads the next character without changing the state of the reader or the character source. Returns the next available character without actually reading it from the input stream.</summary>
|
||||
/// <returns>An integer representing the next character to be read, or -1 if no more characters are available or the stream does not support seeking.</returns>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.IO.TextReader" /> is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060017F5 RID: 6133 RVA: 0x0005C384 File Offset: 0x0005A584
|
||||
public virtual int Peek()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
/// <summary>Reads the next character from the input stream and advances the character position by one character.</summary>
|
||||
/// <returns>The next character from the input stream, or -1 if no more characters are available. The default implementation returns -1.</returns>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.IO.TextReader" /> is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060017F6 RID: 6134 RVA: 0x0005C388 File Offset: 0x0005A588
|
||||
public virtual int Read()
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
/// <summary>Reads a maximum of <paramref name="count" /> characters from the current stream and writes the data to <paramref name="buffer" />, beginning at <paramref name="index" />.</summary>
|
||||
/// <returns>The number of characters that have been read. The number will be less than or equal to <paramref name="count" />, depending on whether the data is available within the stream. This method returns zero if called when no more characters are left to read.</returns>
|
||||
/// <param name="buffer">When this method returns, contains the specified character array with the values between <paramref name="index" /> and (<paramref name="index" /> + <paramref name="count" /> - 1) replaced by the characters read from the current source. </param>
|
||||
/// <param name="index">The position in <paramref name="buffer" /> at which to begin writing. </param>
|
||||
/// <param name="count">The maximum number of characters to read. If the end of the stream is reached before <paramref name="count" /> of characters is read into <paramref name="buffer" />, the current method returns. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="buffer" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">The buffer length minus <paramref name="index" /> is less than <paramref name="count" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> or <paramref name="count" /> is negative. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.IO.TextReader" /> is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060017F7 RID: 6135 RVA: 0x0005C38C File Offset: 0x0005A58C
|
||||
public virtual int Read([In] [Out] char[] buffer, int index, int count)
|
||||
{
|
||||
int i;
|
||||
for (i = 0; i < count; i++)
|
||||
{
|
||||
int num;
|
||||
if ((num = this.Read()) == -1)
|
||||
{
|
||||
return i;
|
||||
}
|
||||
buffer[index + i] = (char)num;
|
||||
}
|
||||
return i;
|
||||
}
|
||||
|
||||
/// <summary>Reads a maximum of <paramref name="count" /> characters from the current stream, and writes the data to <paramref name="buffer" />, beginning at <paramref name="index" />.</summary>
|
||||
/// <returns>The position of the underlying stream is advanced by the number of characters that were read into <paramref name="buffer" />.The number of characters that have been read. The number will be less than or equal to <paramref name="count" />, depending on whether all input characters have been read.</returns>
|
||||
/// <param name="buffer">When this method returns, this parameter contains the specified character array with the values between <paramref name="index" /> and (<paramref name="index" /> + <paramref name="count" /> -1) replaced by the characters read from the current source. </param>
|
||||
/// <param name="index">The position in <paramref name="buffer" /> at which to begin writing. </param>
|
||||
/// <param name="count">The maximum number of characters to read. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="buffer" /> is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentException">The buffer length minus <paramref name="index" /> is less than <paramref name="count" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> or <paramref name="count" /> is negative. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.IO.TextReader" /> is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060017F8 RID: 6136 RVA: 0x0005C3C4 File Offset: 0x0005A5C4
|
||||
public virtual int ReadBlock([In] [Out] char[] buffer, int index, int count)
|
||||
{
|
||||
int num = 0;
|
||||
int num2;
|
||||
do
|
||||
{
|
||||
num2 = this.Read(buffer, index, count);
|
||||
index += num2;
|
||||
num += num2;
|
||||
count -= num2;
|
||||
}
|
||||
while (num2 != 0 && count > 0);
|
||||
return num;
|
||||
}
|
||||
|
||||
/// <summary>Reads a line of characters from the current stream and returns the data as a string.</summary>
|
||||
/// <returns>The next line from the input stream, or null if all characters have been read.</returns>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.OutOfMemoryException">There is insufficient memory to allocate a buffer for the returned string. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.IO.TextReader" /> is closed. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">The number of characters in the next line is larger than <see cref="F:System.Int32.MaxValue" /></exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060017F9 RID: 6137 RVA: 0x0005C3FC File Offset: 0x0005A5FC
|
||||
public virtual string ReadLine()
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>Reads all characters from the current position to the end of the TextReader and returns them as one string.</summary>
|
||||
/// <returns>A string containing all characters from the current position to the end of the TextReader.</returns>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.IO.TextReader" /> is closed. </exception>
|
||||
/// <exception cref="T:System.OutOfMemoryException">There is insufficient memory to allocate a buffer for the returned string. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">The number of characters in the next line is larger than <see cref="F:System.Int32.MaxValue" /></exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x060017FA RID: 6138 RVA: 0x0005C404 File Offset: 0x0005A604
|
||||
public virtual string ReadToEnd()
|
||||
{
|
||||
return string.Empty;
|
||||
}
|
||||
|
||||
/// <summary>Creates a thread-safe wrapper around the specified TextReader.</summary>
|
||||
/// <returns>A thread-safe <see cref="T:System.IO.TextReader" />.</returns>
|
||||
/// <param name="reader">The TextReader to synchronize. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="reader" /> is null. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x060017FB RID: 6139 RVA: 0x0005C40C File Offset: 0x0005A60C
|
||||
public static TextReader Synchronized(TextReader reader)
|
||||
{
|
||||
if (reader == null)
|
||||
{
|
||||
throw new ArgumentNullException("reader is null");
|
||||
}
|
||||
if (reader is SynchronizedReader)
|
||||
{
|
||||
return reader;
|
||||
}
|
||||
return new SynchronizedReader(reader);
|
||||
}
|
||||
|
||||
/// <summary>Provides a TextReader with no data to read from.</summary>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x04000723 RID: 1827
|
||||
public static readonly TextReader Null = new TextReader.NullTextReader();
|
||||
|
||||
// Token: 0x020001D4 RID: 468
|
||||
private class NullTextReader : TextReader
|
||||
{
|
||||
// Token: 0x060017FD RID: 6141 RVA: 0x0005C448 File Offset: 0x0005A648
|
||||
public override string ReadLine()
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,653 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
using System.Text;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
/// <summary>Represents a writer that can write a sequential series of characters. This class is abstract.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x020001D6 RID: 470
|
||||
[ComVisible(true)]
|
||||
[Serializable]
|
||||
public abstract class TextWriter : IDisposable
|
||||
{
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.TextWriter" /> class.</summary>
|
||||
// Token: 0x06001806 RID: 6150 RVA: 0x0005C68C File Offset: 0x0005A88C
|
||||
protected TextWriter()
|
||||
{
|
||||
this.CoreNewLine = Environment.NewLine.ToCharArray();
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.TextWriter" /> class with the specified format provider.</summary>
|
||||
/// <param name="formatProvider">An <see cref="T:System.IFormatProvider" /> object that controls formatting. </param>
|
||||
// Token: 0x06001807 RID: 6151 RVA: 0x0005C6A4 File Offset: 0x0005A8A4
|
||||
protected TextWriter(IFormatProvider formatProvider)
|
||||
{
|
||||
this.CoreNewLine = Environment.NewLine.ToCharArray();
|
||||
this.internalFormatProvider = formatProvider;
|
||||
}
|
||||
|
||||
/// <summary>When overridden in a derived class, returns the <see cref="T:System.Text.Encoding" /> in which the output is written.</summary>
|
||||
/// <returns>The Encoding in which the output is written.</returns>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x1700043C RID: 1084
|
||||
// (get) Token: 0x06001809 RID: 6153
|
||||
public abstract Encoding Encoding { get; }
|
||||
|
||||
/// <summary>Gets an object that controls formatting.</summary>
|
||||
/// <returns>An <see cref="T:System.IFormatProvider" /> object for a specific culture, or the formatting of the current culture if no other culture is specified.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x1700043D RID: 1085
|
||||
// (get) Token: 0x0600180A RID: 6154 RVA: 0x0005C6D0 File Offset: 0x0005A8D0
|
||||
public virtual IFormatProvider FormatProvider
|
||||
{
|
||||
get
|
||||
{
|
||||
return this.internalFormatProvider;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the line terminator string used by the current TextWriter.</summary>
|
||||
/// <returns>The line terminator string for the current TextWriter.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x1700043E RID: 1086
|
||||
// (get) Token: 0x0600180B RID: 6155 RVA: 0x0005C6D8 File Offset: 0x0005A8D8
|
||||
// (set) Token: 0x0600180C RID: 6156 RVA: 0x0005C6E8 File Offset: 0x0005A8E8
|
||||
public virtual string NewLine
|
||||
{
|
||||
get
|
||||
{
|
||||
return new string(this.CoreNewLine);
|
||||
}
|
||||
set
|
||||
{
|
||||
if (value == null)
|
||||
{
|
||||
value = Environment.NewLine;
|
||||
}
|
||||
this.CoreNewLine = value.ToCharArray();
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Closes the current writer and releases any system resources associated with the writer.</summary>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600180D RID: 6157 RVA: 0x0005C704 File Offset: 0x0005A904
|
||||
public virtual void Close()
|
||||
{
|
||||
this.Dispose(true);
|
||||
}
|
||||
|
||||
/// <summary>Releases the unmanaged resources used by the <see cref="T:System.IO.TextWriter" /> and optionally releases the managed resources.</summary>
|
||||
/// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources. </param>
|
||||
// Token: 0x0600180E RID: 6158 RVA: 0x0005C710 File Offset: 0x0005A910
|
||||
protected virtual void Dispose(bool disposing)
|
||||
{
|
||||
if (disposing)
|
||||
{
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Releases all resources used by the <see cref="T:System.IO.TextWriter" /> object.</summary>
|
||||
// Token: 0x0600180F RID: 6159 RVA: 0x0005C720 File Offset: 0x0005A920
|
||||
public void Dispose()
|
||||
{
|
||||
this.Dispose(true);
|
||||
GC.SuppressFinalize(this);
|
||||
}
|
||||
|
||||
/// <summary>Clears all buffers for the current writer and causes any buffered data to be written to the underlying device.</summary>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06001810 RID: 6160 RVA: 0x0005C730 File Offset: 0x0005A930
|
||||
public virtual void Flush()
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Creates a thread-safe wrapper around the specified TextWriter.</summary>
|
||||
/// <returns>A thread-safe wrapper.</returns>
|
||||
/// <param name="writer">The TextWriter to synchronize. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="writer" /> is null. </exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06001811 RID: 6161 RVA: 0x0005C734 File Offset: 0x0005A934
|
||||
public static TextWriter Synchronized(TextWriter writer)
|
||||
{
|
||||
return TextWriter.Synchronized(writer, false);
|
||||
}
|
||||
|
||||
// Token: 0x06001812 RID: 6162 RVA: 0x0005C740 File Offset: 0x0005A940
|
||||
internal static TextWriter Synchronized(TextWriter writer, bool neverClose)
|
||||
{
|
||||
if (writer == null)
|
||||
{
|
||||
throw new ArgumentNullException("writer is null");
|
||||
}
|
||||
if (writer is SynchronizedWriter)
|
||||
{
|
||||
return writer;
|
||||
}
|
||||
return new SynchronizedWriter(writer, neverClose);
|
||||
}
|
||||
|
||||
/// <summary>Writes the text representation of a Boolean value to the text stream.</summary>
|
||||
/// <param name="value">The Boolean to write. </param>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.IO.TextWriter" /> is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06001813 RID: 6163 RVA: 0x0005C768 File Offset: 0x0005A968
|
||||
public virtual void Write(bool value)
|
||||
{
|
||||
this.Write(value.ToString());
|
||||
}
|
||||
|
||||
/// <summary>Writes a character to the text stream.</summary>
|
||||
/// <param name="value">The character to write to the text stream. </param>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.IO.TextWriter" /> is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06001814 RID: 6164 RVA: 0x0005C778 File Offset: 0x0005A978
|
||||
public virtual void Write(char value)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>Writes a character array to the text stream.</summary>
|
||||
/// <param name="buffer">The character array to write to the text stream. </param>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.IO.TextWriter" /> is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06001815 RID: 6165 RVA: 0x0005C77C File Offset: 0x0005A97C
|
||||
public virtual void Write(char[] buffer)
|
||||
{
|
||||
if (buffer == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
this.Write(buffer, 0, buffer.Length);
|
||||
}
|
||||
|
||||
/// <summary>Writes the text representation of a decimal value to the text stream.</summary>
|
||||
/// <param name="value">The decimal value to write. </param>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.IO.TextWriter" /> is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06001816 RID: 6166 RVA: 0x0005C790 File Offset: 0x0005A990
|
||||
public virtual void Write(decimal value)
|
||||
{
|
||||
this.Write(value.ToString(this.internalFormatProvider));
|
||||
}
|
||||
|
||||
/// <summary>Writes the text representation of an 8-byte floating-point value to the text stream.</summary>
|
||||
/// <param name="value">The 8-byte floating-point value to write. </param>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.IO.TextWriter" /> is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06001817 RID: 6167 RVA: 0x0005C7A8 File Offset: 0x0005A9A8
|
||||
public virtual void Write(double value)
|
||||
{
|
||||
this.Write(value.ToString(this.internalFormatProvider));
|
||||
}
|
||||
|
||||
/// <summary>Writes the text representation of a 4-byte signed integer to the text stream.</summary>
|
||||
/// <param name="value">The 4-byte signed integer to write. </param>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.IO.TextWriter" /> is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06001818 RID: 6168 RVA: 0x0005C7C0 File Offset: 0x0005A9C0
|
||||
public virtual void Write(int value)
|
||||
{
|
||||
this.Write(value.ToString(this.internalFormatProvider));
|
||||
}
|
||||
|
||||
/// <summary>Writes the text representation of an 8-byte signed integer to the text stream.</summary>
|
||||
/// <param name="value">The 8-byte signed integer to write. </param>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.IO.TextWriter" /> is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06001819 RID: 6169 RVA: 0x0005C7D8 File Offset: 0x0005A9D8
|
||||
public virtual void Write(long value)
|
||||
{
|
||||
this.Write(value.ToString(this.internalFormatProvider));
|
||||
}
|
||||
|
||||
/// <summary>Writes the text representation of an object to the text stream by calling ToString on that object.</summary>
|
||||
/// <param name="value">The object to write. </param>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.IO.TextWriter" /> is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600181A RID: 6170 RVA: 0x0005C7F0 File Offset: 0x0005A9F0
|
||||
public virtual void Write(object value)
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
this.Write(value.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Writes the text representation of a 4-byte floating-point value to the text stream.</summary>
|
||||
/// <param name="value">The 4-byte floating-point value to write. </param>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.IO.TextWriter" /> is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600181B RID: 6171 RVA: 0x0005C804 File Offset: 0x0005AA04
|
||||
public virtual void Write(float value)
|
||||
{
|
||||
this.Write(value.ToString(this.internalFormatProvider));
|
||||
}
|
||||
|
||||
/// <summary>Writes a string to the text stream.</summary>
|
||||
/// <param name="value">The string to write. </param>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.IO.TextWriter" /> is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600181C RID: 6172 RVA: 0x0005C81C File Offset: 0x0005AA1C
|
||||
public virtual void Write(string value)
|
||||
{
|
||||
if (value != null)
|
||||
{
|
||||
this.Write(value.ToCharArray());
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Writes the text representation of a 4-byte unsigned integer to the text stream.</summary>
|
||||
/// <param name="value">The 4-byte unsigned integer to write. </param>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.IO.TextWriter" /> is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600181D RID: 6173 RVA: 0x0005C830 File Offset: 0x0005AA30
|
||||
[CLSCompliant(false)]
|
||||
public virtual void Write(uint value)
|
||||
{
|
||||
this.Write(value.ToString(this.internalFormatProvider));
|
||||
}
|
||||
|
||||
/// <summary>Writes the text representation of an 8-byte unsigned integer to the text stream.</summary>
|
||||
/// <param name="value">The 8-byte unsigned integer to write. </param>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.IO.TextWriter" /> is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600181E RID: 6174 RVA: 0x0005C848 File Offset: 0x0005AA48
|
||||
[CLSCompliant(false)]
|
||||
public virtual void Write(ulong value)
|
||||
{
|
||||
this.Write(value.ToString(this.internalFormatProvider));
|
||||
}
|
||||
|
||||
/// <summary>Writes out a formatted string, using the same semantics as <see cref="M:System.String.Format(System.String,System.Object)" />.</summary>
|
||||
/// <param name="format">The formatting string. </param>
|
||||
/// <param name="arg0">An object to write into the formatted string. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="format" /> is null. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.IO.TextWriter" /> is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.FormatException">The format specification in format is invalid.-or- The number indicating an argument to be formatted is less than zero, or larger than or equal to the number of provided objects to be formatted. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600181F RID: 6175 RVA: 0x0005C860 File Offset: 0x0005AA60
|
||||
public virtual void Write(string format, object arg0)
|
||||
{
|
||||
this.Write(string.Format(format, arg0));
|
||||
}
|
||||
|
||||
/// <summary>Writes out a formatted string, using the same semantics as <see cref="M:System.String.Format(System.String,System.Object)" />.</summary>
|
||||
/// <param name="format">The formatting string. </param>
|
||||
/// <param name="arg">The object array to write into the formatted string. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="format" /> or <paramref name="arg" /> is null. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.IO.TextWriter" /> is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.FormatException">The format specification in format is invalid.-or- The number indicating an argument to be formatted is less than zero, or larger than or equal to <paramref name="arg" />. Length. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06001820 RID: 6176 RVA: 0x0005C870 File Offset: 0x0005AA70
|
||||
public virtual void Write(string format, params object[] arg)
|
||||
{
|
||||
this.Write(string.Format(format, arg));
|
||||
}
|
||||
|
||||
/// <summary>Writes a subarray of characters to the text stream.</summary>
|
||||
/// <param name="buffer">The character array to write data from. </param>
|
||||
/// <param name="index">Starting index in the buffer. </param>
|
||||
/// <param name="count">The number of characters to write. </param>
|
||||
/// <exception cref="T:System.ArgumentException">The buffer length minus <paramref name="index" /> is less than <paramref name="count" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">The <paramref name="buffer" /> parameter is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> or <paramref name="count" /> is negative. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.IO.TextWriter" /> is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06001821 RID: 6177 RVA: 0x0005C880 File Offset: 0x0005AA80
|
||||
public virtual void Write(char[] buffer, int index, int count)
|
||||
{
|
||||
if (buffer == null)
|
||||
{
|
||||
throw new ArgumentNullException("buffer");
|
||||
}
|
||||
if (index < 0 || index > buffer.Length)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("index");
|
||||
}
|
||||
if (count < 0 || index > buffer.Length - count)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count");
|
||||
}
|
||||
while (count > 0)
|
||||
{
|
||||
this.Write(buffer[index]);
|
||||
count--;
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Writes out a formatted string, using the same semantics as <see cref="M:System.String.Format(System.String,System.Object)" />.</summary>
|
||||
/// <param name="format">The formatting string. </param>
|
||||
/// <param name="arg0">An object to write into the formatted string. </param>
|
||||
/// <param name="arg1">An object to write into the formatted string. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="format" /> is null. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.IO.TextWriter" /> is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.FormatException">The format specification in format is invalid.-or- The number indicating an argument to be formatted is less than zero, or larger than or equal to the number of provided objects to be formatted. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06001822 RID: 6178 RVA: 0x0005C8F8 File Offset: 0x0005AAF8
|
||||
public virtual void Write(string format, object arg0, object arg1)
|
||||
{
|
||||
this.Write(string.Format(format, arg0, arg1));
|
||||
}
|
||||
|
||||
/// <summary>Writes out a formatted string, using the same semantics as <see cref="M:System.String.Format(System.String,System.Object)" />.</summary>
|
||||
/// <param name="format">The formatting string. </param>
|
||||
/// <param name="arg0">An object to write into the formatted string. </param>
|
||||
/// <param name="arg1">An object to write into the formatted string. </param>
|
||||
/// <param name="arg2">An object to write into the formatted string. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="format" /> is null. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.IO.TextWriter" /> is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.FormatException">The format specification in format is invalid.-or- The number indicating an argument to be formatted is less than zero, or larger than or equal to the number of provided objects to be formatted. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06001823 RID: 6179 RVA: 0x0005C908 File Offset: 0x0005AB08
|
||||
public virtual void Write(string format, object arg0, object arg1, object arg2)
|
||||
{
|
||||
this.Write(string.Format(format, arg0, arg1, arg2));
|
||||
}
|
||||
|
||||
/// <summary>Writes a line terminator to the text stream.</summary>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.IO.TextWriter" /> is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06001824 RID: 6180 RVA: 0x0005C91C File Offset: 0x0005AB1C
|
||||
public virtual void WriteLine()
|
||||
{
|
||||
this.Write(this.CoreNewLine);
|
||||
}
|
||||
|
||||
/// <summary>Writes the text representation of a Boolean followed by a line terminator to the text stream.</summary>
|
||||
/// <param name="value">The Boolean to write. </param>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.IO.TextWriter" /> is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06001825 RID: 6181 RVA: 0x0005C92C File Offset: 0x0005AB2C
|
||||
public virtual void WriteLine(bool value)
|
||||
{
|
||||
this.Write(value);
|
||||
this.WriteLine();
|
||||
}
|
||||
|
||||
/// <summary>Writes a character followed by a line terminator to the text stream.</summary>
|
||||
/// <param name="value">The character to write to the text stream. </param>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.IO.TextWriter" /> is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06001826 RID: 6182 RVA: 0x0005C93C File Offset: 0x0005AB3C
|
||||
public virtual void WriteLine(char value)
|
||||
{
|
||||
this.Write(value);
|
||||
this.WriteLine();
|
||||
}
|
||||
|
||||
/// <summary>Writes an array of characters followed by a line terminator to the text stream.</summary>
|
||||
/// <param name="buffer">The character array from which data is read. </param>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.IO.TextWriter" /> is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06001827 RID: 6183 RVA: 0x0005C94C File Offset: 0x0005AB4C
|
||||
public virtual void WriteLine(char[] buffer)
|
||||
{
|
||||
this.Write(buffer);
|
||||
this.WriteLine();
|
||||
}
|
||||
|
||||
/// <summary>Writes the text representation of a decimal value followed by a line terminator to the text stream.</summary>
|
||||
/// <param name="value">The decimal value to write. </param>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.IO.TextWriter" /> is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06001828 RID: 6184 RVA: 0x0005C95C File Offset: 0x0005AB5C
|
||||
public virtual void WriteLine(decimal value)
|
||||
{
|
||||
this.Write(value);
|
||||
this.WriteLine();
|
||||
}
|
||||
|
||||
/// <summary>Writes the text representation of a 8-byte floating-point value followed by a line terminator to the text stream.</summary>
|
||||
/// <param name="value">The 8-byte floating-point value to write. </param>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.IO.TextWriter" /> is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06001829 RID: 6185 RVA: 0x0005C96C File Offset: 0x0005AB6C
|
||||
public virtual void WriteLine(double value)
|
||||
{
|
||||
this.Write(value);
|
||||
this.WriteLine();
|
||||
}
|
||||
|
||||
/// <summary>Writes the text representation of a 4-byte signed integer followed by a line terminator to the text stream.</summary>
|
||||
/// <param name="value">The 4-byte signed integer to write. </param>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.IO.TextWriter" /> is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600182A RID: 6186 RVA: 0x0005C97C File Offset: 0x0005AB7C
|
||||
public virtual void WriteLine(int value)
|
||||
{
|
||||
this.Write(value);
|
||||
this.WriteLine();
|
||||
}
|
||||
|
||||
/// <summary>Writes the text representation of an 8-byte signed integer followed by a line terminator to the text stream.</summary>
|
||||
/// <param name="value">The 8-byte signed integer to write. </param>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.IO.TextWriter" /> is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600182B RID: 6187 RVA: 0x0005C98C File Offset: 0x0005AB8C
|
||||
public virtual void WriteLine(long value)
|
||||
{
|
||||
this.Write(value);
|
||||
this.WriteLine();
|
||||
}
|
||||
|
||||
/// <summary>Writes the text representation of an object by calling ToString on this object, followed by a line terminator to the text stream.</summary>
|
||||
/// <param name="value">The object to write. If <paramref name="value" /> is null, only the line termination characters are written. </param>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.IO.TextWriter" /> is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600182C RID: 6188 RVA: 0x0005C99C File Offset: 0x0005AB9C
|
||||
public virtual void WriteLine(object value)
|
||||
{
|
||||
this.Write(value);
|
||||
this.WriteLine();
|
||||
}
|
||||
|
||||
/// <summary>Writes the text representation of a 4-byte floating-point value followed by a line terminator to the text stream.</summary>
|
||||
/// <param name="value">The 4-byte floating-point value to write. </param>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.IO.TextWriter" /> is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600182D RID: 6189 RVA: 0x0005C9AC File Offset: 0x0005ABAC
|
||||
public virtual void WriteLine(float value)
|
||||
{
|
||||
this.Write(value);
|
||||
this.WriteLine();
|
||||
}
|
||||
|
||||
/// <summary>Writes a string followed by a line terminator to the text stream.</summary>
|
||||
/// <param name="value">The string to write. If <paramref name="value" /> is null, only the line termination characters are written. </param>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.IO.TextWriter" /> is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600182E RID: 6190 RVA: 0x0005C9BC File Offset: 0x0005ABBC
|
||||
public virtual void WriteLine(string value)
|
||||
{
|
||||
this.Write(value);
|
||||
this.WriteLine();
|
||||
}
|
||||
|
||||
/// <summary>Writes the text representation of a 4-byte unsigned integer followed by a line terminator to the text stream.</summary>
|
||||
/// <param name="value">The 4-byte unsigned integer to write. </param>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.IO.TextWriter" /> is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x0600182F RID: 6191 RVA: 0x0005C9CC File Offset: 0x0005ABCC
|
||||
[CLSCompliant(false)]
|
||||
public virtual void WriteLine(uint value)
|
||||
{
|
||||
this.Write(value);
|
||||
this.WriteLine();
|
||||
}
|
||||
|
||||
/// <summary>Writes the text representation of an 8-byte unsigned integer followed by a line terminator to the text stream.</summary>
|
||||
/// <param name="value">The 8-byte unsigned integer to write. </param>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.IO.TextWriter" /> is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06001830 RID: 6192 RVA: 0x0005C9DC File Offset: 0x0005ABDC
|
||||
[CLSCompliant(false)]
|
||||
public virtual void WriteLine(ulong value)
|
||||
{
|
||||
this.Write(value);
|
||||
this.WriteLine();
|
||||
}
|
||||
|
||||
/// <summary>Writes out a formatted string and a new line, using the same semantics as <see cref="M:System.String.Format(System.String,System.Object)" />.</summary>
|
||||
/// <param name="format">The formatted string. </param>
|
||||
/// <param name="arg0">The object to write into the formatted string. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="format" /> is null. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.IO.TextWriter" /> is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.FormatException">The format specification in format is invalid.-or- The number indicating an argument to be formatted is less than zero, or larger than or equal to the number of provided objects to be formatted. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06001831 RID: 6193 RVA: 0x0005C9EC File Offset: 0x0005ABEC
|
||||
public virtual void WriteLine(string format, object arg0)
|
||||
{
|
||||
this.Write(format, arg0);
|
||||
this.WriteLine();
|
||||
}
|
||||
|
||||
/// <summary>Writes out a formatted string and a new line, using the same semantics as <see cref="M:System.String.Format(System.String,System.Object)" />.</summary>
|
||||
/// <param name="format">The formatting string. </param>
|
||||
/// <param name="arg">The object array to write into format string. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">A string or object is passed in as null. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.IO.TextWriter" /> is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.FormatException">The format specification in format is invalid.-or- The number indicating an argument to be formatted is less than zero, or larger than or equal to arg.Length. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06001832 RID: 6194 RVA: 0x0005C9FC File Offset: 0x0005ABFC
|
||||
public virtual void WriteLine(string format, params object[] arg)
|
||||
{
|
||||
this.Write(format, arg);
|
||||
this.WriteLine();
|
||||
}
|
||||
|
||||
/// <summary>Writes a subarray of characters followed by a line terminator to the text stream.</summary>
|
||||
/// <param name="buffer">The character array from which data is read. </param>
|
||||
/// <param name="index">The index into <paramref name="buffer" /> at which to begin reading. </param>
|
||||
/// <param name="count">The maximum number of characters to write. </param>
|
||||
/// <exception cref="T:System.ArgumentException">The buffer length minus <paramref name="index" /> is less than <paramref name="count" />. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">The <paramref name="buffer" /> parameter is null. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">
|
||||
/// <paramref name="index" /> or <paramref name="count" /> is negative. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.IO.TextWriter" /> is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06001833 RID: 6195 RVA: 0x0005CA0C File Offset: 0x0005AC0C
|
||||
public virtual void WriteLine(char[] buffer, int index, int count)
|
||||
{
|
||||
this.Write(buffer, index, count);
|
||||
this.WriteLine();
|
||||
}
|
||||
|
||||
/// <summary>Writes out a formatted string and a new line, using the same semantics as <see cref="M:System.String.Format(System.String,System.Object)" />.</summary>
|
||||
/// <param name="format">The formatting string. </param>
|
||||
/// <param name="arg0">The object to write into the format string. </param>
|
||||
/// <param name="arg1">The object to write into the format string. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="format" /> is null. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.IO.TextWriter" /> is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.FormatException">The format specification in format is invalid.-or- The number indicating an argument to be formatted is less than zero, or larger than or equal to the number of provided objects to be formatted. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06001834 RID: 6196 RVA: 0x0005CA20 File Offset: 0x0005AC20
|
||||
public virtual void WriteLine(string format, object arg0, object arg1)
|
||||
{
|
||||
this.Write(format, arg0, arg1);
|
||||
this.WriteLine();
|
||||
}
|
||||
|
||||
/// <summary>Writes out a formatted string and a new line, using the same semantics as <see cref="M:System.String.Format(System.String,System.Object)" />.</summary>
|
||||
/// <param name="format">The formatting string. </param>
|
||||
/// <param name="arg0">The object to write into the format string. </param>
|
||||
/// <param name="arg1">The object to write into the format string. </param>
|
||||
/// <param name="arg2">The object to write into the format string. </param>
|
||||
/// <exception cref="T:System.ArgumentNullException">
|
||||
/// <paramref name="format" /> is null. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The <see cref="T:System.IO.TextWriter" /> is closed. </exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.FormatException">The format specification in format is invalid.-or- The number indicating an argument to be formatted is less than zero, or larger than or equal to the number of provided objects to be formatted. </exception>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x06001835 RID: 6197 RVA: 0x0005CA34 File Offset: 0x0005AC34
|
||||
public virtual void WriteLine(string format, object arg0, object arg1, object arg2)
|
||||
{
|
||||
this.Write(format, arg0, arg1, arg2);
|
||||
this.WriteLine();
|
||||
}
|
||||
|
||||
/// <summary>Stores the new line characters used for this TextWriter.</summary>
|
||||
// Token: 0x04000725 RID: 1829
|
||||
protected char[] CoreNewLine;
|
||||
|
||||
// Token: 0x04000726 RID: 1830
|
||||
internal IFormatProvider internalFormatProvider;
|
||||
|
||||
/// <summary>Provides a TextWriter with no backing store that can be written to, but not read from.</summary>
|
||||
/// <filterpriority>1</filterpriority>
|
||||
// Token: 0x04000727 RID: 1831
|
||||
public static readonly TextWriter Null = new TextWriter.NullTextWriter();
|
||||
|
||||
// Token: 0x020001D7 RID: 471
|
||||
private sealed class NullTextWriter : TextWriter
|
||||
{
|
||||
// Token: 0x1700043F RID: 1087
|
||||
// (get) Token: 0x06001837 RID: 6199 RVA: 0x0005CA50 File Offset: 0x0005AC50
|
||||
public override Encoding Encoding
|
||||
{
|
||||
get
|
||||
{
|
||||
return Encoding.Default;
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001838 RID: 6200 RVA: 0x0005CA58 File Offset: 0x0005AC58
|
||||
public override void Write(string s)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06001839 RID: 6201 RVA: 0x0005CA5C File Offset: 0x0005AC5C
|
||||
public override void Write(char value)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x0600183A RID: 6202 RVA: 0x0005CA60 File Offset: 0x0005AC60
|
||||
public override void Write(char[] value, int index, int count)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,218 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,111 @@
|
||||
using System;
|
||||
using System.Text;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
// Token: 0x020001DA RID: 474
|
||||
internal class UnexceptionalStreamWriter : StreamWriter
|
||||
{
|
||||
// Token: 0x06001876 RID: 6262 RVA: 0x0005D9C0 File Offset: 0x0005BBC0
|
||||
public UnexceptionalStreamWriter(Stream stream)
|
||||
: base(stream)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06001877 RID: 6263 RVA: 0x0005D9CC File Offset: 0x0005BBCC
|
||||
public UnexceptionalStreamWriter(Stream stream, Encoding encoding)
|
||||
: base(stream, encoding)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06001878 RID: 6264 RVA: 0x0005D9D8 File Offset: 0x0005BBD8
|
||||
public UnexceptionalStreamWriter(Stream stream, Encoding encoding, int bufferSize)
|
||||
: base(stream, encoding, bufferSize)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x06001879 RID: 6265 RVA: 0x0005D9E4 File Offset: 0x0005BBE4
|
||||
public UnexceptionalStreamWriter(string path)
|
||||
: base(path)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x0600187A RID: 6266 RVA: 0x0005D9F0 File Offset: 0x0005BBF0
|
||||
public UnexceptionalStreamWriter(string path, bool append)
|
||||
: base(path, append)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x0600187B RID: 6267 RVA: 0x0005D9FC File Offset: 0x0005BBFC
|
||||
public UnexceptionalStreamWriter(string path, bool append, Encoding encoding)
|
||||
: base(path, append, encoding)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x0600187C RID: 6268 RVA: 0x0005DA08 File Offset: 0x0005BC08
|
||||
public UnexceptionalStreamWriter(string path, bool append, Encoding encoding, int bufferSize)
|
||||
: base(path, append, encoding, bufferSize)
|
||||
{
|
||||
}
|
||||
|
||||
// Token: 0x0600187D RID: 6269 RVA: 0x0005DA18 File Offset: 0x0005BC18
|
||||
public override void Flush()
|
||||
{
|
||||
try
|
||||
{
|
||||
base.Flush();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600187E RID: 6270 RVA: 0x0005DA54 File Offset: 0x0005BC54
|
||||
public override void Write(char[] buffer, int index, int count)
|
||||
{
|
||||
try
|
||||
{
|
||||
base.Write(buffer, index, count);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x0600187F RID: 6271 RVA: 0x0005DA94 File Offset: 0x0005BC94
|
||||
public override void Write(char value)
|
||||
{
|
||||
try
|
||||
{
|
||||
base.Write(value);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001880 RID: 6272 RVA: 0x0005DAD0 File Offset: 0x0005BCD0
|
||||
public override void Write(char[] value)
|
||||
{
|
||||
try
|
||||
{
|
||||
base.Write(value);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
|
||||
// Token: 0x06001881 RID: 6273 RVA: 0x0005DB0C File Offset: 0x0005BD0C
|
||||
public override void Write(string value)
|
||||
{
|
||||
try
|
||||
{
|
||||
base.Write(value);
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,528 @@
|
||||
using System;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace System.IO
|
||||
{
|
||||
/// <summary>Provides access to unmanaged blocks of memory from managed code.</summary>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x020001DB RID: 475
|
||||
[CLSCompliant(false)]
|
||||
public class UnmanagedMemoryStream : Stream
|
||||
{
|
||||
/// <summary>Initializes a new, empty instance of the <see cref="T:System.IO.UnmanagedMemoryStream" /> class.</summary>
|
||||
/// <exception cref="T:System.Security.SecurityException">The user does not have the required permission.</exception>
|
||||
// Token: 0x06001882 RID: 6274 RVA: 0x0005DB48 File Offset: 0x0005BD48
|
||||
protected UnmanagedMemoryStream()
|
||||
{
|
||||
this.closed = true;
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.UnmanagedMemoryStream" /> class using the specified location and memory length.</summary>
|
||||
/// <param name="pointer">A pointer to an unmanaged memory location.</param>
|
||||
/// <param name="length">The length of the memory to use.</param>
|
||||
/// <exception cref="T:System.Security.SecurityException">The user does not have the required permission.</exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">The <paramref name="pointer" /> value is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="length" /> value is less than zero.- or -The <paramref name="length" /> is large enough to cause an overflow.</exception>
|
||||
// Token: 0x06001883 RID: 6275 RVA: 0x0005DB58 File Offset: 0x0005BD58
|
||||
public unsafe UnmanagedMemoryStream(byte* pointer, long length)
|
||||
{
|
||||
this.Initialize(pointer, length, length, FileAccess.Read);
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.UnmanagedMemoryStream" /> class using the specified location, memory length, total amount of memory, and file access values.</summary>
|
||||
/// <param name="pointer">A pointer to an unmanaged memory location.</param>
|
||||
/// <param name="length">The length of the memory to use.</param>
|
||||
/// <param name="capacity">The total amount of memory assigned to the stream.</param>
|
||||
/// <param name="access">One of the <see cref="T:System.IO.FileAccess" /> values.</param>
|
||||
/// <exception cref="T:System.Security.SecurityException">The user does not have the required permission.</exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">The <paramref name="pointer" /> value is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="length" /> value is less than zero.- or - The <paramref name="capacity" /> value is less than zero.- or -The <paramref name="length" /> value is greater than the <paramref name="capacity" /> value.</exception>
|
||||
// Token: 0x06001884 RID: 6276 RVA: 0x0005DB6C File Offset: 0x0005BD6C
|
||||
public unsafe UnmanagedMemoryStream(byte* pointer, long length, long capacity, FileAccess access)
|
||||
{
|
||||
this.Initialize(pointer, length, capacity, access);
|
||||
}
|
||||
|
||||
// Token: 0x14000003 RID: 3
|
||||
// (add) Token: 0x06001885 RID: 6277 RVA: 0x0005DB80 File Offset: 0x0005BD80
|
||||
// (remove) Token: 0x06001886 RID: 6278 RVA: 0x0005DB9C File Offset: 0x0005BD9C
|
||||
internal event EventHandler Closed;
|
||||
|
||||
/// <summary>Gets a value indicating whether a stream supports reading.</summary>
|
||||
/// <returns>false if the object was created by a constructor with an <paramref name="access" /> parameter that did not include reading the stream and if the stream is closed; otherwise, true.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000443 RID: 1091
|
||||
// (get) Token: 0x06001887 RID: 6279 RVA: 0x0005DBB8 File Offset: 0x0005BDB8
|
||||
public override bool CanRead
|
||||
{
|
||||
get
|
||||
{
|
||||
return !this.closed && this.fileaccess != FileAccess.Write;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a value indicating whether a stream supports seeking.</summary>
|
||||
/// <returns>false if the stream is closed; otherwise, true.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000444 RID: 1092
|
||||
// (get) Token: 0x06001888 RID: 6280 RVA: 0x0005DBD4 File Offset: 0x0005BDD4
|
||||
public override bool CanSeek
|
||||
{
|
||||
get
|
||||
{
|
||||
return !this.closed;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets a value indicating whether a stream supports writing.</summary>
|
||||
/// <returns>false if the object was created by a constructor with an <paramref name="access" /> parameter value that supports writing or was created by a constructor that had no parameters, or if the stream is closed; otherwise, true.</returns>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000445 RID: 1093
|
||||
// (get) Token: 0x06001889 RID: 6281 RVA: 0x0005DBE0 File Offset: 0x0005BDE0
|
||||
public override bool CanWrite
|
||||
{
|
||||
get
|
||||
{
|
||||
return !this.closed && this.fileaccess != FileAccess.Read;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the stream length (size) or the total amount of memory assigned to a stream (capacity).</summary>
|
||||
/// <returns>The size or capacity of the stream.</returns>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed.</exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000446 RID: 1094
|
||||
// (get) Token: 0x0600188A RID: 6282 RVA: 0x0005DBFC File Offset: 0x0005BDFC
|
||||
public long Capacity
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.closed)
|
||||
{
|
||||
throw new ObjectDisposedException("The stream is closed");
|
||||
}
|
||||
return this.capacity;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets the length of the data in a stream.</summary>
|
||||
/// <returns>The length of the data in the stream.</returns>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed.</exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000447 RID: 1095
|
||||
// (get) Token: 0x0600188B RID: 6283 RVA: 0x0005DC1C File Offset: 0x0005BE1C
|
||||
public override long Length
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.closed)
|
||||
{
|
||||
throw new ObjectDisposedException("The stream is closed");
|
||||
}
|
||||
return this.length;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets the current position in a stream.</summary>
|
||||
/// <returns>The current position in the stream.</returns>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed.</exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">The position is set to a value that is less than zero, or the position is larger than <see cref="F:System.Int32.MaxValue" /> or results in overflow when added to the current pointer.</exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x17000448 RID: 1096
|
||||
// (get) Token: 0x0600188C RID: 6284 RVA: 0x0005DC3C File Offset: 0x0005BE3C
|
||||
// (set) Token: 0x0600188D RID: 6285 RVA: 0x0005DC5C File Offset: 0x0005BE5C
|
||||
public override long Position
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.closed)
|
||||
{
|
||||
throw new ObjectDisposedException("The stream is closed");
|
||||
}
|
||||
return this.current_position;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (this.closed)
|
||||
{
|
||||
throw new ObjectDisposedException("The stream is closed");
|
||||
}
|
||||
if (value < 0L)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("value", "Non-negative number required.");
|
||||
}
|
||||
if (value > 2147483647L)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("value", "The position is larger than Int32.MaxValue.");
|
||||
}
|
||||
this.current_position = value;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Gets or sets a byte pointer to a stream based on the current position in the stream.</summary>
|
||||
/// <returns>A byte pointer.</returns>
|
||||
/// <exception cref="T:System.IndexOutOfRangeException">The current position is larger than the capacity of the stream.</exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">The position is being set is not a valid position in the current stream.</exception>
|
||||
/// <exception cref="T:System.IO.IOException">The pointer is being set to a lower value than the starting position of the stream.</exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
/// <PermissionSet>
|
||||
/// <IPermission class="System.Security.Permissions.SecurityPermission, mscorlib, Version=2.0.3600.0, Culture=neutral, PublicKeyToken=b77a5c561934e089" version="1" Flags="UnmanagedCode" />
|
||||
/// </PermissionSet>
|
||||
// Token: 0x17000449 RID: 1097
|
||||
// (get) Token: 0x0600188E RID: 6286 RVA: 0x0005DCBC File Offset: 0x0005BEBC
|
||||
// (set) Token: 0x0600188F RID: 6287 RVA: 0x0005DD10 File Offset: 0x0005BF10
|
||||
[CLSCompliant(false)]
|
||||
public unsafe byte* PositionPointer
|
||||
{
|
||||
get
|
||||
{
|
||||
if (this.closed)
|
||||
{
|
||||
throw new ObjectDisposedException("The stream is closed");
|
||||
}
|
||||
if (this.current_position >= this.length)
|
||||
{
|
||||
throw new IndexOutOfRangeException("value");
|
||||
}
|
||||
return (byte*)(void*)this.initial_pointer + this.current_position;
|
||||
}
|
||||
set
|
||||
{
|
||||
if (this.closed)
|
||||
{
|
||||
throw new ObjectDisposedException("The stream is closed");
|
||||
}
|
||||
if (value < (byte*)(void*)this.initial_pointer)
|
||||
{
|
||||
throw new IOException("Address is below the inital address");
|
||||
}
|
||||
this.Position = (long)(value - (void*)this.initial_pointer);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Reads the specified number of bytes into the specified array.</summary>
|
||||
/// <returns>The total number of bytes read into the buffer. This can be less than the number of bytes requested if that many bytes are not currently available, or zero (0) if the end of the stream has been reached.</returns>
|
||||
/// <param name="buffer">When this method returns, contains the specified byte array with the values between <paramref name="offset" /> and (<paramref name="offset" /> + <paramref name="count" /> - 1) replaced by the bytes read from the current source. This parameter is passed uninitialized.</param>
|
||||
/// <param name="offset">The zero-based byte offset in <paramref name="buffer" /> at which to begin storing the data read from the current stream.</param>
|
||||
/// <param name="count">The maximum number of bytes to read from the current stream.</param>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed.</exception>
|
||||
/// <exception cref="T:System.NotSupportedException">The underlying memory does not support reading.- or - The <see cref="P:System.IO.UnmanagedMemoryStream.CanRead" /> property is set to false. </exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">The <paramref name="buffer" /> parameter is set to null.</exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="offset" /> parameter is less than zero. - or - The <paramref name="count" /> parameter is less than zero.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">The length of the buffer array minus the <paramref name="offset" /> parameter is less than the <paramref name="count" /> parameter.</exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06001890 RID: 6288 RVA: 0x0005DD64 File Offset: 0x0005BF64
|
||||
public override int Read([In] [Out] byte[] buffer, int offset, int count)
|
||||
{
|
||||
if (this.closed)
|
||||
{
|
||||
throw new ObjectDisposedException("The stream is closed");
|
||||
}
|
||||
if (buffer == null)
|
||||
{
|
||||
throw new ArgumentNullException("buffer");
|
||||
}
|
||||
if (offset < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("offset", "Non-negative number required.");
|
||||
}
|
||||
if (count < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count", "Non-negative number required.");
|
||||
}
|
||||
if (buffer.Length - offset < count)
|
||||
{
|
||||
throw new ArgumentException("The length of the buffer array minus the offset parameter is less than the count parameter");
|
||||
}
|
||||
if (this.fileaccess == FileAccess.Write)
|
||||
{
|
||||
throw new NotSupportedException("Stream does not support reading");
|
||||
}
|
||||
if (this.current_position >= this.length)
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
int num = ((this.current_position + (long)count >= this.length) ? ((int)(this.length - this.current_position)) : count);
|
||||
Marshal.Copy(new IntPtr(this.initial_pointer.ToInt64() + this.current_position), buffer, offset, num);
|
||||
this.current_position += (long)num;
|
||||
return num;
|
||||
}
|
||||
|
||||
/// <summary>Reads a byte from a stream and advances the position within the stream by one byte, or returns -1 if at the end of the stream.</summary>
|
||||
/// <returns>The unsigned byte cast to an <see cref="T:System.Int32" /> object, or -1 if at the end of the stream.</returns>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed.</exception>
|
||||
/// <exception cref="T:System.NotSupportedException">The underlying memory does not support reading.- or -The current position is at the end of the stream.</exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06001891 RID: 6289 RVA: 0x0005DE60 File Offset: 0x0005C060
|
||||
public override int ReadByte()
|
||||
{
|
||||
if (this.closed)
|
||||
{
|
||||
throw new ObjectDisposedException("The stream is closed");
|
||||
}
|
||||
if (this.fileaccess == FileAccess.Write)
|
||||
{
|
||||
throw new NotSupportedException("Stream does not support reading");
|
||||
}
|
||||
if (this.current_position >= this.length)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
IntPtr intPtr = this.initial_pointer;
|
||||
long num;
|
||||
this.current_position = (num = this.current_position) + 1L;
|
||||
return (int)Marshal.ReadByte(intPtr, (int)num);
|
||||
}
|
||||
|
||||
/// <summary>Sets the current position of the current stream to the given value.</summary>
|
||||
/// <returns>The new position in the stream.</returns>
|
||||
/// <param name="offset">The point relative to <paramref name="origin" /> to begin seeking from. </param>
|
||||
/// <param name="loc">Specifies the beginning, the end, or the current position as a reference point for <paramref name="origin" />, using a value of type <see cref="T:System.IO.SeekOrigin" />. </param>
|
||||
/// <exception cref="T:System.IO.IOException">An attempt was made to seek before the beginning of the stream.</exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="offset" /> value is larger than the maximum size of the stream.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">
|
||||
/// <paramref name="loc" /> is invalid.</exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed.</exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06001892 RID: 6290 RVA: 0x0005DECC File Offset: 0x0005C0CC
|
||||
public override long Seek(long offset, SeekOrigin loc)
|
||||
{
|
||||
if (this.closed)
|
||||
{
|
||||
throw new ObjectDisposedException("The stream is closed");
|
||||
}
|
||||
long num;
|
||||
switch (loc)
|
||||
{
|
||||
case SeekOrigin.Begin:
|
||||
if (offset < 0L)
|
||||
{
|
||||
throw new IOException("An attempt was made to seek before the beginning of the stream");
|
||||
}
|
||||
num = this.initial_position;
|
||||
break;
|
||||
case SeekOrigin.Current:
|
||||
num = this.current_position;
|
||||
break;
|
||||
case SeekOrigin.End:
|
||||
num = this.length;
|
||||
break;
|
||||
default:
|
||||
throw new ArgumentException("Invalid SeekOrigin option");
|
||||
}
|
||||
num += offset;
|
||||
if (num < this.initial_position)
|
||||
{
|
||||
throw new IOException("An attempt was made to seek before the beginning of the stream");
|
||||
}
|
||||
this.current_position = num;
|
||||
return this.current_position;
|
||||
}
|
||||
|
||||
/// <summary>Sets the length of a stream to a specified value.</summary>
|
||||
/// <param name="value">The length of the stream.</param>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error has occurred. </exception>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed.</exception>
|
||||
/// <exception cref="T:System.NotSupportedException">The underlying memory does not support writing.- or -An attempt is made to write to the stream and the <see cref="P:System.IO.UnmanagedMemoryStream.CanWrite" /> property is false.</exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">The specified <paramref name="value" /> exceeds the capacity of the stream.- or -The specified <paramref name="value" /> is negative.</exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06001893 RID: 6291 RVA: 0x0005DF74 File Offset: 0x0005C174
|
||||
public override void SetLength(long value)
|
||||
{
|
||||
if (this.closed)
|
||||
{
|
||||
throw new ObjectDisposedException("The stream is closed");
|
||||
}
|
||||
if (value < 0L)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("length", "Non-negative number required.");
|
||||
}
|
||||
if (value > this.capacity)
|
||||
{
|
||||
throw new IOException("Unable to expand length of this stream beyond its capacity.");
|
||||
}
|
||||
if (this.fileaccess == FileAccess.Read)
|
||||
{
|
||||
throw new NotSupportedException("Stream does not support writing.");
|
||||
}
|
||||
this.length = value;
|
||||
if (this.length < this.current_position)
|
||||
{
|
||||
this.current_position = this.length;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Overrides the <see cref="M:System.IO.Stream.Flush" /> method so that no action is performed.</summary>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed.</exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06001894 RID: 6292 RVA: 0x0005E004 File Offset: 0x0005C204
|
||||
public override void Flush()
|
||||
{
|
||||
if (this.closed)
|
||||
{
|
||||
throw new ObjectDisposedException("The stream is closed");
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Releases the unmanaged resources used by the <see cref="T:System.IO.UnmanagedMemoryStream" /> and optionally releases the managed resources.</summary>
|
||||
/// <param name="disposing">true to release both managed and unmanaged resources; false to release only unmanaged resources.</param>
|
||||
// Token: 0x06001895 RID: 6293 RVA: 0x0005E01C File Offset: 0x0005C21C
|
||||
protected override void Dispose(bool disposing)
|
||||
{
|
||||
if (this.closed)
|
||||
{
|
||||
return;
|
||||
}
|
||||
this.closed = true;
|
||||
if (this.Closed != null)
|
||||
{
|
||||
this.Closed(this, null);
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Writes a block of bytes to the current stream using data from a buffer.</summary>
|
||||
/// <param name="buffer">The byte array from which to copy bytes to the current stream.</param>
|
||||
/// <param name="offset">The offset in the buffer at which to begin copying bytes to the current stream.</param>
|
||||
/// <param name="count">The number of bytes to write to the current stream.</param>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed.</exception>
|
||||
/// <exception cref="T:System.NotSupportedException">The underlying memory does not support writing. - or -An attempt is made to write to the stream and the <see cref="P:System.IO.UnmanagedMemoryStream.CanWrite" /> property is false.- or -The <paramref name="count" /> value is greater than the capacity of the stream.- or -The position is at the end of the stream capacity.</exception>
|
||||
/// <exception cref="T:System.IO.IOException">An I/O error occurs. </exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">One of the specified parameters is less than zero.</exception>
|
||||
/// <exception cref="T:System.ArgumentException">The <paramref name="offset" /> parameter minus the length of the <paramref name="buffer" /> parameter is less than the <paramref name="count" /> parameter.</exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">The <paramref name="buffer" /> parameter is null.</exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06001896 RID: 6294 RVA: 0x0005E04C File Offset: 0x0005C24C
|
||||
public override void Write(byte[] buffer, int offset, int count)
|
||||
{
|
||||
if (this.closed)
|
||||
{
|
||||
throw new ObjectDisposedException("The stream is closed");
|
||||
}
|
||||
if (buffer == null)
|
||||
{
|
||||
throw new ArgumentNullException("The buffer parameter is a null reference");
|
||||
}
|
||||
if (offset < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("offset", "Non-negative number required.");
|
||||
}
|
||||
if (count < 0)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("count", "Non-negative number required.");
|
||||
}
|
||||
if (buffer.Length - offset < count)
|
||||
{
|
||||
throw new ArgumentException("The length of the buffer array minus the offset parameter is less than the count parameter");
|
||||
}
|
||||
if (this.current_position > this.capacity - (long)count)
|
||||
{
|
||||
throw new NotSupportedException("Unable to expand length of this stream beyond its capacity.");
|
||||
}
|
||||
if (this.fileaccess == FileAccess.Read)
|
||||
{
|
||||
throw new NotSupportedException("Stream does not support writing.");
|
||||
}
|
||||
for (int i = 0; i < count; i++)
|
||||
{
|
||||
IntPtr intPtr = this.initial_pointer;
|
||||
long num;
|
||||
this.current_position = (num = this.current_position) + 1L;
|
||||
Marshal.WriteByte(intPtr, (int)num, buffer[offset + i]);
|
||||
}
|
||||
if (this.current_position > this.length)
|
||||
{
|
||||
this.length = this.current_position;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Writes a byte to the current position in the file stream.</summary>
|
||||
/// <param name="value">A byte value written to the stream.</param>
|
||||
/// <exception cref="T:System.ObjectDisposedException">The stream is closed.</exception>
|
||||
/// <exception cref="T:System.NotSupportedException">The underlying memory does not support writing.- or -An attempt is made to write to the stream and the <see cref="P:System.IO.UnmanagedMemoryStream.CanWrite" /> property is false.- or - The current position is at the end of the capacity of the stream.</exception>
|
||||
/// <exception cref="T:System.IO.IOException">The supplied <paramref name="value" /> causes the stream exceed its maximum capacity.</exception>
|
||||
/// <filterpriority>2</filterpriority>
|
||||
// Token: 0x06001897 RID: 6295 RVA: 0x0005E14C File Offset: 0x0005C34C
|
||||
public override void WriteByte(byte value)
|
||||
{
|
||||
if (this.closed)
|
||||
{
|
||||
throw new ObjectDisposedException("The stream is closed");
|
||||
}
|
||||
if (this.current_position == this.capacity)
|
||||
{
|
||||
throw new NotSupportedException("The current position is at the end of the capacity of the stream");
|
||||
}
|
||||
if (this.fileaccess == FileAccess.Read)
|
||||
{
|
||||
throw new NotSupportedException("Stream does not support writing.");
|
||||
}
|
||||
Marshal.WriteByte(this.initial_pointer, (int)this.current_position, value);
|
||||
this.current_position += 1L;
|
||||
if (this.current_position > this.length)
|
||||
{
|
||||
this.length = this.current_position;
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>Initializes a new instance of the <see cref="T:System.IO.UnmanagedMemoryStream" /> class.</summary>
|
||||
/// <param name="pointer">A pointer to an unmanaged memory location.</param>
|
||||
/// <param name="length">The length of the memory to use.</param>
|
||||
/// <param name="capacity">The total amount of memory assigned to the stream.</param>
|
||||
/// <param name="access">One of the <see cref="T:System.IO.FileAccess" /> values.</param>
|
||||
/// <exception cref="T:System.Security.SecurityException">The user does not have the required permission.</exception>
|
||||
/// <exception cref="T:System.ArgumentNullException">The <paramref name="pointer" /> value is null.</exception>
|
||||
/// <exception cref="T:System.ArgumentOutOfRangeException">The <paramref name="length" /> value is less than zero.- or - The <paramref name="capacity" /> value is less than zero.- or -The <paramref name="length" /> value is large enough to cause an overflow.</exception>
|
||||
// Token: 0x06001898 RID: 6296 RVA: 0x0005E1E4 File Offset: 0x0005C3E4
|
||||
protected unsafe void Initialize(byte* pointer, long length, long capacity, FileAccess access)
|
||||
{
|
||||
if (pointer == null)
|
||||
{
|
||||
throw new ArgumentNullException("pointer");
|
||||
}
|
||||
if (length < 0L)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("length", "Non-negative number required.");
|
||||
}
|
||||
if (capacity < 0L)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("capacity", "Non-negative number required.");
|
||||
}
|
||||
if (length > capacity)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("length", "The length cannot be greater than the capacity.");
|
||||
}
|
||||
if (access < FileAccess.Read || access > FileAccess.ReadWrite)
|
||||
{
|
||||
throw new ArgumentOutOfRangeException("access", "Enum value was out of legal range.");
|
||||
}
|
||||
this.fileaccess = access;
|
||||
this.length = length;
|
||||
this.capacity = capacity;
|
||||
this.initial_position = 0L;
|
||||
this.current_position = this.initial_position;
|
||||
this.initial_pointer = new IntPtr((void*)pointer);
|
||||
this.closed = false;
|
||||
}
|
||||
|
||||
// Token: 0x0400072C RID: 1836
|
||||
private long length;
|
||||
|
||||
// Token: 0x0400072D RID: 1837
|
||||
private bool closed;
|
||||
|
||||
// Token: 0x0400072E RID: 1838
|
||||
private long capacity;
|
||||
|
||||
// Token: 0x0400072F RID: 1839
|
||||
private FileAccess fileaccess;
|
||||
|
||||
// Token: 0x04000730 RID: 1840
|
||||
private IntPtr initial_pointer;
|
||||
|
||||
// Token: 0x04000731 RID: 1841
|
||||
private long initial_position;
|
||||
|
||||
// Token: 0x04000732 RID: 1842
|
||||
private long current_position;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user