Ejemplo n.º 1
0
        public UdifPartitionTable(Disk disk, UdifBuffer buffer)
        {
            this._buffer     = buffer;
            this._partitions = new Collection <PartitionInfo>();
            this._disk       = disk;

            foreach (var block in _buffer.Blocks)
            {
                UdifPartitionInfo partition = new UdifPartitionInfo(_disk, block);
                this._partitions.Add(partition);
            }
        }
Ejemplo n.º 2
0
        public UdifPartitionTable(Disk disk, UdifBuffer buffer)
        {
            _buffer     = buffer;
            _partitions = new Collection <PartitionInfo>();
            _disk       = disk;

            foreach (CompressedBlock block in _buffer.Blocks)
            {
                UdifPartitionInfo partition = new UdifPartitionInfo(_disk, block);
                _partitions.Add(partition);
            }
        }
Ejemplo n.º 3
0
        public UdifPartitionTable(Disk disk, UdifBuffer buffer)
        {
            this._buffer = buffer;
            this._partitions = new Collection<PartitionInfo>();
            this._disk = disk;

            foreach (var block in _buffer.Blocks)
            {
                UdifPartitionInfo partition = new UdifPartitionInfo(_disk, block);
                this._partitions.Add(partition);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Initializes a new instance of the DiskImageFile class.
        /// </summary>
        /// <param name="stream">The stream to read</param>
        /// <param name="ownsStream">Indicates if the new instance should control the lifetime of the stream.</param>
        public DiskImageFile(Stream stream, Ownership ownsStream)
        {
            _udifHeader = new UdifResourceFile();
            _stream = stream;
            _ownsStream = ownsStream;

            stream.Position = stream.Length - _udifHeader.Size;
            byte[] data = Utilities.ReadFully(stream, _udifHeader.Size);

            _udifHeader.ReadFrom(data, 0);

            if (_udifHeader.SignatureValid)
            {
                stream.Position = (long)_udifHeader.XmlOffset;
                byte[] xmlData = Utilities.ReadFully(stream, (int)_udifHeader.XmlLength);
                var plist = Plist.Parse(new MemoryStream(xmlData));

                _resources = ResourceFork.FromPlist(plist);
                _buffer = new UdifBuffer(stream, _resources, _udifHeader.SectorCount);
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Initializes a new instance of the DiskImageFile class.
        /// </summary>
        /// <param name="stream">The stream to read.</param>
        /// <param name="ownsStream">Indicates if the new instance should control the lifetime of the stream.</param>
        public DiskImageFile(Stream stream, Ownership ownsStream)
        {
            _udifHeader = new UdifResourceFile();
            _stream     = stream;
            _ownsStream = ownsStream;

            stream.Position = stream.Length - _udifHeader.Size;
            byte[] data = StreamUtilities.ReadExact(stream, _udifHeader.Size);

            _udifHeader.ReadFrom(data, 0);

            if (_udifHeader.SignatureValid)
            {
                stream.Position = (long)_udifHeader.XmlOffset;
                byte[] xmlData = StreamUtilities.ReadExact(stream, (int)_udifHeader.XmlLength);
                Dictionary <string, object> plist = Plist.Parse(new MemoryStream(xmlData));

                _resources = ResourceFork.FromPlist(plist);
                Buffer     = new UdifBuffer(stream, _resources, _udifHeader.SectorCount);
            }
        }