private PlatformCode ReadPlaformCode(VhdPropertyAttribute attribute)
 {
     return (PlatformCode)dataReader.ReadUInt32(offset + attribute.Offset);
 }
예제 #2
0
 private uint ReadCheckSum(VhdPropertyAttribute attribute)
 {
     return(dataReader.ReadUInt32(headerOffset + attribute.Offset));
 }
예제 #3
0
 private IAsyncResult BeginReadDataOffset(VhdPropertyAttribute attribute, AsyncCallback callback, object state)
 {
     return(dataReader.BeginReadUInt64(headerOffset + attribute.Offset, callback, state));
 }
예제 #4
0
 private IAsyncResult BeginReadRawData(VhdPropertyAttribute attribute, AsyncCallback callback, object state)
 {
     return(dataReader.BeginReadBytes(headerOffset + attribute.Offset, attribute.Size, callback, state));
 }
예제 #5
0
        private IEnumerable <CompletionPort> CreateParentLocators(AsyncMachine <IList <ParentLocator> > machine, VhdPropertyAttribute attribute)
        {
            var parentLocators  = new List <ParentLocator>();
            var attributeHelper = new AttributeHelper <ParentLocator>();
            var entityAttribute = attributeHelper.GetEntityAttribute();

            long baseOffset = headerOffset + attribute.Offset;

            for (int i = 0; i < attribute.Count; i++)
            {
                var parentLocatorFactory = new VhdParentLocatorFactory(dataReader, baseOffset);

                parentLocatorFactory.BeginReadCreate(machine.CompletionCallback, null);
                yield return(CompletionPort.SingleOperation);

                ParentLocator parentLocator = parentLocatorFactory.EndReadCreate(machine.CompletionResult);

                parentLocators.Add(parentLocator);
                baseOffset += entityAttribute.Size;
            }
            machine.ParameterValue = parentLocators;
        }
예제 #6
0
 private IAsyncResult BeginReadSavedState(VhdPropertyAttribute attribute, AsyncCallback callback, object state)
 {
     return(dataReader.BeginReadBoolean(this.GetFooterOffset() + attribute.Offset, callback, state));
 }
예제 #7
0
 private IAsyncResult BeginReadVhdCookie(VhdPropertyAttribute attribute, AsyncCallback callback, object state)
 {
     return(dataReader.BeginReadBytes(this.GetFooterOffset() + attribute.Offset, attribute.Size, callback, state));
 }
예제 #8
0
        private string ReadCreatorApplication(VhdPropertyAttribute attribute)
        {
            var creatorApplication = dataReader.ReadBytes(GetFooterOffset() + attribute.Offset, attribute.Size);

            return(Encoding.ASCII.GetString(creatorApplication));
        }
예제 #9
0
 private VhdFeature ReadFeatures(VhdPropertyAttribute attribute)
 {
     return((VhdFeature)dataReader.ReadUInt32(GetFooterOffset() + attribute.Offset));
 }
예제 #10
0
 private IAsyncResult BeginReadCreatorHostOsType(VhdPropertyAttribute attribute, AsyncCallback callback, object state)
 {
     return(dataReader.BeginReadUInt32(this.GetFooterOffset() + attribute.Offset, callback, state));
 }
예제 #11
0
        private VhdCreatorVersion ReadCreatorVersion(VhdPropertyAttribute attribute)
        {
            var version = dataReader.ReadUInt32(GetFooterOffset() + attribute.Offset);

            return(new VhdCreatorVersion(version));
        }
예제 #12
0
        private HostOsType ReadCreatorHostOsType(VhdPropertyAttribute attribute)
        {
            var hostOs = dataReader.ReadUInt32(GetFooterOffset() + attribute.Offset);

            return((HostOsType)hostOs);
        }
예제 #13
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;
        }
예제 #14
0
 private IAsyncResult BeginReadDiskGeometry(VhdPropertyAttribute attribute, AsyncCallback callback, object state)
 {
     return(AsyncMachine <DiskGeometry> .BeginAsyncMachine(ReadDiskGeometryAsync, attribute, callback, state));
 }
 private int ReadReserved(VhdPropertyAttribute attribute)
 {
     return (int)dataReader.ReadUInt32(offset + attribute.Offset);
 }
예제 #16
0
 private Guid ReadUniqueId(VhdPropertyAttribute attribute)
 {
     return(dataReader.ReadGuid(GetFooterOffset() + attribute.Offset));
 }
 private long ReadPlatformDataOffset(VhdPropertyAttribute attribute)
 {
     return (long)dataReader.ReadUInt64(offset + attribute.Offset);
 }
예제 #18
0
 private IAsyncResult BeginReadUniqueId(VhdPropertyAttribute attribute, AsyncCallback callback, object state)
 {
     return(dataReader.BeginReadGuid(this.GetFooterOffset() + attribute.Offset, callback, state));
 }
예제 #19
0
 private VhdCookie ReadVhdCookie(VhdPropertyAttribute attribute)
 {
     byte[] value = dataReader.ReadBytes(this.GetFooterOffset() + attribute.Offset, attribute.Size);
     return(CreateVhdCookie(value));
 }
예제 #20
0
 private DateTime ReadTimeStamp(VhdPropertyAttribute attribute)
 {
     return(dataReader.ReadDateTime(GetFooterOffset() + attribute.Offset));
 }
예제 #21
0
 private byte[] ReadRawData(VhdPropertyAttribute attribute)
 {
     return(dataReader.ReadBytes(headerOffset + attribute.Offset, attribute.Size));
 }
예제 #22
0
 private IAsyncResult BeginReadTimeStamp(VhdPropertyAttribute attribute, AsyncCallback callback, object state)
 {
     return(dataReader.BeginReadDateTime(this.GetFooterOffset() + attribute.Offset, callback, state));
 }
예제 #23
0
 private IAsyncResult BeginReadParentLocators(VhdPropertyAttribute attribute, AsyncCallback callback, object state)
 {
     return(AsyncMachine <IList <ParentLocator> > .BeginAsyncMachine(CreateParentLocators, attribute, callback, state));
 }
예제 #24
0
 private long ReadHeaderOffset(VhdPropertyAttribute attribute)
 {
     return((long)dataReader.ReadUInt64(GetFooterOffset() + attribute.Offset));
 }
예제 #25
0
 private uint ReadReserved1(VhdPropertyAttribute attribute)
 {
     return(dataReader.ReadUInt32(headerOffset + attribute.Offset));
 }
예제 #26
0
        private DiskType ReadDiskType(VhdPropertyAttribute attribute)
        {
            var readDiskType = dataReader.ReadUInt32(GetFooterOffset() + attribute.Offset);

            return(diskTypeFactory.Create(readDiskType));
        }
예제 #27
0
 private long ReadDataOffset(VhdPropertyAttribute attribute)
 {
     return((long)dataReader.ReadUInt64(headerOffset + attribute.Offset));
 }
예제 #28
0
 private long ReadVirtualSize(VhdPropertyAttribute attribute)
 {
     return((long)dataReader.ReadUInt64(this.GetFooterOffset() + attribute.Offset));
 }
예제 #29
0
        private string ReadParentPath(VhdPropertyAttribute attribute)
        {
            var parentNameBytes = dataReader.ReadBytes(headerOffset + attribute.Offset, attribute.Size);

            return(Encoding.BigEndianUnicode.GetString(parentNameBytes).TrimEnd('\0'));
        }
예제 #30
0
 private IAsyncResult BeginReadVirtualSize(VhdPropertyAttribute attribute, AsyncCallback callback, object state)
 {
     return(dataReader.BeginReadUInt64(this.GetFooterOffset() + attribute.Offset, callback, state));
 }
 private int ReadPlatformDataLength(VhdPropertyAttribute attribute)
 {
     return (int)dataReader.ReadUInt32(offset + attribute.Offset);
 }
예제 #32
0
        private VhdFileFormatVersion ReadVhdFileFormatVersion(VhdPropertyAttribute attribute)
        {
            var version = dataReader.ReadUInt32(this.GetFooterOffset() + attribute.Offset);

            return(CreateVhdFileFormatVersion(version));
        }
 private IAsyncResult BeginReadReserved(VhdPropertyAttribute attribute, AsyncCallback callback, object state)
 {
     return dataReader.BeginReadUInt32(offset + attribute.Offset, callback, state);
 }
예제 #34
0
 private IAsyncResult BeginReadVhdFileFormatVersion(VhdPropertyAttribute attribute, AsyncCallback callback, object state)
 {
     return(dataReader.BeginReadUInt32(this.GetFooterOffset() + attribute.Offset, callback, state));
 }
 private IAsyncResult BeginReadPlatformDataOffset(VhdPropertyAttribute attribute, AsyncCallback callback, object state)
 {
     return dataReader.BeginReadUInt64(offset + attribute.Offset, callback, state);
 }
예제 #36
0
 private bool ReadSavedState(VhdPropertyAttribute attribute)
 {
     return(dataReader.ReadBoolean(GetFooterOffset() + attribute.Offset));
 }