Exemple #1
0
        static DecodedVolumeDescriptor DecodeVolumeDescriptor(HighSierraPrimaryVolumeDescriptor pvd)
        {
            var decodedVd = new DecodedVolumeDescriptor
            {
                SystemIdentifier       = Encoding.ASCII.GetString(pvd.system_id).TrimEnd().Trim('\0'),
                VolumeIdentifier       = Encoding.ASCII.GetString(pvd.volume_id).TrimEnd().Trim('\0'),
                VolumeSetIdentifier    = Encoding.ASCII.GetString(pvd.volume_set_id).TrimEnd().Trim('\0'),
                PublisherIdentifier    = Encoding.ASCII.GetString(pvd.publisher_id).TrimEnd().Trim('\0'),
                DataPreparerIdentifier = Encoding.ASCII.GetString(pvd.preparer_id).TrimEnd().Trim('\0'),
                ApplicationIdentifier  = Encoding.ASCII.GetString(pvd.application_data).TrimEnd().Trim('\0')
            };

            if (pvd.creation_date[0] == '0' ||
                pvd.creation_date[0] == 0x00)
            {
                decodedVd.CreationTime = DateTime.MinValue;
            }
            else
            {
                decodedVd.CreationTime = DateHandlers.HighSierraToDateTime(pvd.creation_date);
            }

            if (pvd.modification_date[0] == '0' ||
                pvd.modification_date[0] == 0x00)
            {
                decodedVd.HasModificationTime = false;
            }
            else
            {
                decodedVd.HasModificationTime = true;
                decodedVd.ModificationTime    = DateHandlers.HighSierraToDateTime(pvd.modification_date);
            }

            if (pvd.expiration_date[0] == '0' ||
                pvd.expiration_date[0] == 0x00)
            {
                decodedVd.HasExpirationTime = false;
            }
            else
            {
                decodedVd.HasExpirationTime = true;
                decodedVd.ExpirationTime    = DateHandlers.HighSierraToDateTime(pvd.expiration_date);
            }

            if (pvd.effective_date[0] == '0' ||
                pvd.effective_date[0] == 0x00)
            {
                decodedVd.HasEffectiveTime = false;
            }
            else
            {
                decodedVd.HasEffectiveTime = true;
                decodedVd.EffectiveTime    = DateHandlers.HighSierraToDateTime(pvd.effective_date);
            }

            decodedVd.Blocks    = pvd.volume_space_size;
            decodedVd.BlockSize = pvd.logical_block_size;

            return(decodedVd);
        }
Exemple #2
0
        static DecodedVolumeDescriptor DecodeVolumeDescriptor(FileStructureVolumeDescriptor pvd)
        {
            DecodedVolumeDescriptor decodedVD = new DecodedVolumeDescriptor
            {
                SystemIdentifier       = StringHandlers.CToString(pvd.system_id).TrimEnd(),
                VolumeIdentifier       = StringHandlers.CToString(pvd.volume_id).TrimEnd(),
                VolumeSetIdentifier    = StringHandlers.CToString(pvd.volume_set_id).TrimEnd(),
                PublisherIdentifier    = StringHandlers.CToString(pvd.publisher_id).TrimEnd(),
                DataPreparerIdentifier = StringHandlers.CToString(pvd.preparer_id).TrimEnd(),
                ApplicationIdentifier  = StringHandlers.CToString(pvd.application_data).TrimEnd()
            };

            if (pvd.creation_date[0] == '0' || pvd.creation_date[0] == 0x00)
            {
                decodedVD.CreationTime = DateTime.MinValue;
            }
            else
            {
                decodedVD.CreationTime =
                    DateHandlers.HighSierraToDateTime(pvd.creation_date);
            }

            if (pvd.modification_date[0] == '0' || pvd.modification_date[0] == 0x00)
            {
                decodedVD.HasModificationTime = false;
            }
            else
            {
                decodedVD.HasModificationTime = true;
                decodedVD.ModificationTime    = DateHandlers.HighSierraToDateTime(pvd.modification_date);
            }

            if (pvd.expiration_date[0] == '0' || pvd.expiration_date[0] == 0x00)
            {
                decodedVD.HasExpirationTime = false;
            }
            else
            {
                decodedVD.HasExpirationTime = true;
                decodedVD.ExpirationTime    = DateHandlers.HighSierraToDateTime(pvd.expiration_date);
            }

            if (pvd.effective_date[0] == '0' || pvd.effective_date[0] == 0x00)
            {
                decodedVD.HasEffectiveTime = false;
            }
            else
            {
                decodedVD.HasEffectiveTime = true;
                decodedVD.EffectiveTime    = DateHandlers.HighSierraToDateTime(pvd.effective_date);
            }

            decodedVD.Blocks    = pvd.volume_space_size;
            decodedVD.BlockSize = pvd.logical_block_size;

            return(decodedVD);
        }