public VolumeDescriptor(byte[] b, ISO9660 iso)
     : base(b)
 {
     VolumeFlags                   = b[7];
     SystemIdentifier              = Encoding.ASCII.GetString(b, 8, 32).Trim();
     VolumeIdentifier              = getencoding.GetString(b, 40, 32).Trim();
     VolumeSpaceSize               = BitConverter.ToUInt32(b, 80);
     VolumeSetSize                 = BitConverter.ToUInt16(b, 120);
     VolumeSequenceNumber          = BitConverter.ToUInt16(b, 124);
     LogicalBlockSize              = BitConverter.ToUInt16(b, 128);
     PathTableSize                 = BitConverter.ToUInt32(b, 132);
     TypeLPathTable                = BitConverter.ToUInt32(b, 140);
     OptTypeLPathTable             = BitConverter.ToUInt32(b, 144);
     TypeMPathTable                = Swap(BitConverter.ToUInt32(b, 148));
     OptTypeMPathTable             = Swap(BitConverter.ToUInt32(b, 152));
     DirectoryRecord               = new DirectoryRecord(ToByteArray(b, 156, 34), 0, getencoding, iso);
     VolumeSetIdentifier           = getencoding.GetString(b, 190, 128).Trim();
     PublisherIdentifier           = Encoding.ASCII.GetString(b, 318, 128).Trim();
     DataPreparerIdentifier        = Encoding.ASCII.GetString(b, 446, 128).Trim();
     ApplicationIdentifier         = Encoding.ASCII.GetString(b, 574, 128).Trim();
     CopyrightFileIdentifier       = getencoding.GetString(b, 702, 36).Trim();
     AbstractFileIdentifier        = getencoding.GetString(b, 739, 36).Trim();
     BibliographicFileIdentifier   = getencoding.GetString(b, 776, 36).Trim();
     VolumeCreationDateandTime     = getDate(ToByteArray(b, 813, 16));
     VolumeModificationDateandTime = getDate(ToByteArray(b, 830, 16));
     VolumeExpirationDateandTime   = getDate(ToByteArray(b, 847, 16));
     VolumeEffectiveDateandTime    = getDate(ToByteArray(b, 864, 16));
     FileStructureVersion          = b[881];
 }
Пример #2
0
 private bool Parse()
 {
     byte[] array = new byte[16];
     internalstream.Seek(0L, SeekOrigin.Begin);
     internalstream.Read(array, 0, array.Length);
     checked
     {
         if (Operators.CompareString(Encoding.Default.GetString(array, 0, 4), "CPS3", TextCompare: false) == 0)
         {
             compresion = true;
             ulong num = BitConverter.ToUInt64(array, 4);
             Blocksize = BitConverter.ToUInt32(array, 12);
             Disksize  = num * Blocksize;
         }
         try
         {
             int  num2 = 16;
             bool flag = true;
             while (flag)
             {
                 byte[] b = readsector((ulong)num2);
                 BaseVolumeDescriptor baseVolumeDescriptor = new BaseVolumeDescriptor(b);
                 string standardIdentifier = baseVolumeDescriptor.StandardIdentifier;
                 if (Operators.CompareString(standardIdentifier, "CD001", TextCompare: false) == 0)
                 {
                     if (!VolumeDescriptors.ContainsKey(baseVolumeDescriptor.VolumeDescriptorType))
                     {
                         VolumeDescriptors.Add(baseVolumeDescriptor.VolumeDescriptorType, new VolumeDescriptor(b, this));
                     }
                 }
                 else
                 {
                     flag = false;
                 }
                 num2++;
             }
             if (VolumeDescriptors.ContainsKey(DescriptorType.Supplementary))
             {
                 VolumeDescriptor = VolumeDescriptors[DescriptorType.Supplementary];
             }
             else
             {
                 if (!VolumeDescriptors.ContainsKey(DescriptorType.Primary))
                 {
                     return(false);
                 }
                 VolumeDescriptor = VolumeDescriptors[DescriptorType.Primary];
             }
             Blocksize     = (uint)unchecked ((long)VolumeDescriptor.LogicalBlockSize);
             Disksize      = (ulong)(unchecked ((long)VolumeDescriptor.VolumeSpaceSize) *unchecked ((long)Blocksize));
             root          = VolumeDescriptor.DirectoryRecord;
             root.name     = "\\";
             root.fullname = "\\";
             dirlist.Add(root.fullname, root);
             ReadDirectoryRecord(root);
             return(true);
         }
         catch (Exception projectError)
         {
             ProjectData.SetProjectError(projectError);
             bool result = false;
             ProjectData.ClearProjectError();
             return(result);
         }
     }
 }
Пример #3
0
 public void ReadDirectoryRecord(DirectoryRecord root)
 {
     try
     {
         if ((long)root.dataLength > 0L)
         {
             long num = 0L;
             checked
             {
                 byte[] buffer = new byte[(int)(unchecked ((long)root.dataLength) - 1L) + 1];
                 root.Read(buffer, 0, (int)root.dataLength);
                 root.reset();
                 while (num > -1)
                 {
                     DirectoryRecord directoryRecord = new DirectoryRecord(buffer, (int)num, VolumeDescriptor.getencoding, this);
                     directoryRecord.parent = root;
                     if (directoryRecord.recordLength > 0)
                     {
                         if (!((Operators.CompareString(directoryRecord.name, ".", TextCompare: false) == 0) | (Operators.CompareString(directoryRecord.name, "..", TextCompare: false) == 0)))
                         {
                             directoryRecord.fullname = Path.Combine(root.fullname, directoryRecord.name);
                             if (directoryRecord.flags == FileFlags.Directory)
                             {
                                 if (!dirlist.ContainsKey(directoryRecord.fullname))
                                 {
                                     dirlist.Add(directoryRecord.fullname, directoryRecord);
                                 }
                                 if (!root.directorys.ContainsKey(directoryRecord.fullname))
                                 {
                                     root.directorys.Add(directoryRecord.fullname, directoryRecord);
                                 }
                                 ReadDirectoryRecord(directoryRecord);
                             }
                             else if (filelist.ContainsKey(directoryRecord.fullname))
                             {
                                 filelist[directoryRecord.fullname].SetLength(filelist[directoryRecord.fullname].Length + directoryRecord.Length);
                             }
                             else
                             {
                                 filelist.Add(directoryRecord.fullname, directoryRecord);
                                 if (root.files.ContainsKey(directoryRecord.fullname))
                                 {
                                     root.files.Add(directoryRecord.fullname, directoryRecord);
                                 }
                             }
                         }
                     }
                     else
                     {
                         directoryRecord.recordLength = 1;
                     }
                     num += unchecked ((long)directoryRecord.recordLength);
                     if (num >= root.dataLength)
                     {
                         num = -1L;
                     }
                 }
             }
         }
     }
     catch (Exception projectError)
     {
         ProjectData.SetProjectError(projectError);
         ProjectData.ClearProjectError();
     }
 }