コード例 #1
0
ファイル: SparseExtent.cs プロジェクト: zys0807/iSCSIConsole
        public SparseExtent(string path) : base(path)
        {
            m_file = new RawDiskImage(path, VirtualMachineDisk.BytesPerDiskSector);
            byte[] headerBytes = m_file.ReadSector(0);
            m_header = new SparseExtentHeader(headerBytes);

            if (m_header.IsValidAndSupported)
            {
                if (m_header.DescriptorOffset > 0)
                {
                    byte[]        descriptorBytes = m_file.ReadSectors((long)m_header.DescriptorOffset, (int)m_header.DescriptorSize);
                    string        text            = ASCIIEncoding.ASCII.GetString(descriptorBytes);
                    List <string> lines           = VirtualMachineDiskDescriptor.GetLines(text);
                    m_descriptor = new VirtualMachineDiskDescriptor(lines);
                }
            }
        }
コード例 #2
0
ファイル: SparseExtent.cs プロジェクト: zwj4031/iSCSIConsole
        public SparseExtent(string path) : base(path)
        {
            m_file = new RawDiskImage(path, VirtualMachineDisk.BytesPerDiskSector);
            byte[] headerBytes = m_file.ReadSector(0);
            m_header = new SparseExtentHeader(headerBytes);
            if (!m_header.IsSupported)
            {
                throw new NotSupportedException("Sparse extent header version is not supported");
            }

            if (m_header.CompressionAlgirithm != SparseExtentCompression.None)
            {
                throw new NotSupportedException("Sparse extent compression is not supported");
            }

            if (m_header.DescriptorOffset > 0)
            {
                byte[]        descriptorBytes = m_file.ReadSectors((long)m_header.DescriptorOffset, (int)m_header.DescriptorSize);
                string        text            = ASCIIEncoding.ASCII.GetString(descriptorBytes);
                List <string> lines           = VirtualMachineDiskDescriptor.GetLines(text);
                m_descriptor = new VirtualMachineDiskDescriptor(lines);
            }
        }