BeginReadInt16() public method

public BeginReadInt16 ( long offset, AsyncCallback callback, object state ) : IAsyncResult
offset long
callback AsyncCallback
state object
return IAsyncResult
コード例 #1
0
        private IEnumerable <CompletionPort> ReadDiskGeometryAsync(AsyncMachine <DiskGeometry> machine, VhdPropertyAttribute attribute)
        {
            long offset = GetFooterOffset() + attribute.Offset;

            var attributeHelper = new AttributeHelper <DiskGeometry>();
            var diskGeometry    = new DiskGeometry();

            dataReader.BeginReadInt16(offset + attributeHelper.GetAttribute(() => diskGeometry.Cylinder).Offset, machine.CompletionCallback, null);
            yield return(CompletionPort.SingleOperation);

            diskGeometry.Cylinder = dataReader.EndReadInt16(machine.CompletionResult);

            dataReader.BeginReadByte(offset + attributeHelper.GetAttribute(() => diskGeometry.Heads).Offset, machine.CompletionCallback, null);
            yield return(CompletionPort.SingleOperation);

            diskGeometry.Heads = dataReader.EndReadByte(machine.CompletionResult);

            dataReader.BeginReadByte(offset + attributeHelper.GetAttribute(() => diskGeometry.Sectors).Offset, machine.CompletionCallback, null);
            yield return(CompletionPort.SingleOperation);

            diskGeometry.Sectors = dataReader.EndReadByte(machine.CompletionResult);

            machine.ParameterValue = diskGeometry;
        }