2017-10-09 13:52:26 +01:00
|
|
|
|
// /***************************************************************************
|
2020-02-27 12:31:25 +00:00
|
|
|
|
// Aaru Data Preservation Suite
|
2017-10-09 13:52:26 +01:00
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// Filename : Joliet.cs
|
|
|
|
|
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
|
|
|
|
|
//
|
2017-12-19 03:50:57 +00:00
|
|
|
|
// Component : ISO9660 filesystem plugin.
|
2017-10-09 13:52:26 +01:00
|
|
|
|
//
|
|
|
|
|
|
// --[ Description ] ----------------------------------------------------------
|
|
|
|
|
|
//
|
2017-12-19 03:50:57 +00:00
|
|
|
|
// Joliet extensions structures.
|
2017-10-09 13:52:26 +01:00
|
|
|
|
//
|
|
|
|
|
|
// --[ License ] --------------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// This library is free software; you can redistribute it and/or modify
|
|
|
|
|
|
// it under the terms of the GNU Lesser General Public License as
|
|
|
|
|
|
// published by the Free Software Foundation; either version 2.1 of the
|
|
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
|
|
//
|
|
|
|
|
|
// This library is distributed in the hope that it will be useful, but
|
|
|
|
|
|
// WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
|
|
|
|
// Lesser General Public License for more details.
|
|
|
|
|
|
//
|
|
|
|
|
|
// You should have received a copy of the GNU Lesser General Public
|
|
|
|
|
|
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
//
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2022-02-18 10:02:53 +00:00
|
|
|
|
// Copyright © 2011-2022 Natalia Portillo
|
2019-07-31 20:19:22 +01:00
|
|
|
|
// In the loving memory of Facunda "Tata" Suárez Domínguez, R.I.P. 2019/07/24
|
2017-10-09 13:52:26 +01:00
|
|
|
|
// ****************************************************************************/
|
2017-12-19 19:33:46 +00:00
|
|
|
|
|
2022-03-07 07:36:44 +00:00
|
|
|
|
namespace Aaru.Filesystems;
|
|
|
|
|
|
|
2017-12-21 14:30:38 +00:00
|
|
|
|
using System;
|
2017-10-09 13:52:26 +01:00
|
|
|
|
using System.Text;
|
2020-07-20 15:43:52 +01:00
|
|
|
|
using Aaru.Helpers;
|
2017-10-09 13:52:26 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
public sealed partial class ISO9660
|
2017-10-09 13:52:26 +01:00
|
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
|
static DecodedVolumeDescriptor DecodeJolietDescriptor(PrimaryVolumeDescriptor jolietvd)
|
2017-10-09 13:52:26 +01:00
|
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
|
var decodedVd = new DecodedVolumeDescriptor
|
2017-10-09 13:52:26 +01:00
|
|
|
|
{
|
2022-03-07 07:36:44 +00:00
|
|
|
|
SystemIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.system_id).Replace('\u0000', ' ').TrimEnd(),
|
|
|
|
|
|
VolumeIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.volume_id).Replace('\u0000', ' ').TrimEnd(),
|
|
|
|
|
|
VolumeSetIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.volume_set_id).Replace('\u0000', ' ').
|
|
|
|
|
|
TrimEnd(),
|
2022-03-06 13:29:38 +00:00
|
|
|
|
PublisherIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.publisher_id).Replace('\u0000', ' ').
|
|
|
|
|
|
TrimEnd(),
|
2022-03-07 07:36:44 +00:00
|
|
|
|
DataPreparerIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.preparer_id).Replace('\u0000', ' ').
|
|
|
|
|
|
TrimEnd(),
|
|
|
|
|
|
ApplicationIdentifier = Encoding.BigEndianUnicode.GetString(jolietvd.application_id).Replace('\u0000', ' ').
|
|
|
|
|
|
TrimEnd()
|
2022-03-06 13:29:38 +00:00
|
|
|
|
};
|
2017-10-09 13:52:26 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(jolietvd.creation_date[0] < 0x31 ||
|
|
|
|
|
|
jolietvd.creation_date[0] > 0x39)
|
|
|
|
|
|
decodedVd.CreationTime = DateTime.MinValue;
|
|
|
|
|
|
else
|
|
|
|
|
|
decodedVd.CreationTime = DateHandlers.Iso9660ToDateTime(jolietvd.creation_date);
|
2017-10-09 13:52:26 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(jolietvd.modification_date[0] < 0x31 ||
|
|
|
|
|
|
jolietvd.modification_date[0] > 0x39)
|
|
|
|
|
|
decodedVd.HasModificationTime = false;
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
decodedVd.HasModificationTime = true;
|
|
|
|
|
|
decodedVd.ModificationTime = DateHandlers.Iso9660ToDateTime(jolietvd.modification_date);
|
|
|
|
|
|
}
|
2017-10-09 13:52:26 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(jolietvd.expiration_date[0] < 0x31 ||
|
|
|
|
|
|
jolietvd.expiration_date[0] > 0x39)
|
|
|
|
|
|
decodedVd.HasExpirationTime = false;
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
decodedVd.HasExpirationTime = true;
|
|
|
|
|
|
decodedVd.ExpirationTime = DateHandlers.Iso9660ToDateTime(jolietvd.expiration_date);
|
|
|
|
|
|
}
|
2017-10-09 13:52:26 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
if(jolietvd.effective_date[0] < 0x31 ||
|
|
|
|
|
|
jolietvd.effective_date[0] > 0x39)
|
|
|
|
|
|
decodedVd.HasEffectiveTime = false;
|
|
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
decodedVd.HasEffectiveTime = true;
|
|
|
|
|
|
decodedVd.EffectiveTime = DateHandlers.Iso9660ToDateTime(jolietvd.effective_date);
|
|
|
|
|
|
}
|
2017-10-09 13:52:26 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
decodedVd.Blocks = jolietvd.volume_space_size;
|
|
|
|
|
|
decodedVd.BlockSize = jolietvd.logical_block_size;
|
2017-10-09 13:52:26 +01:00
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
|
return decodedVd;
|
2017-10-09 13:52:26 +01:00
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|