Files
2026-06-04 11:42:34 +02:00

110 lines
3.5 KiB
C#

using System;
using System.Runtime.Remoting.Messaging;
namespace System.IO
{
// Token: 0x02000126 RID: 294
internal class MonoSyncFileStream : FileStream
{
// Token: 0x06000A51 RID: 2641 RVA: 0x0001D2F4 File Offset: 0x0001B4F4
public MonoSyncFileStream(IntPtr handle, FileAccess access, bool ownsHandle, int bufferSize)
: base(handle, access, ownsHandle, bufferSize, false)
{
}
// Token: 0x06000A52 RID: 2642 RVA: 0x0001D304 File Offset: 0x0001B504
public override IAsyncResult BeginWrite(byte[] buffer, int offset, int count, AsyncCallback cback, object state)
{
if (!this.CanWrite)
{
throw new NotSupportedException("This stream does not support writing");
}
if (buffer == null)
{
throw new ArgumentNullException("buffer");
}
if (count < 0)
{
throw new ArgumentOutOfRangeException("count", "Must be >= 0");
}
if (offset < 0)
{
throw new ArgumentOutOfRangeException("offset", "Must be >= 0");
}
MonoSyncFileStream.WriteDelegate writeDelegate = new MonoSyncFileStream.WriteDelegate(this.Write);
return writeDelegate.BeginInvoke(buffer, offset, count, cback, state);
}
// Token: 0x06000A53 RID: 2643 RVA: 0x0001D384 File Offset: 0x0001B584
public override void EndWrite(IAsyncResult asyncResult)
{
if (asyncResult == null)
{
throw new ArgumentNullException("asyncResult");
}
AsyncResult asyncResult2 = asyncResult as AsyncResult;
if (asyncResult2 == null)
{
throw new ArgumentException("Invalid IAsyncResult", "asyncResult");
}
MonoSyncFileStream.WriteDelegate writeDelegate = asyncResult2.AsyncDelegate as MonoSyncFileStream.WriteDelegate;
if (writeDelegate == null)
{
throw new ArgumentException("Invalid IAsyncResult", "asyncResult");
}
writeDelegate.EndInvoke(asyncResult);
}
// Token: 0x06000A54 RID: 2644 RVA: 0x0001D3E8 File Offset: 0x0001B5E8
public override IAsyncResult BeginRead(byte[] buffer, int offset, int count, AsyncCallback cback, object state)
{
if (!this.CanRead)
{
throw new NotSupportedException("This stream does not support reading");
}
if (buffer == null)
{
throw new ArgumentNullException("buffer");
}
if (count < 0)
{
throw new ArgumentOutOfRangeException("count", "Must be >= 0");
}
if (offset < 0)
{
throw new ArgumentOutOfRangeException("offset", "Must be >= 0");
}
MonoSyncFileStream.ReadDelegate readDelegate = new MonoSyncFileStream.ReadDelegate(this.Read);
return readDelegate.BeginInvoke(buffer, offset, count, cback, state);
}
// Token: 0x06000A55 RID: 2645 RVA: 0x0001D468 File Offset: 0x0001B668
public override int EndRead(IAsyncResult asyncResult)
{
if (asyncResult == null)
{
throw new ArgumentNullException("asyncResult");
}
AsyncResult asyncResult2 = asyncResult as AsyncResult;
if (asyncResult2 == null)
{
throw new ArgumentException("Invalid IAsyncResult", "asyncResult");
}
MonoSyncFileStream.ReadDelegate readDelegate = asyncResult2.AsyncDelegate as MonoSyncFileStream.ReadDelegate;
if (readDelegate == null)
{
throw new ArgumentException("Invalid IAsyncResult", "asyncResult");
}
return readDelegate.EndInvoke(asyncResult);
}
// Token: 0x0200030C RID: 780
// (Invoke) Token: 0x06001C09 RID: 7177
private delegate void WriteDelegate(byte[] buffer, int offset, int count);
// Token: 0x0200030D RID: 781
// (Invoke) Token: 0x06001C0D RID: 7181
private delegate int ReadDelegate(byte[] buffer, int offset, int count);
}
}