Пример #1
0
        /// <summary>
        /// Reads the file and directory structure from the image.
        /// </summary>
        /// <returns>Returns true if the file system is valid.</returns>
        private bool ReadFileStructure()
        {
            foreach (var volume in this.LogicalVolumes)
            {
                // Ensure the volume and parittion are valid.
                if (!this.ValidateVolumePartition(volume))
                {
                    return(false);
                }

                int volIndex = this.LogicalVolumes.IndexOf(volume);
                LongAllocationDescriptor nextExtent = volume.FileSetLocation;
                if (nextExtent.Length < VirtualSectorSize)
                {
                    return(false);
                }

                byte[] buffer = new byte[nextExtent.Length];
                this.ReadData(volIndex, nextExtent, buffer);
                VolumeTag tag = new VolumeTag();
                tag.Parse(0, buffer, buffer.Length);
                if (tag.Identifier != (int)VolumeDescriptorType.FileSet)
                {
                    return(false);
                }

                UdfFileSet fs = new UdfFileSet();
                fs.RecordingTime.Parse(16, buffer);
                fs.RootDirICB.Parse(400, buffer);
                volume.FileSet = fs;

                if (!this.ReadRecord(this.RootDirectory as UdfRecord, volIndex, fs.RootDirICB, MaxRecurseLevels))
                {
                    return(false);
                }
            }

            return(true);
        }
Пример #2
0
        /// <summary>
        /// Reads the file and directory structure from the image.
        /// </summary>
        /// <returns>Returns true if the file system is valid.</returns>
        private bool ReadFileStructure()
        {
            foreach (var volume in this.LogicalVolumes)
            {
                // Ensure the volume and parittion are valid.
                if (!this.ValidateVolumePartition(volume))
                {
                    return false;
                }

                int volIndex = this.LogicalVolumes.IndexOf(volume);
                LongAllocationDescriptor nextExtent = volume.FileSetLocation;
                if (nextExtent.Length < VirtualSectorSize)
                {
                    return false;
                }

                byte[] buffer = new byte[nextExtent.Length];
                this.ReadData(volIndex, nextExtent, buffer);
                VolumeTag tag = new VolumeTag();
                tag.Parse(0, buffer, buffer.Length);
                if (tag.Identifier != (int)VolumeDescriptorType.FileSet)
                {
                    return false;
                }

                UdfFileSet fs = new UdfFileSet();
                fs.RecordingTime.Parse(16, buffer);
                fs.RootDirICB.Parse(400, buffer);
                volume.FileSet = fs;

                if (!this.ReadRecord(this.RootDirectory as UdfRecord, volIndex, fs.RootDirICB, MaxRecurseLevels))
                {
                    return false;
                }
            }

            return true;
        }