// Token: 0x06001226 RID: 4646 RVA: 0x0006E79C File Offset: 0x0006C99C
        private void InternalStageCallback(ProxyStreamCopy.CopyStage nextStage, IAsyncResult result)
        {
            bool flag = false;

            if (result.CompletedSynchronously)
            {
                return;
            }
            try
            {
                if (this.ProcessNextSyncBatch(nextStage, result))
                {
                    flag = true;
                }
            }
            catch (Exception exception)
            {
                this.result.CompleteRequest(false, exception);
                return;
            }
            if (flag)
            {
                this.result.CompleteRequest(false);
            }
        }
        // Token: 0x06001225 RID: 4645 RVA: 0x0006E624 File Offset: 0x0006C824
        private bool ProcessNextSyncBatch(ProxyStreamCopy.CopyStage stage, IAsyncResult result)
        {
            ProxyStreamCopy.CopyStage copyStage = stage;
            IAsyncResult asyncResult            = result;
            Stream       stream  = this.source as Stream;
            Stream       stream2 = this.destination;

            for (;;)
            {
                if (copyStage == ProxyStreamCopy.CopyStage.EndWrite)
                {
                    stream2.EndWrite(asyncResult);
                }
                if (copyStage == ProxyStreamCopy.CopyStage.BeginRead || copyStage == ProxyStreamCopy.CopyStage.EndWrite)
                {
                    if (this.sourceType == ProxyStreamCopy.SourceType.String)
                    {
                        this.bytesRead = this.ReadNextStringChunk();
                    }
                    else if ((this.copyMode & (StreamCopyMode)1) != (StreamCopyMode)0)
                    {
                        this.bytesRead = stream.Read(this.Buffer, 0, this.Buffer.Length);
                        copyStage      = ProxyStreamCopy.CopyStage.BeginWrite;
                        asyncResult    = null;
                    }
                    else
                    {
                        IAsyncResult asyncResult2 = stream.BeginRead(this.Buffer, 0, this.Buffer.Length, new AsyncCallback(ProxyStreamCopy.ReadCallback), this);
                        if (!asyncResult2.CompletedSynchronously)
                        {
                            break;
                        }
                        copyStage   = ProxyStreamCopy.CopyStage.EndRead;
                        asyncResult = asyncResult2;
                    }
                }
                if (copyStage == ProxyStreamCopy.CopyStage.EndRead)
                {
                    this.bytesRead = stream.EndRead(asyncResult);
                }
                if (this.bytesRead <= 0)
                {
                    return(true);
                }
                this.totalBytesCopied += this.bytesRead;
                bool flag;
                if ((this.copyMode & (StreamCopyMode)2) != (StreamCopyMode)0)
                {
                    stream2.Write(this.Buffer, 0, this.bytesRead);
                    copyStage   = ProxyStreamCopy.CopyStage.BeginRead;
                    asyncResult = null;
                    flag        = true;
                }
                else
                {
                    IAsyncResult asyncResult3 = stream2.BeginWrite(this.Buffer, 0, this.bytesRead, new AsyncCallback(ProxyStreamCopy.WriteCallback), this);
                    if (!asyncResult3.CompletedSynchronously)
                    {
                        goto IL_158;
                    }
                    copyStage   = ProxyStreamCopy.CopyStage.EndWrite;
                    asyncResult = asyncResult3;
                    flag        = true;
                }
                if (!flag)
                {
                    return(true);
                }
            }
            this.completedSynchronously = false;
            return(false);

IL_158:
            this.completedSynchronously = false;
            return(false);
        }