Exemple #1
0
        public bool Parse(FileStream fs, PVD pvd)
        {
            var len = fs.ReadByte();

            if (len == 0)
            {
                return(false);
            }
            var extlen = fs.ReadByte();

            fs.Seek(-1, SeekOrigin.Current);
            byte[] ll = new byte[len];
            ll[0] = (byte)len;
            fs.Read(ll, 1, len - 1);

            LBA        = BitConverter.ToUInt32(ll, 2);
            DataLength = BitConverter.ToUInt32(ll, 10);
            DateTime   = IsoLib.DiscUtils.IsoUtilities.ToUTCDateTimeFromDirectoryTime(ll, 18);
            //DateTime = new DateTime(1900 + ll[18], ll[19], ll[20], ll[21], ll[22], ll[23]);


            LengthName = ll[32];
            Flags      = ll[25];
            var nm = ll.Skip(33).Take(LengthName).ToArray();

            if (pvd.Type == 2)
            {
                Name = Encoding.BigEndianUnicode.GetString(nm);
            }
            else
            {
                Name = Encoding.UTF8.GetString(nm);
            }
            return(true);
        }
Exemple #2
0
        public void ReadRecords(FileStream fs, PVD pvd)
        {
            var address = LBA * pvd.LogicBlockSize;

            fs.Seek(address, SeekOrigin.Begin);


            int last = (int)DataLength;

            while (last > 0)
            {
                var rec = new DirectoryRecord();

                rec.Parent = this;
                var p0 = fs.Position;
                if (!rec.Parse(fs, pvd))
                {
                    var l = pvd.LogicBlockSize - p0 % pvd.LogicBlockSize;
                    if (l < 100)
                    {
                        continue;
                    }

                    break;
                }
                Records.Add(rec);
                var p1  = fs.Position;
                var len = p1 - p0;
                last -= (int)len;
            }
        }
Exemple #3
0
        public void ReadFile(FileStream fs, PVD pvd)
        {
            var address = LBA * pvd.LogicBlockSize;

            fs.Seek(address, SeekOrigin.Begin);
            Data = new byte[DataLength];
            fs.Read(Data, 0, (int)DataLength);
        }
Exemple #4
0
        public byte[] GetFileData(FileStream fs, PVD pvd)
        {
            var address = LBA * pvd.LogicBlockSize;

            fs.Seek(address, SeekOrigin.Begin);
            var bb = new byte[DataLength];

            fs.Read(bb, 0, (int)DataLength);
            return(bb);
        }
Exemple #5
0
        public void Parse(FileStream fs)
        {
            fs.Seek(0x8000, SeekOrigin.Begin);
            List <PVD> list = new List <PVD>();
            PVD        p;

            while (true)
            {
                p = new PVD();

                p.Parse(fs);
                if (p.Type == 0xff)
                {
                    break;
                }
                list.Add(p);
            }
            DirectoryRecord.ReadRecursive(fs, list.Last().RootDir, list.Last());
            Pvds = list.ToArray();
        }
Exemple #6
0
        public static void ReadRecursive(FileStream fs, DirectoryRecord rec, PVD pvdd)
        {
            rec.ReadRecords(fs, pvdd);

            foreach (var directoryRecord in rec.Records)
            {
                if (directoryRecord.LBA == rec.LBA)
                {
                    continue;
                }
                if (rec.Parent != null && directoryRecord.LBA == rec.Parent.LBA)
                {
                    continue;
                }
                if (directoryRecord.IsDirectory)
                {
                    ReadRecursive(fs, directoryRecord, pvdd);
                }
                else
                {
                    //directoryRecord.ReadFile(fs, pvdd);
                }
            }
        }