diff --git a/Aaru.CommonTypes b/Aaru.CommonTypes index d2c24f9fb..4cdf541a0 160000 --- a/Aaru.CommonTypes +++ b/Aaru.CommonTypes @@ -1 +1 @@ -Subproject commit d2c24f9fb16d13657cf949ee97a35ffedaf2f1f9 +Subproject commit 4cdf541a0981a07044ce73e2f5656560d63dbe98 diff --git a/Aaru.Core/Checksum.cs b/Aaru.Core/Checksum.cs index bd8ab477a..643cc1e67 100644 --- a/Aaru.Core/Checksum.cs +++ b/Aaru.Core/Checksum.cs @@ -34,8 +34,8 @@ using System; using System.Collections.Generic; using System.Threading; using Aaru.Checksums; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Core; @@ -380,148 +380,101 @@ public sealed class Checksum /// Finishes the checksums /// Returns the checksum results - public List End() + public List End() { - List chks = new(); + List chks = new(); - ChecksumType chk; - - if(_enabled.HasFlag(EnableChecksum.All)) - { - chk = new ChecksumType + if(_enabled.HasFlag(EnableChecksum.Adler32)) + chks.Add(new CommonTypes.AaruMetadata.Checksum { - type = ChecksumTypeType.adler32, + Type = ChecksumType.Adler32, Value = _adler32Ctx.End() - }; - - chks.Add(chk); - } + }); if(_enabled.HasFlag(EnableChecksum.Crc16)) - { - chk = new ChecksumType + chks.Add(new CommonTypes.AaruMetadata.Checksum { - type = ChecksumTypeType.crc16, + Type = ChecksumType.CRC16, Value = _crc16Ctx.End() - }; - - chks.Add(chk); - } + }); if(_enabled.HasFlag(EnableChecksum.Crc32)) - { - chk = new ChecksumType + chks.Add(new CommonTypes.AaruMetadata.Checksum { - type = ChecksumTypeType.crc32, + Type = ChecksumType.CRC32, Value = _crc32Ctx.End() - }; - - chks.Add(chk); - } + }); if(_enabled.HasFlag(EnableChecksum.Crc64)) - { - chk = new ChecksumType + chks.Add(new CommonTypes.AaruMetadata.Checksum { - type = ChecksumTypeType.crc64, + Type = ChecksumType.CRC64, Value = _crc64Ctx.End() - }; - - chks.Add(chk); - } + }); if(_enabled.HasFlag(EnableChecksum.Md5)) - { - chk = new ChecksumType + chks.Add(new CommonTypes.AaruMetadata.Checksum { - type = ChecksumTypeType.md5, + Type = ChecksumType.Md5, Value = _md5Ctx.End() - }; - - chks.Add(chk); - } + }); if(_enabled.HasFlag(EnableChecksum.Sha1)) - { - chk = new ChecksumType + chks.Add(new CommonTypes.AaruMetadata.Checksum { - type = ChecksumTypeType.sha1, + Type = ChecksumType.Sha1, Value = _sha1Ctx.End() - }; - - chks.Add(chk); - } + }); if(_enabled.HasFlag(EnableChecksum.Sha256)) - { - chk = new ChecksumType + chks.Add(new CommonTypes.AaruMetadata.Checksum { - type = ChecksumTypeType.sha256, + Type = ChecksumType.Sha256, Value = _sha256Ctx.End() - }; - - chks.Add(chk); - } + }); if(_enabled.HasFlag(EnableChecksum.Sha384)) - { - chk = new ChecksumType + chks.Add(new CommonTypes.AaruMetadata.Checksum { - type = ChecksumTypeType.sha384, + Type = ChecksumType.Sha384, Value = _sha384Ctx.End() - }; - - chks.Add(chk); - } + }); if(_enabled.HasFlag(EnableChecksum.Sha512)) - { - chk = new ChecksumType + chks.Add(new CommonTypes.AaruMetadata.Checksum { - type = ChecksumTypeType.sha512, + Type = ChecksumType.Sha512, Value = _sha512Ctx.End() - }; - - chks.Add(chk); - } + }); if(_enabled.HasFlag(EnableChecksum.SpamSum)) - { - chk = new ChecksumType + chks.Add(new CommonTypes.AaruMetadata.Checksum { - type = ChecksumTypeType.spamsum, + Type = ChecksumType.SpamSum, Value = _ssCtx.End() - }; - - chks.Add(chk); - } + }); if(_enabled.HasFlag(EnableChecksum.Fletcher16)) - { - chk = new ChecksumType + chks.Add(new CommonTypes.AaruMetadata.Checksum { - type = ChecksumTypeType.fletcher16, + Type = ChecksumType.Fletcher16, Value = _f16Ctx.End() - }; - - chks.Add(chk); - } + }); if(!_enabled.HasFlag(EnableChecksum.Fletcher32)) return chks; - chk = new ChecksumType + chks.Add(new CommonTypes.AaruMetadata.Checksum { - type = ChecksumTypeType.fletcher32, + Type = ChecksumType.Fletcher32, Value = _f32Ctx.End() - }; - - chks.Add(chk); + }); return chks; } - internal static List GetChecksums(byte[] data, EnableChecksum enabled = EnableChecksum.All) + internal static List GetChecksums( + byte[] data, EnableChecksum enabled = EnableChecksum.All) { IChecksum adler32CtxData = null; IChecksum crc16CtxData = null; @@ -718,140 +671,93 @@ public sealed class Checksum f16ThreadData.IsAlive || f32ThreadData.IsAlive) {} - List dataChecksums = new(); - ChecksumType chk; + List dataChecksums = new(); if(enabled.HasFlag(EnableChecksum.Adler32)) - { - chk = new ChecksumType + dataChecksums.Add(new CommonTypes.AaruMetadata.Checksum { - type = ChecksumTypeType.adler32, + Type = ChecksumType.Adler32, Value = adler32CtxData.End() - }; - - dataChecksums.Add(chk); - } + }); if(enabled.HasFlag(EnableChecksum.Crc16)) - { - chk = new ChecksumType + dataChecksums.Add(new CommonTypes.AaruMetadata.Checksum { - type = ChecksumTypeType.crc16, + Type = ChecksumType.CRC16, Value = crc16CtxData.End() - }; - - dataChecksums.Add(chk); - } + }); if(enabled.HasFlag(EnableChecksum.Crc32)) - { - chk = new ChecksumType + dataChecksums.Add(new CommonTypes.AaruMetadata.Checksum { - type = ChecksumTypeType.crc32, + Type = ChecksumType.CRC32, Value = crc32CtxData.End() - }; - - dataChecksums.Add(chk); - } + }); if(enabled.HasFlag(EnableChecksum.Crc64)) - { - chk = new ChecksumType + dataChecksums.Add(new CommonTypes.AaruMetadata.Checksum { - type = ChecksumTypeType.crc64, + Type = ChecksumType.CRC64, Value = crc64CtxData.End() - }; - - dataChecksums.Add(chk); - } + }); if(enabled.HasFlag(EnableChecksum.Md5)) - { - chk = new ChecksumType + dataChecksums.Add(new CommonTypes.AaruMetadata.Checksum { - type = ChecksumTypeType.md5, + Type = ChecksumType.Md5, Value = md5CtxData.End() - }; - - dataChecksums.Add(chk); - } + }); if(enabled.HasFlag(EnableChecksum.Sha1)) - { - chk = new ChecksumType + dataChecksums.Add(new CommonTypes.AaruMetadata.Checksum { - type = ChecksumTypeType.sha1, + Type = ChecksumType.Sha1, Value = sha1CtxData.End() - }; - - dataChecksums.Add(chk); - } + }); if(enabled.HasFlag(EnableChecksum.Sha256)) - { - chk = new ChecksumType + dataChecksums.Add(new CommonTypes.AaruMetadata.Checksum { - type = ChecksumTypeType.sha256, + Type = ChecksumType.Sha256, Value = sha256CtxData.End() - }; - - dataChecksums.Add(chk); - } + }); if(enabled.HasFlag(EnableChecksum.Sha384)) - { - chk = new ChecksumType + dataChecksums.Add(new CommonTypes.AaruMetadata.Checksum { - type = ChecksumTypeType.sha384, + Type = ChecksumType.Sha384, Value = sha384CtxData.End() - }; - - dataChecksums.Add(chk); - } + }); if(enabled.HasFlag(EnableChecksum.Sha512)) - { - chk = new ChecksumType + dataChecksums.Add(new CommonTypes.AaruMetadata.Checksum { - type = ChecksumTypeType.sha512, + Type = ChecksumType.Sha512, Value = sha512CtxData.End() - }; - - dataChecksums.Add(chk); - } + }); if(enabled.HasFlag(EnableChecksum.SpamSum)) - { - chk = new ChecksumType + dataChecksums.Add(new CommonTypes.AaruMetadata.Checksum { - type = ChecksumTypeType.spamsum, + Type = ChecksumType.SpamSum, Value = ssctxData.End() - }; - - dataChecksums.Add(chk); - } + }); if(enabled.HasFlag(EnableChecksum.Fletcher16)) - { - chk = new ChecksumType + dataChecksums.Add(new CommonTypes.AaruMetadata.Checksum { - type = ChecksumTypeType.fletcher16, + Type = ChecksumType.Fletcher16, Value = f16CtxData.End() - }; - - dataChecksums.Add(chk); - } + }); if(!enabled.HasFlag(EnableChecksum.Fletcher32)) return dataChecksums; - chk = new ChecksumType + dataChecksums.Add(new CommonTypes.AaruMetadata.Checksum { - type = ChecksumTypeType.fletcher32, + Type = ChecksumType.Fletcher32, Value = f32CtxData.End() - }; - - dataChecksums.Add(chk); + }); return dataChecksums; } diff --git a/Aaru.Core/Devices/Dumping/ATA.cs b/Aaru.Core/Devices/Dumping/ATA.cs index cf1dc7f75..fd2312199 100644 --- a/Aaru.Core/Devices/Dumping/ATA.cs +++ b/Aaru.Core/Devices/Dumping/ATA.cs @@ -34,8 +34,10 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; -using System.Xml.Serialization; +using System.Text.Json; +using System.Text.Json.Serialization; using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Extents; using Aaru.CommonTypes.Interfaces; @@ -44,7 +46,6 @@ using Aaru.Core.Graphics; using Aaru.Core.Logging; using Aaru.Decoders.ATA; using Aaru.Decoders.PCMCIA; -using Schemas; using Identify = Aaru.CommonTypes.Structs.Devices.ATA.Identify; using Tuple = Aaru.Decoders.PCMCIA.Tuple; using Version = Aaru.CommonTypes.Interop.Version; @@ -175,8 +176,8 @@ public partial class Dump bool removable = !_dev.IsCompactFlash && ataId.GeneralConfiguration.HasFlag(Identify.GeneralConfigurationBit.Removable); - DumpHardwareType currentTry = null; - ExtentsULong extents = null; + DumpHardware currentTry = null; + ExtentsULong extents = null; ResumeSupport.Process(ataReader.IsLba, removable, blocks, _dev.Manufacturer, _dev.Model, _dev.Serial, _dev.PlatformId, ref _resume, ref currentTry, ref extents, _dev.FirmwareRevision, @@ -595,7 +596,7 @@ public partial class Dump if(!error || recoveredError) { - mhddLog.Write(currentBlock, duration, 1); + mhddLog.Write(currentBlock, duration); ibgLog.Write(currentBlock, currentSpeed * 1024); DateTime writeStart = DateTime.Now; @@ -612,7 +613,7 @@ public partial class Dump else { _resume.BadBlocks.Add(currentBlock); - mhddLog.Write(currentBlock, duration < 500 ? 65535 : duration, 1); + mhddLog.Write(currentBlock, duration < 500 ? 65535 : duration); ibgLog.Write(currentBlock, 0); DateTime writeStart = DateTime.Now; @@ -679,12 +680,12 @@ public partial class Dump ApplicationVersion = Version.GetVersion() }; - if(!outputFormat.SetMetadata(metadata)) + if(!outputFormat.SetImageInfo(metadata)) ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + Environment.NewLine + outputFormat.ErrorMessage); if(_preSidecar != null) - outputFormat.SetCicmMetadata(_preSidecar); + outputFormat.SetMetadata(_preSidecar); _dumpLog.WriteLine(Localization.Core.Closing_output_file); UpdateStatus?.Invoke(Localization.Core.Closing_output_file); @@ -745,14 +746,14 @@ public partial class Dump _sidecarClass.UpdateProgressEvent2 += UpdateProgress2; _sidecarClass.EndProgressEvent2 += EndProgress2; _sidecarClass.UpdateStatusEvent += UpdateStatus; - CICMMetadataType sidecar = _sidecarClass.Create(); + Metadata sidecar = _sidecarClass.Create(); if(!_aborted) { if(_preSidecar != null) { - _preSidecar.BlockMedia = sidecar.BlockMedia; - sidecar = _preSidecar; + _preSidecar.BlockMedias = sidecar.BlockMedias; + sidecar = _preSidecar; } if(_dev.IsUsb && @@ -761,15 +762,15 @@ public partial class Dump _dumpLog.WriteLine(Localization.Core.Reading_USB_descriptors); UpdateStatus?.Invoke(Localization.Core.Reading_USB_descriptors); - sidecar.BlockMedia[0].USB = new USBType + sidecar.BlockMedias[0].Usb = new Usb { ProductID = _dev.UsbProductId, VendorID = _dev.UsbVendorId, - Descriptors = new DumpType + Descriptors = new CommonTypes.AaruMetadata.Dump { Image = _outputPath, Size = (ulong)_dev.UsbDescriptors.Length, - Checksums = Checksum.GetChecksums(_dev.UsbDescriptors).ToArray() + Checksums = Checksum.GetChecksums(_dev.UsbDescriptors) } }; } @@ -780,13 +781,13 @@ public partial class Dump _dumpLog.WriteLine(Localization.Core.Reading_PCMCIA_CIS); UpdateStatus?.Invoke(Localization.Core.Reading_PCMCIA_CIS); - sidecar.BlockMedia[0].PCMCIA = new PCMCIAType + sidecar.BlockMedias[0].Pcmcia = new Pcmcia { - CIS = new DumpType + Cis = new CommonTypes.AaruMetadata.Dump { Image = _outputPath, Size = (ulong)_dev.Cis.Length, - Checksums = Checksum.GetChecksums(_dev.Cis).ToArray() + Checksums = Checksum.GetChecksums(_dev.Cis) } }; @@ -804,12 +805,10 @@ public partial class Dump if(manufacturerId != null) { - sidecar.BlockMedia[0].PCMCIA.ManufacturerCode = + sidecar.BlockMedias[0].Pcmcia.ManufacturerCode = manufacturerId.ManufacturerID; - sidecar.BlockMedia[0].PCMCIA.CardCode = manufacturerId.CardID; - sidecar.BlockMedia[0].PCMCIA.ManufacturerCodeSpecified = true; - sidecar.BlockMedia[0].PCMCIA.CardCodeSpecified = true; + sidecar.BlockMedias[0].Pcmcia.CardCode = manufacturerId.CardID; } break; @@ -818,14 +817,14 @@ public partial class Dump if(version != null) { - sidecar.BlockMedia[0].PCMCIA.Manufacturer = version.Manufacturer; - sidecar.BlockMedia[0].PCMCIA.ProductName = version.Product; + sidecar.BlockMedias[0].Pcmcia.Manufacturer = version.Manufacturer; + sidecar.BlockMedias[0].Pcmcia.ProductName = version.Product; - sidecar.BlockMedia[0].PCMCIA.Compliance = + sidecar.BlockMedias[0].Pcmcia.Compliance = $"{version.MajorVersion}.{version.MinorVersion}"; - sidecar.BlockMedia[0].PCMCIA.AdditionalInformation = - version.AdditionalInformation; + sidecar.BlockMedias[0].Pcmcia.AdditionalInformation = + new List(version.AdditionalInformation); } break; @@ -835,13 +834,13 @@ public partial class Dump if(_private) DeviceReport.ClearIdentify(ataIdentify); - sidecar.BlockMedia[0].ATA = new ATAType + sidecar.BlockMedias[0].ATA = new ATA { - Identify = new DumpType + Identify = new CommonTypes.AaruMetadata.Dump { Image = _outputPath, Size = (ulong)cmdBuf.Length, - Checksums = Checksum.GetChecksums(cmdBuf).ToArray() + Checksums = Checksum.GetChecksums(cmdBuf) } }; @@ -864,8 +863,8 @@ public partial class Dump List<(ulong start, string type)> filesystems = new(); - if(sidecar.BlockMedia[0].FileSystemInformation != null) - filesystems.AddRange(from partition in sidecar.BlockMedia[0].FileSystemInformation + if(sidecar.BlockMedias[0].FileSystemInformation != null) + filesystems.AddRange(from partition in sidecar.BlockMedias[0].FileSystemInformation where partition.FileSystems != null from fileSystem in partition.FileSystems select (partition.StartSector, fileSystem.Type)); @@ -886,39 +885,40 @@ public partial class Dump (string type, string subType) = CommonTypes.Metadata.MediaType.MediaTypeToString(mediaType); - sidecar.BlockMedia[0].DiskType = type; - sidecar.BlockMedia[0].DiskSubType = subType; - sidecar.BlockMedia[0].Interface = "ATA"; - sidecar.BlockMedia[0].LogicalBlocks = blocks; - sidecar.BlockMedia[0].PhysicalBlockSize = physicalSectorSize; - sidecar.BlockMedia[0].LogicalBlockSize = blockSize; - sidecar.BlockMedia[0].Manufacturer = _dev.Manufacturer; - sidecar.BlockMedia[0].Model = _dev.Model; + sidecar.BlockMedias[0].MediaType = type; + sidecar.BlockMedias[0].MediaSubType = subType; + sidecar.BlockMedias[0].Interface = "ATA"; + sidecar.BlockMedias[0].LogicalBlocks = blocks; + sidecar.BlockMedias[0].PhysicalBlockSize = physicalSectorSize; + sidecar.BlockMedias[0].LogicalBlockSize = blockSize; + sidecar.BlockMedias[0].Manufacturer = _dev.Manufacturer; + sidecar.BlockMedias[0].Model = _dev.Model; if(!_private) - sidecar.BlockMedia[0].Serial = _dev.Serial; + sidecar.BlockMedias[0].Serial = _dev.Serial; - sidecar.BlockMedia[0].Size = blocks * blockSize; + sidecar.BlockMedias[0].Size = blocks * blockSize; if(cylinders > 0 && heads > 0 && sectors > 0) { - sidecar.BlockMedia[0].Cylinders = cylinders; - sidecar.BlockMedia[0].CylindersSpecified = true; - sidecar.BlockMedia[0].Heads = heads; - sidecar.BlockMedia[0].HeadsSpecified = true; - sidecar.BlockMedia[0].SectorsPerTrack = sectors; - sidecar.BlockMedia[0].SectorsPerTrackSpecified = true; + sidecar.BlockMedias[0].Cylinders = cylinders; + sidecar.BlockMedias[0].Heads = heads; + sidecar.BlockMedias[0].SectorsPerTrack = sectors; } UpdateStatus?.Invoke(Localization.Core.Writing_metadata_sidecar); - var xmlFs = new FileStream(_outputPrefix + ".cicm.xml", FileMode.Create); + var jsonFs = new FileStream(_outputPrefix + ".metadata.json", FileMode.Create); - var xmlSer = new XmlSerializer(typeof(CICMMetadataType)); - xmlSer.Serialize(xmlFs, sidecar); - xmlFs.Close(); + JsonSerializer.Serialize(jsonFs, sidecar, new JsonSerializerOptions + { + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, + WriteIndented = true + }); + + jsonFs.Close(); } } diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/CdiReady.cs b/Aaru.Core/Devices/Dumping/CompactDisc/CdiReady.cs index 54a681d34..7e56ed65d 100644 --- a/Aaru.Core/Devices/Dumping/CompactDisc/CdiReady.cs +++ b/Aaru.Core/Devices/Dumping/CompactDisc/CdiReady.cs @@ -37,13 +37,13 @@ using System; using System.Collections.Generic; using System.Linq; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Extents; using Aaru.CommonTypes.Interfaces; -using Aaru.CommonTypes.Structs; using Aaru.Core.Logging; using Aaru.Decoders.CD; using Aaru.Devices; -using Schemas; +using Track = Aaru.CommonTypes.Structs.Track; namespace Aaru.Core.Devices.Dumping; @@ -146,7 +146,7 @@ partial class Dump /// Disc media catalogue number /// List of subchannels not yet dumped correctly /// List of smallest pregap relative address per track - void ReadCdiReady(uint blockSize, ref double currentSpeed, DumpHardwareType currentTry, ExtentsULong extents, + void ReadCdiReady(uint blockSize, ref double currentSpeed, DumpHardware currentTry, ExtentsULong extents, IbgLog ibgLog, ref double imageWriteDuration, ExtentsULong leadOutExtents, ref double maxSpeed, MhddLog mhddLog, ref double minSpeed, uint subSize, MmcSubchannel supportedSubchannel, ref double totalDuration, Track[] tracks, SubchannelLog subLog, MmcSubchannel desiredSubchannel, @@ -242,7 +242,7 @@ partial class Dump if(!sense && !_dev.Error) { - mhddLog.Write(i + r, cmdDuration, 1); + mhddLog.Write(i + r, cmdDuration); ibgLog.Write(i + r, currentSpeed * 1024); extents.Add(i + r, 1, true); DateTime writeStart = DateTime.Now; @@ -324,7 +324,7 @@ partial class Dump FixOffsetData(offsetBytes, sectorSize, sectorsForOffset, supportedSubchannel, ref blocksToRead, subSize, ref cmdBuf, blockSize, false); - mhddLog.Write(i, cmdDuration, 1); + mhddLog.Write(i, cmdDuration); ibgLog.Write(i, currentSpeed * 1024); extents.Add(i, blocksToRead, true); DateTime writeStart = DateTime.Now; diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/Data.cs b/Aaru.Core/Devices/Dumping/CompactDisc/Data.cs index 8eaa8aeae..a6da39236 100644 --- a/Aaru.Core/Devices/Dumping/CompactDisc/Data.cs +++ b/Aaru.Core/Devices/Dumping/CompactDisc/Data.cs @@ -38,16 +38,16 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Extents; using Aaru.CommonTypes.Interfaces; -using Aaru.CommonTypes.Structs; using Aaru.Console; using Aaru.Core.Logging; using Aaru.Decoders.CD; using Aaru.Decoders.SCSI; using Aaru.Devices; -using Schemas; +using Track = Aaru.CommonTypes.Structs.Track; using TrackType = Aaru.CommonTypes.Enums.TrackType; namespace Aaru.Core.Devices.Dumping; @@ -89,7 +89,7 @@ partial class Dump /// List of subchannels not yet dumped correctly /// List of smallest pregap relative address per track void ReadCdData(ExtentsULong audioExtents, ulong blocks, uint blockSize, ref double currentSpeed, - DumpHardwareType currentTry, ExtentsULong extents, IbgLog ibgLog, ref double imageWriteDuration, + DumpHardware currentTry, ExtentsULong extents, IbgLog ibgLog, ref double imageWriteDuration, long lastSector, ExtentsULong leadOutExtents, ref double maxSpeed, MhddLog mhddLog, ref double minSpeed, out bool newTrim, bool nextData, int offsetBytes, bool read6, bool read10, bool read12, bool read16, bool readcd, int sectorsForOffset, uint subSize, @@ -476,7 +476,7 @@ partial class Dump if(!sense && !_dev.Error) { - mhddLog.Write(i + r, cmdDuration, 1); + mhddLog.Write(i + r, cmdDuration); ibgLog.Write(i + r, currentSpeed * 1024); extents.Add(i + r, 1, true); DateTime writeStart = DateTime.Now; @@ -596,7 +596,7 @@ partial class Dump AaruConsole.DebugWriteLine("Dump-Media", Localization.Core.READ_error_0, Sense.PrettifySense(senseBuf)); - mhddLog.Write(i + r, cmdDuration < 500 ? 65535 : cmdDuration, 1); + mhddLog.Write(i + r, cmdDuration < 500 ? 65535 : cmdDuration); ibgLog.Write(i + r, 0); _dumpLog.WriteLine(Localization.Core.Skipping_0_blocks_from_errored_block_1, 1, i + r); diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/Dump.cs b/Aaru.Core/Devices/Dumping/CompactDisc/Dump.cs index 8ff522c88..181e3dde4 100644 --- a/Aaru.Core/Devices/Dumping/CompactDisc/Dump.cs +++ b/Aaru.Core/Devices/Dumping/CompactDisc/Dump.cs @@ -39,10 +39,10 @@ using System.Collections.Generic; using System.Linq; using System.Text; using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Extents; using Aaru.CommonTypes.Interfaces; -using Aaru.CommonTypes.Structs; using Aaru.Console; using Aaru.Core.Graphics; using Aaru.Core.Logging; @@ -50,7 +50,7 @@ using Aaru.Core.Media.Detection; using Aaru.Database.Models; using Aaru.Decoders.CD; using Aaru.Devices; -using Schemas; +using Track = Aaru.CommonTypes.Structs.Track; using TrackType = Aaru.CommonTypes.Enums.TrackType; using Version = Aaru.CommonTypes.Interop.Version; @@ -69,7 +69,7 @@ sealed partial class Dump uint blockSize; // Size of the read sector in bytes CdOffset cdOffset; // Read offset from database byte[] cmdBuf; // Data buffer - DumpHardwareType currentTry = null; // Current dump hardware try + DumpHardware currentTry = null; // Current dump hardware try double currentSpeed = 0; // Current read speed int? discOffset = null; // Disc write offset DateTime dumpStart = DateTime.UtcNow; // Time of dump start @@ -1380,14 +1380,14 @@ sealed partial class Dump ApplicationVersion = Version.GetVersion() }; - if(!outputOptical.SetMetadata(metadata)) + if(!outputOptical.SetImageInfo(metadata)) ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + Environment.NewLine + outputOptical.ErrorMessage); outputOptical.SetDumpHardware(_resume.Tries); if(_preSidecar != null) - outputOptical.SetCicmMetadata(_preSidecar); + outputOptical.SetMetadata(_preSidecar); foreach(KeyValuePair isrc in isrcs) { diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/Error.cs b/Aaru.Core/Devices/Dumping/CompactDisc/Error.cs index e31a9d254..f025dae8d 100644 --- a/Aaru.Core/Devices/Dumping/CompactDisc/Error.cs +++ b/Aaru.Core/Devices/Dumping/CompactDisc/Error.cs @@ -37,16 +37,16 @@ using System; using System.Collections.Generic; using System.Linq; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Extents; using Aaru.CommonTypes.Interfaces; -using Aaru.CommonTypes.Structs; using Aaru.CommonTypes.Structs.Devices.SCSI; using Aaru.Console; using Aaru.Core.Logging; using Aaru.Decoders.CD; using Aaru.Decoders.SCSI; using Aaru.Devices; -using Schemas; +using Track = Aaru.CommonTypes.Structs.Track; using TrackType = Aaru.CommonTypes.Enums.TrackType; namespace Aaru.Core.Devices.Dumping; @@ -72,7 +72,7 @@ partial class Dump /// Disc media catalogue number /// List of subchannels not yet dumped correctly /// List of smallest pregap relative address per track - void RetryCdUserData(ExtentsULong audioExtents, uint blockSize, DumpHardwareType currentTry, ExtentsULong extents, + void RetryCdUserData(ExtentsULong audioExtents, uint blockSize, DumpHardware currentTry, ExtentsULong extents, int offsetBytes, bool readcd, int sectorsForOffset, uint subSize, MmcSubchannel supportedSubchannel, ref double totalDuration, SubchannelLog subLog, MmcSubchannel desiredSubchannel, Track[] tracks, Dictionary isrcs, diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/LeadOuts.cs b/Aaru.Core/Devices/Dumping/CompactDisc/LeadOuts.cs index 806ab5fc6..392c1c8be 100644 --- a/Aaru.Core/Devices/Dumping/CompactDisc/LeadOuts.cs +++ b/Aaru.Core/Devices/Dumping/CompactDisc/LeadOuts.cs @@ -38,13 +38,13 @@ using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Linq; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Extents; using Aaru.CommonTypes.Interfaces; -using Aaru.CommonTypes.Structs; using Aaru.Core.Logging; using Aaru.Devices; -using Schemas; +using Track = Aaru.CommonTypes.Structs.Track; namespace Aaru.Core.Devices.Dumping; @@ -79,7 +79,7 @@ partial class Dump // TODO: Use it [SuppressMessage("ReSharper", "UnusedMember.Local")] - void DumpCdLeadOuts(uint blockSize, ref double currentSpeed, DumpHardwareType currentTry, ExtentsULong extents, + void DumpCdLeadOuts(uint blockSize, ref double currentSpeed, DumpHardware currentTry, ExtentsULong extents, IbgLog ibgLog, ref double imageWriteDuration, ExtentsULong leadOutExtents, ref double maxSpeed, MhddLog mhddLog, ref double minSpeed, bool read6, bool read10, bool read12, bool read16, bool readcd, MmcSubchannel supportedSubchannel, uint subSize, ref double totalDuration, @@ -145,7 +145,7 @@ partial class Dump if(!sense && !_dev.Error) { - mhddLog.Write(i, cmdDuration, 1); + mhddLog.Write(i, cmdDuration); ibgLog.Write(i, currentSpeed * 1024); extents.Add(i, _maximumReadable, true); leadOutExtents.Remove(i); @@ -252,7 +252,7 @@ partial class Dump // TODO: Use it [SuppressMessage("ReSharper", "UnusedMember.Local")] - void RetryCdLeadOuts(uint blockSize, ref double currentSpeed, DumpHardwareType currentTry, ExtentsULong extents, + void RetryCdLeadOuts(uint blockSize, ref double currentSpeed, DumpHardware currentTry, ExtentsULong extents, IbgLog ibgLog, ref double imageWriteDuration, ExtentsULong leadOutExtents, ref double maxSpeed, MhddLog mhddLog, ref double minSpeed, bool read6, bool read10, bool read12, bool read16, bool readcd, MmcSubchannel supportedSubchannel, uint subSize, ref double totalDuration, @@ -380,7 +380,7 @@ partial class Dump imageWriteDuration += (DateTime.Now - writeStart).TotalSeconds; - mhddLog.Write(i, cmdDuration < 500 ? 65535 : cmdDuration, 1); + mhddLog.Write(i, cmdDuration < 500 ? 65535 : cmdDuration); ibgLog.Write(i, 0); } diff --git a/Aaru.Core/Devices/Dumping/CompactDisc/Trim.cs b/Aaru.Core/Devices/Dumping/CompactDisc/Trim.cs index 74e1551ac..468a11ca2 100644 --- a/Aaru.Core/Devices/Dumping/CompactDisc/Trim.cs +++ b/Aaru.Core/Devices/Dumping/CompactDisc/Trim.cs @@ -37,14 +37,14 @@ using System; using System.Collections.Generic; using System.Linq; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Extents; using Aaru.CommonTypes.Interfaces; -using Aaru.CommonTypes.Structs; using Aaru.Core.Logging; using Aaru.Decoders.CD; using Aaru.Decoders.SCSI; using Aaru.Devices; -using Schemas; +using Track = Aaru.CommonTypes.Structs.Track; namespace Aaru.Core.Devices.Dumping; @@ -74,7 +74,7 @@ partial class Dump /// Disc media catalogue number /// List of subchannels not yet dumped correctly /// List of smallest pregap relative address per track - void TrimCdUserData(ExtentsULong audioExtents, uint blockSize, DumpHardwareType currentTry, ExtentsULong extents, + void TrimCdUserData(ExtentsULong audioExtents, uint blockSize, DumpHardware currentTry, ExtentsULong extents, bool newTrim, int offsetBytes, bool read6, bool read10, bool read12, bool read16, bool readcd, int sectorsForOffset, uint subSize, MmcSubchannel supportedSubchannel, bool supportsLongSectors, ref double totalDuration, SubchannelLog subLog, MmcSubchannel desiredSubchannel, Track[] tracks, diff --git a/Aaru.Core/Devices/Dumping/Dump.cs b/Aaru.Core/Devices/Dumping/Dump.cs index 0be945ae4..4459fae7c 100644 --- a/Aaru.Core/Devices/Dumping/Dump.cs +++ b/Aaru.Core/Devices/Dumping/Dump.cs @@ -39,13 +39,14 @@ using System.Text; using System.Text.Json; using System.Text.Json.Serialization; using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Metadata; using Aaru.Core.Logging; using Aaru.Database; using Aaru.Devices; -using Schemas; +using File = System.IO.File; namespace Aaru.Core.Devices.Dumping; @@ -88,7 +89,7 @@ public partial class Dump readonly IBaseWritableImage _outputPlugin; readonly string _outputPrefix; readonly bool _persistent; - readonly CICMMetadataType _preSidecar; + readonly Metadata _preSidecar; readonly bool _private; readonly ushort _retryPasses; readonly bool _retrySubchannel; @@ -157,12 +158,11 @@ public partial class Dump public Dump(bool doResume, Device dev, string devicePath, IBaseWritableImage outputPlugin, ushort retryPasses, bool force, bool dumpRaw, bool persistent, bool stopOnError, Resume resume, DumpLog dumpLog, Encoding encoding, string outputPrefix, string outputPath, Dictionary formatOptions, - CICMMetadataType preSidecar, uint skip, bool metadata, bool trim, bool dumpFirstTrackPregap, - bool fixOffset, bool debug, DumpSubchannel subchannel, int speed, bool @private, - bool fixSubchannelPosition, bool retrySubchannel, bool fixSubchannel, bool fixSubchannelCrc, - bool skipCdireadyHole, ErrorLog errorLog, bool generateSubchannels, uint maximumReadable, - bool useBufferedReads, bool storeEncrypted, bool titleKeys, uint ignoreCdrRunOuts, bool createGraph, - uint dimensions) + Metadata preSidecar, uint skip, bool metadata, bool trim, bool dumpFirstTrackPregap, bool fixOffset, + bool debug, DumpSubchannel subchannel, int speed, bool @private, bool fixSubchannelPosition, + bool retrySubchannel, bool fixSubchannel, bool fixSubchannelCrc, bool skipCdireadyHole, + ErrorLog errorLog, bool generateSubchannels, uint maximumReadable, bool useBufferedReads, + bool storeEncrypted, bool titleKeys, uint ignoreCdrRunOuts, bool createGraph, uint dimensions) { _doResume = doResume; _dev = dev; diff --git a/Aaru.Core/Devices/Dumping/LinearMemory/Retrode.cs b/Aaru.Core/Devices/Dumping/LinearMemory/Retrode.cs index 4a9da8025..3503f476c 100644 --- a/Aaru.Core/Devices/Dumping/LinearMemory/Retrode.cs +++ b/Aaru.Core/Devices/Dumping/LinearMemory/Retrode.cs @@ -423,7 +423,7 @@ public partial class Dump ApplicationVersion = Version.GetVersion() }; - if(!outputBai.SetMetadata(metadata)) + if(!outputBai.SetImageInfo(metadata)) ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + Environment.NewLine + outputBai.ErrorMessage); @@ -431,7 +431,7 @@ public partial class Dump //outputBAI.SetDumpHardware(); if(_preSidecar != null) - outputBai.SetCicmMetadata(_preSidecar); + outputBai.SetMetadata(_preSidecar); _dumpLog.WriteLine(Localization.Core.Closing_output_file); UpdateStatus?.Invoke(Localization.Core.Closing_output_file); diff --git a/Aaru.Core/Devices/Dumping/MMC.cs b/Aaru.Core/Devices/Dumping/MMC.cs index c6152b9da..8a6a10328 100644 --- a/Aaru.Core/Devices/Dumping/MMC.cs +++ b/Aaru.Core/Devices/Dumping/MMC.cs @@ -34,6 +34,7 @@ using System; using System.Collections.Generic; using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Structs.Devices.SCSI; using Aaru.Decoders.Bluray; @@ -43,7 +44,6 @@ using Aaru.Decoders.SCSI.MMC; using Aaru.Decryption; using Aaru.Decryption.DVD; using Aaru.Devices; -using Schemas; using DDS = Aaru.Decoders.DVD.DDS; using DMI = Aaru.Decoders.Xbox.DMI; using DVDDecryption = Aaru.Decryption.DVD.Dump; @@ -802,36 +802,35 @@ partial class Dump } // TODO: Move somewhere else - internal static void AddMediaTagToSidecar(string outputPath, MediaTagType tagType, byte[] tag, - ref CICMMetadataType sidecar) + internal static void AddMediaTagToSidecar(string outputPath, MediaTagType tagType, byte[] tag, ref Metadata sidecar) { switch(tagType) { case MediaTagType.DVD_PFI: - sidecar.OpticalDisc[0].PFI = new DumpType + sidecar.OpticalDiscs[0].Pfi = new CommonTypes.AaruMetadata.Dump { Image = outputPath, Size = (ulong)tag.Length, - Checksums = Checksum.GetChecksums(tag).ToArray() + Checksums = Checksum.GetChecksums(tag) }; break; case MediaTagType.DVD_DMI: - sidecar.OpticalDisc[0].DMI = new DumpType + sidecar.OpticalDiscs[0].Dmi = new CommonTypes.AaruMetadata.Dump { Image = outputPath, Size = (ulong)tag.Length, - Checksums = Checksum.GetChecksums(tag).ToArray() + Checksums = Checksum.GetChecksums(tag) }; break; case MediaTagType.DVD_CMI: case MediaTagType.HDDVD_CPI: - sidecar.OpticalDisc[0].CMI = new DumpType + sidecar.OpticalDiscs[0].Cmi = new CommonTypes.AaruMetadata.Dump { Image = outputPath, Size = (ulong)tag.Length, - Checksums = Checksum.GetChecksums(tag).ToArray() + Checksums = Checksum.GetChecksums(tag) }; byte[] tmp = new byte[tag.Length + 4]; @@ -843,190 +842,190 @@ partial class Dump if(cpy.HasValue && cpy.Value.CopyrightType != CopyrightType.NoProtection) - sidecar.OpticalDisc[0].CopyProtection = cpy.Value.CopyrightType.ToString(); + sidecar.OpticalDiscs[0].CopyProtection = cpy.Value.CopyrightType.ToString(); break; case MediaTagType.DVD_BCA: case MediaTagType.BD_BCA: - sidecar.OpticalDisc[0].BCA = new DumpType + sidecar.OpticalDiscs[0].Bca = new CommonTypes.AaruMetadata.Dump { Image = outputPath, Size = (ulong)tag.Length, - Checksums = Checksum.GetChecksums(tag).ToArray() + Checksums = Checksum.GetChecksums(tag) }; break; case MediaTagType.BD_DDS: case MediaTagType.DVDRAM_DDS: - sidecar.OpticalDisc[0].DDS = new DumpType + sidecar.OpticalDiscs[0].Dds = new CommonTypes.AaruMetadata.Dump { Image = outputPath, Size = (ulong)tag.Length, - Checksums = Checksum.GetChecksums(tag).ToArray() + Checksums = Checksum.GetChecksums(tag) }; break; case MediaTagType.DVDRAM_SpareArea: case MediaTagType.BD_SpareArea: - sidecar.OpticalDisc[0].SAI = new DumpType + sidecar.OpticalDiscs[0].Sai = new CommonTypes.AaruMetadata.Dump { Image = outputPath, Size = (ulong)tag.Length, - Checksums = Checksum.GetChecksums(tag).ToArray() + Checksums = Checksum.GetChecksums(tag) }; break; case MediaTagType.DVDR_PreRecordedInfo: - sidecar.OpticalDisc[0].PRI = new DumpType + sidecar.OpticalDiscs[0].Pri = new CommonTypes.AaruMetadata.Dump { Image = outputPath, Size = (ulong)tag.Length, - Checksums = Checksum.GetChecksums(tag).ToArray() + Checksums = Checksum.GetChecksums(tag) }; break; case MediaTagType.DVD_MediaIdentifier: - sidecar.OpticalDisc[0].MediaID = new DumpType + sidecar.OpticalDiscs[0].MediaID = new CommonTypes.AaruMetadata.Dump { Image = outputPath, Size = (ulong)tag.Length, - Checksums = Checksum.GetChecksums(tag).ToArray() + Checksums = Checksum.GetChecksums(tag) }; break; case MediaTagType.DVDR_PFI: - sidecar.OpticalDisc[0].PFIR = new DumpType + sidecar.OpticalDiscs[0].Pfir = new CommonTypes.AaruMetadata.Dump { Image = outputPath, Size = (ulong)tag.Length, - Checksums = Checksum.GetChecksums(tag).ToArray() + Checksums = Checksum.GetChecksums(tag) }; break; case MediaTagType.DVD_ADIP: - sidecar.OpticalDisc[0].ADIP = new DumpType + sidecar.OpticalDiscs[0].Adip = new CommonTypes.AaruMetadata.Dump { Image = outputPath, Size = (ulong)tag.Length, - Checksums = Checksum.GetChecksums(tag).ToArray() + Checksums = Checksum.GetChecksums(tag) }; break; case MediaTagType.DCB: - sidecar.OpticalDisc[0].DCB = new DumpType + sidecar.OpticalDiscs[0].Dcb = new CommonTypes.AaruMetadata.Dump { Image = outputPath, Size = (ulong)tag.Length, - Checksums = Checksum.GetChecksums(tag).ToArray() + Checksums = Checksum.GetChecksums(tag) }; break; case MediaTagType.BD_DI: - sidecar.OpticalDisc[0].DI = new DumpType + sidecar.OpticalDiscs[0].Di = new CommonTypes.AaruMetadata.Dump { Image = outputPath, Size = (ulong)tag.Length, - Checksums = Checksum.GetChecksums(tag).ToArray() + Checksums = Checksum.GetChecksums(tag) }; break; case MediaTagType.Xbox_SecuritySector: - sidecar.OpticalDisc[0].Xbox ??= new XboxType(); + sidecar.OpticalDiscs[0].Xbox ??= new Xbox(); - sidecar.OpticalDisc[0].Xbox.SecuritySectors = new[] + sidecar.OpticalDiscs[0].Xbox.SecuritySectors = new List { - new XboxSecuritySectorsType + new() { RequestNumber = 0, RequestVersion = 1, - SecuritySectors = new DumpType + SecuritySectors = new CommonTypes.AaruMetadata.Dump { Image = outputPath, Size = (ulong)tag.Length, - Checksums = Checksum.GetChecksums(tag).ToArray() + Checksums = Checksum.GetChecksums(tag) } } }; break; case MediaTagType.Xbox_PFI: - sidecar.OpticalDisc[0].Xbox ??= new XboxType(); + sidecar.OpticalDiscs[0].Xbox ??= new Xbox(); - sidecar.OpticalDisc[0].Xbox.PFI = new DumpType + sidecar.OpticalDiscs[0].Xbox.Pfi = new CommonTypes.AaruMetadata.Dump { Image = outputPath, Size = (ulong)tag.Length, - Checksums = Checksum.GetChecksums(tag).ToArray() + Checksums = Checksum.GetChecksums(tag) }; break; case MediaTagType.Xbox_DMI: - sidecar.OpticalDisc[0].Xbox ??= new XboxType(); + sidecar.OpticalDiscs[0].Xbox ??= new Xbox(); - sidecar.OpticalDisc[0].Xbox.DMI = new DumpType + sidecar.OpticalDiscs[0].Xbox.Dmi = new CommonTypes.AaruMetadata.Dump { Image = outputPath, Size = (ulong)tag.Length, - Checksums = Checksum.GetChecksums(tag).ToArray() + Checksums = Checksum.GetChecksums(tag) }; break; case MediaTagType.CD_FullTOC: - sidecar.OpticalDisc[0].TOC = new DumpType + sidecar.OpticalDiscs[0].Toc = new CommonTypes.AaruMetadata.Dump { Image = outputPath, Size = (ulong)tag.Length, - Checksums = Checksum.GetChecksums(tag).ToArray() + Checksums = Checksum.GetChecksums(tag) }; break; case MediaTagType.CD_ATIP: - sidecar.OpticalDisc[0].ATIP = new DumpType + sidecar.OpticalDiscs[0].Atip = new CommonTypes.AaruMetadata.Dump { Image = outputPath, Size = (ulong)tag.Length, - Checksums = Checksum.GetChecksums(tag).ToArray() + Checksums = Checksum.GetChecksums(tag) }; break; case MediaTagType.CD_PMA: - sidecar.OpticalDisc[0].PMA = new DumpType + sidecar.OpticalDiscs[0].Pma = new CommonTypes.AaruMetadata.Dump { Image = outputPath, Size = (ulong)tag.Length, - Checksums = Checksum.GetChecksums(tag).ToArray() + Checksums = Checksum.GetChecksums(tag) }; break; case MediaTagType.CD_TEXT: - sidecar.OpticalDisc[0].LeadInCdText = new DumpType + sidecar.OpticalDiscs[0].LeadInCdText = new CommonTypes.AaruMetadata.Dump { Image = outputPath, Size = (ulong)tag.Length, - Checksums = Checksum.GetChecksums(tag).ToArray() + Checksums = Checksum.GetChecksums(tag) }; break; case MediaTagType.CD_FirstTrackPregap: - sidecar.OpticalDisc[0].FirstTrackPregrap = new[] + sidecar.OpticalDiscs[0].FirstTrackPregrap = new List { - new BorderType + new() { Image = outputPath, Size = (ulong)tag.Length, - Checksums = Checksum.GetChecksums(tag).ToArray() + Checksums = Checksum.GetChecksums(tag) } }; break; case MediaTagType.CD_LeadIn: - sidecar.OpticalDisc[0].LeadIn = new[] + sidecar.OpticalDiscs[0].LeadIn = new List { - new BorderType + new() { Image = outputPath, Size = (ulong)tag.Length, - Checksums = Checksum.GetChecksums(tag).ToArray() + Checksums = Checksum.GetChecksums(tag) } }; diff --git a/Aaru.Core/Devices/Dumping/Metadata.cs b/Aaru.Core/Devices/Dumping/Metadata.cs index 5f9de9856..f8acf9152 100644 --- a/Aaru.Core/Devices/Dumping/Metadata.cs +++ b/Aaru.Core/Devices/Dumping/Metadata.cs @@ -34,12 +34,13 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; -using System.Xml.Serialization; +using System.Text.Json; +using System.Text.Json.Serialization; using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Metadata; -using Schemas; using MediaType = Aaru.CommonTypes.MediaType; namespace Aaru.Core.Devices.Dumping; @@ -55,7 +56,7 @@ partial class Dump /// Disc sessions /// Total time spent doing checksums /// Disc write offset - void WriteOpticalSidecar(uint blockSize, ulong blocks, MediaType mediaType, LayersType layers, + void WriteOpticalSidecar(uint blockSize, ulong blocks, MediaType mediaType, Layers layers, Dictionary mediaTags, int sessions, out double totalChkDuration, int? discOffset) { @@ -91,8 +92,8 @@ partial class Dump _sidecarClass.UpdateProgressEvent2 += UpdateProgress2; _sidecarClass.EndProgressEvent2 += EndProgress2; _sidecarClass.UpdateStatusEvent += UpdateStatus; - CICMMetadataType sidecar = _sidecarClass.Create(); - DateTime end = DateTime.UtcNow; + Metadata sidecar = _sidecarClass.Create(); + DateTime end = DateTime.UtcNow; if(_aborted) return; @@ -105,14 +106,14 @@ partial class Dump if(_preSidecar != null) { - _preSidecar.OpticalDisc = sidecar.OpticalDisc; - sidecar = _preSidecar; + _preSidecar.OpticalDiscs = sidecar.OpticalDiscs; + sidecar = _preSidecar; } List<(ulong start, string type)> filesystems = new(); - if(sidecar.OpticalDisc[0].Track != null) - filesystems.AddRange(from xmlTrack in sidecar.OpticalDisc[0].Track + if(sidecar.OpticalDiscs[0].Track != null) + filesystems.AddRange(from xmlTrack in sidecar.OpticalDiscs[0].Track where xmlTrack.FileSystemInformation != null from partition in xmlTrack.FileSystemInformation where partition.FileSystems != null from fileSystem in partition.FileSystems @@ -126,19 +127,16 @@ partial class Dump }).Distinct()) _dumpLog.WriteLine(Localization.Core.Found_filesystem_0_at_sector_1, filesystem.type, filesystem.start); - sidecar.OpticalDisc[0].Dimensions = Dimensions.DimensionsFromMediaType(mediaType); + sidecar.OpticalDiscs[0].Dimensions = Dimensions.DimensionsFromMediaType(mediaType); (string type, string subType) discType = CommonTypes.Metadata.MediaType.MediaTypeToString(mediaType); - sidecar.OpticalDisc[0].DiscType = discType.type; - sidecar.OpticalDisc[0].DiscSubType = discType.subType; - sidecar.OpticalDisc[0].DumpHardwareArray = _resume.Tries.ToArray(); - sidecar.OpticalDisc[0].Sessions = (uint)sessions; - sidecar.OpticalDisc[0].Layers = layers; + sidecar.OpticalDiscs[0].DiscType = discType.type; + sidecar.OpticalDiscs[0].DiscSubType = discType.subType; + sidecar.OpticalDiscs[0].DumpHardware = _resume.Tries; + sidecar.OpticalDiscs[0].Sessions = (uint)sessions; + sidecar.OpticalDiscs[0].Layers = layers; if(discOffset.HasValue) - { - sidecar.OpticalDisc[0].Offset = (int)(discOffset / 4); - sidecar.OpticalDisc[0].OffsetSpecified = true; - } + sidecar.OpticalDiscs[0].Offset = (int)(discOffset / 4); if(mediaTags != null) foreach(KeyValuePair tag in mediaTags.Where(tag => _outputPlugin.SupportedMediaTags. @@ -147,10 +145,14 @@ partial class Dump UpdateStatus?.Invoke(Localization.Core.Writing_metadata_sidecar); - var xmlFs = new FileStream(_outputPrefix + ".cicm.xml", FileMode.Create); + var jsonFs = new FileStream(_outputPrefix + ".metadata.json", FileMode.Create); - var xmlSer = new XmlSerializer(typeof(CICMMetadataType)); - xmlSer.Serialize(xmlFs, sidecar); - xmlFs.Close(); + JsonSerializer.Serialize(jsonFs, sidecar, new JsonSerializerOptions + { + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, + WriteIndented = true + }); + + jsonFs.Close(); } } \ No newline at end of file diff --git a/Aaru.Core/Devices/Dumping/MiniDisc.cs b/Aaru.Core/Devices/Dumping/MiniDisc.cs index 342cde4fa..907c30af2 100644 --- a/Aaru.Core/Devices/Dumping/MiniDisc.cs +++ b/Aaru.Core/Devices/Dumping/MiniDisc.cs @@ -36,8 +36,10 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; -using System.Xml.Serialization; +using System.Text.Json; +using System.Text.Json.Serialization; using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Extents; using Aaru.CommonTypes.Interfaces; @@ -47,7 +49,6 @@ using Aaru.Core.Graphics; using Aaru.Core.Logging; using Aaru.Decoders.SCSI; using Aaru.Devices; -using Schemas; using MediaType = Aaru.CommonTypes.MediaType; using Version = Aaru.CommonTypes.Interop.Version; @@ -263,8 +264,10 @@ partial class Dump UpdateStatus?.Invoke(string.Format(Localization.Core.Reading_0_sectors_at_a_time, blocksToRead)); _dumpLog.WriteLine(Localization.Core.Reading_0_sectors_at_a_time, blocksToRead); - var mhddLog = new MhddLog(_outputPrefix + ".mhddlog.bin", _dev, blocks, blockSize, blocksToRead, _private, _dimensions); - var ibgLog = new IbgLog(_outputPrefix + ".ibg", sbcProfile); + var mhddLog = new MhddLog(_outputPrefix + ".mhddlog.bin", _dev, blocks, blockSize, blocksToRead, _private, + _dimensions); + + var ibgLog = new IbgLog(_outputPrefix + ".ibg", sbcProfile); ret = outputFormat.Create(_outputPath, dskType, _formatOptions, blocks, blockSize); // Cannot create image @@ -342,8 +345,8 @@ partial class Dump } } - DumpHardwareType currentTry = null; - ExtentsULong extents = null; + DumpHardware currentTry = null; + ExtentsULong extents = null; ResumeSupport.Process(true, _dev.IsRemovable, blocks, _dev.Manufacturer, _dev.Model, _dev.Serial, _dev.PlatformId, ref _resume, ref currentTry, ref extents, _dev.FirmwareRevision, @@ -740,12 +743,12 @@ partial class Dump ApplicationVersion = Version.GetVersion() }; - if(!outputFormat.SetMetadata(metadata)) + if(!outputFormat.SetImageInfo(metadata)) ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + Environment.NewLine + outputFormat.ErrorMessage); if(_preSidecar != null) - outputFormat.SetCicmMetadata(_preSidecar); + outputFormat.SetMetadata(_preSidecar); _dumpLog.WriteLine(Localization.Core.Closing_output_file); UpdateStatus?.Invoke(Localization.Core.Closing_output_file); @@ -793,7 +796,7 @@ partial class Dump _sidecarClass.UpdateProgressEvent2 += UpdateProgress2; _sidecarClass.EndProgressEvent2 += EndProgress2; _sidecarClass.UpdateStatusEvent += UpdateStatus; - CICMMetadataType sidecar = _sidecarClass.Create(); + Metadata sidecar = _sidecarClass.Create(); end = DateTime.UtcNow; if(!_aborted) @@ -814,14 +817,14 @@ partial class Dump if(_preSidecar != null) { - _preSidecar.BlockMedia = sidecar.BlockMedia; - sidecar = _preSidecar; + _preSidecar.BlockMedias = sidecar.BlockMedias; + sidecar = _preSidecar; } List<(ulong start, string type)> filesystems = new(); - if(sidecar.BlockMedia[0].FileSystemInformation != null) - filesystems.AddRange(from partition in sidecar.BlockMedia[0].FileSystemInformation + if(sidecar.BlockMedias[0].FileSystemInformation != null) + filesystems.AddRange(from partition in sidecar.BlockMedias[0].FileSystemInformation where partition.FileSystems != null from fileSystem in partition.FileSystems select (partition.StartSector, fileSystem.Type)); @@ -839,43 +842,47 @@ partial class Dump filesystem.start); } - sidecar.BlockMedia[0].Dimensions = Dimensions.DimensionsFromMediaType(dskType); + sidecar.BlockMedias[0].Dimensions = Dimensions.DimensionsFromMediaType(dskType); (string type, string subType) xmlType = CommonTypes.Metadata.MediaType.MediaTypeToString(dskType); - sidecar.BlockMedia[0].DiskType = xmlType.type; - sidecar.BlockMedia[0].DiskSubType = xmlType.subType; + sidecar.BlockMedias[0].MediaType = xmlType.type; + sidecar.BlockMedias[0].MediaSubType = xmlType.subType; if(!_dev.IsRemovable || _dev.IsUsb) if(_dev.Type == DeviceType.ATAPI) - sidecar.BlockMedia[0].Interface = "ATAPI"; + sidecar.BlockMedias[0].Interface = "ATAPI"; else if(_dev.IsUsb) - sidecar.BlockMedia[0].Interface = "USB"; + sidecar.BlockMedias[0].Interface = "USB"; else if(_dev.IsFireWire) - sidecar.BlockMedia[0].Interface = "FireWire"; + sidecar.BlockMedias[0].Interface = "FireWire"; else - sidecar.BlockMedia[0].Interface = "SCSI"; + sidecar.BlockMedias[0].Interface = "SCSI"; - sidecar.BlockMedia[0].LogicalBlocks = blocks; - sidecar.BlockMedia[0].PhysicalBlockSize = physicalBlockSize; - sidecar.BlockMedia[0].LogicalBlockSize = blockSize; - sidecar.BlockMedia[0].Manufacturer = _dev.Manufacturer; - sidecar.BlockMedia[0].Model = _dev.Model; + sidecar.BlockMedias[0].LogicalBlocks = blocks; + sidecar.BlockMedias[0].PhysicalBlockSize = physicalBlockSize; + sidecar.BlockMedias[0].LogicalBlockSize = blockSize; + sidecar.BlockMedias[0].Manufacturer = _dev.Manufacturer; + sidecar.BlockMedias[0].Model = _dev.Model; if(!_private) - sidecar.BlockMedia[0].Serial = _dev.Serial; + sidecar.BlockMedias[0].Serial = _dev.Serial; - sidecar.BlockMedia[0].Size = blocks * blockSize; + sidecar.BlockMedias[0].Size = blocks * blockSize; if(_dev.IsRemovable) - sidecar.BlockMedia[0].DumpHardwareArray = _resume.Tries.ToArray(); + sidecar.BlockMedias[0].DumpHardware = _resume.Tries; UpdateStatus?.Invoke(Localization.Core.Writing_metadata_sidecar); - var xmlFs = new FileStream(_outputPrefix + ".cicm.xml", FileMode.Create); + var jsonFs = new FileStream(_outputPrefix + ".metadata.json", FileMode.Create); - var xmlSer = new XmlSerializer(typeof(CICMMetadataType)); - xmlSer.Serialize(xmlFs, sidecar); - xmlFs.Close(); + JsonSerializer.Serialize(jsonFs, sidecar, new JsonSerializerOptions + { + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, + WriteIndented = true + }); + + jsonFs.Close(); } } diff --git a/Aaru.Core/Devices/Dumping/PlayStationPortable/MemoryStick.cs b/Aaru.Core/Devices/Dumping/PlayStationPortable/MemoryStick.cs index a3e5bb3b1..0b1ac6b44 100644 --- a/Aaru.Core/Devices/Dumping/PlayStationPortable/MemoryStick.cs +++ b/Aaru.Core/Devices/Dumping/PlayStationPortable/MemoryStick.cs @@ -36,8 +36,10 @@ using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.IO; using System.Linq; -using System.Xml.Serialization; +using System.Text.Json; +using System.Text.Json.Serialization; using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Extents; using Aaru.CommonTypes.Interfaces; @@ -47,7 +49,6 @@ using Aaru.Core.Graphics; using Aaru.Core.Logging; using Aaru.Decoders.SCSI; using Aaru.Devices; -using Schemas; using MediaType = Aaru.CommonTypes.MediaType; using Version = Aaru.CommonTypes.Interop.Version; @@ -158,8 +159,10 @@ public partial class Dump bool ret; - var mhddLog = new MhddLog(_outputPrefix + ".mhddlog.bin", _dev, blocks, blockSize, blocksToRead, _private, _dimensions); - var ibgLog = new IbgLog(_outputPrefix + ".ibg", sbcProfile); + var mhddLog = new MhddLog(_outputPrefix + ".mhddlog.bin", _dev, blocks, blockSize, blocksToRead, _private, + _dimensions); + + var ibgLog = new IbgLog(_outputPrefix + ".ibg", sbcProfile); ret = outputFormat.Create(_outputPath, dskType, _formatOptions, blocks, blockSize); // Cannot create image @@ -177,8 +180,8 @@ public partial class Dump start = DateTime.UtcNow; double imageWriteDuration = 0; - DumpHardwareType currentTry = null; - ExtentsULong extents = null; + DumpHardware currentTry = null; + ExtentsULong extents = null; ResumeSupport.Process(true, _dev.IsRemovable, blocks, _dev.Manufacturer, _dev.Model, _dev.Serial, _dev.PlatformId, ref _resume, ref currentTry, ref extents, _dev.FirmwareRevision, @@ -591,14 +594,14 @@ public partial class Dump ApplicationVersion = Version.GetVersion() }; - if(!outputFormat.SetMetadata(metadata)) + if(!outputFormat.SetImageInfo(metadata)) ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + Environment.NewLine + outputFormat.ErrorMessage); outputFormat.SetDumpHardware(_resume.Tries); if(_preSidecar != null) - outputFormat.SetCicmMetadata(_preSidecar); + outputFormat.SetMetadata(_preSidecar); _dumpLog.WriteLine(Localization.Core.Closing_output_file); UpdateStatus?.Invoke(Localization.Core.Closing_output_file); @@ -646,7 +649,7 @@ public partial class Dump _sidecarClass.UpdateProgressEvent2 += UpdateProgress2; _sidecarClass.EndProgressEvent2 += EndProgress2; _sidecarClass.UpdateStatusEvent += UpdateStatus; - CICMMetadataType sidecar = _sidecarClass.Create(); + Metadata sidecar = _sidecarClass.Create(); end = DateTime.UtcNow; if(!_aborted) @@ -667,14 +670,14 @@ public partial class Dump if(_preSidecar != null) { - _preSidecar.BlockMedia = sidecar.BlockMedia; - sidecar = _preSidecar; + _preSidecar.BlockMedias = sidecar.BlockMedias; + sidecar = _preSidecar; } List<(ulong start, string type)> filesystems = new(); - if(sidecar.BlockMedia[0].FileSystemInformation != null) - filesystems.AddRange(from partition in sidecar.BlockMedia[0].FileSystemInformation + if(sidecar.BlockMedias[0].FileSystemInformation != null) + filesystems.AddRange(from partition in sidecar.BlockMedias[0].FileSystemInformation where partition.FileSystems != null from fileSystem in partition.FileSystems select (partition.StartSector, fileSystem.Type)); @@ -692,32 +695,36 @@ public partial class Dump filesystem.start); } - sidecar.BlockMedia[0].Dimensions = Dimensions.DimensionsFromMediaType(dskType); + sidecar.BlockMedias[0].Dimensions = Dimensions.DimensionsFromMediaType(dskType); (string type, string subType) xmlType = CommonTypes.Metadata.MediaType.MediaTypeToString(dskType); - sidecar.BlockMedia[0].DiskType = xmlType.type; - sidecar.BlockMedia[0].DiskSubType = xmlType.subType; - sidecar.BlockMedia[0].Interface = "USB"; - sidecar.BlockMedia[0].LogicalBlocks = blocks; - sidecar.BlockMedia[0].PhysicalBlockSize = (int)blockSize; - sidecar.BlockMedia[0].LogicalBlockSize = (int)blockSize; - sidecar.BlockMedia[0].Manufacturer = _dev.Manufacturer; - sidecar.BlockMedia[0].Model = _dev.Model; + sidecar.BlockMedias[0].MediaType = xmlType.type; + sidecar.BlockMedias[0].MediaSubType = xmlType.subType; + sidecar.BlockMedias[0].Interface = "USB"; + sidecar.BlockMedias[0].LogicalBlocks = blocks; + sidecar.BlockMedias[0].PhysicalBlockSize = (int)blockSize; + sidecar.BlockMedias[0].LogicalBlockSize = (int)blockSize; + sidecar.BlockMedias[0].Manufacturer = _dev.Manufacturer; + sidecar.BlockMedias[0].Model = _dev.Model; if(!_private) - sidecar.BlockMedia[0].Serial = _dev.Serial; + sidecar.BlockMedias[0].Serial = _dev.Serial; - sidecar.BlockMedia[0].Size = blocks * blockSize; + sidecar.BlockMedias[0].Size = blocks * blockSize; if(_dev.IsRemovable) - sidecar.BlockMedia[0].DumpHardwareArray = _resume.Tries.ToArray(); + sidecar.BlockMedias[0].DumpHardware = _resume.Tries; UpdateStatus?.Invoke(Localization.Core.Writing_metadata_sidecar); - var xmlFs = new FileStream(_outputPrefix + ".cicm.xml", FileMode.Create); + var jsonFs = new FileStream(_outputPrefix + ".metadata.json", FileMode.Create); - var xmlSer = new XmlSerializer(typeof(CICMMetadataType)); - xmlSer.Serialize(xmlFs, sidecar); - xmlFs.Close(); + JsonSerializer.Serialize(jsonFs, sidecar, new JsonSerializerOptions + { + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, + WriteIndented = true + }); + + jsonFs.Close(); } } diff --git a/Aaru.Core/Devices/Dumping/PlayStationPortable/UMD.cs b/Aaru.Core/Devices/Dumping/PlayStationPortable/UMD.cs index 7562aadbf..3878353e1 100644 --- a/Aaru.Core/Devices/Dumping/PlayStationPortable/UMD.cs +++ b/Aaru.Core/Devices/Dumping/PlayStationPortable/UMD.cs @@ -36,16 +36,16 @@ using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Text; using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Extents; using Aaru.CommonTypes.Interfaces; -using Aaru.CommonTypes.Structs; using Aaru.Console; using Aaru.Core.Graphics; using Aaru.Core.Logging; using Aaru.Decoders.SCSI; using Aaru.Devices; -using Schemas; +using Track = Aaru.CommonTypes.Structs.Track; using TrackType = Aaru.CommonTypes.Enums.TrackType; using Version = Aaru.CommonTypes.Interop.Version; @@ -158,8 +158,10 @@ public partial class Dump bool ret; - var mhddLog = new MhddLog(_outputPrefix + ".mhddlog.bin", _dev, blocks, blockSize, blocksToRead, _private, _dimensions); - var ibgLog = new IbgLog(_outputPrefix + ".ibg", 0x0010); + var mhddLog = new MhddLog(_outputPrefix + ".mhddlog.bin", _dev, blocks, blockSize, blocksToRead, _private, + _dimensions); + + var ibgLog = new IbgLog(_outputPrefix + ".ibg", 0x0010); ret = outputOptical.Create(_outputPath, dskType, _formatOptions, blocks, blockSize); // Cannot create image @@ -191,8 +193,8 @@ public partial class Dump } }); - DumpHardwareType currentTry = null; - ExtentsULong extents = null; + DumpHardware currentTry = null; + ExtentsULong extents = null; ResumeSupport.Process(true, _dev.IsRemovable, blocks, _dev.Manufacturer, _dev.Model, _dev.Serial, _dev.PlatformId, ref _resume, ref currentTry, ref extents, _dev.FirmwareRevision, @@ -589,14 +591,14 @@ public partial class Dump MediaPartNumber = mediaPartNumber }; - if(!outputOptical.SetMetadata(metadata)) + if(!outputOptical.SetImageInfo(metadata)) ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + Environment.NewLine + outputOptical.ErrorMessage); outputOptical.SetDumpHardware(_resume.Tries); if(_preSidecar != null) - outputOptical.SetCicmMetadata(_preSidecar); + outputOptical.SetMetadata(_preSidecar); _dumpLog.WriteLine(Localization.Core.Closing_output_file); UpdateStatus?.Invoke(Localization.Core.Closing_output_file); diff --git a/Aaru.Core/Devices/Dumping/ResumeSupport.cs b/Aaru.Core/Devices/Dumping/ResumeSupport.cs index 1a1d98317..55e4506bc 100644 --- a/Aaru.Core/Devices/Dumping/ResumeSupport.cs +++ b/Aaru.Core/Devices/Dumping/ResumeSupport.cs @@ -32,9 +32,9 @@ using System; using System.Collections.Generic; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Extents; using Aaru.CommonTypes.Metadata; -using Schemas; using PlatformID = Aaru.CommonTypes.Interop.PlatformID; using Version = Aaru.CommonTypes.Interop.Version; @@ -64,7 +64,7 @@ static class ResumeSupport /// progress dump /// internal static void Process(bool isLba, bool removable, ulong blocks, string manufacturer, string model, - string serial, PlatformID platform, ref Resume resume, ref DumpHardwareType currentTry, + string serial, PlatformID platform, ref Resume resume, ref DumpHardware currentTry, ref ExtentsULong extents, string firmware, bool @private, bool force, bool isTape = false) { @@ -102,7 +102,7 @@ static class ResumeSupport InvalidOperationException(string.Format(Localization.Core.Resume_file_different_number_of_blocks_not_continuing, resume.LastBlock + 1, blocks)); - foreach(DumpHardwareType oldTry in resume.Tries) + foreach(DumpHardware oldTry in resume.Tries) { if(!removable && !force) @@ -153,9 +153,9 @@ static class ResumeSupport if(currentTry != null) return; - currentTry = new DumpHardwareType + currentTry = new DumpHardware { - Software = CommonTypes.Metadata.Version.GetSoftwareType(), + Software = CommonTypes.Metadata.Version.GetSoftware(), Manufacturer = manufacturer, Model = model, Serial = serial, @@ -169,16 +169,16 @@ static class ResumeSupport { resume = new Resume { - Tries = new List(), + Tries = new List(), CreationDate = DateTime.UtcNow, BadBlocks = new List(), LastBlock = isTape ? 0 : blocks - 1, Tape = isTape }; - currentTry = new DumpHardwareType + currentTry = new DumpHardware { - Software = CommonTypes.Metadata.Version.GetSoftwareType(), + Software = CommonTypes.Metadata.Version.GetSoftware(), Manufacturer = manufacturer, Model = model, Serial = serial, diff --git a/Aaru.Core/Devices/Dumping/SSC.cs b/Aaru.Core/Devices/Dumping/SSC.cs index 3491ab793..1e34106bf 100644 --- a/Aaru.Core/Devices/Dumping/SSC.cs +++ b/Aaru.Core/Devices/Dumping/SSC.cs @@ -36,21 +36,23 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; +using System.Text.Json; +using System.Text.Json.Serialization; using System.Threading; -using System.Xml.Serialization; using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Extents; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Metadata; -using Aaru.CommonTypes.Structs; using Aaru.Core.Logging; using Aaru.Decoders.SCSI; using Aaru.Decoders.SCSI.SSC; using Aaru.Devices; using Aaru.Helpers; -using Schemas; using MediaType = Aaru.CommonTypes.MediaType; +using TapeFile = Aaru.CommonTypes.Structs.TapeFile; +using TapePartition = Aaru.CommonTypes.Structs.TapePartition; using Version = Aaru.CommonTypes.Interop.Version; namespace Aaru.Core.Devices.Dumping; @@ -498,8 +500,8 @@ partial class Dump } } - DumpHardwareType currentTry = null; - ExtentsULong extents = null; + DumpHardware currentTry = null; + ExtentsULong extents = null; ResumeSupport.Process(true, _dev.IsRemovable, blocks, _dev.Manufacturer, _dev.Model, _dev.Serial, _dev.PlatformId, ref _resume, ref currentTry, ref extents, _dev.FirmwareRevision, @@ -1306,12 +1308,12 @@ partial class Dump ApplicationVersion = Version.GetVersion() }; - if(!outputTape.SetMetadata(metadata)) + if(!outputTape.SetImageInfo(metadata)) ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + Environment.NewLine + outputTape.ErrorMessage); if(_preSidecar != null) - outputTape.SetCicmMetadata(_preSidecar); + outputTape.SetMetadata(_preSidecar); _dumpLog.WriteLine(Localization.Core.Closing_output_file); UpdateStatus?.Invoke(Localization.Core.Closing_output_file); @@ -1367,7 +1369,7 @@ partial class Dump _sidecarClass.UpdateProgressEvent2 += UpdateProgress2; _sidecarClass.EndProgressEvent2 += EndProgress2; _sidecarClass.UpdateStatusEvent += UpdateStatus; - CICMMetadataType sidecar = _sidecarClass.Create(); + Metadata sidecar = _sidecarClass.Create(); end = DateTime.UtcNow; if(!_aborted) @@ -1388,14 +1390,14 @@ partial class Dump if(_preSidecar != null) { - _preSidecar.BlockMedia = sidecar.BlockMedia; - sidecar = _preSidecar; + _preSidecar.BlockMedias = sidecar.BlockMedias; + sidecar = _preSidecar; } List<(ulong start, string type)> filesystems = new(); - if(sidecar.BlockMedia[0].FileSystemInformation != null) - filesystems.AddRange(from partition in sidecar.BlockMedia[0].FileSystemInformation + if(sidecar.BlockMedias[0].FileSystemInformation != null) + filesystems.AddRange(from partition in sidecar.BlockMedias[0].FileSystemInformation where partition.FileSystems != null from fileSystem in partition.FileSystems select (partition.StartSector, fileSystem.Type)); @@ -1413,44 +1415,48 @@ partial class Dump filesystem.start); } - sidecar.BlockMedia[0].Dimensions = Dimensions.DimensionsFromMediaType(dskType); + sidecar.BlockMedias[0].Dimensions = Dimensions.DimensionsFromMediaType(dskType); (string type, string subType) xmlType = CommonTypes.Metadata.MediaType.MediaTypeToString(dskType); - sidecar.BlockMedia[0].DiskType = xmlType.type; - sidecar.BlockMedia[0].DiskSubType = xmlType.subType; + sidecar.BlockMedias[0].MediaType = xmlType.type; + sidecar.BlockMedias[0].MediaSubType = xmlType.subType; // TODO: Implement device firmware revision if(!_dev.IsRemovable || _dev.IsUsb) if(_dev.Type == DeviceType.ATAPI) - sidecar.BlockMedia[0].Interface = "ATAPI"; + sidecar.BlockMedias[0].Interface = "ATAPI"; else if(_dev.IsUsb) - sidecar.BlockMedia[0].Interface = "USB"; + sidecar.BlockMedias[0].Interface = "USB"; else if(_dev.IsFireWire) - sidecar.BlockMedia[0].Interface = "FireWire"; + sidecar.BlockMedias[0].Interface = "FireWire"; else - sidecar.BlockMedia[0].Interface = "SCSI"; + sidecar.BlockMedias[0].Interface = "SCSI"; - sidecar.BlockMedia[0].LogicalBlocks = blocks; - sidecar.BlockMedia[0].Manufacturer = _dev.Manufacturer; - sidecar.BlockMedia[0].Model = _dev.Model; + sidecar.BlockMedias[0].LogicalBlocks = blocks; + sidecar.BlockMedias[0].Manufacturer = _dev.Manufacturer; + sidecar.BlockMedias[0].Model = _dev.Model; if(!_private) - sidecar.BlockMedia[0].Serial = _dev.Serial; + sidecar.BlockMedias[0].Serial = _dev.Serial; - sidecar.BlockMedia[0].Size = blocks * blockSize; + sidecar.BlockMedias[0].Size = blocks * blockSize; if(_dev.IsRemovable) - sidecar.BlockMedia[0].DumpHardwareArray = _resume.Tries.ToArray(); + sidecar.BlockMedias[0].DumpHardware = _resume.Tries; UpdateStatus?.Invoke(Localization.Core.Writing_metadata_sidecar); - var xmlFs = new FileStream(_outputPrefix + ".cicm.xml", FileMode.Create); + var jsonFs = new FileStream(_outputPrefix + ".metadata.json", FileMode.Create); - var xmlSer = new XmlSerializer(typeof(CICMMetadataType)); - xmlSer.Serialize(xmlFs, sidecar); - xmlFs.Close(); + JsonSerializer.Serialize(jsonFs, sidecar, new JsonSerializerOptions + { + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, + WriteIndented = true + }); + + jsonFs.Close(); } } diff --git a/Aaru.Core/Devices/Dumping/Sbc/Data.cs b/Aaru.Core/Devices/Dumping/Sbc/Data.cs index dcc861dd2..ad09b5000 100644 --- a/Aaru.Core/Devices/Dumping/Sbc/Data.cs +++ b/Aaru.Core/Devices/Dumping/Sbc/Data.cs @@ -27,6 +27,7 @@ using System; using System.Linq; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Extents; using Aaru.CommonTypes.Interfaces; @@ -34,7 +35,6 @@ using Aaru.Core.Logging; using Aaru.Decoders.DVD; using Aaru.Decryption; using Aaru.Decryption.DVD; -using Schemas; using DVDDecryption = Aaru.Decryption.DVD.Dump; // ReSharper disable JoinDeclarationAndInitializer @@ -62,7 +62,7 @@ partial class Dump /// Set if we need to start a trim /// DVD CSS decryption module /// The DVD disc key - void ReadSbcData(in ulong blocks, in uint maxBlocksToRead, in uint blockSize, DumpHardwareType currentTry, + void ReadSbcData(in ulong blocks, in uint maxBlocksToRead, in uint blockSize, DumpHardware currentTry, ExtentsULong extents, ref double currentSpeed, ref double minSpeed, ref double maxSpeed, ref double totalDuration, Reader scsiReader, MhddLog mhddLog, IbgLog ibgLog, ref double imageWriteDuration, ref bool newTrim, ref DVDDecryption dvdDecrypt, byte[] discKey) diff --git a/Aaru.Core/Devices/Dumping/Sbc/Dump.cs b/Aaru.Core/Devices/Dumping/Sbc/Dump.cs index c53af4e06..0fd14d72b 100644 --- a/Aaru.Core/Devices/Dumping/Sbc/Dump.cs +++ b/Aaru.Core/Devices/Dumping/Sbc/Dump.cs @@ -35,13 +35,14 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; -using System.Xml.Serialization; +using System.Text.Json; +using System.Text.Json.Serialization; using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Extents; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Metadata; -using Aaru.CommonTypes.Structs; using Aaru.CommonTypes.Structs.Devices.SCSI; using Aaru.Console; using Aaru.Core.Graphics; @@ -52,11 +53,12 @@ using Aaru.Decoders.DVD; using Aaru.Decoders.SCSI; using Aaru.Decoders.SCSI.MMC; using Aaru.Devices; -using Schemas; using DeviceReport = Aaru.Core.Devices.Report.DeviceReport; using DVDDecryption = Aaru.Decryption.DVD.Dump; using MediaType = Aaru.CommonTypes.MediaType; +using Track = Aaru.CommonTypes.Structs.Track; using TrackType = Aaru.CommonTypes.Enums.TrackType; +using Usb = Aaru.CommonTypes.AaruMetadata.Usb; using Version = Aaru.CommonTypes.Interop.Version; // ReSharper disable JoinDeclarationAndInitializer @@ -369,8 +371,10 @@ partial class Dump UpdateStatus?.Invoke(string.Format(Localization.Core.Reading_0_sectors_at_a_time, blocksToRead)); _dumpLog.WriteLine(Localization.Core.Reading_0_sectors_at_a_time, blocksToRead); - var mhddLog = new MhddLog(_outputPrefix + ".mhddlog.bin", _dev, blocks, blockSize, blocksToRead, _private, _dimensions); - var ibgLog = new IbgLog(_outputPrefix + ".ibg", sbcProfile); + var mhddLog = new MhddLog(_outputPrefix + ".mhddlog.bin", _dev, blocks, blockSize, blocksToRead, _private, + _dimensions); + + var ibgLog = new IbgLog(_outputPrefix + ".ibg", sbcProfile); bool imageCreated = false; if(!opticalDisc) @@ -697,8 +701,8 @@ partial class Dump } } - DumpHardwareType currentTry = null; - ExtentsULong extents = null; + DumpHardware currentTry = null; + ExtentsULong extents = null; ResumeSupport.Process(true, _dev.IsRemovable, blocks, _dev.Manufacturer, _dev.Model, _dev.Serial, _dev.PlatformId, ref _resume, ref currentTry, ref extents, _dev.FirmwareRevision, @@ -1023,12 +1027,12 @@ partial class Dump ApplicationVersion = Version.GetVersion() }; - if(!outputFormat.SetMetadata(metadata)) + if(!outputFormat.SetImageInfo(metadata)) ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + Environment.NewLine + outputFormat.ErrorMessage); if(_preSidecar != null) - outputFormat.SetCicmMetadata(_preSidecar); + outputFormat.SetMetadata(_preSidecar); _dumpLog.WriteLine(Localization.Core.Closing_output_file); UpdateStatus?.Invoke(Localization.Core.Closing_output_file); @@ -1082,7 +1086,7 @@ partial class Dump _sidecarClass.UpdateProgressEvent2 += UpdateProgress2; _sidecarClass.EndProgressEvent2 += EndProgress2; _sidecarClass.UpdateStatusEvent += UpdateStatus; - CICMMetadataType sidecar = _sidecarClass.Create(); + Metadata sidecar = _sidecarClass.Create(); end = DateTime.UtcNow; if(!_aborted) @@ -1103,8 +1107,8 @@ partial class Dump if(_preSidecar != null) { - _preSidecar.BlockMedia = sidecar.BlockMedia; - sidecar = _preSidecar; + _preSidecar.BlockMedias = sidecar.BlockMedias; + sidecar = _preSidecar; } // All USB flash drives report as removable, even if the media is not removable @@ -1114,15 +1118,15 @@ partial class Dump if(_dev.IsUsb && _dev.UsbDescriptors != null) if(outputFormat.SupportedMediaTags.Contains(MediaTagType.USB_Descriptors)) - sidecar.BlockMedia[0].USB = new USBType + sidecar.BlockMedias[0].Usb = new Usb { ProductID = _dev.UsbProductId, VendorID = _dev.UsbVendorId, - Descriptors = new DumpType + Descriptors = new CommonTypes.AaruMetadata.Dump { Image = _outputPath, Size = (ulong)_dev.UsbDescriptors.Length, - Checksums = Checksum.GetChecksums(_dev.UsbDescriptors).ToArray() + Checksums = Checksum.GetChecksums(_dev.UsbDescriptors) } }; @@ -1134,13 +1138,13 @@ partial class Dump if(!sense) if(outputFormat.SupportedMediaTags.Contains(MediaTagType.ATAPI_IDENTIFY)) - sidecar.BlockMedia[0].ATA = new ATAType + sidecar.BlockMedias[0].ATA = new ATA { - Identify = new DumpType + Identify = new CommonTypes.AaruMetadata.Dump { Image = _outputPath, Size = (ulong)cmdBuf.Length, - Checksums = Checksum.GetChecksums(cmdBuf).ToArray() + Checksums = Checksum.GetChecksums(cmdBuf) } }; } @@ -1150,13 +1154,13 @@ partial class Dump if(!sense) { if(outputFormat.SupportedMediaTags.Contains(MediaTagType.SCSI_INQUIRY)) - sidecar.BlockMedia[0].SCSI = new SCSIType + sidecar.BlockMedias[0].SCSI = new SCSI { - Inquiry = new DumpType + Inquiry = new CommonTypes.AaruMetadata.Dump { Image = _outputPath, Size = (ulong)cmdBuf.Length, - Checksums = Checksum.GetChecksums(cmdBuf).ToArray() + Checksums = Checksum.GetChecksums(cmdBuf) } }; @@ -1171,25 +1175,25 @@ partial class Dump if(pages != null) { - List evpds = new List(); + List evpds = new(); foreach(byte page in pages) { dumpLog.WriteLine("Requesting page {0:X2}h.", page); sense = dev.ScsiInquiry(out cmdBuf, out _, page); if(sense) continue; - EVPDType evpd = new EVPDType + Evpd evpd = new() { Image = $"{outputPrefix}.evpd_{page:X2}h.bin", - Checksums = Checksum.GetChecksums(cmdBuf).ToArray(), + Checksums = Checksum.GetChecksums(cmdBuf), Size = cmdBuf.Length }; - evpd.Checksums = Checksum.GetChecksums(cmdBuf).ToArray(); + evpd.Checksums = Checksum.GetChecksums(cmdBuf); DataFile.WriteTo("SCSI Dump", evpd.Image, cmdBuf); evpds.Add(evpd); } - if(evpds.Count > 0) sidecar.BlockMedia[0].SCSI.EVPD = evpds.ToArray(); + if(evpds.Count > 0) sidecar.BlockMedias[0].SCSI.Evpds = evpds; } } */ @@ -1209,11 +1213,11 @@ partial class Dump !_dev.Error) if(Modes.DecodeMode10(cmdBuf, _dev.ScsiType).HasValue) if(outputFormat.SupportedMediaTags.Contains(MediaTagType.SCSI_MODESENSE_10)) - sidecar.BlockMedia[0].SCSI.ModeSense10 = new DumpType + sidecar.BlockMedias[0].SCSI.ModeSense10 = new CommonTypes.AaruMetadata.Dump { Image = _outputPath, Size = (ulong)cmdBuf.Length, - Checksums = Checksum.GetChecksums(cmdBuf).ToArray() + Checksums = Checksum.GetChecksums(cmdBuf) }; UpdateStatus?.Invoke(Localization.Core.Requesting_MODE_SENSE_6); @@ -1233,19 +1237,19 @@ partial class Dump !_dev.Error) if(Modes.DecodeMode6(cmdBuf, _dev.ScsiType).HasValue) if(outputFormat.SupportedMediaTags.Contains(MediaTagType.SCSI_MODESENSE_6)) - sidecar.BlockMedia[0].SCSI.ModeSense = new DumpType + sidecar.BlockMedias[0].SCSI.ModeSense = new CommonTypes.AaruMetadata.Dump { Image = _outputPath, Size = (ulong)cmdBuf.Length, - Checksums = Checksum.GetChecksums(cmdBuf).ToArray() + Checksums = Checksum.GetChecksums(cmdBuf) }; } } List<(ulong start, string type)> filesystems = new(); - if(sidecar.BlockMedia[0].FileSystemInformation != null) - filesystems.AddRange(from partition in sidecar.BlockMedia[0].FileSystemInformation + if(sidecar.BlockMedias[0].FileSystemInformation != null) + filesystems.AddRange(from partition in sidecar.BlockMedias[0].FileSystemInformation where partition.FileSystems != null from fileSystem in partition.FileSystems select (partition.StartSector, fileSystem.Type)); @@ -1264,46 +1268,50 @@ partial class Dump filesystem.start); } - sidecar.BlockMedia[0].Dimensions = Dimensions.DimensionsFromMediaType(dskType); + sidecar.BlockMedias[0].Dimensions = Dimensions.DimensionsFromMediaType(dskType); (string type, string subType) xmlType = CommonTypes.Metadata.MediaType.MediaTypeToString(dskType); - sidecar.BlockMedia[0].DiskType = xmlType.type; - sidecar.BlockMedia[0].DiskSubType = xmlType.subType; + sidecar.BlockMedias[0].MediaType = xmlType.type; + sidecar.BlockMedias[0].MediaSubType = xmlType.subType; // TODO: Implement device firmware revision if(!_dev.IsRemovable || _dev.IsUsb) if(_dev.Type == DeviceType.ATAPI) - sidecar.BlockMedia[0].Interface = "ATAPI"; + sidecar.BlockMedias[0].Interface = "ATAPI"; else if(_dev.IsUsb) - sidecar.BlockMedia[0].Interface = "USB"; + sidecar.BlockMedias[0].Interface = "USB"; else if(_dev.IsFireWire) - sidecar.BlockMedia[0].Interface = "FireWire"; + sidecar.BlockMedias[0].Interface = "FireWire"; else - sidecar.BlockMedia[0].Interface = "SCSI"; + sidecar.BlockMedias[0].Interface = "SCSI"; - sidecar.BlockMedia[0].LogicalBlocks = blocks; - sidecar.BlockMedia[0].PhysicalBlockSize = physicalBlockSize; - sidecar.BlockMedia[0].LogicalBlockSize = logicalBlockSize; - sidecar.BlockMedia[0].Manufacturer = _dev.Manufacturer; - sidecar.BlockMedia[0].Model = _dev.Model; + sidecar.BlockMedias[0].LogicalBlocks = blocks; + sidecar.BlockMedias[0].PhysicalBlockSize = physicalBlockSize; + sidecar.BlockMedias[0].LogicalBlockSize = logicalBlockSize; + sidecar.BlockMedias[0].Manufacturer = _dev.Manufacturer; + sidecar.BlockMedias[0].Model = _dev.Model; if(!_private) - sidecar.BlockMedia[0].Serial = _dev.Serial; + sidecar.BlockMedias[0].Serial = _dev.Serial; - sidecar.BlockMedia[0].Size = blocks * blockSize; + sidecar.BlockMedias[0].Size = blocks * blockSize; if(_dev.IsRemovable) - sidecar.BlockMedia[0].DumpHardwareArray = _resume.Tries.ToArray(); + sidecar.BlockMedias[0].DumpHardware = _resume.Tries; UpdateStatus?.Invoke(Localization.Core.Writing_metadata_sidecar); - var xmlFs = new FileStream(_outputPrefix + ".cicm.xml", FileMode.Create); + var jsonFs = new FileStream(_outputPrefix + ".metadata.json", FileMode.Create); - var xmlSer = new XmlSerializer(typeof(CICMMetadataType)); - xmlSer.Serialize(xmlFs, sidecar); - xmlFs.Close(); + JsonSerializer.Serialize(jsonFs, sidecar, new JsonSerializerOptions + { + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, + WriteIndented = true + }); + + jsonFs.Close(); } } } diff --git a/Aaru.Core/Devices/Dumping/Sbc/Error.cs b/Aaru.Core/Devices/Dumping/Sbc/Error.cs index 75a6ab0be..3a10e4cac 100644 --- a/Aaru.Core/Devices/Dumping/Sbc/Error.cs +++ b/Aaru.Core/Devices/Dumping/Sbc/Error.cs @@ -26,6 +26,7 @@ // ****************************************************************************/ using System.Linq; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Extents; using Aaru.CommonTypes.Interfaces; @@ -36,7 +37,6 @@ using Aaru.Decoders.SCSI; using Aaru.Decryption; using Aaru.Decryption.DVD; using Aaru.Devices; -using Schemas; using DVDDecryption = Aaru.Decryption.DVD.Dump; // ReSharper disable JoinDeclarationAndInitializer @@ -53,7 +53,7 @@ partial class Dump /// Total time spent in commands /// SCSI reader /// Blank extents - void RetrySbcData(Reader scsiReader, DumpHardwareType currentTry, ExtentsULong extents, ref double totalDuration, + void RetrySbcData(Reader scsiReader, DumpHardware currentTry, ExtentsULong extents, ref double totalDuration, ExtentsULong blankExtents) { int pass = 1; @@ -326,7 +326,7 @@ partial class Dump } if(newBlank) - _resume.BlankExtents = ExtentsConverter.ToMetadata(blankExtents); + _resume.BlankExtents = ExtentsConverter.ToMetadata(blankExtents).ToArray(); EndProgress?.Invoke(); } diff --git a/Aaru.Core/Devices/Dumping/Sbc/Optical.cs b/Aaru.Core/Devices/Dumping/Sbc/Optical.cs index 6e8953de0..0a19a4a20 100644 --- a/Aaru.Core/Devices/Dumping/Sbc/Optical.cs +++ b/Aaru.Core/Devices/Dumping/Sbc/Optical.cs @@ -4,13 +4,13 @@ using System; using System.Linq; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Extents; using Aaru.CommonTypes.Interfaces; using Aaru.Console; using Aaru.Core.Logging; using Aaru.Decoders.SCSI; using Aaru.Helpers; -using Schemas; namespace Aaru.Core.Devices.Dumping; @@ -35,7 +35,7 @@ partial class Dump /// Total time spent writing to image /// Set if we need to start a trim /// Blank extents - void ReadOpticalData(in ulong blocks, in uint maxBlocksToRead, in uint blockSize, DumpHardwareType currentTry, + void ReadOpticalData(in ulong blocks, in uint maxBlocksToRead, in uint blockSize, DumpHardware currentTry, ExtentsULong extents, ref double currentSpeed, ref double minSpeed, ref double maxSpeed, ref double totalDuration, Reader scsiReader, MhddLog mhddLog, IbgLog ibgLog, ref double imageWriteDuration, ref bool newTrim, ref ExtentsULong blankExtents) @@ -148,7 +148,7 @@ partial class Dump } if(_resume != null && canMediumScan) - _resume.BlankExtents = ExtentsConverter.ToMetadata(blankExtents); + _resume.BlankExtents = ExtentsConverter.ToMetadata(blankExtents).ToArray(); EndProgress?.Invoke(); } diff --git a/Aaru.Core/Devices/Dumping/Sbc/Trim.cs b/Aaru.Core/Devices/Dumping/Sbc/Trim.cs index a900be3db..561251ab7 100644 --- a/Aaru.Core/Devices/Dumping/Sbc/Trim.cs +++ b/Aaru.Core/Devices/Dumping/Sbc/Trim.cs @@ -28,9 +28,9 @@ // ReSharper disable InlineOutVariableDeclaration // ReSharper disable TooWideLocalVariableScope +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Extents; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Core.Devices.Dumping; @@ -41,7 +41,7 @@ partial class Dump /// Correctly dump extents /// Resume information /// Blank extents - void TrimSbcData(Reader scsiReader, ExtentsULong extents, DumpHardwareType currentTry, ExtentsULong blankExtents) + void TrimSbcData(Reader scsiReader, ExtentsULong extents, DumpHardware currentTry, ExtentsULong blankExtents) { ulong[] tmpArray = _resume.BadBlocks.ToArray(); bool sense; @@ -95,6 +95,6 @@ partial class Dump } if(newBlank) - _resume.BlankExtents = ExtentsConverter.ToMetadata(blankExtents); + _resume.BlankExtents = ExtentsConverter.ToMetadata(blankExtents).ToArray(); } } \ No newline at end of file diff --git a/Aaru.Core/Devices/Dumping/SecureDigital.cs b/Aaru.Core/Devices/Dumping/SecureDigital.cs index 774ab3ba7..ffaf15fcd 100644 --- a/Aaru.Core/Devices/Dumping/SecureDigital.cs +++ b/Aaru.Core/Devices/Dumping/SecureDigital.cs @@ -36,8 +36,10 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; -using System.Xml.Serialization; +using System.Text.Json; +using System.Text.Json.Serialization; using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Extents; using Aaru.CommonTypes.Interfaces; @@ -46,7 +48,6 @@ using Aaru.Core.Graphics; using Aaru.Core.Logging; using Aaru.Decoders.MMC; using Aaru.Decoders.SecureDigital; -using Schemas; using CSD = Aaru.Decoders.MMC.CSD; using DeviceType = Aaru.CommonTypes.Enums.DeviceType; using MediaType = Aaru.CommonTypes.MediaType; @@ -418,8 +419,8 @@ public partial class Dump if(_skip < blocksToRead) _skip = blocksToRead; - DumpHardwareType currentTry = null; - ExtentsULong extents = null; + DumpHardware currentTry = null; + ExtentsULong extents = null; ResumeSupport.Process(true, false, blocks, _dev.Manufacturer, _dev.Model, _dev.Serial, _dev.PlatformId, ref _resume, ref currentTry, ref extents, _dev.FirmwareRevision, _private, _force); @@ -457,8 +458,10 @@ public partial class Dump } } - var mhddLog = new MhddLog(_outputPrefix + ".mhddlog.bin", _dev, blocks, blockSize, blocksToRead, _private, _dimensions); - var ibgLog = new IbgLog(_outputPrefix + ".ibg", sdProfile); + var mhddLog = new MhddLog(_outputPrefix + ".mhddlog.bin", _dev, blocks, blockSize, blocksToRead, _private, + _dimensions); + + var ibgLog = new IbgLog(_outputPrefix + ".ibg", sdProfile); ret = outputFormat.Create(_outputPath, _dev.Type == DeviceType.SecureDigital ? MediaType.SecureDigital : MediaType.MMC, @@ -867,12 +870,12 @@ public partial class Dump ApplicationVersion = Version.GetVersion() }; - if(!outputFormat.SetMetadata(metadata)) + if(!outputFormat.SetImageInfo(metadata)) ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + Environment.NewLine + outputFormat.ErrorMessage); if(_preSidecar != null) - outputFormat.SetCicmMetadata(_preSidecar); + outputFormat.SetMetadata(_preSidecar); _dumpLog.WriteLine(Localization.Core.Closing_output_file); UpdateStatus?.Invoke(Localization.Core.Closing_output_file); @@ -916,14 +919,14 @@ public partial class Dump _sidecarClass.UpdateProgressEvent2 += UpdateProgress2; _sidecarClass.EndProgressEvent2 += EndProgress2; _sidecarClass.UpdateStatusEvent += UpdateStatus; - CICMMetadataType sidecar = _sidecarClass.Create(); + Metadata sidecar = _sidecarClass.Create(); if(!_aborted) { if(_preSidecar != null) { - _preSidecar.BlockMedia = sidecar.BlockMedia; - sidecar = _preSidecar; + _preSidecar.BlockMedias = sidecar.BlockMedias; + sidecar = _preSidecar; } end = DateTime.UtcNow; @@ -949,39 +952,43 @@ public partial class Dump case DeviceType.MMC: xmlType = CommonTypes.Metadata.MediaType.MediaTypeToString(MediaType.MMC); - sidecar.BlockMedia[0].Dimensions = Dimensions.DimensionsFromMediaType(MediaType.MMC); + sidecar.BlockMedias[0].Dimensions = Dimensions.DimensionsFromMediaType(MediaType.MMC); break; case DeviceType.SecureDigital: CommonTypes.Metadata.MediaType.MediaTypeToString(MediaType.SecureDigital); - sidecar.BlockMedia[0].Dimensions = Dimensions.DimensionsFromMediaType(MediaType.SecureDigital); + sidecar.BlockMedias[0].Dimensions = Dimensions.DimensionsFromMediaType(MediaType.SecureDigital); break; } - sidecar.BlockMedia[0].DiskType = xmlType.type; - sidecar.BlockMedia[0].DiskSubType = xmlType.subType; + sidecar.BlockMedias[0].MediaType = xmlType.type; + sidecar.BlockMedias[0].MediaSubType = xmlType.subType; // TODO: Implement device firmware revision - sidecar.BlockMedia[0].LogicalBlocks = blocks; - sidecar.BlockMedia[0].PhysicalBlockSize = physicalBlockSize > 0 ? physicalBlockSize : blockSize; - sidecar.BlockMedia[0].LogicalBlockSize = blockSize; - sidecar.BlockMedia[0].Manufacturer = _dev.Manufacturer; - sidecar.BlockMedia[0].Model = _dev.Model; + sidecar.BlockMedias[0].LogicalBlocks = blocks; + sidecar.BlockMedias[0].PhysicalBlockSize = physicalBlockSize > 0 ? physicalBlockSize : blockSize; + sidecar.BlockMedias[0].LogicalBlockSize = blockSize; + sidecar.BlockMedias[0].Manufacturer = _dev.Manufacturer; + sidecar.BlockMedias[0].Model = _dev.Model; if(!_private) - sidecar.BlockMedia[0].Serial = _dev.Serial; + sidecar.BlockMedias[0].Serial = _dev.Serial; - sidecar.BlockMedia[0].Size = blocks * blockSize; + sidecar.BlockMedias[0].Size = blocks * blockSize; UpdateStatus?.Invoke(Localization.Core.Writing_metadata_sidecar); - var xmlFs = new FileStream(_outputPrefix + ".cicm.xml", FileMode.Create); + var jsonFs = new FileStream(_outputPrefix + ".metadata.json", FileMode.Create); - var xmlSer = new XmlSerializer(typeof(CICMMetadataType)); - xmlSer.Serialize(xmlFs, sidecar); - xmlFs.Close(); + JsonSerializer.Serialize(jsonFs, sidecar, new JsonSerializerOptions + { + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, + WriteIndented = true + }); + + jsonFs.Close(); } } diff --git a/Aaru.Core/Devices/Dumping/XGD.cs b/Aaru.Core/Devices/Dumping/XGD.cs index 88ca5ea23..fce741e4b 100644 --- a/Aaru.Core/Devices/Dumping/XGD.cs +++ b/Aaru.Core/Devices/Dumping/XGD.cs @@ -36,11 +36,11 @@ using System; using System.Collections.Generic; using System.Linq; using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Extents; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Interop; -using Aaru.CommonTypes.Structs; using Aaru.CommonTypes.Structs.Devices.SCSI; using Aaru.Console; using Aaru.Core.Graphics; @@ -49,9 +49,10 @@ using Aaru.Decoders.DVD; using Aaru.Decoders.SCSI; using Aaru.Decoders.Xbox; using Aaru.Devices; -using Schemas; using Device = Aaru.Devices.Remote.Device; +using Layers = Aaru.CommonTypes.AaruMetadata.Layers; using PlatformID = Aaru.CommonTypes.Interop.PlatformID; +using Track = Aaru.CommonTypes.Structs.Track; using TrackType = Aaru.CommonTypes.Enums.TrackType; using Version = Aaru.CommonTypes.Interop.Version; @@ -498,8 +499,10 @@ partial class Dump _dumpLog.WriteLine(Localization.Core.Reading_0_sectors_at_a_time, blocksToRead); UpdateStatus?.Invoke(string.Format(Localization.Core.Reading_0_sectors_at_a_time, blocksToRead)); - var mhddLog = new MhddLog(_outputPrefix + ".mhddlog.bin", _dev, blocks, blockSize, blocksToRead, _private, _dimensions); - var ibgLog = new IbgLog(_outputPrefix + ".ibg", 0x0010); + var mhddLog = new MhddLog(_outputPrefix + ".mhddlog.bin", _dev, blocks, blockSize, blocksToRead, _private, + _dimensions); + + var ibgLog = new IbgLog(_outputPrefix + ".ibg", 0x0010); ret = outputFormat.Create(_outputPath, dskType, _formatOptions, blocks, blockSize); // Cannot create image @@ -517,10 +520,10 @@ partial class Dump start = DateTime.UtcNow; double imageWriteDuration = 0; - double cmdDuration = 0; - uint saveBlocksToRead = blocksToRead; - DumpHardwareType currentTry = null; - ExtentsULong extents = null; + double cmdDuration = 0; + uint saveBlocksToRead = blocksToRead; + DumpHardware currentTry = null; + ExtentsULong extents = null; ResumeSupport.Process(true, true, totalSize, _dev.Manufacturer, _dev.Model, _dev.Serial, _dev.PlatformId, ref _resume, ref currentTry, ref extents, _dev.FirmwareRevision, _private, _force); @@ -1262,12 +1265,12 @@ partial class Dump ApplicationVersion = Version.GetVersion() }; - if(!outputFormat.SetMetadata(metadata)) + if(!outputFormat.SetImageInfo(metadata)) ErrorMessage?.Invoke(Localization.Core.Error_0_setting_metadata + Environment.NewLine + outputFormat.ErrorMessage); if(_preSidecar != null) - outputFormat.SetCicmMetadata(_preSidecar); + outputFormat.SetMetadata(_preSidecar); _dumpLog.WriteLine(Localization.Core.Closing_output_file); UpdateStatus?.Invoke(Localization.Core.Closing_output_file); @@ -1292,16 +1295,16 @@ partial class Dump if(_metadata) { - var layers = new LayersType + var layers = new Layers { - type = LayersTypeType.OTP, - typeSpecified = true, - Sectors = new SectorsType[1] - }; - - layers.Sectors[0] = new SectorsType - { - Value = layerBreak + Type = LayerType.OTP, + Sectors = new List + { + new() + { + Value = layerBreak + } + } }; WriteOpticalSidecar(blockSize, blocks, dskType, layers, mediaTags, 1, out totalChkDuration, null); diff --git a/Aaru.Core/ImageInfo.cs b/Aaru.Core/ImageInfo.cs index 51c626ed5..c59b78dbd 100644 --- a/Aaru.Core/ImageInfo.cs +++ b/Aaru.Core/ImageInfo.cs @@ -36,6 +36,7 @@ using System.Linq; using System.Text; using System.Text.Json; using System.Text.Json.Serialization; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Structs; @@ -49,12 +50,12 @@ using Aaru.Decoders.PCMCIA; using Aaru.Decoders.SCSI; using Aaru.Decoders.Xbox; using Aaru.Helpers; -using Schemas; using Spectre.Console; using DDS = Aaru.Decoders.DVD.DDS; using DMI = Aaru.Decoders.Xbox.DMI; using Inquiry = Aaru.Decoders.SCSI.Inquiry; using Session = Aaru.CommonTypes.Structs.Session; +using Track = Aaru.CommonTypes.Structs.Track; using Tuple = Aaru.Decoders.PCMCIA.Tuple; namespace Aaru.Core; @@ -105,7 +106,7 @@ public static class ImageInfo AaruConsole.WriteLine(Localization.Core.Last_modified_on_0, imageFormat.Info.LastModificationTime); AaruConsole.WriteLine(Localization.Core.Contains_a_media_of_type_0_and_XML_type_1_WithMarkup, - imageFormat.Info.MediaType, imageFormat.Info.XmlMediaType); + imageFormat.Info.MediaType, imageFormat.Info.MetadataMediaType); AaruConsole.WriteLine(imageFormat.Info.HasPartitions ? Localization.Core.Has_partitions : Localization.Core.Doesnt_have_partitions); @@ -161,9 +162,9 @@ public static class ImageInfo AaruConsole.WriteLine(Localization.Core.Drive_firmware_info_0_WithMarkup, Markup.Escape(imageFormat.Info.DriveFirmwareRevision)); - if(imageFormat.Info.Cylinders > 0 && - imageFormat.Info is { Heads: > 0, SectorsPerTrack: > 0 } && - imageFormat.Info.XmlMediaType != XmlMediaType.OpticalDisc && + if(imageFormat.Info.Cylinders > 0 && + imageFormat.Info is { Heads: > 0, SectorsPerTrack: > 0 } && + imageFormat.Info.MetadataMediaType != MetadataMediaType.OpticalDisc && imageFormat is not ITapeImage { IsTape: true }) AaruConsole.WriteLine(Localization.Core.Media_geometry_0_cylinders_1_heads_2_sectors_per_track_WithMarkup, imageFormat.Info.Cylinders, imageFormat.Info.Heads, imageFormat.Info.SectorsPerTrack); @@ -192,7 +193,7 @@ public static class ImageInfo AaruConsole.WriteLine(); - if(imageFormat.Info.XmlMediaType == XmlMediaType.LinearMedia) + if(imageFormat.Info.MetadataMediaType == MetadataMediaType.LinearMedia) PrintByteAddressableImageInfo(imageFormat as IByteAddressableImage); else PrintBlockImageInfo(imageFormat as IMediaImage); @@ -208,7 +209,7 @@ public static class ImageInfo int osLen = Localization.Core.Title_Operating_system.Length; int sectorLen = Localization.Core.Title_Start.Length; - foreach(DumpHardwareType dump in imageFormat.DumpHardware) + foreach(DumpHardware dump in imageFormat.DumpHardware) { if(dump.Manufacturer?.Length > manufacturerLen) manufacturerLen = dump.Manufacturer.Length; @@ -228,7 +229,7 @@ public static class ImageInfo if(dump.Software?.OperatingSystem?.Length > osLen) osLen = dump.Software.OperatingSystem.Length; - foreach(ExtentType extent in dump.Extents) + foreach(Extent extent in dump.Extents) { if($"{extent.Start}".Length > sectorLen) sectorLen = $"{extent.Start}".Length; @@ -252,9 +253,9 @@ public static class ImageInfo table.AddColumn(Localization.Core.Title_Start); table.AddColumn(Localization.Core.Title_End); - foreach(DumpHardwareType dump in imageFormat.DumpHardware) + foreach(DumpHardware dump in imageFormat.DumpHardware) { - foreach(ExtentType extent in dump.Extents) + foreach(Extent extent in dump.Extents) table.AddRow(Markup.Escape(dump.Manufacturer ?? ""), Markup.Escape(dump.Model ?? ""), Markup.Escape(dump.Serial ?? ""), Markup.Escape(dump.Software.Name ?? ""), Markup.Escape(dump.Software.Version ?? ""), @@ -527,7 +528,9 @@ public static class ImageInfo if(errno == ErrorNumber.NoError) { - AaruConsole.WriteLine(Localization.Core.DVD_RAM_Disc_Definition_Structure_contained_in_image_WithMarkup); + AaruConsole.WriteLine(Localization.Core. + DVD_RAM_Disc_Definition_Structure_contained_in_image_WithMarkup); + AaruConsole.Write("{0}", DDS.Prettify(dds)); AaruConsole.WriteLine(); } diff --git a/Aaru.Core/Sidecar/AudioMedia.cs b/Aaru.Core/Sidecar/AudioMedia.cs index 4e0374bb8..75b76becd 100644 --- a/Aaru.Core/Sidecar/AudioMedia.cs +++ b/Aaru.Core/Sidecar/AudioMedia.cs @@ -35,8 +35,8 @@ using System.Collections.Generic; using System.IO; using System.Text; using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Core; @@ -53,24 +53,24 @@ public sealed partial class Sidecar /// Metadata sidecar /// Encoding to be used for filesystem plugins static void AudioMedia(IBaseImage image, Guid filterId, string imagePath, FileInfo fi, PluginBase plugins, - List imgChecksums, ref CICMMetadataType sidecar, Encoding encoding) + List imgChecksums, ref Metadata sidecar, + Encoding encoding) { - sidecar.AudioMedia = new[] + sidecar.AudioMedia = new List { - new AudioMediaType + new() { - Checksums = imgChecksums.ToArray(), - Image = new ImageType + Checksums = imgChecksums, + Image = new Image { - format = image.Format, - offset = 0, - offsetSpecified = true, - Value = Path.GetFileName(imagePath) + Format = image.Format, + Offset = 0, + Value = Path.GetFileName(imagePath) }, Size = (ulong)fi.Length, - Sequence = new SequenceType + Sequence = new Sequence { - MediaTitle = image.Info.MediaTitle + Title = image.Info.MediaTitle } } }; diff --git a/Aaru.Core/Sidecar/BlockMedia.cs b/Aaru.Core/Sidecar/BlockMedia.cs index 49d7dbaaf..fc368a0da 100644 --- a/Aaru.Core/Sidecar/BlockMedia.cs +++ b/Aaru.Core/Sidecar/BlockMedia.cs @@ -36,19 +36,23 @@ using System.IO; using System.Linq; using System.Text; using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Metadata; -using Aaru.CommonTypes.Structs; using Aaru.CommonTypes.Structs.Devices.ATA; using Aaru.Console; using Aaru.Decoders.PCMCIA; using Aaru.DiscImages; using Aaru.Filters; using Aaru.Helpers; -using Schemas; +using Directory = System.IO.Directory; +using File = System.IO.File; using MediaType = Aaru.CommonTypes.Metadata.MediaType; +using Partition = Aaru.CommonTypes.Partition; +using Pcmcia = Aaru.CommonTypes.AaruMetadata.Pcmcia; using Tuple = Aaru.Decoders.PCMCIA.Tuple; +using Usb = Aaru.CommonTypes.AaruMetadata.Usb; namespace Aaru.Core; @@ -64,27 +68,26 @@ public sealed partial class Sidecar /// Metadata sidecar /// Encoding to be used for filesystem plugins void BlockMedia(IMediaImage image, Guid filterId, string imagePath, FileInfo fi, PluginBase plugins, - List imgChecksums, ref CICMMetadataType sidecar, Encoding encoding) + List imgChecksums, ref Metadata sidecar, Encoding encoding) { if(_aborted) return; - sidecar.BlockMedia = new[] + sidecar.BlockMedias = new List { - new BlockMediaType + new() { - Checksums = imgChecksums.ToArray(), - Image = new ImageType + Checksums = imgChecksums, + Image = new Image { - format = image.Format, - offset = 0, - offsetSpecified = true, - Value = Path.GetFileName(imagePath) + Format = image.Format, + Offset = 0, + Value = Path.GetFileName(imagePath) }, Size = (ulong)fi.Length, - Sequence = new SequenceType + Sequence = new Sequence { - MediaTitle = image.Info.MediaTitle + Title = image.Info.MediaTitle } } }; @@ -92,13 +95,13 @@ public sealed partial class Sidecar if(image.Info.MediaSequence != 0 && image.Info.LastMediaSequence != 0) { - sidecar.BlockMedia[0].Sequence.MediaSequence = (uint)image.Info.MediaSequence; - sidecar.BlockMedia[0].Sequence.TotalMedia = (uint)image.Info.LastMediaSequence; + sidecar.BlockMedias[0].Sequence.MediaSequence = (uint)image.Info.MediaSequence; + sidecar.BlockMedias[0].Sequence.TotalMedia = (uint)image.Info.LastMediaSequence; } else { - sidecar.BlockMedia[0].Sequence.MediaSequence = 1; - sidecar.BlockMedia[0].Sequence.TotalMedia = 1; + sidecar.BlockMedias[0].Sequence.MediaSequence = 1; + sidecar.BlockMedias[0].Sequence.TotalMedia = 1; } UpdateStatus(Localization.Core.Hashing_media_tags); @@ -118,11 +121,11 @@ public sealed partial class Sidecar if(errno != ErrorNumber.NoError) break; - sidecar.BlockMedia[0].ATA = new ATAType + sidecar.BlockMedias[0].ATA = new ATA { - Identify = new DumpType + Identify = new Dump { - Checksums = Checksum.GetChecksums(buffer).ToArray(), + Checksums = Checksum.GetChecksums(buffer), Size = (ulong)buffer.Length } }; @@ -134,11 +137,11 @@ public sealed partial class Sidecar if(errno != ErrorNumber.NoError) break; - sidecar.BlockMedia[0].ATA = new ATAType + sidecar.BlockMedias[0].ATA = new ATA { - Identify = new DumpType + Identify = new Dump { - Checksums = Checksum.GetChecksums(buffer).ToArray(), + Checksums = Checksum.GetChecksums(buffer), Size = (ulong)buffer.Length } }; @@ -150,11 +153,11 @@ public sealed partial class Sidecar if(errno != ErrorNumber.NoError) break; - sidecar.BlockMedia[0].PCMCIA = new PCMCIAType + sidecar.BlockMedias[0].Pcmcia = new Pcmcia { - CIS = new DumpType + Cis = new Dump { - Checksums = Checksum.GetChecksums(cis).ToArray(), + Checksums = Checksum.GetChecksums(cis), Size = (ulong)cis.Length } }; @@ -171,11 +174,9 @@ public sealed partial class Sidecar if(manfid != null) { - sidecar.BlockMedia[0].PCMCIA.ManufacturerCode = manfid.ManufacturerID; + sidecar.BlockMedias[0].Pcmcia.ManufacturerCode = manfid.ManufacturerID; - sidecar.BlockMedia[0].PCMCIA.CardCode = manfid.CardID; - sidecar.BlockMedia[0].PCMCIA.ManufacturerCodeSpecified = true; - sidecar.BlockMedia[0].PCMCIA.CardCodeSpecified = true; + sidecar.BlockMedias[0].Pcmcia.CardCode = manfid.CardID; } break; @@ -184,13 +185,14 @@ public sealed partial class Sidecar if(vers != null) { - sidecar.BlockMedia[0].PCMCIA.Manufacturer = vers.Manufacturer; - sidecar.BlockMedia[0].PCMCIA.ProductName = vers.Product; + sidecar.BlockMedias[0].Pcmcia.Manufacturer = vers.Manufacturer; + sidecar.BlockMedias[0].Pcmcia.ProductName = vers.Product; - sidecar.BlockMedia[0].PCMCIA.Compliance = + sidecar.BlockMedias[0].Pcmcia.Compliance = $"{vers.MajorVersion}.{vers.MinorVersion}"; - sidecar.BlockMedia[0].PCMCIA.AdditionalInformation = vers.AdditionalInformation; + sidecar.BlockMedias[0].Pcmcia.AdditionalInformation = + new List(vers.AdditionalInformation); } break; @@ -203,11 +205,11 @@ public sealed partial class Sidecar if(errno != ErrorNumber.NoError) break; - sidecar.BlockMedia[0].SCSI = new SCSIType + sidecar.BlockMedias[0].SCSI = new SCSI { - Inquiry = new DumpType + Inquiry = new Dump { - Checksums = Checksum.GetChecksums(buffer).ToArray(), + Checksums = Checksum.GetChecksums(buffer), Size = (ulong)buffer.Length } }; @@ -219,11 +221,11 @@ public sealed partial class Sidecar if(errno != ErrorNumber.NoError) break; - sidecar.BlockMedia[0].SecureDigital ??= new SecureDigitalType(); + sidecar.BlockMedias[0].SecureDigital ??= new SecureDigital(); - sidecar.BlockMedia[0].SecureDigital.CID = new DumpType + sidecar.BlockMedias[0].SecureDigital.CID = new Dump { - Checksums = Checksum.GetChecksums(buffer).ToArray(), + Checksums = Checksum.GetChecksums(buffer), Size = (ulong)buffer.Length }; @@ -234,11 +236,11 @@ public sealed partial class Sidecar if(errno != ErrorNumber.NoError) break; - sidecar.BlockMedia[0].SecureDigital ??= new SecureDigitalType(); + sidecar.BlockMedias[0].SecureDigital ??= new SecureDigital(); - sidecar.BlockMedia[0].SecureDigital.CSD = new DumpType + sidecar.BlockMedias[0].SecureDigital.CSD = new Dump { - Checksums = Checksum.GetChecksums(buffer).ToArray(), + Checksums = Checksum.GetChecksums(buffer), Size = (ulong)buffer.Length }; @@ -249,11 +251,11 @@ public sealed partial class Sidecar if(errno != ErrorNumber.NoError) break; - sidecar.BlockMedia[0].SecureDigital ??= new SecureDigitalType(); + sidecar.BlockMedias[0].SecureDigital ??= new SecureDigital(); - sidecar.BlockMedia[0].SecureDigital.SCR = new DumpType + sidecar.BlockMedias[0].SecureDigital.SCR = new Dump { - Checksums = Checksum.GetChecksums(buffer).ToArray(), + Checksums = Checksum.GetChecksums(buffer), Size = (ulong)buffer.Length }; @@ -264,11 +266,11 @@ public sealed partial class Sidecar if(errno != ErrorNumber.NoError) break; - sidecar.BlockMedia[0].SecureDigital ??= new SecureDigitalType(); + sidecar.BlockMedias[0].SecureDigital ??= new SecureDigital(); - sidecar.BlockMedia[0].SecureDigital.OCR = new DumpType + sidecar.BlockMedias[0].SecureDigital.OCR = new Dump { - Checksums = Checksum.GetChecksums(buffer).ToArray(), + Checksums = Checksum.GetChecksums(buffer), Size = (ulong)buffer.Length }; @@ -279,11 +281,11 @@ public sealed partial class Sidecar if(errno != ErrorNumber.NoError) break; - sidecar.BlockMedia[0].MultiMediaCard ??= new MultiMediaCardType(); + sidecar.BlockMedias[0].MultiMediaCard ??= new MultiMediaCard(); - sidecar.BlockMedia[0].MultiMediaCard.CID = new DumpType + sidecar.BlockMedias[0].MultiMediaCard.CID = new Dump { - Checksums = Checksum.GetChecksums(buffer).ToArray(), + Checksums = Checksum.GetChecksums(buffer), Size = (ulong)buffer.Length }; @@ -294,11 +296,11 @@ public sealed partial class Sidecar if(errno != ErrorNumber.NoError) break; - sidecar.BlockMedia[0].MultiMediaCard ??= new MultiMediaCardType(); + sidecar.BlockMedias[0].MultiMediaCard ??= new MultiMediaCard(); - sidecar.BlockMedia[0].MultiMediaCard.CSD = new DumpType + sidecar.BlockMedias[0].MultiMediaCard.CSD = new Dump { - Checksums = Checksum.GetChecksums(buffer).ToArray(), + Checksums = Checksum.GetChecksums(buffer), Size = (ulong)buffer.Length }; @@ -309,11 +311,11 @@ public sealed partial class Sidecar if(errno != ErrorNumber.NoError) break; - sidecar.BlockMedia[0].MultiMediaCard ??= new MultiMediaCardType(); + sidecar.BlockMedias[0].MultiMediaCard ??= new MultiMediaCard(); - sidecar.BlockMedia[0].MultiMediaCard.OCR = new DumpType + sidecar.BlockMedias[0].MultiMediaCard.OCR = new Dump { - Checksums = Checksum.GetChecksums(buffer).ToArray(), + Checksums = Checksum.GetChecksums(buffer), Size = (ulong)buffer.Length }; @@ -324,11 +326,11 @@ public sealed partial class Sidecar if(errno != ErrorNumber.NoError) break; - sidecar.BlockMedia[0].MultiMediaCard ??= new MultiMediaCardType(); + sidecar.BlockMedias[0].MultiMediaCard ??= new MultiMediaCard(); - sidecar.BlockMedia[0].MultiMediaCard.ExtendedCSD = new DumpType + sidecar.BlockMedias[0].MultiMediaCard.ExtendedCSD = new Dump { - Checksums = Checksum.GetChecksums(buffer).ToArray(), + Checksums = Checksum.GetChecksums(buffer), Size = (ulong)buffer.Length }; @@ -339,11 +341,11 @@ public sealed partial class Sidecar if(errno != ErrorNumber.NoError) break; - sidecar.BlockMedia[0].USB ??= new USBType(); + sidecar.BlockMedias[0].Usb ??= new Usb(); - sidecar.BlockMedia[0].USB.Descriptors = new DumpType + sidecar.BlockMedias[0].Usb.Descriptors = new Dump { - Checksums = Checksum.GetChecksums(buffer).ToArray(), + Checksums = Checksum.GetChecksums(buffer), Size = (ulong)buffer.Length }; @@ -354,11 +356,11 @@ public sealed partial class Sidecar if(errno != ErrorNumber.NoError) break; - sidecar.BlockMedia[0].SCSI ??= new SCSIType(); + sidecar.BlockMedias[0].SCSI ??= new SCSI(); - sidecar.BlockMedia[0].SCSI.ModeSense = new DumpType + sidecar.BlockMedias[0].SCSI.ModeSense = new Dump { - Checksums = Checksum.GetChecksums(buffer).ToArray(), + Checksums = Checksum.GetChecksums(buffer), Size = (ulong)buffer.Length }; @@ -369,11 +371,11 @@ public sealed partial class Sidecar if(errno != ErrorNumber.NoError) break; - sidecar.BlockMedia[0].SCSI ??= new SCSIType(); + sidecar.BlockMedias[0].SCSI ??= new SCSI(); - sidecar.BlockMedia[0].SCSI.ModeSense10 = new DumpType + sidecar.BlockMedias[0].SCSI.ModeSense10 = new Dump { - Checksums = Checksum.GetChecksums(buffer).ToArray(), + Checksums = Checksum.GetChecksums(buffer), Size = (ulong)buffer.Length }; @@ -384,7 +386,7 @@ public sealed partial class Sidecar // If there is only one track, and it's the same as the image file (e.g. ".iso" files), don't re-checksum. if(image.Id == new Guid("12345678-AAAA-BBBB-CCCC-123456789000") && filterId == new Guid("12345678-AAAA-BBBB-CCCC-123456789000")) - sidecar.BlockMedia[0].ContentChecksums = sidecar.BlockMedia[0].Checksums; + sidecar.BlockMedias[0].ContentChecksums = sidecar.BlockMedias[0].Checksums; else { UpdateStatus(Localization.Core.Hashing_sectors); @@ -448,42 +450,40 @@ public sealed partial class Sidecar // For fast debugging, skip checksum //skipImageChecksum: - List cntChecksums = contentChkWorker.End(); - - sidecar.BlockMedia[0].ContentChecksums = cntChecksums.ToArray(); + sidecar.BlockMedias[0].ContentChecksums = contentChkWorker.End(); EndProgress2(); } (string type, string subType) diskType = MediaType.MediaTypeToString(image.Info.MediaType); - sidecar.BlockMedia[0].DiskType = diskType.type; - sidecar.BlockMedia[0].DiskSubType = diskType.subType; + sidecar.BlockMedias[0].MediaType = diskType.type; + sidecar.BlockMedias[0].MediaSubType = diskType.subType; Statistics.AddMedia(image.Info.MediaType, false); - sidecar.BlockMedia[0].Dimensions = Dimensions.DimensionsFromMediaType(image.Info.MediaType); + sidecar.BlockMedias[0].Dimensions = Dimensions.DimensionsFromMediaType(image.Info.MediaType); - sidecar.BlockMedia[0].LogicalBlocks = image.Info.Sectors; - sidecar.BlockMedia[0].LogicalBlockSize = image.Info.SectorSize; + sidecar.BlockMedias[0].LogicalBlocks = image.Info.Sectors; + sidecar.BlockMedias[0].LogicalBlockSize = image.Info.SectorSize; // TODO: Detect it - sidecar.BlockMedia[0].PhysicalBlockSize = image.Info.SectorSize; + sidecar.BlockMedias[0].PhysicalBlockSize = image.Info.SectorSize; if(image is ITapeImage { IsTape: true } tapeImage) { - List tapePartitions = new(); + List tapePartitions = new(); - foreach(TapePartition tapePartition in tapeImage.TapePartitions) + foreach(CommonTypes.Structs.TapePartition tapePartition in tapeImage.TapePartitions) { - var thisPartition = new TapePartitionType + var thisPartition = new TapePartition { - Image = sidecar.BlockMedia[0].Image, + Image = sidecar.BlockMedias[0].Image, Sequence = tapePartition.Number, StartBlock = tapePartition.FirstBlock, EndBlock = tapePartition.LastBlock }; if(tapeImage.TapePartitions.Count == 1) - thisPartition.Checksums = sidecar.BlockMedia[0].ContentChecksums; + thisPartition.Checksums = sidecar.BlockMedias[0].ContentChecksums; else { UpdateStatus(string.Format(Localization.Core.Hashing_partition_0, tapePartition.Number)); @@ -560,23 +560,22 @@ public sealed partial class Sidecar // For fast debugging, skip checksum //skipImageChecksum: - List partitionChecksums = tapePartitionChk.End(); - - thisPartition.Checksums = partitionChecksums.ToArray(); + thisPartition.Checksums = tapePartitionChk.End(); EndProgress2(); } - List filesInPartition = new(); + List filesInPartition = new(); - foreach(TapeFile tapeFile in tapeImage.Files.Where(f => f.Partition == tapePartition.Number)) + foreach(CommonTypes.Structs.TapeFile tapeFile in + tapeImage.Files.Where(f => f.Partition == tapePartition.Number)) { - var thisFile = new TapeFileType + var thisFile = new TapeFile { Sequence = tapeFile.File, StartBlock = tapeFile.FirstBlock, EndBlock = tapeFile.LastBlock, - Image = sidecar.BlockMedia[0].Image, + Image = sidecar.BlockMedias[0].Image, Size = 0, BlockSize = 0 }; @@ -666,9 +665,7 @@ public sealed partial class Sidecar // For fast debugging, skip checksum //skipImageChecksum: - List fileChecksums = tapeFileChk.End(); - - thisFile.Checksums = fileChecksums.ToArray(); + thisFile.Checksums = tapeFileChk.End(); EndProgress2(); } @@ -676,11 +673,11 @@ public sealed partial class Sidecar filesInPartition.Add(thisFile); } - thisPartition.File = filesInPartition.ToArray(); + thisPartition.File = filesInPartition; tapePartitions.Add(thisPartition); } - sidecar.BlockMedia[0].TapeInformation = tapePartitions.ToArray(); + sidecar.BlockMedias[0].TapeInformation = tapePartitions; } UpdateStatus(Localization.Core.Checking_filesystems); @@ -691,28 +688,26 @@ public sealed partial class Sidecar List partitions = Partitions.GetAll(image); Partitions.AddSchemesToStats(partitions); - sidecar.BlockMedia[0].FileSystemInformation = new PartitionType[1]; + sidecar.BlockMedias[0].FileSystemInformation = new List(); if(partitions.Count > 0) { - sidecar.BlockMedia[0].FileSystemInformation = new PartitionType[partitions.Count]; - - for(int i = 0; i < partitions.Count; i++) + foreach(Partition partition in partitions) { if(_aborted) return; - sidecar.BlockMedia[0].FileSystemInformation[i] = new PartitionType + var fsInfo = new CommonTypes.AaruMetadata.Partition { - Description = partitions[i].Description, - EndSector = partitions[i].End, - Name = partitions[i].Name, - Sequence = (uint)partitions[i].Sequence, - StartSector = partitions[i].Start, - Type = partitions[i].Type + Description = partition.Description, + EndSector = partition.End, + Name = partition.Name, + Sequence = (uint)partition.Sequence, + StartSector = partition.Start, + Type = partition.Type }; - List lstFs = new(); + List lstFs = new(); foreach(IFilesystem plugin in plugins.PluginsList.Values) try @@ -720,23 +715,23 @@ public sealed partial class Sidecar if(_aborted) return; - if(!plugin.Identify(image, partitions[i])) + if(!plugin.Identify(image, partition)) continue; if(plugin is IReadOnlyFilesystem fsPlugin && - fsPlugin.Mount(image, partitions[i], encoding, null, null) == ErrorNumber.NoError) + fsPlugin.Mount(image, partition, encoding, null, null) == ErrorNumber.NoError) { - UpdateStatus(string.Format(Localization.Core.Mounting_0, fsPlugin.XmlFsType.Type)); + UpdateStatus(string.Format(Localization.Core.Mounting_0, fsPlugin.Metadata.Type)); - fsPlugin.XmlFsType.Contents = Files(fsPlugin); + fsPlugin.Metadata.Contents = Files(fsPlugin); fsPlugin.Unmount(); } else - plugin.GetInformation(image, partitions[i], out _, encoding); + plugin.GetInformation(image, partition, out _, encoding); - lstFs.Add(plugin.XmlFsType); - Statistics.AddFilesystem(plugin.XmlFsType.Type); + lstFs.Add(plugin.Metadata); + Statistics.AddFilesystem(plugin.Metadata.Type); } #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body catch @@ -746,7 +741,9 @@ public sealed partial class Sidecar } if(lstFs.Count > 0) - sidecar.BlockMedia[0].FileSystemInformation[i].FileSystems = lstFs.ToArray(); + fsInfo.FileSystems = lstFs; + + sidecar.BlockMedias[0].FileSystemInformation.Add(fsInfo); } } else @@ -754,7 +751,7 @@ public sealed partial class Sidecar if(_aborted) return; - sidecar.BlockMedia[0].FileSystemInformation[0] = new PartitionType + var fsInfo = new CommonTypes.AaruMetadata.Partition { StartSector = 0, EndSector = image.Info.Sectors - 1 @@ -767,7 +764,7 @@ public sealed partial class Sidecar Size = image.Info.Sectors * image.Info.SectorSize }; - List lstFs = new(); + List lstFs = new(); foreach(IFilesystem plugin in plugins.PluginsList.Values) try @@ -781,17 +778,17 @@ public sealed partial class Sidecar if(plugin is IReadOnlyFilesystem fsPlugin && fsPlugin.Mount(image, wholePart, encoding, null, null) == ErrorNumber.NoError) { - UpdateStatus(string.Format(Localization.Core.Mounting_0, fsPlugin.XmlFsType.Type)); + UpdateStatus(string.Format(Localization.Core.Mounting_0, fsPlugin.Metadata.Type)); - fsPlugin.XmlFsType.Contents = Files(fsPlugin); + fsPlugin.Metadata.Contents = Files(fsPlugin); fsPlugin.Unmount(); } else plugin.GetInformation(image, wholePart, out _, encoding); - lstFs.Add(plugin.XmlFsType); - Statistics.AddFilesystem(plugin.XmlFsType.Type); + lstFs.Add(plugin.Metadata); + Statistics.AddFilesystem(plugin.Metadata.Type); } #pragma warning disable RECS0022 // A catch clause that catches System.Exception and has an empty body catch @@ -801,7 +798,9 @@ public sealed partial class Sidecar } if(lstFs.Count > 0) - sidecar.BlockMedia[0].FileSystemInformation[0].FileSystems = lstFs.ToArray(); + fsInfo.FileSystems = lstFs; + + sidecar.BlockMedias[0].FileSystemInformation.Add(fsInfo); } UpdateStatus(Localization.Core.Saving_metadata); @@ -809,12 +808,9 @@ public sealed partial class Sidecar if(image.Info.Cylinders > 0 && image.Info is { Heads: > 0, SectorsPerTrack: > 0 }) { - sidecar.BlockMedia[0].CylindersSpecified = true; - sidecar.BlockMedia[0].HeadsSpecified = true; - sidecar.BlockMedia[0].SectorsPerTrackSpecified = true; - sidecar.BlockMedia[0].Cylinders = image.Info.Cylinders; - sidecar.BlockMedia[0].Heads = (ushort)image.Info.Heads; - sidecar.BlockMedia[0].SectorsPerTrack = image.Info.SectorsPerTrack; + sidecar.BlockMedias[0].Cylinders = image.Info.Cylinders; + sidecar.BlockMedias[0].Heads = (ushort)image.Info.Heads; + sidecar.BlockMedias[0].SectorsPerTrack = image.Info.SectorsPerTrack; } if(image.Info.ReadableMediaTags.Contains(MediaTagType.ATA_IDENTIFY)) @@ -830,28 +826,21 @@ public sealed partial class Sidecar ataId.Value.CurrentHeads > 0 && ataId.Value.CurrentSectorsPerTrack > 0) { - sidecar.BlockMedia[0].CylindersSpecified = true; - sidecar.BlockMedia[0].HeadsSpecified = true; - sidecar.BlockMedia[0].SectorsPerTrackSpecified = true; - sidecar.BlockMedia[0].Cylinders = ataId.Value.CurrentCylinders; - sidecar.BlockMedia[0].Heads = ataId.Value.CurrentHeads; - sidecar.BlockMedia[0].SectorsPerTrack = ataId.Value.CurrentSectorsPerTrack; + sidecar.BlockMedias[0].Cylinders = ataId.Value.CurrentCylinders; + sidecar.BlockMedias[0].Heads = ataId.Value.CurrentHeads; + sidecar.BlockMedias[0].SectorsPerTrack = ataId.Value.CurrentSectorsPerTrack; } else if(ataId.Value.Cylinders > 0 && ataId.Value.Heads > 0 && ataId.Value.SectorsPerTrack > 0) { - sidecar.BlockMedia[0].CylindersSpecified = true; - sidecar.BlockMedia[0].HeadsSpecified = true; - sidecar.BlockMedia[0].SectorsPerTrackSpecified = true; - sidecar.BlockMedia[0].Cylinders = ataId.Value.Cylinders; - sidecar.BlockMedia[0].Heads = ataId.Value.Heads; - sidecar.BlockMedia[0].SectorsPerTrack = ataId.Value.SectorsPerTrack; + sidecar.BlockMedias[0].Cylinders = ataId.Value.Cylinders; + sidecar.BlockMedias[0].Heads = ataId.Value.Heads; + sidecar.BlockMedias[0].SectorsPerTrack = ataId.Value.SectorsPerTrack; } } - if(image.DumpHardware != null) - sidecar.BlockMedia[0].DumpHardwareArray = image.DumpHardware.ToArray(); + sidecar.BlockMedias[0].DumpHardware = image.DumpHardware; // TODO: This is more of a hack, redo it planned for >4.0 string trkFormat = null; @@ -1009,24 +998,24 @@ public sealed partial class Sidecar (image.Info.Heads == 1 && scpImage.Header.heads is 1 or 2)) if(scpImage.Header.end + 1 >= image.Info.Cylinders) { - List scpBlockTrackTypes = new(); - ulong currentSector = 0; - Stream scpStream = scpFilter.GetDataForkStream(); + List scpBlockTrackTypes = new(); + ulong currentSector = 0; + Stream scpStream = scpFilter.GetDataForkStream(); for(byte t = scpImage.Header.start; t <= scpImage.Header.end; t++) { if(_aborted) return; - var scpBlockTrackType = new BlockTrackType + var scpBlockTrackType = new BlockTrack { Cylinder = t / image.Info.Heads, Head = (ushort)(t % image.Info.Heads), - Image = new ImageType + Image = new Image { - format = scpImage.Format, + Format = scpImage.Format, Value = Path.GetFileName(scpFilePath), - offset = scpImage.Header.offsets[t] + Offset = scpImage.Header.offsets[t] } }; @@ -1049,14 +1038,14 @@ public sealed partial class Sidecar scpStream.Position = scpImage.Header.offsets[t]; scpStream.EnsureRead(trackContents, 0, trackContents.Length); scpBlockTrackType.Size = (ulong)trackContents.Length; - scpBlockTrackType.Checksums = Checksum.GetChecksums(trackContents).ToArray(); + scpBlockTrackType.Checksums = Checksum.GetChecksums(trackContents); } scpBlockTrackTypes.Add(scpBlockTrackType); } - sidecar.BlockMedia[0].Track = scpBlockTrackTypes.OrderBy(t => t.Cylinder). - ThenBy(t => t.Head).ToArray(); + sidecar.BlockMedias[0].Track = scpBlockTrackTypes.OrderBy(t => t.Cylinder). + ThenBy(t => t.Head).ToList(); } else AaruConsole. @@ -1115,7 +1104,7 @@ public sealed partial class Sidecar if(kfImage.Info.Heads == image.Info.Heads) if(kfImage.Info.Cylinders >= image.Info.Cylinders) { - List kfBlockTrackTypes = new(); + List kfBlockTrackTypes = new(); ulong currentSector = 0; @@ -1124,18 +1113,18 @@ public sealed partial class Sidecar if(_aborted) return; - var kfBlockTrackType = new BlockTrackType + var kfBlockTrackType = new BlockTrack { Cylinder = kvp.Key / image.Info.Heads, Head = (ushort)(kvp.Key % image.Info.Heads), - Image = new ImageType + Image = new Image { - format = kfImage.Format, + Format = kfImage.Format, Value = kfDir ? Path. Combine(Path.GetFileName(Path.GetDirectoryName(kvp.Value.BasePath)), kvp.Value.Filename) : kvp.Value.Filename, - offset = 0 + Offset = 0 } }; @@ -1154,13 +1143,13 @@ public sealed partial class Sidecar kfStream.Position = 0; kfStream.EnsureRead(trackContents, 0, trackContents.Length); kfBlockTrackType.Size = (ulong)trackContents.Length; - kfBlockTrackType.Checksums = Checksum.GetChecksums(trackContents).ToArray(); + kfBlockTrackType.Checksums = Checksum.GetChecksums(trackContents); kfBlockTrackTypes.Add(kfBlockTrackType); } - sidecar.BlockMedia[0].Track = kfBlockTrackTypes.OrderBy(t => t.Cylinder). - ThenBy(t => t.Head).ToArray(); + sidecar.BlockMedias[0].Track = kfBlockTrackTypes.OrderBy(t => t.Cylinder). + ThenBy(t => t.Head).ToList(); } else AaruConsole. @@ -1202,22 +1191,22 @@ public sealed partial class Sidecar if(image.Info.Heads == dfiImage.Info.Heads) if(dfiImage.Info.Cylinders >= image.Info.Cylinders) { - List dfiBlockTrackTypes = new(); - ulong currentSector = 0; - Stream dfiStream = dfiFilter.GetDataForkStream(); + List dfiBlockTrackTypes = new(); + ulong currentSector = 0; + Stream dfiStream = dfiFilter.GetDataForkStream(); foreach(int t in dfiImage.TrackOffsets.Keys) { if(_aborted) return; - var dfiBlockTrackType = new BlockTrackType + var dfiBlockTrackType = new BlockTrack { Cylinder = (uint)(t / image.Info.Heads), Head = (ushort)(t % image.Info.Heads), - Image = new ImageType + Image = new Image { - format = dfiImage.Format, + Format = dfiImage.Format, Value = Path.GetFileName(dfiFilePath) } }; @@ -1235,18 +1224,18 @@ public sealed partial class Sidecar if(dfiImage.TrackOffsets.TryGetValue(t, out long offset) && dfiImage.TrackLengths.TryGetValue(t, out long length)) { - dfiBlockTrackType.Image.offset = (ulong)offset; + dfiBlockTrackType.Image.Offset = (ulong)offset; byte[] trackContents = new byte[length]; dfiStream.Position = offset; dfiStream.EnsureRead(trackContents, 0, trackContents.Length); dfiBlockTrackType.Size = (ulong)trackContents.Length; - dfiBlockTrackType.Checksums = Checksum.GetChecksums(trackContents).ToArray(); + dfiBlockTrackType.Checksums = Checksum.GetChecksums(trackContents); } dfiBlockTrackTypes.Add(dfiBlockTrackType); } - sidecar.BlockMedia[0].Track = dfiBlockTrackTypes.OrderBy(t => t.Cylinder).ThenBy(t => t.Head).ToArray(); + sidecar.BlockMedias[0].Track = dfiBlockTrackTypes.OrderBy(t => t.Cylinder).ThenBy(t => t.Head).ToList(); } else AaruConsole. diff --git a/Aaru.Core/Sidecar/BlockTape.cs b/Aaru.Core/Sidecar/BlockTape.cs index afb31b48d..bdb6731d6 100644 --- a/Aaru.Core/Sidecar/BlockTape.cs +++ b/Aaru.Core/Sidecar/BlockTape.cs @@ -32,8 +32,8 @@ using System.Collections.Generic; using System.IO; +using Aaru.CommonTypes.AaruMetadata; using Aaru.Helpers; -using Schemas; namespace Aaru.Core; @@ -44,37 +44,35 @@ public sealed partial class Sidecar /// List of files /// Dump path /// Expected block size in bytes - public CICMMetadataType BlockTape(string folderName, List files, uint blockSize) + public Metadata BlockTape(string folderName, List files, uint blockSize) { - _sidecar = new CICMMetadataType + _sidecar = new Metadata { - BlockMedia = new[] + BlockMedias = new List { - new BlockMediaType + new() { - Image = new ImageType + Image = new Image { - format = "Directory", - offsetSpecified = false, - Value = folderName + Format = "Directory", + Value = folderName }, - Sequence = new SequenceType + Sequence = new Sequence { - MediaTitle = folderName, + Title = folderName, MediaSequence = 1, TotalMedia = 1 }, PhysicalBlockSize = blockSize, LogicalBlockSize = blockSize, - TapeInformation = new[] + TapeInformation = new List { - new TapePartitionType + new() { - Image = new ImageType + Image = new Image { - format = "Directory", - offsetSpecified = false, - Value = folderName + Format = "Directory", + Value = folderName } } } @@ -85,10 +83,10 @@ public sealed partial class Sidecar if(_aborted) return _sidecar; - ulong currentBlock = 0; - ulong totalSize = 0; - var tapeWorker = new Checksum(); - List tapeFiles = new(); + ulong currentBlock = 0; + ulong totalSize = 0; + var tapeWorker = new Checksum(); + List tapeFiles = new(); UpdateStatus(Localization.Core.Hashing_files); @@ -100,12 +98,12 @@ public sealed partial class Sidecar _fs = new FileStream(files[i], FileMode.Open, FileAccess.Read); var fileWorker = new Checksum(); - var tapeFile = new TapeFileType + var tapeFile = new TapeFile { - Image = new ImageType + Image = new Image { - format = "Raw disk image (sector by sector copy)", - offset = 0, + Format = "Raw disk image (sector by sector copy)", + Offset = 0, Value = Path.GetFileName(files[i]) }, Size = (ulong)_fs.Length, @@ -159,92 +157,92 @@ public sealed partial class Sidecar tapeFile.EndBlock = tapeFile.StartBlock + sectors - 1; currentBlock += sectors; totalSize += (ulong)_fs.Length; - tapeFile.Checksums = fileWorker.End().ToArray(); + tapeFile.Checksums = fileWorker.End(); tapeFiles.Add(tapeFile); EndProgress2(); } UpdateStatus("Setting metadata..."); - _sidecar.BlockMedia[0].Checksums = tapeWorker.End().ToArray(); - _sidecar.BlockMedia[0].ContentChecksums = _sidecar.BlockMedia[0].Checksums; - _sidecar.BlockMedia[0].Size = totalSize; - _sidecar.BlockMedia[0].LogicalBlocks = currentBlock; - _sidecar.BlockMedia[0].TapeInformation[0].EndBlock = currentBlock - 1; - _sidecar.BlockMedia[0].TapeInformation[0].Size = totalSize; - _sidecar.BlockMedia[0].TapeInformation[0].Checksums = _sidecar.BlockMedia[0].Checksums; - _sidecar.BlockMedia[0].TapeInformation[0].File = tapeFiles.ToArray(); + _sidecar.BlockMedias[0].Checksums = tapeWorker.End(); + _sidecar.BlockMedias[0].ContentChecksums = _sidecar.BlockMedias[0].Checksums; + _sidecar.BlockMedias[0].Size = totalSize; + _sidecar.BlockMedias[0].LogicalBlocks = currentBlock; + _sidecar.BlockMedias[0].TapeInformation[0].EndBlock = currentBlock - 1; + _sidecar.BlockMedias[0].TapeInformation[0].Size = totalSize; + _sidecar.BlockMedias[0].TapeInformation[0].Checksums = _sidecar.BlockMedias[0].Checksums; + _sidecar.BlockMedias[0].TapeInformation[0].File = tapeFiles; // This is purely for convenience, as typically these kind of data represents QIC tapes if(blockSize == 512) { - _sidecar.BlockMedia[0].DiskType = "Quarter-inch cartridge"; + _sidecar.BlockMedias[0].MediaType = "Quarter-inch cartridge"; switch(totalSize) { case <= 20 * 1048576: - _sidecar.BlockMedia[0].DiskSubType = "QIC-11"; + _sidecar.BlockMedias[0].MediaSubType = "QIC-11"; break; case <= 40 * 1048576: - _sidecar.BlockMedia[0].DiskSubType = "QIC-40"; + _sidecar.BlockMedias[0].MediaSubType = "QIC-40"; break; case <= 60 * 1048576: - _sidecar.BlockMedia[0].DiskSubType = "QIC-24"; + _sidecar.BlockMedias[0].MediaSubType = "QIC-24"; break; case <= 80 * 1048576: - _sidecar.BlockMedia[0].DiskSubType = "QIC-80"; + _sidecar.BlockMedias[0].MediaSubType = "QIC-80"; break; case <= 120 * 1048576: - _sidecar.BlockMedia[0].DiskSubType = "QIC-120"; + _sidecar.BlockMedias[0].MediaSubType = "QIC-120"; break; case <= 150 * 1048576: - _sidecar.BlockMedia[0].DiskSubType = "QIC-150"; + _sidecar.BlockMedias[0].MediaSubType = "QIC-150"; break; case <= 320 * 1048576: - _sidecar.BlockMedia[0].DiskSubType = "QIC-320"; + _sidecar.BlockMedias[0].MediaSubType = "QIC-320"; break; case <= 340 * 1048576: - _sidecar.BlockMedia[0].DiskSubType = "QIC-3010"; + _sidecar.BlockMedias[0].MediaSubType = "QIC-3010"; break; case <= 525 * 1048576: - _sidecar.BlockMedia[0].DiskSubType = "QIC-525"; + _sidecar.BlockMedias[0].MediaSubType = "QIC-525"; break; case <= 670 * 1048576: - _sidecar.BlockMedia[0].DiskSubType = "QIC-3020"; + _sidecar.BlockMedias[0].MediaSubType = "QIC-3020"; break; case <= 1200 * 1048576: - _sidecar.BlockMedia[0].DiskSubType = "QIC-3080"; + _sidecar.BlockMedias[0].MediaSubType = "QIC-3080"; break; case <= 1350 * 1048576: - _sidecar.BlockMedia[0].DiskSubType = "QIC-1350"; + _sidecar.BlockMedias[0].MediaSubType = "QIC-1350"; break; case <= (long)4000 * 1048576: - _sidecar.BlockMedia[0].DiskSubType = "QIC-3095"; + _sidecar.BlockMedias[0].MediaSubType = "QIC-3095"; break; default: - _sidecar.BlockMedia[0].DiskType = "Unknown tape"; - _sidecar.BlockMedia[0].DiskSubType = "Unknown tape"; + _sidecar.BlockMedias[0].MediaType = "Unknown tape"; + _sidecar.BlockMedias[0].MediaSubType = "Unknown tape"; break; } } else { - _sidecar.BlockMedia[0].DiskType = "Unknown tape"; - _sidecar.BlockMedia[0].DiskSubType = "Unknown tape"; + _sidecar.BlockMedias[0].MediaType = "Unknown tape"; + _sidecar.BlockMedias[0].MediaSubType = "Unknown tape"; } return _sidecar; diff --git a/Aaru.Core/Sidecar/Files.cs b/Aaru.Core/Sidecar/Files.cs index 63d97ea23..5196ed83f 100644 --- a/Aaru.Core/Sidecar/Files.cs +++ b/Aaru.Core/Sidecar/Files.cs @@ -34,27 +34,27 @@ using System; using System.Collections.Generic; using System.Linq; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Structs; using Aaru.Console; -using Schemas; namespace Aaru.Core; public sealed partial class Sidecar { - FilesystemContentsType Files(IReadOnlyFilesystem filesystem) + FilesystemContents Files(IReadOnlyFilesystem filesystem) { - var contents = new FilesystemContentsType(); + var contents = new FilesystemContents(); ErrorNumber ret = filesystem.ReadDir("/", out List dirents); if(ret != ErrorNumber.NoError) return null; - List directories = new(); - List files = new(); + List directories = new(); + List files = new(); foreach(string dirent in dirents) { @@ -78,86 +78,40 @@ public sealed partial class Sidecar } if(files.Count > 0) - contents.File = files.OrderBy(f => f.name).ToArray(); + contents.Files = files.OrderBy(f => f.Name).ToList(); if(directories.Count > 0) - contents.Directory = directories.OrderBy(d => d.name).ToArray(); + contents.Directories = directories.OrderBy(d => d.Name).ToList(); return contents; } - DirectoryType SidecarDirectory(IReadOnlyFilesystem filesystem, string path, string filename, FileEntryInfo stat) + Directory SidecarDirectory(IReadOnlyFilesystem filesystem, string path, string filename, FileEntryInfo stat) { - var directory = new DirectoryType(); - - if(stat.AccessTimeUtc.HasValue) + var directory = new Directory { - directory.accessTime = stat.AccessTimeUtc.Value; - directory.accessTimeSpecified = true; - } - - directory.attributes = (ulong)stat.Attributes; - - if(stat.BackupTimeUtc.HasValue) - { - directory.backupTime = stat.BackupTimeUtc.Value; - directory.backupTimeSpecified = true; - } - - if(stat.CreationTimeUtc.HasValue) - { - directory.creationTime = stat.CreationTimeUtc.Value; - directory.creationTimeSpecified = true; - } - - if(stat.DeviceNo.HasValue) - { - directory.deviceNumber = stat.DeviceNo.Value; - directory.deviceNumberSpecified = true; - } - - directory.inode = stat.Inode; - - if(stat.LastWriteTimeUtc.HasValue) - { - directory.lastWriteTime = stat.LastWriteTimeUtc.Value; - directory.lastWriteTimeSpecified = true; - } - - directory.links = stat.Links; - directory.name = filename; - - if(stat.GID.HasValue) - { - directory.posixGroupId = stat.GID.Value; - directory.posixGroupIdSpecified = true; - } - - if(stat.Mode.HasValue) - { - directory.posixMode = stat.Mode.Value; - directory.posixModeSpecified = true; - } - - if(stat.UID.HasValue) - { - directory.posixUserId = stat.UID.Value; - directory.posixUserIdSpecified = true; - } - - if(stat.StatusChangeTimeUtc.HasValue) - { - directory.statusChangeTime = stat.StatusChangeTimeUtc.Value; - directory.statusChangeTimeSpecified = true; - } + AccessTime = stat.AccessTimeUtc, + Attributes = (ulong)stat.Attributes, + BackupTime = stat.BackupTimeUtc, + CreationTime = stat.CreationTimeUtc, + DeviceNumber = stat.DeviceNo, + Inode = stat.Inode, + LastWriteTime = stat.LastWriteTimeUtc, + Links = stat.Links, + Name = filename, + PosixGroupId = stat.GID, + PosixMode = stat.Mode, + PosixUserId = stat.UID, + StatusChangeTime = stat.StatusChangeTimeUtc + }; ErrorNumber ret = filesystem.ReadDir(path + "/" + filename, out List dirents); if(ret != ErrorNumber.NoError) return null; - List directories = new(); - List files = new(); + List directories = new(); + List files = new(); foreach(string dirent in dirents) { @@ -181,80 +135,35 @@ public sealed partial class Sidecar } if(files.Count > 0) - directory.File = files.OrderBy(f => f.name).ToArray(); + directory.Files = files.OrderBy(f => f.Name).ToList(); if(directories.Count > 0) - directory.Directory = directories.OrderBy(d => d.name).ToArray(); + directory.Directories = directories.OrderBy(d => d.Name).ToList(); return directory; } - ContentsFileType SidecarFile(IReadOnlyFilesystem filesystem, string path, string filename, FileEntryInfo stat) + ContentsFile SidecarFile(IReadOnlyFilesystem filesystem, string path, string filename, FileEntryInfo stat) { - var file = new ContentsFileType(); var fileChkWorker = new Checksum(); - if(stat.AccessTimeUtc.HasValue) + var file = new ContentsFile { - file.accessTime = stat.AccessTimeUtc.Value; - file.accessTimeSpecified = true; - } - - file.attributes = (ulong)stat.Attributes; - - if(stat.BackupTimeUtc.HasValue) - { - file.backupTime = stat.BackupTimeUtc.Value; - file.backupTimeSpecified = true; - } - - if(stat.CreationTimeUtc.HasValue) - { - file.creationTime = stat.CreationTimeUtc.Value; - file.creationTimeSpecified = true; - } - - if(stat.DeviceNo.HasValue) - { - file.deviceNumber = stat.DeviceNo.Value; - file.deviceNumberSpecified = true; - } - - file.inode = stat.Inode; - - if(stat.LastWriteTimeUtc.HasValue) - { - file.lastWriteTime = stat.LastWriteTimeUtc.Value; - file.lastWriteTimeSpecified = true; - } - - file.length = (ulong)stat.Length; - file.links = stat.Links; - file.name = filename; - - if(stat.GID.HasValue) - { - file.posixGroupId = stat.GID.Value; - file.posixGroupIdSpecified = true; - } - - if(stat.Mode.HasValue) - { - file.posixMode = stat.Mode.Value; - file.posixModeSpecified = true; - } - - if(stat.UID.HasValue) - { - file.posixUserId = stat.UID.Value; - file.posixUserIdSpecified = true; - } - - if(stat.StatusChangeTimeUtc.HasValue) - { - file.statusChangeTime = stat.StatusChangeTimeUtc.Value; - file.statusChangeTimeSpecified = true; - } + AccessTime = stat.AccessTimeUtc, + Attributes = (ulong)stat.Attributes, + BackupTime = stat.BackupTimeUtc, + CreationTime = stat.CreationTimeUtc, + DeviceNumber = stat.DeviceNo, + Inode = stat.Inode, + LastWriteTime = stat.LastWriteTimeUtc, + Length = (ulong)stat.Length, + Links = stat.Links, + Name = filename, + PosixGroupId = stat.GID, + PosixMode = stat.Mode, + PosixUserId = stat.UID, + StatusChangeTime = stat.StatusChangeTimeUtc + }; byte[] data = Array.Empty(); @@ -288,7 +197,7 @@ public sealed partial class Sidecar EndProgress2(); - file.Checksums = fileChkWorker.End().ToArray(); + file.Checksums = fileChkWorker.End(); } else file.Checksums = _emptyChecksums; @@ -298,7 +207,7 @@ public sealed partial class Sidecar if(ret != ErrorNumber.NoError) return file; - List xattrTypes = new(); + List xattrTypes = new(); foreach(string xattr in xattrs) { @@ -310,16 +219,16 @@ public sealed partial class Sidecar var xattrChkWorker = new Checksum(); xattrChkWorker.Update(data); - xattrTypes.Add(new ExtendedAttributeType + xattrTypes.Add(new ExtendedAttribute { - Checksums = xattrChkWorker.End().ToArray(), - length = (ulong)data.Length, - name = xattr + Checksums = xattrChkWorker.End(), + Length = (ulong)data.Length, + Name = xattr }); } if(xattrTypes.Count > 0) - file.ExtendedAttributes = xattrTypes.OrderBy(x => x.name).ToArray(); + file.ExtendedAttributes = xattrTypes.OrderBy(x => x.Name).ToList(); return file; } diff --git a/Aaru.Core/Sidecar/LinearMedia.cs b/Aaru.Core/Sidecar/LinearMedia.cs index 9fd217563..1682b4d2d 100644 --- a/Aaru.Core/Sidecar/LinearMedia.cs +++ b/Aaru.Core/Sidecar/LinearMedia.cs @@ -35,8 +35,8 @@ using System.Collections.Generic; using System.IO; using System.Text; using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Core; @@ -53,18 +53,17 @@ public sealed partial class Sidecar /// Metadata sidecar /// Encoding to be used for filesystem plugins static void LinearMedia(IByteAddressableImage image, Guid filterId, string imagePath, FileInfo fi, - PluginBase plugins, List imgChecksums, ref CICMMetadataType sidecar, - Encoding encoding) => sidecar.LinearMedia = new[] + PluginBase plugins, List imgChecksums, + ref Metadata sidecar, Encoding encoding) => sidecar.LinearMedias = new List { - new LinearMediaType + new() { - Checksums = imgChecksums.ToArray(), - Image = new ImageType + Checksums = imgChecksums, + Image = new Image { - format = image.Format, - offset = 0, - offsetSpecified = true, - Value = Path.GetFileName(imagePath) + Format = image.Format, + Offset = 0, + Value = Path.GetFileName(imagePath) }, Size = image.Info.Sectors } diff --git a/Aaru.Core/Sidecar/OpticalDisc.cs b/Aaru.Core/Sidecar/OpticalDisc.cs index f33a589b3..9fbd6b51c 100644 --- a/Aaru.Core/Sidecar/OpticalDisc.cs +++ b/Aaru.Core/Sidecar/OpticalDisc.cs @@ -36,18 +36,19 @@ using System.IO; using System.Linq; using System.Text; using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Metadata; -using Aaru.CommonTypes.Structs; -using Aaru.Core.Devices.Dumping; using Aaru.Decoders.CD; using Aaru.Decoders.DVD; -using Schemas; using DMI = Aaru.Decoders.Xbox.DMI; +using Dump = Aaru.Core.Devices.Dumping.Dump; using MediaType = Aaru.CommonTypes.MediaType; +using Partition = Aaru.CommonTypes.Partition; using Session = Aaru.CommonTypes.Structs.Session; -using TrackType = Schemas.TrackType; +using Track = Aaru.CommonTypes.Structs.Track; +using TrackType = Aaru.CommonTypes.Enums.TrackType; namespace Aaru.Core; @@ -63,27 +64,26 @@ public sealed partial class Sidecar /// Metadata sidecar /// Encoding to be used for filesystem plugins void OpticalDisc(IOpticalMediaImage image, Guid filterId, string imagePath, FileInfo fi, PluginBase plugins, - List imgChecksums, ref CICMMetadataType sidecar, Encoding encoding) + List imgChecksums, ref Metadata sidecar, Encoding encoding) { if(_aborted) return; - sidecar.OpticalDisc = new[] + sidecar.OpticalDiscs = new List { - new OpticalDiscType + new() { - Checksums = imgChecksums.ToArray(), - Image = new ImageType + Checksums = imgChecksums, + Image = new Image { - format = image.Format, - offset = 0, - offsetSpecified = true, - Value = Path.GetFileName(imagePath) + Format = image.Format, + Offset = 0, + Value = Path.GetFileName(imagePath) }, Size = (ulong)fi.Length, - Sequence = new SequenceType + Sequence = new Sequence { - MediaTitle = image.Info.MediaTitle + Title = image.Info.MediaTitle } } }; @@ -91,13 +91,13 @@ public sealed partial class Sidecar if(image.Info.MediaSequence != 0 && image.Info.LastMediaSequence != 0) { - sidecar.OpticalDisc[0].Sequence.MediaSequence = (uint)image.Info.MediaSequence; - sidecar.OpticalDisc[0].Sequence.TotalMedia = (uint)image.Info.LastMediaSequence; + sidecar.OpticalDiscs[0].Sequence.MediaSequence = (uint)image.Info.MediaSequence; + sidecar.OpticalDiscs[0].Sequence.TotalMedia = (uint)image.Info.LastMediaSequence; } else { - sidecar.OpticalDisc[0].Sequence.MediaSequence = 1; - sidecar.OpticalDisc[0].Sequence.TotalMedia = 1; + sidecar.OpticalDiscs[0].Sequence.MediaSequence = 1; + sidecar.OpticalDiscs[0].Sequence.TotalMedia = 1; } MediaType dskType = image.Info.MediaType; @@ -134,7 +134,7 @@ public sealed partial class Sidecar { dskType = MediaType.XGD; - sidecar.OpticalDisc[0].Dimensions = new DimensionsType + sidecar.OpticalDiscs[0].Dimensions = new DimensionsNew { Diameter = 120, Thickness = 1.2 @@ -144,7 +144,7 @@ public sealed partial class Sidecar { dskType = MediaType.XGD2; - sidecar.OpticalDisc[0].Dimensions = new DimensionsType + sidecar.OpticalDiscs[0].Dimensions = new DimensionsNew { Diameter = 120, Thickness = 1.2 @@ -194,29 +194,25 @@ public sealed partial class Sidecar pfi.Value.DiscSize == DVDSize.OneTwenty) dskType = MediaType.WOD; - sidecar.OpticalDisc[0].Dimensions = new DimensionsType(); + sidecar.OpticalDiscs[0].Dimensions = new DimensionsNew(); if(dskType == MediaType.UMD) { - sidecar.OpticalDisc[0].Dimensions.Height = 64; - sidecar.OpticalDisc[0].Dimensions.HeightSpecified = true; - sidecar.OpticalDisc[0].Dimensions.Width = 63; - sidecar.OpticalDisc[0].Dimensions.WidthSpecified = true; - sidecar.OpticalDisc[0].Dimensions.Thickness = 4; + sidecar.OpticalDiscs[0].Dimensions.Height = 64; + sidecar.OpticalDiscs[0].Dimensions.Width = 63; + sidecar.OpticalDiscs[0].Dimensions.Thickness = 4; } else switch(pfi.Value.DiscSize) { case DVDSize.Eighty: - sidecar.OpticalDisc[0].Dimensions.Diameter = 80; - sidecar.OpticalDisc[0].Dimensions.DiameterSpecified = true; - sidecar.OpticalDisc[0].Dimensions.Thickness = 1.2; + sidecar.OpticalDiscs[0].Dimensions.Diameter = 80; + sidecar.OpticalDiscs[0].Dimensions.Thickness = 1.2; break; case DVDSize.OneTwenty: - sidecar.OpticalDisc[0].Dimensions.Diameter = 120; - sidecar.OpticalDisc[0].Dimensions.DiameterSpecified = true; - sidecar.OpticalDisc[0].Dimensions.Thickness = 1.2; + sidecar.OpticalDiscs[0].Dimensions.Diameter = 120; + sidecar.OpticalDiscs[0].Dimensions.Thickness = 1.2; break; } @@ -229,26 +225,26 @@ public sealed partial class Sidecar try { List sessions = image.Sessions; - sidecar.OpticalDisc[0].Sessions = (uint)(sessions?.Count ?? 1); + sidecar.OpticalDiscs[0].Sessions = (uint)(sessions?.Count ?? 1); } catch { - sidecar.OpticalDisc[0].Sessions = 1; + sidecar.OpticalDiscs[0].Sessions = 1; } - List tracks = image.Tracks; - List trksLst = null; + List tracks = image.Tracks; + List trksLst = null; if(tracks != null) { - sidecar.OpticalDisc[0].Tracks = new uint[1]; - sidecar.OpticalDisc[0].Tracks[0] = (uint)tracks.Count; - trksLst = new List(); + sidecar.OpticalDiscs[0].Tracks = new uint[1]; + sidecar.OpticalDiscs[0].Tracks[0] = (uint)tracks.Count; + trksLst = new List(); } - if(sidecar.OpticalDisc[0].Dimensions == null && - image.Info.MediaType != MediaType.Unknown) - sidecar.OpticalDisc[0].Dimensions = Dimensions.DimensionsFromMediaType(image.Info.MediaType); + if(sidecar.OpticalDiscs[0].Dimensions == null && + image.Info.MediaType != MediaType.Unknown) + sidecar.OpticalDiscs[0].Dimensions = Dimensions.DimensionsFromMediaType(image.Info.MediaType); if(_aborted) return; @@ -270,30 +266,30 @@ public sealed partial class Sidecar return; } - var xmlTrk = new TrackType(); + var xmlTrk = new CommonTypes.AaruMetadata.Track(); - xmlTrk.TrackType1 = trk.Type switch + xmlTrk.Type = trk.Type switch { - CommonTypes.Enums.TrackType.Audio => TrackTypeTrackType.audio, - CommonTypes.Enums.TrackType.CdMode2Form2 => TrackTypeTrackType.m2f2, - CommonTypes.Enums.TrackType.CdMode2Formless => TrackTypeTrackType.mode2, - CommonTypes.Enums.TrackType.CdMode2Form1 => TrackTypeTrackType.m2f1, - CommonTypes.Enums.TrackType.CdMode1 => TrackTypeTrackType.mode1, - CommonTypes.Enums.TrackType.Data => sidecar.OpticalDisc[0].DiscType switch + TrackType.Audio => CommonTypes.AaruMetadata.TrackType.Audio, + TrackType.CdMode2Form2 => CommonTypes.AaruMetadata.TrackType.Mode2Form2, + TrackType.CdMode2Formless => CommonTypes.AaruMetadata.TrackType.Mode2, + TrackType.CdMode2Form1 => CommonTypes.AaruMetadata.TrackType.Mode2Form1, + TrackType.CdMode1 => CommonTypes.AaruMetadata.TrackType.Mode1, + TrackType.Data => sidecar.OpticalDiscs[0].DiscType switch { - "BD" => TrackTypeTrackType.bluray, - "DDCD" => TrackTypeTrackType.ddcd, - "DVD" => TrackTypeTrackType.dvd, - "HD DVD" => TrackTypeTrackType.hddvd, - _ => TrackTypeTrackType.mode1 + "BD" => CommonTypes.AaruMetadata.TrackType.Bluray, + "DDCD" => CommonTypes.AaruMetadata.TrackType.Ddcd, + "DVD" => CommonTypes.AaruMetadata.TrackType.Dvd, + "HD DVD" => CommonTypes.AaruMetadata.TrackType.HdDvd, + _ => CommonTypes.AaruMetadata.TrackType.Mode1 }, - _ => xmlTrk.TrackType1 + _ => xmlTrk.Type }; - xmlTrk.Sequence = new TrackSequenceType + xmlTrk.Sequence = new TrackSequence { - Session = trk.Session, - TrackNumber = trk.Sequence + Session = trk.Session, + Number = trk.Sequence }; xmlTrk.StartSector = trk.StartSector; @@ -303,32 +299,29 @@ public sealed partial class Sidecar idx0 >= 0) xmlTrk.StartSector = (ulong)idx0; - switch(sidecar.OpticalDisc[0].DiscType) + switch(sidecar.OpticalDiscs[0].DiscType) { case "CD": case "GD": - xmlTrk.StartMSF = LbaToMsf((long)xmlTrk.StartSector); - xmlTrk.EndMSF = LbaToMsf((long)xmlTrk.EndSector); + xmlTrk.StartMsf = LbaToMsf((long)xmlTrk.StartSector); + xmlTrk.EndMsf = LbaToMsf((long)xmlTrk.EndSector); break; case "DDCD": - xmlTrk.StartMSF = DdcdLbaToMsf((long)xmlTrk.StartSector); - xmlTrk.EndMSF = DdcdLbaToMsf((long)xmlTrk.EndSector); + xmlTrk.StartMsf = DdcdLbaToMsf((long)xmlTrk.StartSector); + xmlTrk.EndMsf = DdcdLbaToMsf((long)xmlTrk.EndSector); break; } - xmlTrk.Image = new ImageType + xmlTrk.Image = new Image { Value = Path.GetFileName(trk.File), - format = trk.FileType + Format = trk.FileType }; if(trk.FileOffset > 0) - { - xmlTrk.Image.offset = trk.FileOffset; - xmlTrk.Image.offsetSpecified = true; - } + xmlTrk.Image.Offset = trk.FileOffset; xmlTrk.Size = (xmlTrk.EndSector - xmlTrk.StartSector + 1) * (ulong)trk.RawBytesPerSector; @@ -346,7 +339,7 @@ public sealed partial class Sidecar // ...or AppleDouble filterId == new Guid("1b2165ee-c9df-4b21-bbbb-9e5892b2df4d"))) - xmlTrk.Checksums = sidecar.OpticalDisc[0].Checksums; + xmlTrk.Checksums = sidecar.OpticalDiscs[0].Checksums; else { UpdateProgress(Localization.Core.Track_0_of_1, trk.Sequence, tracks.Count); @@ -372,8 +365,7 @@ public sealed partial class Sidecar if(sectors - doneSectors >= sectorsToRead) { - errno = image.ReadSectorsLong(doneSectors, sectorsToRead, xmlTrk.Sequence.TrackNumber, - out sector); + errno = image.ReadSectorsLong(doneSectors, sectorsToRead, xmlTrk.Sequence.Number, out sector); UpdateProgress2(Localization.Core.Hashing_sector_0_of_1, (long)doneSectors, (long)(trk.EndSector - trk.StartSector + 1)); @@ -391,7 +383,7 @@ public sealed partial class Sidecar else { errno = image.ReadSectorsLong(doneSectors, (uint)(sectors - doneSectors), - xmlTrk.Sequence.TrackNumber, out sector); + xmlTrk.Sequence.Number, out sector); UpdateProgress2(Localization.Core.Hashing_sector_0_of_1, (long)doneSectors, (long)(trk.EndSector - trk.StartSector + 1)); @@ -410,18 +402,16 @@ public sealed partial class Sidecar trkChkWorker.Update(sector); } - List trkChecksums = trkChkWorker.End(); - - xmlTrk.Checksums = trkChecksums.ToArray(); + xmlTrk.Checksums = trkChkWorker.End(); EndProgress2(); } if(trk.SubchannelType != TrackSubchannelType.None) { - xmlTrk.SubChannel = new SubChannelType + xmlTrk.SubChannel = new SubChannel { - Image = new ImageType + Image = new Image { Value = trk.SubchannelFile }, @@ -434,26 +424,23 @@ public sealed partial class Sidecar { case TrackSubchannelType.Packed: case TrackSubchannelType.PackedInterleaved: - xmlTrk.SubChannel.Image.format = "rw"; + xmlTrk.SubChannel.Image.Format = "rw"; break; case TrackSubchannelType.Raw: case TrackSubchannelType.RawInterleaved: - xmlTrk.SubChannel.Image.format = "rw_raw"; + xmlTrk.SubChannel.Image.Format = "rw_raw"; break; case TrackSubchannelType.Q16: case TrackSubchannelType.Q16Interleaved: - xmlTrk.SubChannel.Image.format = "q16"; + xmlTrk.SubChannel.Image.Format = "q16"; break; } if(trk.FileOffset > 0) - { - xmlTrk.SubChannel.Image.offset = trk.SubchannelOffset; - xmlTrk.SubChannel.Image.offsetSpecified = true; - } + xmlTrk.SubChannel.Image.Offset = trk.SubchannelOffset; var subChkWorker = new Checksum(); @@ -476,7 +463,7 @@ public sealed partial class Sidecar if(sectors - doneSectors >= sectorsToRead) { - errno = image.ReadSectorsTag(doneSectors, sectorsToRead, xmlTrk.Sequence.TrackNumber, + errno = image.ReadSectorsTag(doneSectors, sectorsToRead, xmlTrk.Sequence.Number, SectorTagType.CdSectorSubchannel, out sector); UpdateProgress2(Localization.Core.Hashing_subchannel_sector_0_of_1, (long)doneSectors, @@ -494,9 +481,8 @@ public sealed partial class Sidecar } else { - errno = image.ReadSectorsTag(doneSectors, (uint)(sectors - doneSectors), - xmlTrk.Sequence.TrackNumber, SectorTagType.CdSectorSubchannel, - out sector); + errno = image.ReadSectorsTag(doneSectors, (uint)(sectors - doneSectors), xmlTrk.Sequence.Number, + SectorTagType.CdSectorSubchannel, out sector); UpdateProgress2(Localization.Core.Hashing_subchannel_sector_0_of_1, (long)doneSectors, (long)(trk.EndSector - trk.StartSector + 1)); @@ -515,9 +501,7 @@ public sealed partial class Sidecar subChkWorker.Update(sector); } - List subChecksums = subChkWorker.End(); - - xmlTrk.SubChannel.Checksums = subChecksums.ToArray(); + xmlTrk.SubChannel.Checksums = subChkWorker.End(); EndProgress2(); } @@ -528,25 +512,23 @@ public sealed partial class Sidecar List trkPartitions = partitions.Where(p => p.Start >= trk.StartSector && p.End <= trk.EndSector).ToList(); - xmlTrk.FileSystemInformation = new PartitionType[1]; + xmlTrk.FileSystemInformation = new List(); if(trkPartitions.Count > 0) { - xmlTrk.FileSystemInformation = new PartitionType[trkPartitions.Count]; - - for(int i = 0; i < trkPartitions.Count; i++) + foreach(Partition partition in trkPartitions) { - xmlTrk.FileSystemInformation[i] = new PartitionType + var metadataPartition = new CommonTypes.AaruMetadata.Partition { - Description = trkPartitions[i].Description, - EndSector = trkPartitions[i].End, - Name = trkPartitions[i].Name, - Sequence = (uint)trkPartitions[i].Sequence, - StartSector = trkPartitions[i].Start, - Type = trkPartitions[i].Type + Description = partition.Description, + EndSector = partition.End, + Name = partition.Name, + Sequence = (uint)partition.Sequence, + StartSector = partition.Start, + Type = partition.Type }; - List lstFs = new(); + List lstFs = new(); foreach(IFilesystem plugin in plugins.PluginsList.Values) try @@ -558,14 +540,14 @@ public sealed partial class Sidecar return; } - if(!plugin.Identify(image, trkPartitions[i])) + if(!plugin.Identify(image, partition)) continue; - plugin.GetInformation(image, trkPartitions[i], out _, encoding); - lstFs.Add(plugin.XmlFsType); - Statistics.AddFilesystem(plugin.XmlFsType.Type); + plugin.GetInformation(image, partition, out _, encoding); + lstFs.Add(plugin.Metadata); + Statistics.AddFilesystem(plugin.Metadata.Type); - dskType = plugin.XmlFsType.Type switch + dskType = plugin.Metadata.Type switch { "Opera" => MediaType.ThreeDO, "PC Engine filesystem" => MediaType.SuperCDROM2, @@ -582,26 +564,28 @@ public sealed partial class Sidecar } if(lstFs.Count > 0) - xmlTrk.FileSystemInformation[i].FileSystems = lstFs.ToArray(); + metadataPartition.FileSystems = lstFs; + + xmlTrk.FileSystemInformation.Add(metadataPartition); } } else { - xmlTrk.FileSystemInformation[0] = new PartitionType + var metadataPartition = new CommonTypes.AaruMetadata.Partition { EndSector = xmlTrk.EndSector, StartSector = xmlTrk.StartSector }; - List lstFs = new(); + List lstFs = new(); var xmlPart = new Partition { Start = xmlTrk.StartSector, Length = xmlTrk.EndSector - xmlTrk.StartSector + 1, - Type = xmlTrk.TrackType1.ToString(), + Type = xmlTrk.Type.ToString(), Size = xmlTrk.Size, - Sequence = xmlTrk.Sequence.TrackNumber + Sequence = xmlTrk.Sequence.Number }; foreach(IFilesystem plugin in plugins.PluginsList.Values) @@ -618,10 +602,10 @@ public sealed partial class Sidecar continue; plugin.GetInformation(image, xmlPart, out _, encoding); - lstFs.Add(plugin.XmlFsType); - Statistics.AddFilesystem(plugin.XmlFsType.Type); + lstFs.Add(plugin.Metadata); + Statistics.AddFilesystem(plugin.Metadata.Type); - dskType = plugin.XmlFsType.Type switch + dskType = plugin.Metadata.Type switch { "Opera" => MediaType.ThreeDO, "PC Engine filesystem" => MediaType.SuperCDROM2, @@ -638,7 +622,9 @@ public sealed partial class Sidecar } if(lstFs.Count > 0) - xmlTrk.FileSystemInformation[0].FileSystems = lstFs.ToArray(); + metadataPartition.FileSystems = lstFs; + + xmlTrk.FileSystemInformation.Add(metadataPartition); } errno = image.ReadSectorTag(trk.Sequence, SectorTagType.CdTrackIsrc, out byte[] isrcData); @@ -652,7 +638,7 @@ public sealed partial class Sidecar { var trackFlags = (CdFlags)flagsData[0]; - xmlTrk.Flags = new TrackFlagsType + xmlTrk.Flags = new TrackFlags { PreEmphasis = trackFlags.HasFlag(CdFlags.PreEmphasis), CopyPermitted = trackFlags.HasFlag(CdFlags.CopyPermitted), @@ -662,11 +648,11 @@ public sealed partial class Sidecar } if(trk.Indexes?.Count > 0) - xmlTrk.Indexes = trk.Indexes?.OrderBy(i => i.Key).Select(i => new TrackIndexType + xmlTrk.Indexes = trk.Indexes?.OrderBy(i => i.Key).Select(i => new TrackIndex { - index = i.Key, + Index = i.Key, Value = i.Value - }).ToArray(); + }).ToList(); trksLst.Add(xmlTrk); } @@ -674,36 +660,37 @@ public sealed partial class Sidecar EndProgress(); if(trksLst != null) - sidecar.OpticalDisc[0].Track = trksLst.ToArray(); + sidecar.OpticalDiscs[0].Track = trksLst; // All XGD3 all have the same number of blocks if(dskType == MediaType.XGD2 && - sidecar.OpticalDisc[0].Track.Length == 1) + sidecar.OpticalDiscs[0].Track.Count == 1) { - ulong blocks = sidecar.OpticalDisc[0].Track[0].EndSector - sidecar.OpticalDisc[0].Track[0].StartSector + 1; + ulong blocks = sidecar.OpticalDiscs[0].Track[0].EndSector - sidecar.OpticalDiscs[0].Track[0].StartSector + + 1; if(blocks is 25063 or 4229664 or 4246304) // Wxripper unlock dskType = MediaType.XGD3; } (string type, string subType) discType = CommonTypes.Metadata.MediaType.MediaTypeToString(dskType); - sidecar.OpticalDisc[0].DiscType = discType.type; - sidecar.OpticalDisc[0].DiscSubType = discType.subType; + sidecar.OpticalDiscs[0].DiscType = discType.type; + sidecar.OpticalDiscs[0].DiscSubType = discType.subType; Statistics.AddMedia(dskType, false); if(image.DumpHardware != null) - sidecar.OpticalDisc[0].DumpHardwareArray = image.DumpHardware.ToArray(); + sidecar.OpticalDiscs[0].DumpHardware = image.DumpHardware; else if(!string.IsNullOrEmpty(image.Info.DriveManufacturer) || !string.IsNullOrEmpty(image.Info.DriveModel) || !string.IsNullOrEmpty(image.Info.DriveFirmwareRevision) || !string.IsNullOrEmpty(image.Info.DriveSerialNumber)) - sidecar.OpticalDisc[0].DumpHardwareArray = new[] + sidecar.OpticalDiscs[0].DumpHardware = new List { - new DumpHardwareType + new() { - Extents = new[] + Extents = new List { - new ExtentType + new() { Start = 0, End = image.Info.Sectors @@ -713,7 +700,7 @@ public sealed partial class Sidecar Model = image.Info.DriveModel, Firmware = image.Info.DriveFirmwareRevision, Serial = image.Info.DriveSerialNumber, - Software = new SoftwareType + Software = new Software { Name = image.Info.Application, Version = image.Info.ApplicationVersion diff --git a/Aaru.Core/Sidecar/Sidecar.cs b/Aaru.Core/Sidecar/Sidecar.cs index 986357a89..6b076a0db 100644 --- a/Aaru.Core/Sidecar/Sidecar.cs +++ b/Aaru.Core/Sidecar/Sidecar.cs @@ -35,27 +35,27 @@ using System.Collections.Generic; using System.IO; using System.Text; using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Console; using Aaru.Helpers; -using Schemas; namespace Aaru.Core; public sealed partial class Sidecar { - readonly ChecksumType[] _emptyChecksums; - readonly Encoding _encoding; - readonly FileInfo _fi; - readonly Guid _filterId; - readonly IBaseImage _image; - readonly string _imagePath; - readonly Checksum _imgChkWorker; - readonly PluginBase _plugins; - bool _aborted; - FileStream _fs; - CICMMetadataType _sidecar; + readonly List _emptyChecksums; + readonly Encoding _encoding; + readonly FileInfo _fi; + readonly Guid _filterId; + readonly IBaseImage _image; + readonly string _imagePath; + readonly Checksum _imgChkWorker; + readonly PluginBase _plugins; + bool _aborted; + FileStream _fs; + Metadata _sidecar; /// Initializes a new instance of this class public Sidecar() @@ -66,7 +66,7 @@ public sealed partial class Sidecar var emptyChkWorker = new Checksum(); emptyChkWorker.Update(Array.Empty()); - _emptyChecksums = emptyChkWorker.End().ToArray(); + _emptyChecksums = emptyChkWorker.End(); } /// Image @@ -79,7 +79,7 @@ public sealed partial class Sidecar _imagePath = imagePath; _filterId = filterId; _encoding = encoding; - _sidecar = image.CicmMetadata ?? new CICMMetadataType(); + _sidecar = image.AaruMetadata ?? new Metadata(); _plugins = GetPluginBase.Instance; _fi = new FileInfo(imagePath); _fs = new FileStream(imagePath, FileMode.Open, FileAccess.Read); @@ -89,7 +89,7 @@ public sealed partial class Sidecar /// Implements creating a metadata sidecar /// The metadata sidecar - public CICMMetadataType Create() + public Metadata Create() { // For fast debugging, skip checksum //goto skipImageChecksum; @@ -127,19 +127,14 @@ public sealed partial class Sidecar EndProgress(); _fs.Close(); - List imgChecksums = _imgChkWorker.End(); - - _sidecar.OpticalDisc = null; - _sidecar.BlockMedia = null; - _sidecar.AudioMedia = null; - _sidecar.LinearMedia = null; + List imgChecksums = _imgChkWorker.End(); if(_aborted) return _sidecar; - switch(_image.Info.XmlMediaType) + switch(_image.Info.MetadataMediaType) { - case XmlMediaType.OpticalDisc: + case MetadataMediaType.OpticalDisc: if(_image is IOpticalMediaImage opticalImage) OpticalDisc(opticalImage, _filterId, _imagePath, _fi, _plugins, imgChecksums, ref _sidecar, _encoding); @@ -152,7 +147,7 @@ public sealed partial class Sidecar } break; - case XmlMediaType.BlockMedia: + case MetadataMediaType.BlockMedia: if(_image is IMediaImage blockImage) BlockMedia(blockImage, _filterId, _imagePath, _fi, _plugins, imgChecksums, ref _sidecar, _encoding); else @@ -164,7 +159,7 @@ public sealed partial class Sidecar } break; - case XmlMediaType.LinearMedia: + case MetadataMediaType.LinearMedia: if(_image is IByteAddressableImage byteAddressableImage) LinearMedia(byteAddressableImage, _filterId, _imagePath, _fi, _plugins, imgChecksums, ref _sidecar, _encoding); @@ -177,7 +172,7 @@ public sealed partial class Sidecar } break; - case XmlMediaType.AudioMedia: + case MetadataMediaType.AudioMedia: AudioMedia(_image, _filterId, _imagePath, _fi, _plugins, imgChecksums, ref _sidecar, _encoding); break; diff --git a/Aaru.Filesystems/AODOS/AODOS.cs b/Aaru.Filesystems/AODOS/AODOS.cs index 8a0019990..bab5b0573 100644 --- a/Aaru.Filesystems/AODOS/AODOS.cs +++ b/Aaru.Filesystems/AODOS/AODOS.cs @@ -32,8 +32,8 @@ using System; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -44,7 +44,7 @@ namespace Aaru.Filesystems; public sealed partial class AODOS : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public string Name => Localization.AODOS_Name; /// diff --git a/Aaru.Filesystems/AODOS/Info.cs b/Aaru.Filesystems/AODOS/Info.cs index a800f384c..a48ec272c 100644 --- a/Aaru.Filesystems/AODOS/Info.cs +++ b/Aaru.Filesystems/AODOS/Info.cs @@ -32,11 +32,11 @@ using System.Linq; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -88,17 +88,15 @@ public sealed partial class AODOS sbInformation.AppendLine(Localization.Alexander_Osipov_DOS_file_system); - XmlFsType = new FileSystemType + Metadata = new FileSystem { - Type = FS_TYPE, - Clusters = imagePlugin.Info.Sectors, - ClusterSize = imagePlugin.Info.SectorSize, - Files = bb.files, - FilesSpecified = true, - FreeClusters = imagePlugin.Info.Sectors - bb.usedSectors, - FreeClustersSpecified = true, - VolumeName = StringHandlers.SpacePaddedToString(bb.volumeLabel, Encoding), - Bootable = true + Type = FS_TYPE, + Clusters = imagePlugin.Info.Sectors, + ClusterSize = imagePlugin.Info.SectorSize, + Files = bb.files, + FreeClusters = imagePlugin.Info.Sectors - bb.usedSectors, + VolumeName = StringHandlers.SpacePaddedToString(bb.volumeLabel, Encoding), + Bootable = true }; sbInformation.AppendFormat(Localization._0_files_on_volume, bb.files).AppendLine(); diff --git a/Aaru.Filesystems/APFS/APFS.cs b/Aaru.Filesystems/APFS/APFS.cs index c6a0a85b2..506288fa8 100644 --- a/Aaru.Filesystems/APFS/APFS.cs +++ b/Aaru.Filesystems/APFS/APFS.cs @@ -29,8 +29,8 @@ using System; using System.Diagnostics.CodeAnalysis; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -40,7 +40,7 @@ namespace Aaru.Filesystems; public sealed partial class APFS : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/APFS/Info.cs b/Aaru.Filesystems/APFS/Info.cs index 2ad8dc77a..2d702afa4 100644 --- a/Aaru.Filesystems/APFS/Info.cs +++ b/Aaru.Filesystems/APFS/Info.cs @@ -28,11 +28,11 @@ using System.Diagnostics.CodeAnalysis; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -71,7 +71,7 @@ public sealed partial class APFS { Encoding = Encoding.UTF8; var sbInformation = new StringBuilder(); - XmlFsType = new FileSystemType(); + Metadata = new FileSystem(); information = ""; if(partition.Start >= partition.End) @@ -105,7 +105,7 @@ public sealed partial class APFS information = sbInformation.ToString(); - XmlFsType = new FileSystemType + Metadata = new FileSystem { Bootable = false, Clusters = nxSb.containerBlocks, diff --git a/Aaru.Filesystems/Acorn/Acorn.cs b/Aaru.Filesystems/Acorn/Acorn.cs index c02f15d1a..17adefa61 100644 --- a/Aaru.Filesystems/Acorn/Acorn.cs +++ b/Aaru.Filesystems/Acorn/Acorn.cs @@ -28,8 +28,8 @@ using System; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -38,7 +38,7 @@ namespace Aaru.Filesystems; public sealed partial class AcornADFS : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public string Name => Localization.AcornADFS_Name; /// diff --git a/Aaru.Filesystems/Acorn/Info.cs b/Aaru.Filesystems/Acorn/Info.cs index d960fbf7d..b185dc97b 100644 --- a/Aaru.Filesystems/Acorn/Info.cs +++ b/Aaru.Filesystems/Acorn/Info.cs @@ -28,12 +28,12 @@ using System; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Console; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -263,7 +263,7 @@ public sealed partial class AcornADFS { Encoding = encoding ?? Encoding.GetEncoding("iso-8859-1"); var sbInformation = new StringBuilder(); - XmlFsType = new FileSystemType(); + Metadata = new FileSystem(); information = ""; ErrorNumber errno; @@ -321,7 +321,7 @@ public sealed partial class AcornADFS namebytes[(i * 2) + 1] = oldMap1.name[i]; } - XmlFsType = new FileSystemType + Metadata = new FileSystem { Bootable = oldMap1.boot != 0, // Or not? Clusters = bytes / imagePlugin.Info.SectorSize, @@ -420,12 +420,12 @@ public sealed partial class AcornADFS if(oldMap1.discId > 0) { - XmlFsType.VolumeSerial = $"{oldMap1.discId:X4}"; + Metadata.VolumeSerial = $"{oldMap1.discId:X4}"; sbInformation.AppendFormat(Localization.Volume_ID_0_X4, oldMap1.discId).AppendLine(); } if(!ArrayHelpers.ArrayIsNullOrEmpty(namebytes)) - XmlFsType.VolumeName = StringHandlers.CToString(namebytes, Encoding); + Metadata.VolumeName = StringHandlers.CToString(namebytes, Encoding); information = sbInformation.ToString(); @@ -527,7 +527,7 @@ public sealed partial class AcornADFS if(bytes > imagePlugin.Info.Sectors * imagePlugin.Info.SectorSize) return; - XmlFsType = new FileSystemType(); + Metadata = new FileSystem(); sbInformation.AppendLine(Localization.Acorn_Advanced_Disc_Filing_System); sbInformation.AppendLine(); @@ -548,22 +548,22 @@ public sealed partial class AcornADFS if(drSb.disc_id > 0) { - XmlFsType.VolumeSerial = $"{drSb.disc_id:X4}"; + Metadata.VolumeSerial = $"{drSb.disc_id:X4}"; sbInformation.AppendFormat(Localization.Volume_ID_0_X4, drSb.disc_id).AppendLine(); } if(!ArrayHelpers.ArrayIsNullOrEmpty(drSb.disc_name)) { string discname = StringHandlers.CToString(drSb.disc_name, Encoding); - XmlFsType.VolumeName = discname; + Metadata.VolumeName = discname; sbInformation.AppendFormat(Localization.Volume_name_0, discname).AppendLine(); } information = sbInformation.ToString(); - XmlFsType.Bootable |= drSb.bootoption != 0; // Or not? - XmlFsType.Clusters = bytes / (ulong)(1 << drSb.log2secsize); - XmlFsType.ClusterSize = (uint)(1 << drSb.log2secsize); - XmlFsType.Type = FS_TYPE; + Metadata.Bootable |= drSb.bootoption != 0; // Or not? + Metadata.Clusters = bytes / (ulong)(1 << drSb.log2secsize); + Metadata.ClusterSize = (uint)(1 << drSb.log2secsize); + Metadata.Type = FS_TYPE; } } \ No newline at end of file diff --git a/Aaru.Filesystems/AmigaDOS/AmigaDOS.cs b/Aaru.Filesystems/AmigaDOS/AmigaDOS.cs index 2aabec274..f7d60cbe0 100644 --- a/Aaru.Filesystems/AmigaDOS/AmigaDOS.cs +++ b/Aaru.Filesystems/AmigaDOS/AmigaDOS.cs @@ -28,8 +28,8 @@ using System; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -38,7 +38,7 @@ namespace Aaru.Filesystems; public sealed partial class AmigaDOSPlugin : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public string Name => Localization.AmigaDOSPlugin_Name; /// diff --git a/Aaru.Filesystems/AmigaDOS/Info.cs b/Aaru.Filesystems/AmigaDOS/Info.cs index d2f9ee024..1b2c72e6d 100644 --- a/Aaru.Filesystems/AmigaDOS/Info.cs +++ b/Aaru.Filesystems/AmigaDOS/Info.cs @@ -30,12 +30,12 @@ using System; using System.Linq; using System.Text; using Aaru.Checksums; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Console; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -169,7 +169,7 @@ public sealed partial class AmigaDOSPlugin { Encoding = encoding ?? Encoding.GetEncoding("iso-8859-1"); var sbInformation = new StringBuilder(); - XmlFsType = new FileSystemType(); + Metadata = new FileSystem(); information = null; ErrorNumber errno = imagePlugin.ReadSectors(0 + partition.Start, 2, out byte[] bootBlockSectors); @@ -278,42 +278,42 @@ public sealed partial class AmigaDOSPlugin { case 0: sbInformation.Append(Localization.Amiga_Original_File_System); - XmlFsType.Type = FS_TYPE_OFS; + Metadata.Type = FS_TYPE_OFS; break; case 1: sbInformation.Append(Localization.Amiga_Fast_File_System); - XmlFsType.Type = FS_TYPE_FFS; + Metadata.Type = FS_TYPE_FFS; break; case 2: sbInformation.Append(Localization.Amiga_Original_File_System_with_international_characters); - XmlFsType.Type = FS_TYPE_OFS; + Metadata.Type = FS_TYPE_OFS; break; case 3: sbInformation.Append(Localization.Amiga_Fast_File_System_with_international_characters); - XmlFsType.Type = FS_TYPE_FFS; + Metadata.Type = FS_TYPE_FFS; break; case 4: sbInformation.Append(Localization.Amiga_Original_File_System_with_directory_cache); - XmlFsType.Type = FS_TYPE_OFS; + Metadata.Type = FS_TYPE_OFS; break; case 5: sbInformation.Append(Localization.Amiga_Fast_File_System_with_directory_cache); - XmlFsType.Type = FS_TYPE_FFS; + Metadata.Type = FS_TYPE_FFS; break; case 6: sbInformation.Append(Localization.Amiga_Original_File_System_with_long_filenames); - XmlFsType.Type = FS_TYPE_OFS2; + Metadata.Type = FS_TYPE_OFS2; break; case 7: sbInformation.Append(Localization.Amiga_Fast_File_System_with_long_filenames); - XmlFsType.Type = FS_TYPE_FFS2; + Metadata.Type = FS_TYPE_FFS2; break; } @@ -365,20 +365,17 @@ public sealed partial class AmigaDOSPlugin sbInformation.AppendFormat(Localization.Root_block_checksum_is_0, rootBlk.checksum).AppendLine(); information = sbInformation.ToString(); - XmlFsType.CreationDate = DateHandlers.AmigaToDateTime(rootBlk.cDays, rootBlk.cMins, rootBlk.cTicks); + Metadata.CreationDate = DateHandlers.AmigaToDateTime(rootBlk.cDays, rootBlk.cMins, rootBlk.cTicks); - XmlFsType.CreationDateSpecified = true; + Metadata.ModificationDate = DateHandlers.AmigaToDateTime(rootBlk.vDays, rootBlk.vMins, rootBlk.vTicks); - XmlFsType.ModificationDate = DateHandlers.AmigaToDateTime(rootBlk.vDays, rootBlk.vMins, rootBlk.vTicks); - - XmlFsType.ModificationDateSpecified = true; - XmlFsType.Dirty = rootBlk.bitmapFlag != 0xFFFFFFFF; - XmlFsType.Clusters = blocks; - XmlFsType.ClusterSize = blockSize; - XmlFsType.VolumeName = diskName; - XmlFsType.Bootable = bsum == bootBlk.checksum; + Metadata.Dirty = rootBlk.bitmapFlag != 0xFFFFFFFF; + Metadata.Clusters = blocks; + Metadata.ClusterSize = blockSize; + Metadata.VolumeName = diskName; + Metadata.Bootable = bsum == bootBlk.checksum; // Useful as a serial - XmlFsType.VolumeSerial = $"{rootBlk.checksum:X8}"; + Metadata.VolumeSerial = $"{rootBlk.checksum:X8}"; } } \ No newline at end of file diff --git a/Aaru.Filesystems/AppleDOS/AppleDOS.cs b/Aaru.Filesystems/AppleDOS/AppleDOS.cs index 2a761e25c..0d5d2bb6b 100644 --- a/Aaru.Filesystems/AppleDOS/AppleDOS.cs +++ b/Aaru.Filesystems/AppleDOS/AppleDOS.cs @@ -29,8 +29,8 @@ using System; using System.Collections.Generic; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -52,7 +52,7 @@ public sealed partial class AppleDOS : IReadOnlyFilesystem Vtoc _vtoc; /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/AppleDOS/Info.cs b/Aaru.Filesystems/AppleDOS/Info.cs index 85bb347e8..52dd5f63c 100644 --- a/Aaru.Filesystems/AppleDOS/Info.cs +++ b/Aaru.Filesystems/AppleDOS/Info.cs @@ -27,13 +27,13 @@ // ****************************************************************************/ using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Helpers; using Claunia.Encoding; -using Schemas; using Encoding = System.Text.Encoding; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -97,7 +97,7 @@ public sealed partial class AppleDOS information = sb.ToString(); - XmlFsType = new FileSystemType + Metadata = new FileSystem { Bootable = true, Clusters = imagePlugin.Info.Sectors, diff --git a/Aaru.Filesystems/AppleDOS/Super.cs b/Aaru.Filesystems/AppleDOS/Super.cs index 51e4dc93c..c36faee78 100644 --- a/Aaru.Filesystems/AppleDOS/Super.cs +++ b/Aaru.Filesystems/AppleDOS/Super.cs @@ -27,15 +27,15 @@ // ****************************************************************************/ using System.Collections.Generic; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Structs; using Aaru.Console; using Aaru.Helpers; using Claunia.Encoding; -using Schemas; using Encoding = System.Text.Encoding; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -104,18 +104,16 @@ public sealed partial class AppleDOS } // Create XML metadata for mounted filesystem - XmlFsType = new FileSystemType + Metadata = new FileSystem { - Bootable = true, - Clusters = _device.Info.Sectors, - ClusterSize = _vtoc.bytesPerSector, - Files = (ulong)_catalogCache.Count, - FilesSpecified = true, - FreeClustersSpecified = true, - Type = FS_TYPE + Bootable = true, + Clusters = _device.Info.Sectors, + ClusterSize = _vtoc.bytesPerSector, + Files = (ulong)_catalogCache.Count, + Type = FS_TYPE }; - XmlFsType.FreeClusters = XmlFsType.Clusters - _usedSectors; + Metadata.FreeClusters = Metadata.Clusters - _usedSectors; options ??= GetDefaultOptions(); diff --git a/Aaru.Filesystems/AppleHFS/AppleHFS.cs b/Aaru.Filesystems/AppleHFS/AppleHFS.cs index 987c36402..d9344c7af 100644 --- a/Aaru.Filesystems/AppleHFS/AppleHFS.cs +++ b/Aaru.Filesystems/AppleHFS/AppleHFS.cs @@ -33,8 +33,8 @@ using System; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -45,7 +45,7 @@ namespace Aaru.Filesystems; public sealed partial class AppleHFS : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/AppleHFS/Info.cs b/Aaru.Filesystems/AppleHFS/Info.cs index 21624fb41..9e9ee79ac 100644 --- a/Aaru.Filesystems/AppleHFS/Info.cs +++ b/Aaru.Filesystems/AppleHFS/Info.cs @@ -29,11 +29,11 @@ using System; using System.Linq; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -273,43 +273,38 @@ public sealed partial class AppleHFS information = sb.ToString(); - XmlFsType = new FileSystemType(); + Metadata = new FileSystem(); if(mdb.drVolBkUp > 0) { - XmlFsType.BackupDate = DateHandlers.MacToDateTime(mdb.drVolBkUp); - XmlFsType.BackupDateSpecified = true; + Metadata.BackupDate = DateHandlers.MacToDateTime(mdb.drVolBkUp); } - XmlFsType.Bootable = bootBlockInfo != null || mdb.drFndrInfo0 != 0 || mdb.drFndrInfo3 != 0 || - mdb.drFndrInfo5 != 0; + Metadata.Bootable = bootBlockInfo != null || mdb.drFndrInfo0 != 0 || mdb.drFndrInfo3 != 0 || + mdb.drFndrInfo5 != 0; - XmlFsType.Clusters = mdb.drNmAlBlks; - XmlFsType.ClusterSize = mdb.drAlBlkSiz; + Metadata.Clusters = mdb.drNmAlBlks; + Metadata.ClusterSize = mdb.drAlBlkSiz; if(mdb.drCrDate > 0) { - XmlFsType.CreationDate = DateHandlers.MacToDateTime(mdb.drCrDate); - XmlFsType.CreationDateSpecified = true; + Metadata.CreationDate = DateHandlers.MacToDateTime(mdb.drCrDate); } - XmlFsType.Dirty = !mdb.drAtrb.HasFlag(AppleCommon.VolumeAttributes.Unmounted); - XmlFsType.Files = mdb.drFilCnt; - XmlFsType.FilesSpecified = true; - XmlFsType.FreeClusters = mdb.drFreeBks; - XmlFsType.FreeClustersSpecified = true; + Metadata.Dirty = !mdb.drAtrb.HasFlag(AppleCommon.VolumeAttributes.Unmounted); + Metadata.Files = mdb.drFilCnt; + Metadata.FreeClusters = mdb.drFreeBks; if(mdb.drLsMod > 0) { - XmlFsType.ModificationDate = DateHandlers.MacToDateTime(mdb.drLsMod); - XmlFsType.ModificationDateSpecified = true; + Metadata.ModificationDate = DateHandlers.MacToDateTime(mdb.drLsMod); } - XmlFsType.Type = FS_TYPE; - XmlFsType.VolumeName = StringHandlers.PascalToString(mdb.drVN, Encoding); + Metadata.Type = FS_TYPE; + Metadata.VolumeName = StringHandlers.PascalToString(mdb.drVN, Encoding); if(mdb.drFndrInfo6 != 0 && mdb.drFndrInfo7 != 0) - XmlFsType.VolumeSerial = $"{mdb.drFndrInfo6:X8}{mdb.drFndrInfo7:X8}"; + Metadata.VolumeSerial = $"{mdb.drFndrInfo6:X8}{mdb.drFndrInfo7:X8}"; } } \ No newline at end of file diff --git a/Aaru.Filesystems/AppleHFSPlus/AppleHFSPlus.cs b/Aaru.Filesystems/AppleHFSPlus/AppleHFSPlus.cs index 6c4b03e43..2b71d7266 100644 --- a/Aaru.Filesystems/AppleHFSPlus/AppleHFSPlus.cs +++ b/Aaru.Filesystems/AppleHFSPlus/AppleHFSPlus.cs @@ -28,8 +28,8 @@ using System; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -39,7 +39,7 @@ namespace Aaru.Filesystems; public sealed partial class AppleHFSPlus : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/AppleHFSPlus/Info.cs b/Aaru.Filesystems/AppleHFSPlus/Info.cs index 21c20f8ac..fc6d3a92d 100644 --- a/Aaru.Filesystems/AppleHFSPlus/Info.cs +++ b/Aaru.Filesystems/AppleHFSPlus/Info.cs @@ -28,11 +28,11 @@ using System; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -259,48 +259,43 @@ public sealed partial class AppleHFSPlus vh.drFndrInfo7 != 0) sb.AppendFormat(Localization.Mac_OS_X_Volume_ID_0_1, vh.drFndrInfo6, vh.drFndrInfo7).AppendLine(); - XmlFsType = new FileSystemType(); + Metadata = new FileSystem(); if(vh.backupDate > 0) { - XmlFsType.BackupDate = DateHandlers.MacToDateTime(vh.backupDate); - XmlFsType.BackupDateSpecified = true; + Metadata.BackupDate = DateHandlers.MacToDateTime(vh.backupDate); } - XmlFsType.Bootable |= vh.drFndrInfo0 != 0 || vh.drFndrInfo3 != 0 || vh.drFndrInfo5 != 0; - XmlFsType.Clusters = vh.totalBlocks; - XmlFsType.ClusterSize = vh.blockSize; + Metadata.Bootable |= vh.drFndrInfo0 != 0 || vh.drFndrInfo3 != 0 || vh.drFndrInfo5 != 0; + Metadata.Clusters = vh.totalBlocks; + Metadata.ClusterSize = vh.blockSize; if(vh.createDate > 0) { - XmlFsType.CreationDate = DateHandlers.MacToDateTime(vh.createDate); - XmlFsType.CreationDateSpecified = true; + Metadata.CreationDate = DateHandlers.MacToDateTime(vh.createDate); } - XmlFsType.Dirty = (vh.attributes & 0x100) != 0x100; - XmlFsType.Files = vh.fileCount; - XmlFsType.FilesSpecified = true; - XmlFsType.FreeClusters = vh.freeBlocks; - XmlFsType.FreeClustersSpecified = true; + Metadata.Dirty = (vh.attributes & 0x100) != 0x100; + Metadata.Files = vh.fileCount; + Metadata.FreeClusters = vh.freeBlocks; if(vh.modifyDate > 0) { - XmlFsType.ModificationDate = DateHandlers.MacToDateTime(vh.modifyDate); - XmlFsType.ModificationDateSpecified = true; + Metadata.ModificationDate = DateHandlers.MacToDateTime(vh.modifyDate); } - XmlFsType.Type = vh.signature switch + Metadata.Type = vh.signature switch { 0x482B => FS_TYPE_HFSP, 0x4858 => FS_TYPE_HFSX, - _ => XmlFsType.Type + _ => Metadata.Type }; if(vh.drFndrInfo6 != 0 && vh.drFndrInfo7 != 0) - XmlFsType.VolumeSerial = $"{vh.drFndrInfo6:X8}{vh.drFndrInfo7:X8}"; + Metadata.VolumeSerial = $"{vh.drFndrInfo6:X8}{vh.drFndrInfo7:X8}"; - XmlFsType.SystemIdentifier = Encoding.ASCII.GetString(vh.lastMountedVersion); + Metadata.SystemIdentifier = Encoding.ASCII.GetString(vh.lastMountedVersion); } else { diff --git a/Aaru.Filesystems/AppleMFS/AppleMFS.cs b/Aaru.Filesystems/AppleMFS/AppleMFS.cs index ba99ced7d..e033587ba 100644 --- a/Aaru.Filesystems/AppleMFS/AppleMFS.cs +++ b/Aaru.Filesystems/AppleMFS/AppleMFS.cs @@ -29,8 +29,8 @@ using System; using System.Collections.Generic; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -59,7 +59,7 @@ public sealed partial class AppleMFS : IReadOnlyFilesystem byte[] _bitmapTags; /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public string Name => Localization.AppleMFS_Name; /// diff --git a/Aaru.Filesystems/AppleMFS/Info.cs b/Aaru.Filesystems/AppleMFS/Info.cs index 342bcee20..52dafc104 100644 --- a/Aaru.Filesystems/AppleMFS/Info.cs +++ b/Aaru.Filesystems/AppleMFS/Info.cs @@ -28,13 +28,13 @@ using System; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Helpers; using Claunia.Encoding; -using Schemas; using Encoding = System.Text.Encoding; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -153,29 +153,25 @@ public sealed partial class AppleMFS information = sb.ToString(); - XmlFsType = new FileSystemType(); + Metadata = new FileSystem(); if(mdb.drLsBkUp > 0) { - XmlFsType.BackupDate = DateHandlers.MacToDateTime(mdb.drLsBkUp); - XmlFsType.BackupDateSpecified = true; + Metadata.BackupDate = DateHandlers.MacToDateTime(mdb.drLsBkUp); } - XmlFsType.Bootable = bootBlockInfo != null; - XmlFsType.Clusters = mdb.drNmAlBlks; - XmlFsType.ClusterSize = mdb.drAlBlkSiz; + Metadata.Bootable = bootBlockInfo != null; + Metadata.Clusters = mdb.drNmAlBlks; + Metadata.ClusterSize = mdb.drAlBlkSiz; if(mdb.drCrDate > 0) { - XmlFsType.CreationDate = DateHandlers.MacToDateTime(mdb.drCrDate); - XmlFsType.CreationDateSpecified = true; + Metadata.CreationDate = DateHandlers.MacToDateTime(mdb.drCrDate); } - XmlFsType.Files = mdb.drNmFls; - XmlFsType.FilesSpecified = true; - XmlFsType.FreeClusters = mdb.drFreeBks; - XmlFsType.FreeClustersSpecified = true; - XmlFsType.Type = FS_TYPE; - XmlFsType.VolumeName = mdb.drVN; + Metadata.Files = mdb.drNmFls; + Metadata.FreeClusters = mdb.drFreeBks; + Metadata.Type = FS_TYPE; + Metadata.VolumeName = mdb.drVN; } } \ No newline at end of file diff --git a/Aaru.Filesystems/AppleMFS/Super.cs b/Aaru.Filesystems/AppleMFS/Super.cs index cf7a43c1e..7c1bd25d3 100644 --- a/Aaru.Filesystems/AppleMFS/Super.cs +++ b/Aaru.Filesystems/AppleMFS/Super.cs @@ -29,12 +29,12 @@ using System; using System.Collections.Generic; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Structs; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -178,30 +178,26 @@ public sealed partial class AppleMFS if(bbSig != AppleCommon.BB_MAGIC) _bootBlocks = null; - XmlFsType = new FileSystemType(); + Metadata = new FileSystem(); if(_volMdb.drLsBkUp > 0) { - XmlFsType.BackupDate = DateHandlers.MacToDateTime(_volMdb.drLsBkUp); - XmlFsType.BackupDateSpecified = true; + Metadata.BackupDate = DateHandlers.MacToDateTime(_volMdb.drLsBkUp); } - XmlFsType.Bootable = bbSig == AppleCommon.BB_MAGIC; - XmlFsType.Clusters = _volMdb.drNmAlBlks; - XmlFsType.ClusterSize = _volMdb.drAlBlkSiz; + Metadata.Bootable = bbSig == AppleCommon.BB_MAGIC; + Metadata.Clusters = _volMdb.drNmAlBlks; + Metadata.ClusterSize = _volMdb.drAlBlkSiz; if(_volMdb.drCrDate > 0) { - XmlFsType.CreationDate = DateHandlers.MacToDateTime(_volMdb.drCrDate); - XmlFsType.CreationDateSpecified = true; + Metadata.CreationDate = DateHandlers.MacToDateTime(_volMdb.drCrDate); } - XmlFsType.Files = _volMdb.drNmFls; - XmlFsType.FilesSpecified = true; - XmlFsType.FreeClusters = _volMdb.drFreeBks; - XmlFsType.FreeClustersSpecified = true; - XmlFsType.Type = FS_TYPE; - XmlFsType.VolumeName = _volMdb.drVN; + Metadata.Files = _volMdb.drNmFls; + Metadata.FreeClusters = _volMdb.drFreeBks; + Metadata.Type = FS_TYPE; + Metadata.VolumeName = _volMdb.drVN; return ErrorNumber.NoError; } diff --git a/Aaru.Filesystems/AtheOS/AtheOS.cs b/Aaru.Filesystems/AtheOS/AtheOS.cs index bc7843df7..503b527de 100644 --- a/Aaru.Filesystems/AtheOS/AtheOS.cs +++ b/Aaru.Filesystems/AtheOS/AtheOS.cs @@ -29,8 +29,8 @@ using System; using System.Diagnostics.CodeAnalysis; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -40,7 +40,7 @@ namespace Aaru.Filesystems; public sealed partial class AtheOS : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/AtheOS/Info.cs b/Aaru.Filesystems/AtheOS/Info.cs index cbe8e5b4b..cfc7fd74e 100644 --- a/Aaru.Filesystems/AtheOS/Info.cs +++ b/Aaru.Filesystems/AtheOS/Info.cs @@ -29,11 +29,11 @@ using System; using System.Diagnostics.CodeAnalysis; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -145,15 +145,14 @@ public sealed partial class AtheOS information = sb.ToString(); - XmlFsType = new FileSystemType + Metadata = new FileSystem { - Clusters = (ulong)afsSb.num_blocks, - ClusterSize = afsSb.block_size, - Dirty = false, - FreeClusters = (ulong)(afsSb.num_blocks - afsSb.used_blocks), - FreeClustersSpecified = true, - Type = FS_TYPE, - VolumeName = StringHandlers.CToString(afsSb.name, Encoding) + Clusters = (ulong)afsSb.num_blocks, + ClusterSize = afsSb.block_size, + Dirty = false, + FreeClusters = (ulong)(afsSb.num_blocks - afsSb.used_blocks), + Type = FS_TYPE, + VolumeName = StringHandlers.CToString(afsSb.name, Encoding) }; } } \ No newline at end of file diff --git a/Aaru.Filesystems/BFS/BFS.cs b/Aaru.Filesystems/BFS/BFS.cs index b4452e479..e31e80853 100644 --- a/Aaru.Filesystems/BFS/BFS.cs +++ b/Aaru.Filesystems/BFS/BFS.cs @@ -29,8 +29,8 @@ using System; using System.Diagnostics.CodeAnalysis; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -41,7 +41,7 @@ namespace Aaru.Filesystems; public sealed partial class BeFS : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/BFS/Info.cs b/Aaru.Filesystems/BFS/Info.cs index 803ddba4f..d4cea3c26 100644 --- a/Aaru.Filesystems/BFS/Info.cs +++ b/Aaru.Filesystems/BFS/Info.cs @@ -29,11 +29,11 @@ using System; using System.Diagnostics.CodeAnalysis; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -217,15 +217,14 @@ public sealed partial class BeFS information = sb.ToString(); - XmlFsType = new FileSystemType + Metadata = new FileSystem { - Clusters = (ulong)besb.num_blocks, - ClusterSize = besb.block_size, - Dirty = besb.flags == BEFS_DIRTY, - FreeClusters = (ulong)(besb.num_blocks - besb.used_blocks), - FreeClustersSpecified = true, - Type = FS_TYPE, - VolumeName = StringHandlers.CToString(besb.name, Encoding) + Clusters = (ulong)besb.num_blocks, + ClusterSize = besb.block_size, + Dirty = besb.flags == BEFS_DIRTY, + FreeClusters = (ulong)(besb.num_blocks - besb.used_blocks), + Type = FS_TYPE, + VolumeName = StringHandlers.CToString(besb.name, Encoding) }; } } \ No newline at end of file diff --git a/Aaru.Filesystems/BTRFS/BTRFS.cs b/Aaru.Filesystems/BTRFS/BTRFS.cs index 7e7ddbf16..d13ba903d 100644 --- a/Aaru.Filesystems/BTRFS/BTRFS.cs +++ b/Aaru.Filesystems/BTRFS/BTRFS.cs @@ -32,8 +32,8 @@ using System; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -42,7 +42,7 @@ namespace Aaru.Filesystems; public sealed partial class BTRFS : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/BTRFS/Info.cs b/Aaru.Filesystems/BTRFS/Info.cs index 993cae38c..0763a4fa3 100644 --- a/Aaru.Filesystems/BTRFS/Info.cs +++ b/Aaru.Filesystems/BTRFS/Info.cs @@ -31,12 +31,12 @@ // ****************************************************************************/ using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Console; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -85,7 +85,7 @@ public sealed partial class BTRFS { Encoding = encoding ?? Encoding.GetEncoding("iso-8859-15"); var sbInformation = new StringBuilder(); - XmlFsType = new FileSystemType(); + Metadata = new FileSystem(); information = ""; ulong sbSectorOff = 0x10000 / imagePlugin.Info.SectorSize; @@ -183,17 +183,16 @@ public sealed partial class BTRFS information = sbInformation.ToString(); - XmlFsType = new FileSystemType + Metadata = new FileSystem { - Clusters = btrfsSb.total_bytes / btrfsSb.sectorsize, - ClusterSize = btrfsSb.sectorsize, - FreeClustersSpecified = true, - VolumeName = btrfsSb.label, - VolumeSerial = $"{btrfsSb.uuid}", - VolumeSetIdentifier = $"{btrfsSb.dev_item.device_uuid}", - Type = FS_TYPE + Clusters = btrfsSb.total_bytes / btrfsSb.sectorsize, + ClusterSize = btrfsSb.sectorsize, + VolumeName = btrfsSb.label, + VolumeSerial = $"{btrfsSb.uuid}", + VolumeSetIdentifier = $"{btrfsSb.dev_item.device_uuid}", + Type = FS_TYPE }; - XmlFsType.FreeClusters = XmlFsType.Clusters - (btrfsSb.bytes_used / btrfsSb.sectorsize); + Metadata.FreeClusters = Metadata.Clusters - (btrfsSb.bytes_used / btrfsSb.sectorsize); } } \ No newline at end of file diff --git a/Aaru.Filesystems/CBM/CBM.cs b/Aaru.Filesystems/CBM/CBM.cs index 53bbc5167..7d0279876 100644 --- a/Aaru.Filesystems/CBM/CBM.cs +++ b/Aaru.Filesystems/CBM/CBM.cs @@ -28,8 +28,8 @@ using System; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -38,7 +38,7 @@ namespace Aaru.Filesystems; public sealed partial class CBM : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public string Name => Localization.CBM_Name; /// diff --git a/Aaru.Filesystems/CBM/Info.cs b/Aaru.Filesystems/CBM/Info.cs index 8a766b1e1..cc64f4c41 100644 --- a/Aaru.Filesystems/CBM/Info.cs +++ b/Aaru.Filesystems/CBM/Info.cs @@ -28,13 +28,13 @@ using System; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Helpers; using Claunia.Encoding; -using Schemas; using Encoding = System.Text.Encoding; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -99,7 +99,7 @@ public sealed partial class CBM sbInformation.AppendLine(Localization.Commodore_file_system); - XmlFsType = new FileSystemType + Metadata = new FileSystem { Type = FS_TYPE, Clusters = imagePlugin.Info.Sectors, @@ -138,8 +138,8 @@ public sealed partial class CBM sbInformation.AppendFormat(Localization.Disk_name_0, StringHandlers.CToString(cbmHdr.name, Encoding)). AppendLine(); - XmlFsType.VolumeName = StringHandlers.CToString(cbmHdr.name, Encoding); - XmlFsType.VolumeSerial = $"{cbmHdr.diskId}"; + Metadata.VolumeName = StringHandlers.CToString(cbmHdr.name, Encoding); + Metadata.VolumeSerial = $"{cbmHdr.diskId}"; } else { @@ -166,8 +166,8 @@ public sealed partial class CBM sbInformation.AppendFormat(Localization.Disk_name_0, StringHandlers.CToString(cbmBam.name, Encoding)). AppendLine(); - XmlFsType.VolumeName = StringHandlers.CToString(cbmBam.name, Encoding); - XmlFsType.VolumeSerial = $"{cbmBam.diskId}"; + Metadata.VolumeName = StringHandlers.CToString(cbmBam.name, Encoding); + Metadata.VolumeSerial = $"{cbmBam.diskId}"; } information = sbInformation.ToString(); diff --git a/Aaru.Filesystems/CPM/CPM.cs b/Aaru.Filesystems/CPM/CPM.cs index 5b2de3a36..2c1147465 100644 --- a/Aaru.Filesystems/CPM/CPM.cs +++ b/Aaru.Filesystems/CPM/CPM.cs @@ -33,9 +33,9 @@ using System; using System.Collections.Generic; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Structs; -using Schemas; namespace Aaru.Filesystems; @@ -82,7 +82,7 @@ public sealed partial class CPM : IReadOnlyFilesystem CpmDefinition _workingDefinition; /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/CPM/File.cs b/Aaru.Filesystems/CPM/File.cs index c7bd5f280..f872d0347 100644 --- a/Aaru.Filesystems/CPM/File.cs +++ b/Aaru.Filesystems/CPM/File.cs @@ -148,7 +148,7 @@ public sealed partial class CPM stat = new FileEntryInfo { Attributes = FileAttributes.Directory, - BlockSize = XmlFsType.ClusterSize + BlockSize = Metadata.ClusterSize }; if(_labelCreationDate != null) diff --git a/Aaru.Filesystems/CPM/Info.cs b/Aaru.Filesystems/CPM/Info.cs index 5babda335..650406860 100644 --- a/Aaru.Filesystems/CPM/Info.cs +++ b/Aaru.Filesystems/CPM/Info.cs @@ -35,11 +35,12 @@ using System.IO; using System.Linq; using System.Text; using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Console; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -1236,29 +1237,27 @@ public sealed partial class CPM sb.AppendFormat(Localization.Volume_updated_on_0, DateHandlers.CpmToDateTime(_labelUpdateDate)). AppendLine(); - XmlFsType = new FileSystemType(); - XmlFsType.Bootable |= _workingDefinition.sofs > 0 || _workingDefinition.ofs > 0; - XmlFsType.ClusterSize = (uint)(128 << _dpb.bsh); + Metadata = new FileSystem(); + Metadata.Bootable |= _workingDefinition.sofs > 0 || _workingDefinition.ofs > 0; + Metadata.ClusterSize = (uint)(128 << _dpb.bsh); if(_dpb.dsm > 0) - XmlFsType.Clusters = _dpb.dsm; + Metadata.Clusters = _dpb.dsm; else - XmlFsType.Clusters = partition.End - partition.Start; + Metadata.Clusters = partition.End - partition.Start; if(_labelCreationDate != null) { - XmlFsType.CreationDate = DateHandlers.CpmToDateTime(_labelCreationDate); - XmlFsType.CreationDateSpecified = true; + Metadata.CreationDate = DateHandlers.CpmToDateTime(_labelCreationDate); } if(_labelUpdateDate != null) { - XmlFsType.ModificationDate = DateHandlers.CpmToDateTime(_labelUpdateDate); - XmlFsType.ModificationDateSpecified = true; + Metadata.ModificationDate = DateHandlers.CpmToDateTime(_labelUpdateDate); } - XmlFsType.Type = FS_TYPE; - XmlFsType.VolumeName = _label; + Metadata.Type = FS_TYPE; + Metadata.VolumeName = _label; information = sb.ToString(); } diff --git a/Aaru.Filesystems/CPM/Super.cs b/Aaru.Filesystems/CPM/Super.cs index 859c03949..36c8e5fb6 100644 --- a/Aaru.Filesystems/CPM/Super.cs +++ b/Aaru.Filesystems/CPM/Super.cs @@ -37,15 +37,15 @@ using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Structs; using Aaru.Console; using Aaru.Helpers; -using Schemas; using FileAttributes = Aaru.CommonTypes.Structs.FileAttributes; using FileSystemInfo = Aaru.CommonTypes.Structs.FileSystemInfo; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -782,31 +782,27 @@ public sealed partial class CPM _cpmStat.Type = FS_TYPE; // Generate XML info - XmlFsType = new FileSystemType + Metadata = new FileSystem { - Clusters = _cpmStat.Blocks, - ClusterSize = (uint)blockSize, - Files = (ulong)_fileCache.Count, - FilesSpecified = true, - FreeClusters = _cpmStat.FreeBlocks, - FreeClustersSpecified = true, - Type = FS_TYPE + Clusters = _cpmStat.Blocks, + ClusterSize = (uint)blockSize, + Files = (ulong)_fileCache.Count, + FreeClusters = _cpmStat.FreeBlocks, + Type = FS_TYPE }; if(_labelCreationDate != null) { - XmlFsType.CreationDate = DateHandlers.CpmToDateTime(_labelCreationDate); - XmlFsType.CreationDateSpecified = true; + Metadata.CreationDate = DateHandlers.CpmToDateTime(_labelCreationDate); } if(_labelUpdateDate != null) { - XmlFsType.ModificationDate = DateHandlers.CpmToDateTime(_labelUpdateDate); - XmlFsType.ModificationDateSpecified = true; + Metadata.ModificationDate = DateHandlers.CpmToDateTime(_labelUpdateDate); } if(!string.IsNullOrEmpty(_label)) - XmlFsType.VolumeName = _label; + Metadata.VolumeName = _label; _mounted = true; diff --git a/Aaru.Filesystems/Cram/Cram.cs b/Aaru.Filesystems/Cram/Cram.cs index 82b6f082c..18d282a01 100644 --- a/Aaru.Filesystems/Cram/Cram.cs +++ b/Aaru.Filesystems/Cram/Cram.cs @@ -31,8 +31,8 @@ using System; using System.Diagnostics.CodeAnalysis; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -42,7 +42,7 @@ namespace Aaru.Filesystems; public sealed partial class Cram : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/Cram/Info.cs b/Aaru.Filesystems/Cram/Info.cs index 0188b17ab..86efd69e5 100644 --- a/Aaru.Filesystems/Cram/Info.cs +++ b/Aaru.Filesystems/Cram/Info.cs @@ -31,11 +31,11 @@ using System; using System.Diagnostics.CodeAnalysis; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -103,15 +103,13 @@ public sealed partial class Cram information = sbInformation.ToString(); - XmlFsType = new FileSystemType + Metadata = new FileSystem { - VolumeName = StringHandlers.CToString(crSb.name, Encoding), - Type = FS_TYPE, - Clusters = crSb.blocks, - Files = crSb.files, - FilesSpecified = true, - FreeClusters = 0, - FreeClustersSpecified = true + VolumeName = StringHandlers.CToString(crSb.name, Encoding), + Type = FS_TYPE, + Clusters = crSb.blocks, + Files = crSb.files, + FreeClusters = 0 }; } } \ No newline at end of file diff --git a/Aaru.Filesystems/ECMA67/ECMA67.cs b/Aaru.Filesystems/ECMA67/ECMA67.cs index 763771970..e58c81912 100644 --- a/Aaru.Filesystems/ECMA67/ECMA67.cs +++ b/Aaru.Filesystems/ECMA67/ECMA67.cs @@ -32,8 +32,8 @@ using System; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -48,7 +48,7 @@ public sealed partial class ECMA67 : IFilesystem /// public Guid Id => new("62A2D44A-CBC1-4377-B4B6-28C5C92034A1"); /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public string Author => Authors.NataliaPortillo; } \ No newline at end of file diff --git a/Aaru.Filesystems/ECMA67/Info.cs b/Aaru.Filesystems/ECMA67/Info.cs index c94d46e97..f1f9c179b 100644 --- a/Aaru.Filesystems/ECMA67/Info.cs +++ b/Aaru.Filesystems/ECMA67/Info.cs @@ -32,11 +32,11 @@ using System.Linq; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -87,7 +87,7 @@ public sealed partial class ECMA67 sbInformation.AppendFormat(Localization.Volume_owner_0, Encoding.ASCII.GetString(vol.owner)).AppendLine(); - XmlFsType = new FileSystemType + Metadata = new FileSystem { Type = FS_TYPE, ClusterSize = 256, diff --git a/Aaru.Filesystems/EFS/EFS.cs b/Aaru.Filesystems/EFS/EFS.cs index a74a52c77..c806111ba 100644 --- a/Aaru.Filesystems/EFS/EFS.cs +++ b/Aaru.Filesystems/EFS/EFS.cs @@ -28,8 +28,8 @@ using System; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -38,7 +38,7 @@ namespace Aaru.Filesystems; public sealed partial class EFS : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/EFS/Info.cs b/Aaru.Filesystems/EFS/Info.cs index 259b87506..92cfc3b06 100644 --- a/Aaru.Filesystems/EFS/Info.cs +++ b/Aaru.Filesystems/EFS/Info.cs @@ -28,12 +28,12 @@ using System; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Console; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -48,7 +48,7 @@ public sealed partial class EFS return false; // Misaligned - if(imagePlugin.Info.XmlMediaType == XmlMediaType.OpticalDisc) + if(imagePlugin.Info.MetadataMediaType == MetadataMediaType.OpticalDisc) { uint sbSize = (uint)((Marshal.SizeOf() + 0x200) / imagePlugin.Info.SectorSize); @@ -114,7 +114,7 @@ public sealed partial class EFS Superblock efsSb; // Misaligned - if(imagePlugin.Info.XmlMediaType == XmlMediaType.OpticalDisc) + if(imagePlugin.Info.MetadataMediaType == MetadataMediaType.OpticalDisc) { uint sbSize = (uint)((Marshal.SizeOf() + 0x400) / imagePlugin.Info.SectorSize); @@ -200,18 +200,16 @@ public sealed partial class EFS information = sb.ToString(); - XmlFsType = new FileSystemType + Metadata = new FileSystem { - Type = FS_TYPE, - ClusterSize = 512, - Clusters = (ulong)efsSb.sb_size, - FreeClusters = (ulong)efsSb.sb_tfree, - FreeClustersSpecified = true, - Dirty = efsSb.sb_dirty > 0, - VolumeName = StringHandlers.CToString(efsSb.sb_fname, Encoding), - VolumeSerial = $"{efsSb.sb_checksum:X8}", - CreationDate = DateHandlers.UnixToDateTime(efsSb.sb_time), - CreationDateSpecified = true + Type = FS_TYPE, + ClusterSize = 512, + Clusters = (ulong)efsSb.sb_size, + FreeClusters = (ulong)efsSb.sb_tfree, + Dirty = efsSb.sb_dirty > 0, + VolumeName = StringHandlers.CToString(efsSb.sb_fname, Encoding), + VolumeSerial = $"{efsSb.sb_checksum:X8}", + CreationDate = DateHandlers.UnixToDateTime(efsSb.sb_time) }; } } \ No newline at end of file diff --git a/Aaru.Filesystems/F2FS/F2FS.cs b/Aaru.Filesystems/F2FS/F2FS.cs index 0afd66962..50fbcb0a4 100644 --- a/Aaru.Filesystems/F2FS/F2FS.cs +++ b/Aaru.Filesystems/F2FS/F2FS.cs @@ -29,8 +29,8 @@ using System; using System.Diagnostics.CodeAnalysis; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -40,7 +40,7 @@ namespace Aaru.Filesystems; public sealed partial class F2FS : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/F2FS/Info.cs b/Aaru.Filesystems/F2FS/Info.cs index 331cd2715..12f8263f9 100644 --- a/Aaru.Filesystems/F2FS/Info.cs +++ b/Aaru.Filesystems/F2FS/Info.cs @@ -28,11 +28,11 @@ using System.Diagnostics.CodeAnalysis; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -135,7 +135,7 @@ public sealed partial class F2FS information = sb.ToString(); - XmlFsType = new FileSystemType + Metadata = new FileSystem { Type = FS_TYPE, SystemIdentifier = Encoding.ASCII.GetString(f2fsSb.version), diff --git a/Aaru.Filesystems/FAT/BPB.cs b/Aaru.Filesystems/FAT/BPB.cs index 7ad87fd4a..9207521cd 100644 --- a/Aaru.Filesystems/FAT/BPB.cs +++ b/Aaru.Filesystems/FAT/BPB.cs @@ -154,7 +154,7 @@ public sealed partial class FAT bool correctSpcApricot = apricotBpb.mainBPB.spc is 1 or 2 or 4 or 8 or 16 or 32 or 64; // This is to support FAT partitions on hybrid ISO/USB images - if(imagePlugin.Info.XmlMediaType == XmlMediaType.OpticalDisc) + if(imagePlugin.Info.MetadataMediaType == MetadataMediaType.OpticalDisc) { atariBpb.sectors /= 4; msxBpb.sectors /= 4; diff --git a/Aaru.Filesystems/FAT/FAT.cs b/Aaru.Filesystems/FAT/FAT.cs index 95d021ef0..6a58b875c 100644 --- a/Aaru.Filesystems/FAT/FAT.cs +++ b/Aaru.Filesystems/FAT/FAT.cs @@ -30,9 +30,9 @@ using System; using System.Collections.Generic; using System.Globalization; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Structs; -using Schemas; namespace Aaru.Filesystems; @@ -64,7 +64,7 @@ public sealed partial class FAT : IReadOnlyFilesystem bool _useFirstFat; /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/FAT/File.cs b/Aaru.Filesystems/FAT/File.cs index 07cc6b827..6141b7a51 100644 --- a/Aaru.Filesystems/FAT/File.cs +++ b/Aaru.Filesystems/FAT/File.cs @@ -225,7 +225,7 @@ public sealed partial class FAT if(startCluster == 0) return Array.Empty(); - if(startCluster >= XmlFsType.Clusters) + if(startCluster >= Metadata.Clusters) return null; List clusters = new(); diff --git a/Aaru.Filesystems/FAT/Info.cs b/Aaru.Filesystems/FAT/Info.cs index 58896a1ea..945edaacc 100644 --- a/Aaru.Filesystems/FAT/Info.cs +++ b/Aaru.Filesystems/FAT/Info.cs @@ -33,13 +33,13 @@ using System.Linq; using System.Runtime.InteropServices; using System.Text; using Aaru.Checksums; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Console; using Aaru.Helpers; -using Schemas; using Marshal = Aaru.Helpers.Marshal; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -197,7 +197,7 @@ public sealed partial class FAT AaruConsole.DebugWriteLine("FAT plugin", "apricot_fat_sectors = {0}", apricotFatSectors); // This is to support FAT partitions on hybrid ISO/USB images - if(imagePlugin.Info.XmlMediaType == XmlMediaType.OpticalDisc) + if(imagePlugin.Info.MetadataMediaType == MetadataMediaType.OpticalDisc) { sectors /= 4; bigSectors /= 4; @@ -427,7 +427,7 @@ public sealed partial class FAT information = ""; var sb = new StringBuilder(); - XmlFsType = new FileSystemType(); + Metadata = new FileSystem(); uint sectorsPerBpb = imagePlugin.Info.SectorSize < 512 ? 512 / imagePlugin.Info.SectorSize : 1; @@ -446,7 +446,7 @@ public sealed partial class FAT ulong rootDirectorySector = 0; string extraInfo = null; string bootChk = null; - XmlFsType.Bootable = bootable; + Metadata.Bootable = bootable; // This is needed because for FAT16, GEMDOS increases bytes per sector count instead of using big_sectors field. uint sectorsPerRealSector; @@ -474,7 +474,7 @@ public sealed partial class FAT Marshal.ByteArrayToStructureLittleEndian(bpbSector); // This is to support FAT partitions on hybrid ISO/USB images - if(imagePlugin.Info.XmlMediaType == XmlMediaType.OpticalDisc) + if(imagePlugin.Info.MetadataMediaType == MetadataMediaType.OpticalDisc) { fat32Bpb.bps *= 4; fat32Bpb.spc /= 4; @@ -486,12 +486,12 @@ public sealed partial class FAT if(fat32Bpb.version != 0) { sb.AppendLine(Localization.FAT_Plus); - XmlFsType.Type = FS_TYPE_FAT_PLUS; + Metadata.Type = FS_TYPE_FAT_PLUS; } else { sb.AppendLine(Localization.Microsoft_FAT32); - XmlFsType.Type = FS_TYPE_FAT32; + Metadata.Type = FS_TYPE_FAT32; } if(fat32Bpb.oem_name != null) @@ -500,14 +500,14 @@ public sealed partial class FAT fat32Bpb.oem_name[7] == 0x43) sb.AppendLine(Localization.Volume_has_been_modified_by_Windows_9x_Me_Volume_Tracker); else - XmlFsType.SystemIdentifier = StringHandlers.CToString(fat32Bpb.oem_name); + Metadata.SystemIdentifier = StringHandlers.CToString(fat32Bpb.oem_name); - if(!string.IsNullOrEmpty(XmlFsType.SystemIdentifier)) - sb.AppendFormat(Localization.OEM_name_0, XmlFsType.SystemIdentifier.Trim()).AppendLine(); + if(!string.IsNullOrEmpty(Metadata.SystemIdentifier)) + sb.AppendFormat(Localization.OEM_name_0, Metadata.SystemIdentifier.Trim()).AppendLine(); sb.AppendFormat(Localization._0_bytes_per_sector, fat32Bpb.bps).AppendLine(); sb.AppendFormat(Localization._0_sectors_per_cluster, fat32Bpb.spc).AppendLine(); - XmlFsType.ClusterSize = (uint)(fat32Bpb.bps * fat32Bpb.spc); + Metadata.ClusterSize = (uint)(fat32Bpb.bps * fat32Bpb.spc); sb.AppendFormat(Localization._0_sectors_reserved_between_BPB_and_FAT, fat32Bpb.rsectors).AppendLine(); if(fat32Bpb is { big_sectors: 0, signature: 0x28 }) @@ -515,24 +515,24 @@ public sealed partial class FAT sb.AppendFormat(Localization._0_sectors_on_volume_1_bytes, shortFat32Bpb.huge_sectors, shortFat32Bpb.huge_sectors * shortFat32Bpb.bps).AppendLine(); - XmlFsType.Clusters = shortFat32Bpb.huge_sectors / shortFat32Bpb.spc; + Metadata.Clusters = shortFat32Bpb.huge_sectors / shortFat32Bpb.spc; } else if(fat32Bpb.sectors == 0) { sb.AppendFormat(Localization._0_sectors_on_volume_1_bytes, fat32Bpb.big_sectors, fat32Bpb.big_sectors * fat32Bpb.bps).AppendLine(); - XmlFsType.Clusters = fat32Bpb.big_sectors / fat32Bpb.spc; + Metadata.Clusters = fat32Bpb.big_sectors / fat32Bpb.spc; } else { sb.AppendFormat(Localization._0_sectors_on_volume_1_bytes, fat32Bpb.sectors, fat32Bpb.sectors * fat32Bpb.bps).AppendLine(); - XmlFsType.Clusters = (ulong)(fat32Bpb.sectors / fat32Bpb.spc); + Metadata.Clusters = (ulong)(fat32Bpb.sectors / fat32Bpb.spc); } - sb.AppendFormat(Localization._0_clusters_on_volume, XmlFsType.Clusters).AppendLine(); + sb.AppendFormat(Localization._0_clusters_on_volume, Metadata.Clusters).AppendLine(); sb.AppendFormat(Localization.Media_descriptor_0, fat32Bpb.media).AppendLine(); sb.AppendFormat(Localization._0_sectors_per_FAT, fat32Bpb.big_spfat).AppendLine(); sb.AppendFormat(Localization._0_sectors_per_track, fat32Bpb.sptrk).AppendLine(); @@ -546,14 +546,14 @@ public sealed partial class FAT sb.AppendFormat(Localization.Drive_number_0, fat32Bpb.drive_no).AppendLine(); sb.AppendFormat(Localization.Volume_Serial_Number_0, fat32Bpb.serial_no).AppendLine(); - XmlFsType.VolumeSerial = $"{fat32Bpb.serial_no:X8}"; + Metadata.VolumeSerial = $"{fat32Bpb.serial_no:X8}"; if((fat32Bpb.flags & 0xF8) == 0x00) { if((fat32Bpb.flags & 0x01) == 0x01) { sb.AppendLine(Localization.Volume_should_be_checked_on_next_mount); - XmlFsType.Dirty = true; + Metadata.Dirty = true; } if((fat32Bpb.flags & 0x02) == 0x02) @@ -573,8 +573,8 @@ public sealed partial class FAT if(fat32Bpb.signature == 0x29) { - XmlFsType.VolumeName = StringHandlers.SpacePaddedToString(fat32Bpb.volume_label, Encoding); - XmlFsType.VolumeName = XmlFsType.VolumeName?.Replace("\0", ""); + Metadata.VolumeName = StringHandlers.SpacePaddedToString(fat32Bpb.volume_label, Encoding); + Metadata.VolumeName = Metadata.VolumeName?.Replace("\0", ""); sb.AppendFormat(Localization.Filesystem_type_0, Encoding.ASCII.GetString(fat32Bpb.fs_type)). AppendLine(); @@ -586,7 +586,7 @@ public sealed partial class FAT // Check that jumps to a correct boot code position and has boot signature set. // This will mean that the volume will boot, even if just to say "this is not bootable change disk"...... - XmlFsType.Bootable = + Metadata.Bootable = (fat32Bpb.jump[0] == 0xEB && fat32Bpb.jump[1] >= minBootNearJump && fat32Bpb.jump[1] < 0x80) || (fat32Bpb.jump[0] == 0xE9 && fat32Bpb.jump.Length >= 3 && BitConverter.ToUInt16(fat32Bpb.jump, 1) >= minBootNearJump && @@ -616,8 +616,7 @@ public sealed partial class FAT if(fsInfo.free_clusters < 0xFFFFFFFF) { sb.AppendFormat(Localization._0_free_clusters, fsInfo.free_clusters).AppendLine(); - XmlFsType.FreeClusters = fsInfo.free_clusters; - XmlFsType.FreeClustersSpecified = true; + Metadata.FreeClusters = fsInfo.free_clusters; } if(fsInfo.last_cluster is > 2 and < 0xFFFFFFFF) @@ -639,7 +638,7 @@ public sealed partial class FAT // TODO: Check this if(sum == 0x1234) { - XmlFsType.Bootable = true; + Metadata.Bootable = true; var atariSb = new StringBuilder(); atariSb.AppendFormat(Localization.cmdload_will_be_loaded_with_value_0, @@ -680,7 +679,7 @@ public sealed partial class FAT } case BpbKind.Human: - XmlFsType.Bootable = true; + Metadata.Bootable = true; break; } @@ -688,7 +687,7 @@ public sealed partial class FAT if(!isFat32) { // This is to support FAT partitions on hybrid ISO/USB images - if(imagePlugin.Info.XmlMediaType == XmlMediaType.OpticalDisc) + if(imagePlugin.Info.MetadataMediaType == MetadataMediaType.OpticalDisc) { fakeBpb.bps *= 4; fakeBpb.spc /= 4; @@ -803,7 +802,7 @@ public sealed partial class FAT break; } - XmlFsType.Type = FS_TYPE_FAT12; + Metadata.Type = FS_TYPE_FAT12; } else if(isFat16) { @@ -814,7 +813,7 @@ public sealed partial class FAT _ => Localization.Microsoft_FAT16 }); - XmlFsType.Type = FS_TYPE_FAT16; + Metadata.Type = FS_TYPE_FAT16; } if(bpbKind == BpbKind.Atari) @@ -824,13 +823,13 @@ public sealed partial class FAT atariBpb.serial_no[2] == 0x43) sb.AppendLine(Localization.Volume_has_been_modified_by_Windows_9x_Me_Volume_Tracker); else - XmlFsType.VolumeSerial = $"{atariBpb.serial_no[0]:X2}{atariBpb.serial_no[1]:X2}{ - atariBpb.serial_no[2]:X2}"; + Metadata.VolumeSerial = $"{atariBpb.serial_no[0]:X2}{atariBpb.serial_no[1]:X2}{atariBpb.serial_no[2] + :X2}"; - XmlFsType.SystemIdentifier = StringHandlers.CToString(atariBpb.oem_name); + Metadata.SystemIdentifier = StringHandlers.CToString(atariBpb.oem_name); - if(string.IsNullOrEmpty(XmlFsType.SystemIdentifier)) - XmlFsType.SystemIdentifier = null; + if(string.IsNullOrEmpty(Metadata.SystemIdentifier)) + Metadata.SystemIdentifier = null; } else if(fakeBpb.oem_name != null) { @@ -839,7 +838,7 @@ public sealed partial class FAT fakeBpb.oem_name[7] == 0x43) sb.AppendLine(Localization.Volume_has_been_modified_by_Windows_9x_Me_Volume_Tracker); else - XmlFsType.SystemIdentifier = fakeBpb.oem_name[0] switch + Metadata.SystemIdentifier = fakeBpb.oem_name[0] switch { // Later versions of Windows create a DOS 3 BPB without OEM name on 8 sectors/track floppies // OEM ID should be ASCII, otherwise ignore it @@ -861,15 +860,15 @@ public sealed partial class FAT fakeBpb.oem_name[7] >= 0x20 && fakeBpb.oem_name[7] <= 0x7F => StringHandlers.CToString(fakeBpb.oem_name, Encoding, start: 1), - _ => XmlFsType.SystemIdentifier + _ => Metadata.SystemIdentifier }; if(fakeBpb.signature is 0x28 or 0x29) - XmlFsType.VolumeSerial = $"{fakeBpb.serial_no:X8}"; + Metadata.VolumeSerial = $"{fakeBpb.serial_no:X8}"; } - if(XmlFsType.SystemIdentifier != null) - sb.AppendFormat(Localization.OEM_name_0, XmlFsType.SystemIdentifier.Trim()).AppendLine(); + if(Metadata.SystemIdentifier != null) + sb.AppendFormat(Localization.OEM_name_0, Metadata.SystemIdentifier.Trim()).AppendLine(); sb.AppendFormat(Localization._0_bytes_per_sector, fakeBpb.bps).AppendLine(); @@ -885,10 +884,10 @@ public sealed partial class FAT clusters * humanBpb.bpc / imagePlugin.Info.SectorSize, clusters * humanBpb.bpc). AppendLine(); - XmlFsType.Clusters = clusters; + Metadata.Clusters = clusters; sb.AppendFormat(Localization._0_sectors_per_cluster, fakeBpb.spc).AppendLine(); - sb.AppendFormat(Localization._0_clusters_on_volume, XmlFsType.Clusters).AppendLine(); - XmlFsType.ClusterSize = (uint)(fakeBpb.bps * fakeBpb.spc); + sb.AppendFormat(Localization._0_clusters_on_volume, Metadata.Clusters).AppendLine(); + Metadata.ClusterSize = (uint)(fakeBpb.bps * fakeBpb.spc); sb.AppendFormat(Localization._0_sectors_reserved_between_BPB_and_FAT, fakeBpb.rsectors).AppendLine(); sb.AppendFormat(Localization._0_FATs, fakeBpb.fats_no).AppendLine(); sb.AppendFormat(Localization._0_entries_on_root_directory, fakeBpb.root_ent).AppendLine(); @@ -912,15 +911,15 @@ public sealed partial class FAT { sb.AppendFormat(Localization.Drive_number_0, fakeBpb.drive_no).AppendLine(); - if(XmlFsType.VolumeSerial != null) - sb.AppendFormat(Localization.Volume_Serial_Number_0, XmlFsType.VolumeSerial).AppendLine(); + if(Metadata.VolumeSerial != null) + sb.AppendFormat(Localization.Volume_Serial_Number_0, Metadata.VolumeSerial).AppendLine(); if((fakeBpb.flags & 0xF8) == 0x00) { if((fakeBpb.flags & 0x01) == 0x01) { sb.AppendLine(Localization.Volume_should_be_checked_on_next_mount); - XmlFsType.Dirty = true; + Metadata.Dirty = true; } if((fakeBpb.flags & 0x02) == 0x02) @@ -929,28 +928,28 @@ public sealed partial class FAT if(fakeBpb.signature == 0x29 || andosOemCorrect) { - XmlFsType.VolumeName = StringHandlers.SpacePaddedToString(fakeBpb.volume_label, Encoding); - XmlFsType.VolumeName = XmlFsType.VolumeName?.Replace("\0", ""); + Metadata.VolumeName = StringHandlers.SpacePaddedToString(fakeBpb.volume_label, Encoding); + Metadata.VolumeName = Metadata.VolumeName?.Replace("\0", ""); sb.AppendFormat(Localization.Filesystem_type_0, Encoding.ASCII.GetString(fakeBpb.fs_type)). AppendLine(); } } - else if(bpbKind == BpbKind.Atari && - XmlFsType.VolumeSerial != null) - sb.AppendFormat(Localization.Volume_Serial_Number_0, XmlFsType.VolumeSerial).AppendLine(); + else if(bpbKind == BpbKind.Atari && + Metadata.VolumeSerial != null) + sb.AppendFormat(Localization.Volume_Serial_Number_0, Metadata.VolumeSerial).AppendLine(); bootChk = Sha1Context.Data(fakeBpb.boot_code, out _); // Workaround that PCExchange jumps into "FAT16 "... - if(XmlFsType.SystemIdentifier == "PCX 2.0 ") + if(Metadata.SystemIdentifier == "PCX 2.0 ") fakeBpb.jump[1] += 8; // Check that jumps to a correct boot code position and has boot signature set. // This will mean that the volume will boot, even if just to say "this is not bootable change disk"...... - if(XmlFsType.Bootable == false && - fakeBpb.jump != null) - XmlFsType.Bootable |= + if(Metadata.Bootable == false && + fakeBpb.jump != null) + Metadata.Bootable |= (fakeBpb.jump[0] == 0xEB && fakeBpb.jump[1] >= minBootNearJump && fakeBpb.jump[1] < 0x80) || (fakeBpb.jump[0] == 0xE9 && fakeBpb.jump.Length >= 3 && BitConverter.ToUInt16(fakeBpb.jump, 1) >= minBootNearJump && @@ -968,7 +967,7 @@ public sealed partial class FAT sb.Append(extraInfo); if(rootDirectorySector + partition.Start < partition.End && - imagePlugin.Info.XmlMediaType != XmlMediaType.OpticalDisc) + imagePlugin.Info.MetadataMediaType != MetadataMediaType.OpticalDisc) { errno = imagePlugin.ReadSectors(rootDirectorySector + partition.Start, sectorsForRootDirectory, out byte[] rootDirectory); @@ -1021,24 +1020,22 @@ public sealed partial class FAT string volname = Encoding.GetString(fullname).Trim(); if(!string.IsNullOrEmpty(volname)) - XmlFsType.VolumeName = entry.caseinfo.HasFlag(CaseInfo.AllLowerCase) ? volname.ToLower() : volname; + Metadata.VolumeName = entry.caseinfo.HasFlag(CaseInfo.AllLowerCase) ? volname.ToLower() : volname; if(entry is { ctime: > 0, cdate: > 0 }) { - XmlFsType.CreationDate = DateHandlers.DosToDateTime(entry.cdate, entry.ctime); + Metadata.CreationDate = DateHandlers.DosToDateTime(entry.cdate, entry.ctime); if(entry.ctime_ms > 0) - XmlFsType.CreationDate = XmlFsType.CreationDate.AddMilliseconds(entry.ctime_ms * 10); + Metadata.CreationDate = Metadata.CreationDate?.AddMilliseconds(entry.ctime_ms * 10); - XmlFsType.CreationDateSpecified = true; - sb.AppendFormat(Localization.Volume_created_on_0, XmlFsType.CreationDate).AppendLine(); + sb.AppendFormat(Localization.Volume_created_on_0, Metadata.CreationDate).AppendLine(); } if(entry is { mtime: > 0, mdate: > 0 }) { - XmlFsType.ModificationDate = DateHandlers.DosToDateTime(entry.mdate, entry.mtime); - XmlFsType.ModificationDateSpecified = true; - sb.AppendFormat(Localization.Volume_last_modified_on_0, XmlFsType.ModificationDate).AppendLine(); + Metadata.ModificationDate = DateHandlers.DosToDateTime(entry.mdate, entry.mtime); + sb.AppendFormat(Localization.Volume_last_modified_on_0, Metadata.ModificationDate).AppendLine(); } if(entry.adate > 0) @@ -1049,10 +1046,10 @@ public sealed partial class FAT } } - if(!string.IsNullOrEmpty(XmlFsType.VolumeName)) - sb.AppendFormat(Localization.Volume_label_0, XmlFsType.VolumeName).AppendLine(); + if(!string.IsNullOrEmpty(Metadata.VolumeName)) + sb.AppendFormat(Localization.Volume_label_0, Metadata.VolumeName).AppendLine(); - if(XmlFsType.Bootable) + if(Metadata.Bootable) { switch(bpbSector[0]) { diff --git a/Aaru.Filesystems/FAT/Super.cs b/Aaru.Filesystems/FAT/Super.cs index 5827826c8..49f1578d7 100644 --- a/Aaru.Filesystems/FAT/Super.cs +++ b/Aaru.Filesystems/FAT/Super.cs @@ -33,15 +33,15 @@ using System.IO; using System.Linq; using System.Runtime.InteropServices; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Structs; using Aaru.Console; using Aaru.Helpers; -using Schemas; using FileSystemInfo = Aaru.CommonTypes.Structs.FileSystemInfo; using Marshal = Aaru.Helpers.Marshal; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -54,7 +54,7 @@ public sealed partial class FAT public ErrorNumber Mount(IMediaImage imagePlugin, Partition partition, Encoding encoding, Dictionary options, string @namespace) { - XmlFsType = new FileSystemType(); + Metadata = new FileSystem(); options ??= GetDefaultOptions(); @@ -106,11 +106,11 @@ public sealed partial class FAT out HumanParameterBlock humanBpb, out AtariParameterBlock atariBpb, out byte minBootNearJump, out bool andosOemCorrect, out bool bootable); - _fat12 = false; - _fat16 = false; - _fat32 = false; - _useFirstFat = true; - XmlFsType.Bootable = bootable; + _fat12 = false; + _fat16 = false; + _fat32 = false; + _useFirstFat = true; + Metadata.Bootable = bootable; _statfs = new FileSystemInfo { @@ -153,7 +153,7 @@ public sealed partial class FAT rootDirectoryCluster = fat32Bpb.root_cluster; // This is to support FAT partitions on hybrid ISO/USB images - if(imagePlugin.Info.XmlMediaType == XmlMediaType.OpticalDisc) + if(imagePlugin.Info.MetadataMediaType == MetadataMediaType.OpticalDisc) { fat32Bpb.bps *= 4; fat32Bpb.spc /= 4; @@ -162,25 +162,25 @@ public sealed partial class FAT fat32Bpb.sptrk /= 4; } - XmlFsType.Type = fat32Bpb.version != 0 ? FS_TYPE_FAT_PLUS : FS_TYPE_FAT32; + Metadata.Type = fat32Bpb.version != 0 ? FS_TYPE_FAT_PLUS : FS_TYPE_FAT32; if(fat32Bpb.oem_name != null && (fat32Bpb.oem_name[5] != 0x49 || fat32Bpb.oem_name[6] != 0x48 || fat32Bpb.oem_name[7] != 0x43)) - XmlFsType.SystemIdentifier = StringHandlers.CToString(fat32Bpb.oem_name); + Metadata.SystemIdentifier = StringHandlers.CToString(fat32Bpb.oem_name); - _sectorsPerCluster = fat32Bpb.spc; - XmlFsType.ClusterSize = (uint)(fat32Bpb.bps * fat32Bpb.spc); - _reservedSectors = fat32Bpb.rsectors; + _sectorsPerCluster = fat32Bpb.spc; + Metadata.ClusterSize = (uint)(fat32Bpb.bps * fat32Bpb.spc); + _reservedSectors = fat32Bpb.rsectors; if(fat32Bpb is { big_sectors: 0, signature: 0x28 }) - XmlFsType.Clusters = shortFat32Bpb.huge_sectors / shortFat32Bpb.spc; + Metadata.Clusters = shortFat32Bpb.huge_sectors / shortFat32Bpb.spc; else if(fat32Bpb.sectors == 0) - XmlFsType.Clusters = fat32Bpb.big_sectors / fat32Bpb.spc; + Metadata.Clusters = fat32Bpb.big_sectors / fat32Bpb.spc; else - XmlFsType.Clusters = (ulong)(fat32Bpb.sectors / fat32Bpb.spc); + Metadata.Clusters = (ulong)(fat32Bpb.sectors / fat32Bpb.spc); - _sectorsPerFat = fat32Bpb.big_spfat; - XmlFsType.VolumeSerial = $"{fat32Bpb.serial_no:X8}"; + _sectorsPerFat = fat32Bpb.big_spfat; + Metadata.VolumeSerial = $"{fat32Bpb.serial_no:X8}"; _statfs.Id = new FileSystemId { @@ -190,20 +190,20 @@ public sealed partial class FAT if((fat32Bpb.flags & 0xF8) == 0x00) if((fat32Bpb.flags & 0x01) == 0x01) - XmlFsType.Dirty = true; + Metadata.Dirty = true; if((fat32Bpb.mirror_flags & 0x80) == 0x80) _useFirstFat = (fat32Bpb.mirror_flags & 0xF) != 1; if(fat32Bpb.signature == 0x29) { - XmlFsType.VolumeName = StringHandlers.SpacePaddedToString(fat32Bpb.volume_label, Encoding); - XmlFsType.VolumeName = XmlFsType.VolumeName?.Replace("\0", ""); + Metadata.VolumeName = StringHandlers.SpacePaddedToString(fat32Bpb.volume_label, Encoding); + Metadata.VolumeName = Metadata.VolumeName?.Replace("\0", ""); } // Check that jumps to a correct boot code position and has boot signature set. // This will mean that the volume will boot, even if just to say "this is not bootable change disk"...... - XmlFsType.Bootable = + Metadata.Bootable = (fat32Bpb.jump[0] == 0xEB && fat32Bpb.jump[1] >= minBootNearJump && fat32Bpb.jump[1] < 0x80) || (fat32Bpb.jump[0] == 0xE9 && fat32Bpb.jump.Length >= 3 && BitConverter.ToUInt16(fat32Bpb.jump, 1) >= minBootNearJump && @@ -229,8 +229,7 @@ public sealed partial class FAT if(fsInfo is { signature1: FSINFO_SIGNATURE1, signature2 : FSINFO_SIGNATURE2 } and { signature3 : FSINFO_SIGNATURE3, free_clusters: < 0xFFFFFFFF }) { - XmlFsType.FreeClusters = fsInfo.free_clusters; - XmlFsType.FreeClustersSpecified = true; + Metadata.FreeClusters = fsInfo.free_clusters; } } @@ -247,7 +246,7 @@ public sealed partial class FAT // TODO: Check this if(sum == 0x1234) - XmlFsType.Bootable = true; + Metadata.Bootable = true; // BGM changes the bytes per sector instead of changing the sectors per cluster. Why?! WHY!? uint ratio = fakeBpb.bps / imagePlugin.Info.SectorSize; @@ -267,7 +266,7 @@ public sealed partial class FAT if(!_debug) _namespace = Namespace.Human; - XmlFsType.Bootable = true; + Metadata.Bootable = true; break; } @@ -277,7 +276,7 @@ public sealed partial class FAT if(!_fat32) { // This is to support FAT partitions on hybrid ISO/USB images - if(imagePlugin.Info.XmlMediaType == XmlMediaType.OpticalDisc) + if(imagePlugin.Info.MetadataMediaType == MetadataMediaType.OpticalDisc) { fakeBpb.bps *= 4; fakeBpb.spc /= 4; @@ -373,9 +372,9 @@ public sealed partial class FAT } if(_fat12) - XmlFsType.Type = FS_TYPE_FAT12; + Metadata.Type = FS_TYPE_FAT12; else if(_fat16) - XmlFsType.Type = FS_TYPE_FAT16; + Metadata.Type = FS_TYPE_FAT16; if(bpbKind == BpbKind.Atari) { @@ -383,8 +382,8 @@ public sealed partial class FAT atariBpb.serial_no[1] != 0x48 || atariBpb.serial_no[2] != 0x43) { - XmlFsType.VolumeSerial = $"{atariBpb.serial_no[0]:X2}{atariBpb.serial_no[1]:X2}{ - atariBpb.serial_no[2]:X2}"; + Metadata.VolumeSerial = $"{atariBpb.serial_no[0]:X2}{atariBpb.serial_no[1]:X2}{atariBpb.serial_no[2] + :X2}"; _statfs.Id = new FileSystemId { @@ -394,17 +393,17 @@ public sealed partial class FAT }; } - XmlFsType.SystemIdentifier = StringHandlers.CToString(atariBpb.oem_name); + Metadata.SystemIdentifier = StringHandlers.CToString(atariBpb.oem_name); - if(string.IsNullOrEmpty(XmlFsType.SystemIdentifier)) - XmlFsType.SystemIdentifier = null; + if(string.IsNullOrEmpty(Metadata.SystemIdentifier)) + Metadata.SystemIdentifier = null; } else if(fakeBpb.oem_name != null) { if(fakeBpb.oem_name[5] != 0x49 || fakeBpb.oem_name[6] != 0x48 || fakeBpb.oem_name[7] != 0x43) - XmlFsType.SystemIdentifier = fakeBpb.oem_name[0] switch + Metadata.SystemIdentifier = fakeBpb.oem_name[0] switch { // Later versions of Windows create a DOS 3 BPB without OEM name on 8 sectors/track floppies // OEM ID should be ASCII, otherwise ignore it @@ -426,12 +425,12 @@ public sealed partial class FAT fakeBpb.oem_name[7] >= 0x20 && fakeBpb.oem_name[7] <= 0x7F => StringHandlers.CToString(fakeBpb.oem_name, Encoding, start: 1), - _ => XmlFsType.SystemIdentifier + _ => Metadata.SystemIdentifier }; if(fakeBpb.signature is 0x28 or 0x29) { - XmlFsType.VolumeSerial = $"{fakeBpb.serial_no:X8}"; + Metadata.VolumeSerial = $"{fakeBpb.serial_no:X8}"; _statfs.Id = new FileSystemId { @@ -441,34 +440,34 @@ public sealed partial class FAT } } - XmlFsType.Clusters = clusters; - _sectorsPerCluster = fakeBpb.spc; - XmlFsType.ClusterSize = (uint)(fakeBpb.bps * fakeBpb.spc); - _reservedSectors = fakeBpb.rsectors; - _sectorsPerFat = fakeBpb.spfat; + Metadata.Clusters = clusters; + _sectorsPerCluster = fakeBpb.spc; + Metadata.ClusterSize = (uint)(fakeBpb.bps * fakeBpb.spc); + _reservedSectors = fakeBpb.rsectors; + _sectorsPerFat = fakeBpb.spfat; if(fakeBpb.signature is 0x28 or 0x29 || andosOemCorrect) { if((fakeBpb.flags & 0xF8) == 0x00) if((fakeBpb.flags & 0x01) == 0x01) - XmlFsType.Dirty = true; + Metadata.Dirty = true; if(fakeBpb.signature == 0x29 || andosOemCorrect) { - XmlFsType.VolumeName = StringHandlers.SpacePaddedToString(fakeBpb.volume_label, Encoding); - XmlFsType.VolumeName = XmlFsType.VolumeName?.Replace("\0", ""); + Metadata.VolumeName = StringHandlers.SpacePaddedToString(fakeBpb.volume_label, Encoding); + Metadata.VolumeName = Metadata.VolumeName?.Replace("\0", ""); } } // Workaround that PCExchange jumps into "FAT16 "... - if(XmlFsType.SystemIdentifier == "PCX 2.0 ") + if(Metadata.SystemIdentifier == "PCX 2.0 ") fakeBpb.jump[1] += 8; // Check that jumps to a correct boot code position and has boot signature set. // This will mean that the volume will boot, even if just to say "this is not bootable change disk"...... - if(XmlFsType.Bootable == false && - fakeBpb.jump != null) - XmlFsType.Bootable |= + if(Metadata.Bootable == false && + fakeBpb.jump != null) + Metadata.Bootable |= (fakeBpb.jump[0] == 0xEB && fakeBpb.jump[1] >= minBootNearJump && fakeBpb.jump[1] < 0x80) || (fakeBpb.jump[0] == 0xE9 && fakeBpb.jump.Length >= 3 && BitConverter.ToUInt16(fakeBpb.jump, 1) >= minBootNearJump && @@ -631,25 +630,22 @@ public sealed partial class FAT string volname = Encoding.GetString(fullname).Trim(); if(!string.IsNullOrEmpty(volname)) - XmlFsType.VolumeName = entry.caseinfo.HasFlag(CaseInfo.AllLowerCase) && _namespace == Namespace.Nt - ? volname.ToLower() : volname; + Metadata.VolumeName = entry.caseinfo.HasFlag(CaseInfo.AllLowerCase) && _namespace == Namespace.Nt + ? volname.ToLower() : volname; - XmlFsType.VolumeName = XmlFsType.VolumeName?.Replace("\0", ""); + Metadata.VolumeName = Metadata.VolumeName?.Replace("\0", ""); if(entry is { ctime: > 0, cdate: > 0 }) { - XmlFsType.CreationDate = DateHandlers.DosToDateTime(entry.cdate, entry.ctime); + Metadata.CreationDate = DateHandlers.DosToDateTime(entry.cdate, entry.ctime); if(entry.ctime_ms > 0) - XmlFsType.CreationDate = XmlFsType.CreationDate.AddMilliseconds(entry.ctime_ms * 10); - - XmlFsType.CreationDateSpecified = true; + Metadata.CreationDate = Metadata.CreationDate?.AddMilliseconds(entry.ctime_ms * 10); } if(entry is { mtime: > 0, mdate: > 0 }) { - XmlFsType.ModificationDate = DateHandlers.DosToDateTime(entry.mdate, entry.mtime); - XmlFsType.ModificationDateSpecified = true; + Metadata.ModificationDate = DateHandlers.DosToDateTime(entry.mdate, entry.mtime); } continue; @@ -764,14 +760,14 @@ public sealed partial class FAT lastLfnChecksum = 0; } - XmlFsType.VolumeName = XmlFsType.VolumeName?.Trim(); - _statfs.Blocks = XmlFsType.Clusters; + Metadata.VolumeName = Metadata.VolumeName?.Trim(); + _statfs.Blocks = Metadata.Clusters; switch(bpbKind) { case BpbKind.ShortFat32: case BpbKind.LongFat32: - _statfs.Type = XmlFsType.Type == FS_TYPE_FAT_PLUS ? FS_TYPE_FAT_PLUS : FS_TYPE_FAT32; + _statfs.Type = Metadata.Type == FS_TYPE_FAT_PLUS ? FS_TYPE_FAT_PLUS : FS_TYPE_FAT32; break; default: @@ -970,8 +966,8 @@ public sealed partial class FAT _mounted = true; - if(string.IsNullOrWhiteSpace(XmlFsType.VolumeName)) - XmlFsType.VolumeName = null; + if(string.IsNullOrWhiteSpace(Metadata.VolumeName)) + Metadata.VolumeName = null; return ErrorNumber.NoError; } diff --git a/Aaru.Filesystems/FATX/FATX.cs b/Aaru.Filesystems/FATX/FATX.cs index 5c102eb3f..eb0fca266 100644 --- a/Aaru.Filesystems/FATX/FATX.cs +++ b/Aaru.Filesystems/FATX/FATX.cs @@ -30,10 +30,10 @@ using System; using System.Collections.Generic; using System.Globalization; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Structs; -using Schemas; namespace Aaru.Filesystems; @@ -58,7 +58,7 @@ public sealed partial class XboxFatPlugin : IReadOnlyFilesystem Superblock _superblock; /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/FATX/Info.cs b/Aaru.Filesystems/FATX/Info.cs index bf8789a8b..352e87898 100644 --- a/Aaru.Filesystems/FATX/Info.cs +++ b/Aaru.Filesystems/FATX/Info.cs @@ -27,11 +27,11 @@ // ****************************************************************************/ using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -103,7 +103,7 @@ public sealed partial class XboxFatPlugin information = sb.ToString(); - XmlFsType = new FileSystemType + Metadata = new FileSystem { Type = FS_TYPE, ClusterSize = (uint)(fatxSb.sectorsPerCluster * logicalSectorsPerPhysicalSectors * @@ -112,7 +112,6 @@ public sealed partial class XboxFatPlugin VolumeSerial = $"{fatxSb.id:X8}" }; - XmlFsType.Clusters = (partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize / - XmlFsType.ClusterSize; + Metadata.Clusters = (partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize / Metadata.ClusterSize; } } \ No newline at end of file diff --git a/Aaru.Filesystems/FATX/Super.cs b/Aaru.Filesystems/FATX/Super.cs index 0574b8537..6f42d3d43 100644 --- a/Aaru.Filesystems/FATX/Super.cs +++ b/Aaru.Filesystems/FATX/Super.cs @@ -31,14 +31,14 @@ using System.Collections.Generic; using System.Globalization; using System.Runtime.InteropServices; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Structs; using Aaru.Console; using Aaru.Helpers; -using Schemas; using Marshal = Aaru.Helpers.Marshal; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -90,7 +90,7 @@ public sealed partial class XboxFatPlugin !_littleEndian ? Encoding.BigEndianUnicode : Encoding.Unicode, true); - XmlFsType = new FileSystemType + Metadata = new FileSystem { Type = Localization.FATX_filesystem, ClusterSize = (uint)(_superblock.sectorsPerCluster * logicalSectorsPerPhysicalSectors * @@ -99,12 +99,11 @@ public sealed partial class XboxFatPlugin VolumeSerial = $"{_superblock.id:X8}" }; - XmlFsType.Clusters = (partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize / - XmlFsType.ClusterSize; + Metadata.Clusters = (partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize / Metadata.ClusterSize; _statfs = new FileSystemInfo { - Blocks = XmlFsType.Clusters, + Blocks = Metadata.Clusters, FilenameLength = MAX_FILENAME, Files = 0, // Requires traversing all directories FreeFiles = 0, @@ -118,9 +117,9 @@ public sealed partial class XboxFatPlugin FreeBlocks = 0 // Requires traversing the FAT }; - AaruConsole.DebugWriteLine("Xbox FAT plugin", "XmlFsType.ClusterSize: {0}", XmlFsType.ClusterSize); - AaruConsole.DebugWriteLine("Xbox FAT plugin", "XmlFsType.VolumeName: {0}", XmlFsType.VolumeName); - AaruConsole.DebugWriteLine("Xbox FAT plugin", "XmlFsType.VolumeSerial: {0}", XmlFsType.VolumeSerial); + AaruConsole.DebugWriteLine("Xbox FAT plugin", "XmlFsType.ClusterSize: {0}", Metadata.ClusterSize); + AaruConsole.DebugWriteLine("Xbox FAT plugin", "XmlFsType.VolumeName: {0}", Metadata.VolumeName); + AaruConsole.DebugWriteLine("Xbox FAT plugin", "XmlFsType.VolumeSerial: {0}", Metadata.VolumeSerial); AaruConsole.DebugWriteLine("Xbox FAT plugin", "stat.Blocks: {0}", _statfs.Blocks); AaruConsole.DebugWriteLine("Xbox FAT plugin", "stat.FilenameLength: {0}", _statfs.FilenameLength); AaruConsole.DebugWriteLine("Xbox FAT plugin", "stat.Id: {0}", _statfs.Id.Serial32); diff --git a/Aaru.Filesystems/FFS/FFS.cs b/Aaru.Filesystems/FFS/FFS.cs index 763305e96..6aad9942f 100644 --- a/Aaru.Filesystems/FFS/FFS.cs +++ b/Aaru.Filesystems/FFS/FFS.cs @@ -29,8 +29,8 @@ using System; using System.Diagnostics.CodeAnalysis; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; using time_t = System.Int32; using ufs_daddr_t = System.Int32; @@ -43,7 +43,7 @@ namespace Aaru.Filesystems; public sealed partial class FFSPlugin : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/FFS/Info.cs b/Aaru.Filesystems/FFS/Info.cs index 277e1b8c1..a3bed0c09 100644 --- a/Aaru.Filesystems/FFS/Info.cs +++ b/Aaru.Filesystems/FFS/Info.cs @@ -30,12 +30,12 @@ using System; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Console; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; using time_t = System.Int32; using ufs_daddr_t = System.Int32; @@ -152,50 +152,50 @@ public sealed partial class FFSPlugin return; } - XmlFsType = new FileSystemType(); + Metadata = new FileSystem(); switch(magic) { case UFS_MAGIC: sbInformation.AppendLine(Localization.UFS_filesystem); - XmlFsType.Type = FS_TYPE_UFS; + Metadata.Type = FS_TYPE_UFS; break; case UFS_CIGAM: sbInformation.AppendLine(Localization.Big_endian_UFS_filesystem); - XmlFsType.Type = FS_TYPE_UFS; + Metadata.Type = FS_TYPE_UFS; break; case UFS_MAGIC_BW: sbInformation.AppendLine(Localization.BorderWare_UFS_filesystem); - XmlFsType.Type = FS_TYPE_UFS; + Metadata.Type = FS_TYPE_UFS; break; case UFS_CIGAM_BW: sbInformation.AppendLine(Localization.Big_endian_BorderWare_UFS_filesystem); - XmlFsType.Type = FS_TYPE_UFS; + Metadata.Type = FS_TYPE_UFS; break; case UFS2_MAGIC: sbInformation.AppendLine(Localization.UFS2_filesystem); - XmlFsType.Type = FS_TYPE_UFS2; + Metadata.Type = FS_TYPE_UFS2; break; case UFS2_CIGAM: sbInformation.AppendLine(Localization.Big_endian_UFS2_filesystem); - XmlFsType.Type = FS_TYPE_UFS2; + Metadata.Type = FS_TYPE_UFS2; break; case UFS_BAD_MAGIC: sbInformation.AppendLine(Localization.Incompletely_initialized_UFS_filesystem); sbInformation.AppendLine(Localization.BEWARE_Following_information_may_be_completely_wrong); - XmlFsType.Type = FS_TYPE_UFS; + Metadata.Type = FS_TYPE_UFS; break; case UFS_BAD_CIGAM: sbInformation.AppendLine(Localization.Incompletely_initialized_big_endian_UFS_filesystem); sbInformation.AppendLine(Localization.BEWARE_Following_information_may_be_completely_wrong); - XmlFsType.Type = FS_TYPE_UFS; + Metadata.Type = FS_TYPE_UFS; break; } @@ -359,14 +359,13 @@ public sealed partial class FFSPlugin sbInformation.AppendFormat(Localization.Volume_last_written_on_0, DateHandlers.UnixToDateTime(sb.fs_old_time)). AppendLine(); - XmlFsType.ModificationDate = DateHandlers.UnixToDateTime(sb.fs_old_time); - XmlFsType.ModificationDateSpecified = true; + Metadata.ModificationDate = DateHandlers.UnixToDateTime(sb.fs_old_time); sbInformation.AppendFormat(Localization._0_blocks_in_volume_1_bytes, sb.fs_old_size, (long)sb.fs_old_size * sb.fs_fsize).AppendLine(); - XmlFsType.Clusters = (ulong)sb.fs_old_size; - XmlFsType.ClusterSize = (uint)sb.fs_fsize; + Metadata.Clusters = (ulong)sb.fs_old_size; + Metadata.ClusterSize = (uint)sb.fs_fsize; sbInformation.AppendFormat(Localization._0_data_blocks_in_volume_1_bytes, sb.fs_old_dsize, (long)sb.fs_old_dsize * sb.fs_fsize).AppendLine(); @@ -446,15 +445,14 @@ public sealed partial class FFSPlugin sbInformation.AppendFormat(Localization._0_free_blocks_1_bytes, sb.fs_old_cstotal.cs_nbfree, (long)sb.fs_old_cstotal.cs_nbfree * sb.fs_fsize).AppendLine(); - XmlFsType.FreeClusters = (ulong)sb.fs_old_cstotal.cs_nbfree; - XmlFsType.FreeClustersSpecified = true; + Metadata.FreeClusters = (ulong)sb.fs_old_cstotal.cs_nbfree; sbInformation.AppendFormat(Localization._0_free_inodes, sb.fs_old_cstotal.cs_nifree).AppendLine(); sbInformation.AppendFormat(Localization._0_free_frags, sb.fs_old_cstotal.cs_nffree).AppendLine(); if(sb.fs_fmod == 1) { sbInformation.AppendLine(Localization.Superblock_is_under_modification); - XmlFsType.Dirty = true; + Metadata.Dirty = true; } if(sb.fs_clean == 1) @@ -476,7 +474,7 @@ public sealed partial class FFSPlugin sbInformation.AppendFormat(Localization.Volume_name_0, StringHandlers.CToString(sb.fs_volname)). AppendLine(); - XmlFsType.VolumeName = StringHandlers.CToString(sb.fs_volname); + Metadata.VolumeName = StringHandlers.CToString(sb.fs_volname); sbInformation.AppendFormat(Localization.Volume_ID_0_X16, sb.fs_swuid).AppendLine(); //xmlFSType.VolumeSerial = string.Format("{0:X16}", sb.fs_swuid); @@ -491,8 +489,7 @@ public sealed partial class FFSPlugin sbInformation.AppendFormat(Localization._0_free_blocks_1_bytes, sb.fs_cstotal.cs_nbfree, sb.fs_cstotal.cs_nbfree * sb.fs_fsize).AppendLine(); - XmlFsType.FreeClusters = (ulong)sb.fs_cstotal.cs_nbfree; - XmlFsType.FreeClustersSpecified = true; + Metadata.FreeClusters = (ulong)sb.fs_cstotal.cs_nbfree; sbInformation.AppendFormat(Localization._0_free_inodes, sb.fs_cstotal.cs_nifree).AppendLine(); sbInformation.AppendFormat(Localization._0_free_frags, sb.fs_cstotal.cs_nffree).AppendLine(); sbInformation.AppendFormat(Localization._0_free_clusters, sb.fs_cstotal.cs_numclusters).AppendLine(); @@ -500,13 +497,12 @@ public sealed partial class FFSPlugin sbInformation.AppendFormat(Localization.Volume_last_written_on_0, DateHandlers.UnixToDateTime(sb.fs_time)). AppendLine(); - XmlFsType.ModificationDate = DateHandlers.UnixToDateTime(sb.fs_time); - XmlFsType.ModificationDateSpecified = true; + Metadata.ModificationDate = DateHandlers.UnixToDateTime(sb.fs_time); sbInformation.AppendFormat(Localization._0_blocks_1_bytes, sb.fs_size, sb.fs_size * sb.fs_fsize). AppendLine(); - XmlFsType.Clusters = (ulong)sb.fs_size; + Metadata.Clusters = (ulong)sb.fs_size; sbInformation.AppendFormat(Localization._0_data_blocks_1_bytes, sb.fs_dsize, sb.fs_dsize * sb.fs_fsize). AppendLine(); diff --git a/Aaru.Filesystems/Fossil/Fossil.cs b/Aaru.Filesystems/Fossil/Fossil.cs index 8093ee6eb..6dbf5c76b 100644 --- a/Aaru.Filesystems/Fossil/Fossil.cs +++ b/Aaru.Filesystems/Fossil/Fossil.cs @@ -28,8 +28,8 @@ using System; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -38,7 +38,7 @@ namespace Aaru.Filesystems; public sealed partial class Fossil : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/Fossil/Info.cs b/Aaru.Filesystems/Fossil/Info.cs index d7fc1cde4..4c3a47c1a 100644 --- a/Aaru.Filesystems/Fossil/Info.cs +++ b/Aaru.Filesystems/Fossil/Info.cs @@ -27,12 +27,12 @@ // ****************************************************************************/ using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Console; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -93,7 +93,7 @@ public sealed partial class Fossil ulong sbLocation = (hdr.super * (hdr.blockSize / imagePlugin.Info.SectorSize)) + partition.Start; - XmlFsType = new FileSystemType + Metadata = new FileSystem { Type = FS_TYPE, ClusterSize = hdr.blockSize, @@ -116,7 +116,7 @@ public sealed partial class Fossil sb.AppendFormat(Localization.Next_root_block_0, fsb.next).AppendLine(); sb.AppendFormat(Localization.Current_root_block_0, fsb.current).AppendLine(); sb.AppendFormat(Localization.Volume_label_0, StringHandlers.CToString(fsb.name, Encoding)).AppendLine(); - XmlFsType.VolumeName = StringHandlers.CToString(fsb.name, Encoding); + Metadata.VolumeName = StringHandlers.CToString(fsb.name, Encoding); } } diff --git a/Aaru.Filesystems/HAMMER/HAMMER.cs b/Aaru.Filesystems/HAMMER/HAMMER.cs index ae2cd4f8b..f4ccb0f4b 100644 --- a/Aaru.Filesystems/HAMMER/HAMMER.cs +++ b/Aaru.Filesystems/HAMMER/HAMMER.cs @@ -28,8 +28,8 @@ using System; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; using hammer_crc_t = System.UInt32; using hammer_off_t = System.UInt64; using hammer_tid_t = System.UInt64; @@ -43,7 +43,7 @@ namespace Aaru.Filesystems; public sealed partial class HAMMER : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/HAMMER/Info.cs b/Aaru.Filesystems/HAMMER/Info.cs index 1f76828dc..fdf250c7b 100644 --- a/Aaru.Filesystems/HAMMER/Info.cs +++ b/Aaru.Filesystems/HAMMER/Info.cs @@ -28,14 +28,14 @@ using System; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Helpers; -using Schemas; using hammer_crc_t = System.UInt32; using hammer_off_t = System.UInt64; using hammer_tid_t = System.UInt64; +using Partition = Aaru.CommonTypes.Partition; #pragma warning disable 169 @@ -107,7 +107,7 @@ public sealed partial class HAMMER sb.AppendFormat(Localization.First_volume_buffer_starts_at_0, superBlock.vol_buf_beg).AppendLine(); sb.AppendFormat(Localization.Volume_ends_at_0, superBlock.vol_buf_end).AppendLine(); - XmlFsType = new FileSystemType + Metadata = new FileSystem { Clusters = partition.Size / HAMMER_BIGBLOCK_SIZE, ClusterSize = HAMMER_BIGBLOCK_SIZE, @@ -127,11 +127,9 @@ public sealed partial class HAMMER sb.AppendFormat(Localization.Filesystem_has_0_inodes_used, superBlock.vol0_stat_inodes).AppendLine(); - XmlFsType.Clusters = (ulong)superBlock.vol0_stat_bigblocks; - XmlFsType.FreeClusters = (ulong)superBlock.vol0_stat_freebigblocks; - XmlFsType.FreeClustersSpecified = true; - XmlFsType.Files = (ulong)superBlock.vol0_stat_inodes; - XmlFsType.FilesSpecified = true; + Metadata.Clusters = (ulong)superBlock.vol0_stat_bigblocks; + Metadata.FreeClusters = (ulong)superBlock.vol0_stat_freebigblocks; + Metadata.Files = (ulong)superBlock.vol0_stat_inodes; } // 0 ? diff --git a/Aaru.Filesystems/HPFS/HPFS.cs b/Aaru.Filesystems/HPFS/HPFS.cs index 6da3660a2..8c9742567 100644 --- a/Aaru.Filesystems/HPFS/HPFS.cs +++ b/Aaru.Filesystems/HPFS/HPFS.cs @@ -32,8 +32,8 @@ using System; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -43,7 +43,7 @@ namespace Aaru.Filesystems; public sealed partial class HPFS : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/HPFS/Info.cs b/Aaru.Filesystems/HPFS/Info.cs index 27b76080b..3dbb6c343 100644 --- a/Aaru.Filesystems/HPFS/Info.cs +++ b/Aaru.Filesystems/HPFS/Info.cs @@ -33,11 +33,11 @@ using System; using System.Text; using Aaru.Checksums; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -223,7 +223,7 @@ public sealed partial class HPFS if((sp.flags2 & 0x80) == 0x80) sb.AppendLine(Localization.Unknown_flag_0x80_on_flags2_is_active); - XmlFsType = new FileSystemType(); + Metadata = new FileSystem(); // Theoretically everything from BPB to SB is boot code, should I hash everything or only the sector loaded by BIOS itself? if(bpb.jump[0] == 0xEB && @@ -231,19 +231,19 @@ public sealed partial class HPFS bpb.jump[1] < 0x80 && bpb.signature2 == 0xAA55) { - XmlFsType.Bootable = true; + Metadata.Bootable = true; string bootChk = Sha1Context.Data(bpb.boot_code, out byte[] _); sb.AppendLine(Localization.Volume_is_bootable); sb.AppendFormat(Localization.Boot_code_SHA1_0, bootChk).AppendLine(); } - XmlFsType.Dirty |= (sp.flags1 & 0x01) == 0x01; - XmlFsType.Clusters = hpfsSb.sectors; - XmlFsType.ClusterSize = bpb.bps; - XmlFsType.Type = FS_TYPE; - XmlFsType.VolumeName = StringHandlers.CToString(bpb.volume_label, Encoding); - XmlFsType.VolumeSerial = $"{bpb.serial_no:X8}"; - XmlFsType.SystemIdentifier = StringHandlers.CToString(bpb.oem_name); + Metadata.Dirty |= (sp.flags1 & 0x01) == 0x01; + Metadata.Clusters = hpfsSb.sectors; + Metadata.ClusterSize = bpb.bps; + Metadata.Type = FS_TYPE; + Metadata.VolumeName = StringHandlers.CToString(bpb.volume_label, Encoding); + Metadata.VolumeSerial = $"{bpb.serial_no:X8}"; + Metadata.SystemIdentifier = StringHandlers.CToString(bpb.oem_name); information = sb.ToString(); } diff --git a/Aaru.Filesystems/HPOFS/HPOFS.cs b/Aaru.Filesystems/HPOFS/HPOFS.cs index 240aa0b71..da5b3b608 100644 --- a/Aaru.Filesystems/HPOFS/HPOFS.cs +++ b/Aaru.Filesystems/HPOFS/HPOFS.cs @@ -28,8 +28,8 @@ using System; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -40,7 +40,7 @@ namespace Aaru.Filesystems; public sealed partial class HPOFS : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/HPOFS/Info.cs b/Aaru.Filesystems/HPOFS/Info.cs index 164a553fc..1ff42fa44 100644 --- a/Aaru.Filesystems/HPOFS/Info.cs +++ b/Aaru.Filesystems/HPOFS/Info.cs @@ -33,12 +33,12 @@ using System.Linq; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Console; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -212,12 +212,11 @@ public sealed partial class HPOFS sb.AppendFormat(Localization.Filesystem_version_0_1, mib.major, mib.minor).AppendLine(); sb.AppendFormat(Localization.Volume_can_be_filled_up_to_0, vib.percentFull).AppendLine(); - XmlFsType = new FileSystemType + Metadata = new FileSystem { Clusters = mib.sectors / bpb.spc, ClusterSize = (uint)(bpb.bps * bpb.spc), CreationDate = DateHandlers.DosToDateTime(mib.creationDate, mib.creationTime), - CreationDateSpecified = true, DataPreparerIdentifier = StringHandlers.SpacePaddedToString(vib.owner, Encoding), Type = FS_TYPE, VolumeName = StringHandlers.SpacePaddedToString(mib.volumeLabel, Encoding), diff --git a/Aaru.Filesystems/ISO9660/ISO9660.cs b/Aaru.Filesystems/ISO9660/ISO9660.cs index c2286f023..eeac87b87 100644 --- a/Aaru.Filesystems/ISO9660/ISO9660.cs +++ b/Aaru.Filesystems/ISO9660/ISO9660.cs @@ -31,9 +31,9 @@ using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Structs; -using Schemas; namespace Aaru.Filesystems; @@ -59,7 +59,7 @@ public sealed partial class ISO9660 : IReadOnlyFilesystem ushort _blockSize; /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/ISO9660/Info.cs b/Aaru.Filesystems/ISO9660/Info.cs index 1fbc8f230..e738bf178 100644 --- a/Aaru.Filesystems/ISO9660/Info.cs +++ b/Aaru.Filesystems/ISO9660/Info.cs @@ -31,13 +31,13 @@ using System; using System.Collections.Generic; using System.Text; using Aaru.Checksums; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Console; using Aaru.Decoders.Sega; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -237,7 +237,7 @@ public sealed partial class ISO9660 DecodedVolumeDescriptor decodedVd; var decodedJolietVd = new DecodedVolumeDescriptor(); - XmlFsType = new FileSystemType(); + Metadata = new FileSystem(); if(pvd == null && hsvd == null && @@ -910,105 +910,97 @@ public sealed partial class ISO9660 isoMetadata.Append(suspInformation); if(highSierraInfo) - XmlFsType.Type = FS_TYPE_HSF; + Metadata.Type = FS_TYPE_HSF; else if(cdiInfo) - XmlFsType.Type = FS_TYPE_CDI; + Metadata.Type = FS_TYPE_CDI; else - XmlFsType.Type = FS_TYPE_ISO; + Metadata.Type = FS_TYPE_ISO; if(jolietvd != null) { - XmlFsType.VolumeName = decodedJolietVd.VolumeIdentifier; + Metadata.VolumeName = decodedJolietVd.VolumeIdentifier; if(string.IsNullOrEmpty(decodedJolietVd.SystemIdentifier) || decodedVd.SystemIdentifier.Length > decodedJolietVd.SystemIdentifier.Length) - XmlFsType.SystemIdentifier = decodedVd.SystemIdentifier; + Metadata.SystemIdentifier = decodedVd.SystemIdentifier; else - XmlFsType.SystemIdentifier = string.IsNullOrEmpty(decodedJolietVd.SystemIdentifier) ? null - : decodedJolietVd.SystemIdentifier; + Metadata.SystemIdentifier = string.IsNullOrEmpty(decodedJolietVd.SystemIdentifier) ? null + : decodedJolietVd.SystemIdentifier; if(string.IsNullOrEmpty(decodedJolietVd.VolumeSetIdentifier) || decodedVd.VolumeSetIdentifier.Length > decodedJolietVd.VolumeSetIdentifier.Length) - XmlFsType.VolumeSetIdentifier = decodedVd.VolumeSetIdentifier; + Metadata.VolumeSetIdentifier = decodedVd.VolumeSetIdentifier; else - XmlFsType.VolumeSetIdentifier = string.IsNullOrEmpty(decodedJolietVd.VolumeSetIdentifier) ? null - : decodedJolietVd.VolumeSetIdentifier; + Metadata.VolumeSetIdentifier = string.IsNullOrEmpty(decodedJolietVd.VolumeSetIdentifier) ? null + : decodedJolietVd.VolumeSetIdentifier; if(string.IsNullOrEmpty(decodedJolietVd.PublisherIdentifier) || decodedVd.PublisherIdentifier.Length > decodedJolietVd.PublisherIdentifier.Length) - XmlFsType.PublisherIdentifier = decodedVd.PublisherIdentifier; + Metadata.PublisherIdentifier = decodedVd.PublisherIdentifier; else - XmlFsType.PublisherIdentifier = string.IsNullOrEmpty(decodedJolietVd.PublisherIdentifier) ? null - : decodedJolietVd.PublisherIdentifier; + Metadata.PublisherIdentifier = string.IsNullOrEmpty(decodedJolietVd.PublisherIdentifier) ? null + : decodedJolietVd.PublisherIdentifier; if(string.IsNullOrEmpty(decodedJolietVd.DataPreparerIdentifier) || decodedVd.DataPreparerIdentifier.Length > decodedJolietVd.DataPreparerIdentifier.Length) - XmlFsType.DataPreparerIdentifier = decodedVd.DataPreparerIdentifier; + Metadata.DataPreparerIdentifier = decodedVd.DataPreparerIdentifier; else - XmlFsType.DataPreparerIdentifier = string.IsNullOrEmpty(decodedJolietVd.DataPreparerIdentifier) ? null - : decodedJolietVd.DataPreparerIdentifier; + Metadata.DataPreparerIdentifier = string.IsNullOrEmpty(decodedJolietVd.DataPreparerIdentifier) ? null + : decodedJolietVd.DataPreparerIdentifier; if(string.IsNullOrEmpty(decodedJolietVd.ApplicationIdentifier) || decodedVd.ApplicationIdentifier.Length > decodedJolietVd.ApplicationIdentifier.Length) - XmlFsType.ApplicationIdentifier = decodedVd.ApplicationIdentifier; + Metadata.ApplicationIdentifier = decodedVd.ApplicationIdentifier; else - XmlFsType.ApplicationIdentifier = string.IsNullOrEmpty(decodedJolietVd.ApplicationIdentifier) ? null - : decodedJolietVd.ApplicationIdentifier; + Metadata.ApplicationIdentifier = string.IsNullOrEmpty(decodedJolietVd.ApplicationIdentifier) ? null + : decodedJolietVd.ApplicationIdentifier; - XmlFsType.CreationDate = decodedJolietVd.CreationTime; - XmlFsType.CreationDateSpecified = true; + Metadata.CreationDate = decodedJolietVd.CreationTime; if(decodedJolietVd.HasModificationTime) { - XmlFsType.ModificationDate = decodedJolietVd.ModificationTime; - XmlFsType.ModificationDateSpecified = true; + Metadata.ModificationDate = decodedJolietVd.ModificationTime; } if(decodedJolietVd.HasExpirationTime) { - XmlFsType.ExpirationDate = decodedJolietVd.ExpirationTime; - XmlFsType.ExpirationDateSpecified = true; + Metadata.ExpirationDate = decodedJolietVd.ExpirationTime; } if(decodedJolietVd.HasEffectiveTime) { - XmlFsType.EffectiveDate = decodedJolietVd.EffectiveTime; - XmlFsType.EffectiveDateSpecified = true; + Metadata.EffectiveDate = decodedJolietVd.EffectiveTime; } } else { - XmlFsType.SystemIdentifier = decodedVd.SystemIdentifier; - XmlFsType.VolumeName = decodedVd.VolumeIdentifier; - XmlFsType.VolumeSetIdentifier = decodedVd.VolumeSetIdentifier; - XmlFsType.PublisherIdentifier = decodedVd.PublisherIdentifier; - XmlFsType.DataPreparerIdentifier = decodedVd.DataPreparerIdentifier; - XmlFsType.ApplicationIdentifier = decodedVd.ApplicationIdentifier; - XmlFsType.CreationDate = decodedVd.CreationTime; - XmlFsType.CreationDateSpecified = true; + Metadata.SystemIdentifier = decodedVd.SystemIdentifier; + Metadata.VolumeName = decodedVd.VolumeIdentifier; + Metadata.VolumeSetIdentifier = decodedVd.VolumeSetIdentifier; + Metadata.PublisherIdentifier = decodedVd.PublisherIdentifier; + Metadata.DataPreparerIdentifier = decodedVd.DataPreparerIdentifier; + Metadata.ApplicationIdentifier = decodedVd.ApplicationIdentifier; + Metadata.CreationDate = decodedVd.CreationTime; if(decodedVd.HasModificationTime) { - XmlFsType.ModificationDate = decodedVd.ModificationTime; - XmlFsType.ModificationDateSpecified = true; + Metadata.ModificationDate = decodedVd.ModificationTime; } if(decodedVd.HasExpirationTime) { - XmlFsType.ExpirationDate = decodedVd.ExpirationTime; - XmlFsType.ExpirationDateSpecified = true; + Metadata.ExpirationDate = decodedVd.ExpirationTime; } if(decodedVd.HasEffectiveTime) { - XmlFsType.EffectiveDate = decodedVd.EffectiveTime; - XmlFsType.EffectiveDateSpecified = true; + Metadata.EffectiveDate = decodedVd.EffectiveTime; } } - XmlFsType.Bootable |= bvd != null || segaCd != null || saturn != null || dreamcast != null; - XmlFsType.Clusters = decodedVd.Blocks; - XmlFsType.ClusterSize = decodedVd.BlockSize; + Metadata.Bootable |= bvd != null || segaCd != null || saturn != null || dreamcast != null; + Metadata.Clusters = decodedVd.Blocks; + Metadata.ClusterSize = decodedVd.BlockSize; information = isoMetadata.ToString(); } diff --git a/Aaru.Filesystems/ISO9660/Super.cs b/Aaru.Filesystems/ISO9660/Super.cs index 8565a4803..7dcfe7d38 100644 --- a/Aaru.Filesystems/ISO9660/Super.cs +++ b/Aaru.Filesystems/ISO9660/Super.cs @@ -34,14 +34,14 @@ using System; using System.Collections.Generic; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Structs; using Aaru.Console; using Aaru.Decoders.Sega; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -252,7 +252,7 @@ public sealed partial class ISO9660 DecodedVolumeDescriptor decodedVd; var decodedJolietVd = new DecodedVolumeDescriptor(); - XmlFsType = new FileSystemType(); + Metadata = new FileSystem(); if(pvd == null && hsvd == null && @@ -517,7 +517,7 @@ public sealed partial class ISO9660 ? DecodeHighSierraDirectory(rootLocation + rootXattrLength, rootSize) : DecodeIsoDirectory(rootLocation + rootXattrLength, rootSize); - XmlFsType.Type = fsFormat; + Metadata.Type = fsFormat; if(jolietvd != null && _namespace is Namespace.Joliet or Namespace.Rrip) @@ -531,93 +531,85 @@ public sealed partial class ISO9660 _rootDirectoryCache = DecodeIsoDirectory(rootLocation + rootXattrLength, rootSize); - XmlFsType.VolumeName = decodedJolietVd.VolumeIdentifier; + Metadata.VolumeName = decodedJolietVd.VolumeIdentifier; if(string.IsNullOrEmpty(decodedJolietVd.SystemIdentifier) || decodedVd.SystemIdentifier.Length > decodedJolietVd.SystemIdentifier.Length) - XmlFsType.SystemIdentifier = decodedVd.SystemIdentifier; + Metadata.SystemIdentifier = decodedVd.SystemIdentifier; else - XmlFsType.SystemIdentifier = string.IsNullOrEmpty(decodedJolietVd.SystemIdentifier) ? null - : decodedJolietVd.SystemIdentifier; + Metadata.SystemIdentifier = string.IsNullOrEmpty(decodedJolietVd.SystemIdentifier) ? null + : decodedJolietVd.SystemIdentifier; if(string.IsNullOrEmpty(decodedJolietVd.VolumeSetIdentifier) || decodedVd.VolumeSetIdentifier.Length > decodedJolietVd.VolumeSetIdentifier.Length) - XmlFsType.VolumeSetIdentifier = decodedVd.VolumeSetIdentifier; + Metadata.VolumeSetIdentifier = decodedVd.VolumeSetIdentifier; else - XmlFsType.VolumeSetIdentifier = string.IsNullOrEmpty(decodedJolietVd.VolumeSetIdentifier) ? null - : decodedJolietVd.VolumeSetIdentifier; + Metadata.VolumeSetIdentifier = string.IsNullOrEmpty(decodedJolietVd.VolumeSetIdentifier) ? null + : decodedJolietVd.VolumeSetIdentifier; if(string.IsNullOrEmpty(decodedJolietVd.PublisherIdentifier) || decodedVd.PublisherIdentifier.Length > decodedJolietVd.PublisherIdentifier.Length) - XmlFsType.PublisherIdentifier = decodedVd.PublisherIdentifier; + Metadata.PublisherIdentifier = decodedVd.PublisherIdentifier; else - XmlFsType.PublisherIdentifier = string.IsNullOrEmpty(decodedJolietVd.PublisherIdentifier) ? null - : decodedJolietVd.PublisherIdentifier; + Metadata.PublisherIdentifier = string.IsNullOrEmpty(decodedJolietVd.PublisherIdentifier) ? null + : decodedJolietVd.PublisherIdentifier; if(string.IsNullOrEmpty(decodedJolietVd.DataPreparerIdentifier) || decodedVd.DataPreparerIdentifier.Length > decodedJolietVd.DataPreparerIdentifier.Length) - XmlFsType.DataPreparerIdentifier = decodedVd.DataPreparerIdentifier; + Metadata.DataPreparerIdentifier = decodedVd.DataPreparerIdentifier; else - XmlFsType.DataPreparerIdentifier = string.IsNullOrEmpty(decodedJolietVd.DataPreparerIdentifier) ? null - : decodedJolietVd.DataPreparerIdentifier; + Metadata.DataPreparerIdentifier = string.IsNullOrEmpty(decodedJolietVd.DataPreparerIdentifier) ? null + : decodedJolietVd.DataPreparerIdentifier; if(string.IsNullOrEmpty(decodedJolietVd.ApplicationIdentifier) || decodedVd.ApplicationIdentifier.Length > decodedJolietVd.ApplicationIdentifier.Length) - XmlFsType.ApplicationIdentifier = decodedVd.ApplicationIdentifier; + Metadata.ApplicationIdentifier = decodedVd.ApplicationIdentifier; else - XmlFsType.ApplicationIdentifier = string.IsNullOrEmpty(decodedJolietVd.ApplicationIdentifier) ? null - : decodedJolietVd.ApplicationIdentifier; + Metadata.ApplicationIdentifier = string.IsNullOrEmpty(decodedJolietVd.ApplicationIdentifier) ? null + : decodedJolietVd.ApplicationIdentifier; - XmlFsType.CreationDate = decodedJolietVd.CreationTime; - XmlFsType.CreationDateSpecified = true; + Metadata.CreationDate = decodedJolietVd.CreationTime; if(decodedJolietVd.HasModificationTime) { - XmlFsType.ModificationDate = decodedJolietVd.ModificationTime; - XmlFsType.ModificationDateSpecified = true; + Metadata.ModificationDate = decodedJolietVd.ModificationTime; } if(decodedJolietVd.HasExpirationTime) { - XmlFsType.ExpirationDate = decodedJolietVd.ExpirationTime; - XmlFsType.ExpirationDateSpecified = true; + Metadata.ExpirationDate = decodedJolietVd.ExpirationTime; } if(decodedJolietVd.HasEffectiveTime) { - XmlFsType.EffectiveDate = decodedJolietVd.EffectiveTime; - XmlFsType.EffectiveDateSpecified = true; + Metadata.EffectiveDate = decodedJolietVd.EffectiveTime; } decodedVd = decodedJolietVd; } else { - XmlFsType.SystemIdentifier = decodedVd.SystemIdentifier; - XmlFsType.VolumeName = decodedVd.VolumeIdentifier; - XmlFsType.VolumeSetIdentifier = decodedVd.VolumeSetIdentifier; - XmlFsType.PublisherIdentifier = decodedVd.PublisherIdentifier; - XmlFsType.DataPreparerIdentifier = decodedVd.DataPreparerIdentifier; - XmlFsType.ApplicationIdentifier = decodedVd.ApplicationIdentifier; - XmlFsType.CreationDate = decodedVd.CreationTime; - XmlFsType.CreationDateSpecified = true; + Metadata.SystemIdentifier = decodedVd.SystemIdentifier; + Metadata.VolumeName = decodedVd.VolumeIdentifier; + Metadata.VolumeSetIdentifier = decodedVd.VolumeSetIdentifier; + Metadata.PublisherIdentifier = decodedVd.PublisherIdentifier; + Metadata.DataPreparerIdentifier = decodedVd.DataPreparerIdentifier; + Metadata.ApplicationIdentifier = decodedVd.ApplicationIdentifier; + Metadata.CreationDate = decodedVd.CreationTime; if(decodedVd.HasModificationTime) { - XmlFsType.ModificationDate = decodedVd.ModificationTime; - XmlFsType.ModificationDateSpecified = true; + Metadata.ModificationDate = decodedVd.ModificationTime; } if(decodedVd.HasExpirationTime) { - XmlFsType.ExpirationDate = decodedVd.ExpirationTime; - XmlFsType.ExpirationDateSpecified = true; + Metadata.ExpirationDate = decodedVd.ExpirationTime; } if(decodedVd.HasEffectiveTime) { - XmlFsType.EffectiveDate = decodedVd.EffectiveTime; - XmlFsType.EffectiveDateSpecified = true; + Metadata.EffectiveDate = decodedVd.EffectiveTime; } } @@ -754,9 +746,9 @@ public sealed partial class ISO9660 }); } - XmlFsType.Bootable |= bvd != null || segaCd != null || saturn != null || dreamcast != null; - XmlFsType.Clusters = decodedVd.Blocks; - XmlFsType.ClusterSize = decodedVd.BlockSize; + Metadata.Bootable |= bvd != null || segaCd != null || saturn != null || dreamcast != null; + Metadata.Clusters = decodedVd.Blocks; + Metadata.ClusterSize = decodedVd.BlockSize; _statfs = new FileSystemInfo { diff --git a/Aaru.Filesystems/JFS/Info.cs b/Aaru.Filesystems/JFS/Info.cs index 571c496e3..737d7e1cf 100644 --- a/Aaru.Filesystems/JFS/Info.cs +++ b/Aaru.Filesystems/JFS/Info.cs @@ -29,11 +29,11 @@ // ReSharper disable UnusedMember.Local using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -166,20 +166,19 @@ public sealed partial class JFS sb.AppendFormat(Localization.Volume_UUID_0, jfsSb.s_uuid).AppendLine(); - XmlFsType = new FileSystemType + Metadata = new FileSystem { - Type = FS_TYPE, - Clusters = jfsSb.s_size, - ClusterSize = jfsSb.s_bsize, - Bootable = true, - VolumeName = StringHandlers.CToString(jfsSb.s_version == 1 ? jfsSb.s_fpack : jfsSb.s_label, Encoding), - VolumeSerial = $"{jfsSb.s_uuid}", - ModificationDate = DateHandlers.UnixUnsignedToDateTime(jfsSb.s_time.tv_sec, jfsSb.s_time.tv_nsec), - ModificationDateSpecified = true + Type = FS_TYPE, + Clusters = jfsSb.s_size, + ClusterSize = jfsSb.s_bsize, + Bootable = true, + VolumeName = StringHandlers.CToString(jfsSb.s_version == 1 ? jfsSb.s_fpack : jfsSb.s_label, Encoding), + VolumeSerial = $"{jfsSb.s_uuid}", + ModificationDate = DateHandlers.UnixUnsignedToDateTime(jfsSb.s_time.tv_sec, jfsSb.s_time.tv_nsec) }; if(jfsSb.s_state != 0) - XmlFsType.Dirty = true; + Metadata.Dirty = true; information = sb.ToString(); } diff --git a/Aaru.Filesystems/JFS/JFS.cs b/Aaru.Filesystems/JFS/JFS.cs index 83d5f0bae..b400922e0 100644 --- a/Aaru.Filesystems/JFS/JFS.cs +++ b/Aaru.Filesystems/JFS/JFS.cs @@ -30,8 +30,8 @@ using System; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -40,7 +40,7 @@ namespace Aaru.Filesystems; public sealed partial class JFS : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/LIF/Info.cs b/Aaru.Filesystems/LIF/Info.cs index fa7d91a1b..34779a80b 100644 --- a/Aaru.Filesystems/LIF/Info.cs +++ b/Aaru.Filesystems/LIF/Info.cs @@ -27,12 +27,12 @@ // ****************************************************************************/ using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Console; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -94,14 +94,13 @@ public sealed partial class LIF information = sb.ToString(); - XmlFsType = new FileSystemType + Metadata = new FileSystem { - Type = FS_TYPE, - ClusterSize = 256, - Clusters = partition.Size / 256, - CreationDate = DateHandlers.LifToDateTime(lifSb.creationDate), - CreationDateSpecified = true, - VolumeName = StringHandlers.CToString(lifSb.volumeLabel, Encoding) + Type = FS_TYPE, + ClusterSize = 256, + Clusters = partition.Size / 256, + CreationDate = DateHandlers.LifToDateTime(lifSb.creationDate), + VolumeName = StringHandlers.CToString(lifSb.volumeLabel, Encoding) }; } } \ No newline at end of file diff --git a/Aaru.Filesystems/LIF/LIF.cs b/Aaru.Filesystems/LIF/LIF.cs index 6cd096182..ebe566d65 100644 --- a/Aaru.Filesystems/LIF/LIF.cs +++ b/Aaru.Filesystems/LIF/LIF.cs @@ -28,8 +28,8 @@ using System; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -39,7 +39,7 @@ namespace Aaru.Filesystems; public sealed partial class LIF : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/LisaFS/Info.cs b/Aaru.Filesystems/LisaFS/Info.cs index 9da542974..82cb2f25c 100644 --- a/Aaru.Filesystems/LisaFS/Info.cs +++ b/Aaru.Filesystems/LisaFS/Info.cs @@ -28,15 +28,15 @@ using System; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Console; using Aaru.Decoders; using Aaru.Helpers; using Claunia.Encoding; -using Schemas; using Encoding = System.Text.Encoding; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -378,31 +378,27 @@ public sealed partial class LisaFS information = sb.ToString(); - XmlFsType = new FileSystemType(); + Metadata = new FileSystem(); if(DateTime.Compare(infoMddf.dtvb, DateHandlers.LisaToDateTime(0)) > 0) { - XmlFsType.BackupDate = infoMddf.dtvb; - XmlFsType.BackupDateSpecified = true; + Metadata.BackupDate = infoMddf.dtvb; } - XmlFsType.Clusters = infoMddf.vol_size; - XmlFsType.ClusterSize = (uint)(infoMddf.clustersize * infoMddf.datasize); + Metadata.Clusters = infoMddf.vol_size; + Metadata.ClusterSize = (uint)(infoMddf.clustersize * infoMddf.datasize); if(DateTime.Compare(infoMddf.dtvc, DateHandlers.LisaToDateTime(0)) > 0) { - XmlFsType.CreationDate = infoMddf.dtvc; - XmlFsType.CreationDateSpecified = true; + Metadata.CreationDate = infoMddf.dtvc; } - XmlFsType.Dirty = infoMddf.vol_left_mounted != 0; - XmlFsType.Files = infoMddf.filecount; - XmlFsType.FilesSpecified = true; - XmlFsType.FreeClusters = infoMddf.freecount; - XmlFsType.FreeClustersSpecified = true; - XmlFsType.Type = FS_TYPE; - XmlFsType.VolumeName = infoMddf.volname; - XmlFsType.VolumeSerial = $"{infoMddf.volid:X16}"; + Metadata.Dirty = infoMddf.vol_left_mounted != 0; + Metadata.Files = infoMddf.filecount; + Metadata.FreeClusters = infoMddf.freecount; + Metadata.Type = FS_TYPE; + Metadata.VolumeName = infoMddf.volname; + Metadata.VolumeSerial = $"{infoMddf.volid:X16}"; return; } diff --git a/Aaru.Filesystems/LisaFS/LisaFS.cs b/Aaru.Filesystems/LisaFS/LisaFS.cs index 19405d12f..720c601fb 100644 --- a/Aaru.Filesystems/LisaFS/LisaFS.cs +++ b/Aaru.Filesystems/LisaFS/LisaFS.cs @@ -29,8 +29,8 @@ using System; using System.Collections.Generic; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -55,7 +55,7 @@ public sealed partial class LisaFS : IReadOnlyFilesystem /// public Encoding Encoding { get; private set; } /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public string Author => Authors.NataliaPortillo; diff --git a/Aaru.Filesystems/LisaFS/Super.cs b/Aaru.Filesystems/LisaFS/Super.cs index 57ad0b6a2..4b1997f37 100644 --- a/Aaru.Filesystems/LisaFS/Super.cs +++ b/Aaru.Filesystems/LisaFS/Super.cs @@ -28,7 +28,7 @@ using System; using System.Collections.Generic; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Structs; @@ -36,8 +36,8 @@ using Aaru.Console; using Aaru.Decoders; using Aaru.Helpers; using Claunia.Encoding; -using Schemas; using Encoding = System.Text.Encoding; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -320,31 +320,27 @@ public sealed partial class LisaFS } // Create XML metadata for mounted filesystem - XmlFsType = new FileSystemType(); + Metadata = new FileSystem(); if(DateTime.Compare(_mddf.dtvb, DateHandlers.LisaToDateTime(0)) > 0) { - XmlFsType.BackupDate = _mddf.dtvb; - XmlFsType.BackupDateSpecified = true; + Metadata.BackupDate = _mddf.dtvb; } - XmlFsType.Clusters = _mddf.vol_size; - XmlFsType.ClusterSize = (uint)(_mddf.clustersize * _mddf.datasize); + Metadata.Clusters = _mddf.vol_size; + Metadata.ClusterSize = (uint)(_mddf.clustersize * _mddf.datasize); if(DateTime.Compare(_mddf.dtvc, DateHandlers.LisaToDateTime(0)) > 0) { - XmlFsType.CreationDate = _mddf.dtvc; - XmlFsType.CreationDateSpecified = true; + Metadata.CreationDate = _mddf.dtvc; } - XmlFsType.Dirty = _mddf.vol_left_mounted != 0; - XmlFsType.Files = _mddf.filecount; - XmlFsType.FilesSpecified = true; - XmlFsType.FreeClusters = _mddf.freecount; - XmlFsType.FreeClustersSpecified = true; - XmlFsType.Type = FS_TYPE; - XmlFsType.VolumeName = _mddf.volname; - XmlFsType.VolumeSerial = $"{_mddf.volid:X16}"; + Metadata.Dirty = _mddf.vol_left_mounted != 0; + Metadata.Files = _mddf.filecount; + Metadata.FreeClusters = _mddf.freecount; + Metadata.Type = FS_TYPE; + Metadata.VolumeName = _mddf.volname; + Metadata.VolumeSerial = $"{_mddf.volid:X16}"; return ErrorNumber.NoError; } diff --git a/Aaru.Filesystems/Locus/Info.cs b/Aaru.Filesystems/Locus/Info.cs index b9c312f4b..384044b66 100644 --- a/Aaru.Filesystems/Locus/Info.cs +++ b/Aaru.Filesystems/Locus/Info.cs @@ -29,12 +29,11 @@ // Commit count using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Console; using Aaru.Helpers; -using Schemas; using commitcnt_t = System.Int32; // Disk address @@ -48,6 +47,7 @@ using gfs_t = System.Int32; // Inode number using ino_t = System.Int32; +using Partition = Aaru.CommonTypes.Partition; // Filesystem pack number using pckno_t = System.Int16; @@ -238,19 +238,17 @@ public sealed partial class Locus information = sb.ToString(); - XmlFsType = new FileSystemType + Metadata = new FileSystem { Type = FS_TYPE, ClusterSize = (uint)blockSize, Clusters = (ulong)locusSb.s_fsize, // Sometimes it uses one, or the other. Use the bigger - VolumeName = string.IsNullOrEmpty(s_fsmnt) ? s_fpack : s_fsmnt, + VolumeName = string.IsNullOrEmpty(s_fsmnt) ? s_fpack : s_fsmnt, ModificationDate = DateHandlers.UnixToDateTime(locusSb.s_time), - ModificationDateSpecified = true, - Dirty = !locusSb.s_flags.HasFlag(Flags.SB_CLEAN) || locusSb.s_flags.HasFlag(Flags.SB_DIRTY), - FreeClusters = (ulong)locusSb.s_tfree, - FreeClustersSpecified = true + Dirty = !locusSb.s_flags.HasFlag(Flags.SB_CLEAN) || locusSb.s_flags.HasFlag(Flags.SB_DIRTY), + FreeClusters = (ulong)locusSb.s_tfree }; } } \ No newline at end of file diff --git a/Aaru.Filesystems/Locus/Locus.cs b/Aaru.Filesystems/Locus/Locus.cs index d5d7542ee..37caf074e 100644 --- a/Aaru.Filesystems/Locus/Locus.cs +++ b/Aaru.Filesystems/Locus/Locus.cs @@ -30,8 +30,8 @@ using System; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; using commitcnt_t = System.Int32; // Disk address @@ -62,7 +62,7 @@ namespace Aaru.Filesystems; public sealed partial class Locus : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/MicroDOS/Info.cs b/Aaru.Filesystems/MicroDOS/Info.cs index 4318c7f37..5d9b8af00 100644 --- a/Aaru.Filesystems/MicroDOS/Info.cs +++ b/Aaru.Filesystems/MicroDOS/Info.cs @@ -30,11 +30,11 @@ // ReSharper disable UnusedMember.Local using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -88,15 +88,13 @@ public sealed partial class MicroDOS sb.AppendFormat(Localization.Volume_contains_0_files, block0.files).AppendLine(); sb.AppendFormat(Localization.First_used_block_is_0, block0.firstUsedBlock).AppendLine(); - XmlFsType = new FileSystemType + Metadata = new FileSystem { - Type = FS_TYPE, - ClusterSize = 512, - Clusters = block0.blocks, - Files = block0.files, - FilesSpecified = true, - FreeClusters = (ulong)(block0.blocks - block0.usedBlocks), - FreeClustersSpecified = true + Type = FS_TYPE, + ClusterSize = 512, + Clusters = block0.blocks, + Files = block0.files, + FreeClusters = (ulong)(block0.blocks - block0.usedBlocks) }; information = sb.ToString(); diff --git a/Aaru.Filesystems/MicroDOS/MicroDOS.cs b/Aaru.Filesystems/MicroDOS/MicroDOS.cs index 8a5b92574..df825c90e 100644 --- a/Aaru.Filesystems/MicroDOS/MicroDOS.cs +++ b/Aaru.Filesystems/MicroDOS/MicroDOS.cs @@ -31,8 +31,8 @@ using System; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -44,7 +44,7 @@ namespace Aaru.Filesystems; public sealed partial class MicroDOS : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/MinixFS/Info.cs b/Aaru.Filesystems/MinixFS/Info.cs index e8920f830..c280ad328 100644 --- a/Aaru.Filesystems/MinixFS/Info.cs +++ b/Aaru.Filesystems/MinixFS/Info.cs @@ -28,11 +28,11 @@ using System; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -47,7 +47,7 @@ public sealed partial class MinixFS uint sector = 2; uint offset = 0; - if(imagePlugin.Info.XmlMediaType == XmlMediaType.OpticalDisc) + if(imagePlugin.Info.MetadataMediaType == MetadataMediaType.OpticalDisc) { sector = 0; offset = 0x400; @@ -91,7 +91,7 @@ public sealed partial class MinixFS uint sector = 2; uint offset = 0; - if(imagePlugin.Info.XmlMediaType == XmlMediaType.OpticalDisc) + if(imagePlugin.Info.MetadataMediaType == MetadataMediaType.OpticalDisc) { sector = 0; offset = 0x400; @@ -115,7 +115,7 @@ public sealed partial class MinixFS ushort magic = BitConverter.ToUInt16(minixSbSector, 0x018); - XmlFsType = new FileSystemType(); + Metadata = new FileSystem(); bool littleEndian; @@ -128,19 +128,19 @@ public sealed partial class MinixFS { case MINIX3_MAGIC: case MINIX3_CIGAM: - minixVersion = Localization.Minix_v3_filesystem; - XmlFsType.Type = FS_TYPE_V3; + minixVersion = Localization.Minix_v3_filesystem; + Metadata.Type = FS_TYPE_V3; break; case MINIX2_MAGIC: case MINIX2_CIGAM: - minixVersion = Localization.Minix_3_v2_filesystem; - XmlFsType.Type = FS_TYPE_V3; + minixVersion = Localization.Minix_3_v2_filesystem; + Metadata.Type = FS_TYPE_V3; break; default: - minixVersion = Localization.Minix_3_v1_filesystem; - XmlFsType.Type = FS_TYPE_V3; + minixVersion = Localization.Minix_3_v1_filesystem; + Metadata.Type = FS_TYPE_V3; break; } @@ -154,59 +154,59 @@ public sealed partial class MinixFS switch(magic) { case MINIX_MAGIC: - filenamesize = 14; - minixVersion = Localization.Minix_v1_filesystem; - littleEndian = true; - XmlFsType.Type = FS_TYPE_V1; + filenamesize = 14; + minixVersion = Localization.Minix_v1_filesystem; + littleEndian = true; + Metadata.Type = FS_TYPE_V1; break; case MINIX_MAGIC2: - filenamesize = 30; - minixVersion = Localization.Minix_v1_filesystem; - littleEndian = true; - XmlFsType.Type = FS_TYPE_V1; + filenamesize = 30; + minixVersion = Localization.Minix_v1_filesystem; + littleEndian = true; + Metadata.Type = FS_TYPE_V1; break; case MINIX2_MAGIC: - filenamesize = 14; - minixVersion = Localization.Minix_v2_filesystem; - littleEndian = true; - XmlFsType.Type = FS_TYPE_V2; + filenamesize = 14; + minixVersion = Localization.Minix_v2_filesystem; + littleEndian = true; + Metadata.Type = FS_TYPE_V2; break; case MINIX2_MAGIC2: - filenamesize = 30; - minixVersion = Localization.Minix_v2_filesystem; - littleEndian = true; - XmlFsType.Type = FS_TYPE_V2; + filenamesize = 30; + minixVersion = Localization.Minix_v2_filesystem; + littleEndian = true; + Metadata.Type = FS_TYPE_V2; break; case MINIX_CIGAM: - filenamesize = 14; - minixVersion = Localization.Minix_v1_filesystem; - littleEndian = false; - XmlFsType.Type = FS_TYPE_V1; + filenamesize = 14; + minixVersion = Localization.Minix_v1_filesystem; + littleEndian = false; + Metadata.Type = FS_TYPE_V1; break; case MINIX_CIGAM2: - filenamesize = 30; - minixVersion = Localization.Minix_v1_filesystem; - littleEndian = false; - XmlFsType.Type = FS_TYPE_V1; + filenamesize = 30; + minixVersion = Localization.Minix_v1_filesystem; + littleEndian = false; + Metadata.Type = FS_TYPE_V1; break; case MINIX2_CIGAM: - filenamesize = 14; - minixVersion = Localization.Minix_v2_filesystem; - littleEndian = false; - XmlFsType.Type = FS_TYPE_V2; + filenamesize = 14; + minixVersion = Localization.Minix_v2_filesystem; + littleEndian = false; + Metadata.Type = FS_TYPE_V2; break; case MINIX2_CIGAM2: - filenamesize = 30; - minixVersion = Localization.Minix_v2_filesystem; - littleEndian = false; - XmlFsType.Type = FS_TYPE_V2; + filenamesize = 30; + minixVersion = Localization.Minix_v2_filesystem; + littleEndian = false; + Metadata.Type = FS_TYPE_V2; break; default: return; @@ -247,8 +247,8 @@ public sealed partial class MinixFS sb.AppendFormat(Localization._0_bytes_maximum_per_file, mnxSb.s_max_size).AppendLine(); sb.AppendFormat(Localization.On_disk_filesystem_version_0, mnxSb.s_disk_version).AppendLine(); - XmlFsType.ClusterSize = mnxSb.s_blocksize; - XmlFsType.Clusters = mnxSb.s_zones > 0 ? mnxSb.s_zones : mnxSb.s_nzones; + Metadata.ClusterSize = mnxSb.s_blocksize; + Metadata.Clusters = mnxSb.s_zones > 0 ? mnxSb.s_zones : mnxSb.s_nzones; } else { @@ -278,8 +278,8 @@ public sealed partial class MinixFS //sb.AppendFormat("log2 of blocks/zone: {0}", mnx_sb.s_log_zone_size).AppendLine(); // Apparently 0 sb.AppendFormat(Localization._0_bytes_maximum_per_file, mnxSb.s_max_size).AppendLine(); sb.AppendFormat(Localization.Filesystem_state_0, mnxSb.s_state).AppendLine(); - XmlFsType.ClusterSize = 1024; - XmlFsType.Clusters = mnxSb.s_zones > 0 ? mnxSb.s_zones : mnxSb.s_nzones; + Metadata.ClusterSize = 1024; + Metadata.Clusters = mnxSb.s_zones > 0 ? mnxSb.s_zones : mnxSb.s_nzones; } information = sb.ToString(); diff --git a/Aaru.Filesystems/MinixFS/MinixFS.cs b/Aaru.Filesystems/MinixFS/MinixFS.cs index b374e0dd8..174d1b516 100644 --- a/Aaru.Filesystems/MinixFS/MinixFS.cs +++ b/Aaru.Filesystems/MinixFS/MinixFS.cs @@ -28,8 +28,8 @@ using System; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -39,7 +39,7 @@ namespace Aaru.Filesystems; public sealed partial class MinixFS : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/NILFS2/Info.cs b/Aaru.Filesystems/NILFS2/Info.cs index de0650763..34b5a2880 100644 --- a/Aaru.Filesystems/NILFS2/Info.cs +++ b/Aaru.Filesystems/NILFS2/Info.cs @@ -29,11 +29,11 @@ // ReSharper disable UnusedMember.Local using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -136,21 +136,19 @@ public sealed partial class NILFS2 information = sb.ToString(); - XmlFsType = new FileSystemType + Metadata = new FileSystem { - Type = FS_TYPE, - ClusterSize = (uint)(1 << (int)(nilfsSb.log_block_size + 10)), - VolumeName = StringHandlers.CToString(nilfsSb.volume_name, Encoding), - VolumeSerial = nilfsSb.uuid.ToString(), - CreationDate = DateHandlers.UnixUnsignedToDateTime(nilfsSb.ctime), - CreationDateSpecified = true, - ModificationDate = DateHandlers.UnixUnsignedToDateTime(nilfsSb.wtime), - ModificationDateSpecified = true + Type = FS_TYPE, + ClusterSize = (uint)(1 << (int)(nilfsSb.log_block_size + 10)), + VolumeName = StringHandlers.CToString(nilfsSb.volume_name, Encoding), + VolumeSerial = nilfsSb.uuid.ToString(), + CreationDate = DateHandlers.UnixUnsignedToDateTime(nilfsSb.ctime), + ModificationDate = DateHandlers.UnixUnsignedToDateTime(nilfsSb.wtime) }; if(nilfsSb.creator_os == 0) - XmlFsType.SystemIdentifier = "Linux"; + Metadata.SystemIdentifier = "Linux"; - XmlFsType.Clusters = nilfsSb.dev_size / XmlFsType.ClusterSize; + Metadata.Clusters = nilfsSb.dev_size / Metadata.ClusterSize; } } \ No newline at end of file diff --git a/Aaru.Filesystems/NILFS2/NILFS2.cs b/Aaru.Filesystems/NILFS2/NILFS2.cs index 4d5b2835d..d0c0f7e98 100644 --- a/Aaru.Filesystems/NILFS2/NILFS2.cs +++ b/Aaru.Filesystems/NILFS2/NILFS2.cs @@ -30,8 +30,8 @@ using System; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -40,7 +40,7 @@ namespace Aaru.Filesystems; public sealed partial class NILFS2 : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/NTFS/Info.cs b/Aaru.Filesystems/NTFS/Info.cs index 44f5caec1..08bc5e94c 100644 --- a/Aaru.Filesystems/NTFS/Info.cs +++ b/Aaru.Filesystems/NTFS/Info.cs @@ -29,11 +29,11 @@ using System; using System.Text; using Aaru.Checksums; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -130,23 +130,23 @@ public sealed partial class NTFS // sb.AppendFormat("Signature 2: 0x{0:X4}", ntfs_bb.signature2).AppendLine(); - XmlFsType = new FileSystemType(); + Metadata = new FileSystem(); if(ntfsBb.jump[0] == 0xEB && ntfsBb.jump[1] > 0x4E && ntfsBb.jump[1] < 0x80 && ntfsBb.signature2 == 0xAA55) { - XmlFsType.Bootable = true; + Metadata.Bootable = true; string bootChk = Sha1Context.Data(ntfsBb.boot_code, out _); sb.AppendLine(Localization.Volume_is_bootable); sb.AppendFormat(Localization.Boot_code_SHA1_0, bootChk).AppendLine(); } - XmlFsType.ClusterSize = (uint)(ntfsBb.spc * ntfsBb.bps); - XmlFsType.Clusters = (ulong)(ntfsBb.sectors / ntfsBb.spc); - XmlFsType.VolumeSerial = $"{ntfsBb.serial_no:X16}"; - XmlFsType.Type = FS_TYPE; + Metadata.ClusterSize = (uint)(ntfsBb.spc * ntfsBb.bps); + Metadata.Clusters = (ulong)(ntfsBb.sectors / ntfsBb.spc); + Metadata.VolumeSerial = $"{ntfsBb.serial_no:X16}"; + Metadata.Type = FS_TYPE; information = sb.ToString(); } diff --git a/Aaru.Filesystems/NTFS/NTFS.cs b/Aaru.Filesystems/NTFS/NTFS.cs index 80d33720f..3c305cd3c 100644 --- a/Aaru.Filesystems/NTFS/NTFS.cs +++ b/Aaru.Filesystems/NTFS/NTFS.cs @@ -28,8 +28,8 @@ using System; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -39,7 +39,7 @@ namespace Aaru.Filesystems; public sealed partial class NTFS : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/Nintendo/Info.cs b/Aaru.Filesystems/Nintendo/Info.cs index 23086d3a4..d87641049 100644 --- a/Aaru.Filesystems/Nintendo/Info.cs +++ b/Aaru.Filesystems/Nintendo/Info.cs @@ -28,12 +28,12 @@ using System; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Console; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -67,7 +67,7 @@ public sealed partial class NintendoPlugin Encoding = encoding ?? Encoding.GetEncoding("shift_jis"); var sbInformation = new StringBuilder(); information = ""; - XmlFsType = new FileSystemType(); + Metadata = new FileSystem(); var fields = new NintendoFields(); @@ -323,12 +323,12 @@ public sealed partial class NintendoPlugin sbInformation.AppendFormat(Localization.FST_starts_at_0_and_has_1_bytes, fields.FstOff, fields.FstSize). AppendLine(); - information = sbInformation.ToString(); - XmlFsType.Bootable = true; - XmlFsType.Clusters = imagePlugin.Info.Sectors * imagePlugin.Info.SectorSize / 2048; - XmlFsType.ClusterSize = 2048; - XmlFsType.Type = wii ? FS_TYPE_WII : FS_TYPE_NGC; - XmlFsType.VolumeName = fields.Title; - XmlFsType.VolumeSerial = fields.DiscId; + information = sbInformation.ToString(); + Metadata.Bootable = true; + Metadata.Clusters = imagePlugin.Info.Sectors * imagePlugin.Info.SectorSize / 2048; + Metadata.ClusterSize = 2048; + Metadata.Type = wii ? FS_TYPE_WII : FS_TYPE_NGC; + Metadata.VolumeName = fields.Title; + Metadata.VolumeSerial = fields.DiscId; } } \ No newline at end of file diff --git a/Aaru.Filesystems/Nintendo/Nintendo.cs b/Aaru.Filesystems/Nintendo/Nintendo.cs index db34210d4..b5d776e45 100644 --- a/Aaru.Filesystems/Nintendo/Nintendo.cs +++ b/Aaru.Filesystems/Nintendo/Nintendo.cs @@ -28,8 +28,8 @@ using System; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -38,7 +38,7 @@ namespace Aaru.Filesystems; public sealed partial class NintendoPlugin : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/ODS/Info.cs b/Aaru.Filesystems/ODS/Info.cs index b16e56d56..41831c2a9 100644 --- a/Aaru.Filesystems/ODS/Info.cs +++ b/Aaru.Filesystems/ODS/Info.cs @@ -32,12 +32,12 @@ using System; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Console; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -78,7 +78,7 @@ public sealed partial class ODS return true; // Optical disc - if(imagePlugin.Info.XmlMediaType != XmlMediaType.OpticalDisc) + if(imagePlugin.Info.MetadataMediaType != MetadataMediaType.OpticalDisc) return false; if(hbSector.Length < 0x400) @@ -113,8 +113,8 @@ public sealed partial class ODS HomeBlock homeblock = Marshal.ByteArrayToStructureLittleEndian(hbSector); // Optical disc - if(imagePlugin.Info.XmlMediaType == XmlMediaType.OpticalDisc && - StringHandlers.CToString(homeblock.format) != "DECFILE11A " && + if(imagePlugin.Info.MetadataMediaType == MetadataMediaType.OpticalDisc && + StringHandlers.CToString(homeblock.format) != "DECFILE11A " && StringHandlers.CToString(homeblock.format) != "DECFILE11B ") { if(hbSector.Length < 0x400) @@ -257,7 +257,7 @@ public sealed partial class ODS sb.AppendFormat(Localization.File_protection_0, homeblock.fileprot).AppendLine(); sb.AppendFormat(Localization.Record_protection_0, homeblock.recprot).AppendLine(); - XmlFsType = new FileSystemType + Metadata = new FileSystem { Type = FS_TYPE, ClusterSize = (uint)(homeblock.cluster * 512), @@ -268,14 +268,12 @@ public sealed partial class ODS if(homeblock.credate > 0) { - XmlFsType.CreationDate = DateHandlers.VmsToDateTime(homeblock.credate); - XmlFsType.CreationDateSpecified = true; + Metadata.CreationDate = DateHandlers.VmsToDateTime(homeblock.credate); } if(homeblock.revdate > 0) { - XmlFsType.ModificationDate = DateHandlers.VmsToDateTime(homeblock.revdate); - XmlFsType.ModificationDateSpecified = true; + Metadata.ModificationDate = DateHandlers.VmsToDateTime(homeblock.revdate); } information = sb.ToString(); diff --git a/Aaru.Filesystems/ODS/ODS.cs b/Aaru.Filesystems/ODS/ODS.cs index df3165543..15f46a285 100644 --- a/Aaru.Filesystems/ODS/ODS.cs +++ b/Aaru.Filesystems/ODS/ODS.cs @@ -32,8 +32,8 @@ using System; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -51,7 +51,7 @@ namespace Aaru.Filesystems; public sealed partial class ODS : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/Opera/Info.cs b/Aaru.Filesystems/Opera/Info.cs index 4a5bf77cc..72bffa334 100644 --- a/Aaru.Filesystems/Opera/Info.cs +++ b/Aaru.Filesystems/Opera/Info.cs @@ -28,11 +28,11 @@ using System; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -130,7 +130,7 @@ public sealed partial class OperaFS information = superBlockMetadata.ToString(); - XmlFsType = new FileSystemType + Metadata = new FileSystem { Type = FS_TYPE, VolumeName = StringHandlers.CToString(sb.volume_label, Encoding), diff --git a/Aaru.Filesystems/Opera/Opera.cs b/Aaru.Filesystems/Opera/Opera.cs index decd76ec6..7e45101d3 100644 --- a/Aaru.Filesystems/Opera/Opera.cs +++ b/Aaru.Filesystems/Opera/Opera.cs @@ -29,10 +29,10 @@ using System; using System.Collections.Generic; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Structs; -using Schemas; namespace Aaru.Filesystems; @@ -49,7 +49,7 @@ public sealed partial class OperaFS : IReadOnlyFilesystem uint _volumeBlockSizeRatio; /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/Opera/Super.cs b/Aaru.Filesystems/Opera/Super.cs index 8eb0ef98d..fc5f707ec 100644 --- a/Aaru.Filesystems/Opera/Super.cs +++ b/Aaru.Filesystems/Opera/Super.cs @@ -28,12 +28,12 @@ using System.Collections.Generic; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Structs; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -70,7 +70,7 @@ public sealed partial class OperaFS else _volumeBlockSizeRatio = sb.block_size / imagePlugin.Info.SectorSize; - XmlFsType = new FileSystemType + Metadata = new FileSystem { Type = FS_TYPE, VolumeName = StringHandlers.CToString(sb.volume_label, Encoding), diff --git a/Aaru.Filesystems/PCEngine/Info.cs b/Aaru.Filesystems/PCEngine/Info.cs index 20ea20ba9..d1d0e0908 100644 --- a/Aaru.Filesystems/PCEngine/Info.cs +++ b/Aaru.Filesystems/PCEngine/Info.cs @@ -32,10 +32,10 @@ using System; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -66,7 +66,7 @@ public sealed partial class PCEnginePlugin Encoding = encoding ?? Encoding.GetEncoding("shift_jis"); information = ""; - XmlFsType = new FileSystemType + Metadata = new FileSystem { Type = FS_TYPE, Clusters = (partition.End - partition.Start + 1) / imagePlugin.Info.SectorSize * 2048, diff --git a/Aaru.Filesystems/PCEngine/PCEngine.cs b/Aaru.Filesystems/PCEngine/PCEngine.cs index ab638287c..66dda2387 100644 --- a/Aaru.Filesystems/PCEngine/PCEngine.cs +++ b/Aaru.Filesystems/PCEngine/PCEngine.cs @@ -32,8 +32,8 @@ using System; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -42,7 +42,7 @@ namespace Aaru.Filesystems; public sealed partial class PCEnginePlugin : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/PCFX/Info.cs b/Aaru.Filesystems/PCFX/Info.cs index a8036a1cd..f630b24ca 100644 --- a/Aaru.Filesystems/PCFX/Info.cs +++ b/Aaru.Filesystems/PCFX/Info.cs @@ -32,11 +32,11 @@ using System; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -48,8 +48,8 @@ public sealed partial class PCFX /// public bool Identify(IMediaImage imagePlugin, Partition partition) { - if(2 + partition.Start >= partition.End || - imagePlugin.Info.XmlMediaType != XmlMediaType.OpticalDisc) + if(2 + partition.Start >= partition.End || + imagePlugin.Info.MetadataMediaType != MetadataMediaType.OpticalDisc) return false; ErrorNumber errno = imagePlugin.ReadSectors(partition.Start, 2, out byte[] sector); @@ -112,17 +112,16 @@ public sealed partial class PCFX information = sb.ToString(); - XmlFsType = new FileSystemType + Metadata = new FileSystem { - Type = FS_TYPE, - Clusters = partition.Length, - ClusterSize = 2048, - Bootable = true, - CreationDate = dateTime, - CreationDateSpecified = date != null, - PublisherIdentifier = StringHandlers.CToString(header.makerName, Encoding), - VolumeName = StringHandlers.CToString(header.title, Encoding), - SystemIdentifier = "PC-FX" + Type = FS_TYPE, + Clusters = partition.Length, + ClusterSize = 2048, + Bootable = true, + CreationDate = date != null ? dateTime : null, + PublisherIdentifier = StringHandlers.CToString(header.makerName, Encoding), + VolumeName = StringHandlers.CToString(header.title, Encoding), + SystemIdentifier = "PC-FX" }; } } \ No newline at end of file diff --git a/Aaru.Filesystems/PCFX/PCFX.cs b/Aaru.Filesystems/PCFX/PCFX.cs index 1fbba949c..296240811 100644 --- a/Aaru.Filesystems/PCFX/PCFX.cs +++ b/Aaru.Filesystems/PCFX/PCFX.cs @@ -32,8 +32,8 @@ using System; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -43,7 +43,7 @@ namespace Aaru.Filesystems; public sealed partial class PCFX : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/PFS/Info.cs b/Aaru.Filesystems/PFS/Info.cs index 43f407daa..1648c7db2 100644 --- a/Aaru.Filesystems/PFS/Info.cs +++ b/Aaru.Filesystems/PFS/Info.cs @@ -29,11 +29,11 @@ // ReSharper disable UnusedType.Local using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -70,25 +70,25 @@ public sealed partial class PFS RootBlock rootBlock = Marshal.ByteArrayToStructureBigEndian(rootBlockSector); var sbInformation = new StringBuilder(); - XmlFsType = new FileSystemType(); + Metadata = new FileSystem(); switch(rootBlock.diskType) { case AFS_DISK: case MUAF_DISK: sbInformation.Append(Localization.Professional_File_System_v1); - XmlFsType.Type = FS_TYPE; + Metadata.Type = FS_TYPE; break; case PFS2_DISK: sbInformation.Append(Localization.Professional_File_System_v2); - XmlFsType.Type = FS_TYPE; + Metadata.Type = FS_TYPE; break; case PFS_DISK: case MUPFS_DISK: sbInformation.Append(Localization.Professional_File_System_v3); - XmlFsType.Type = FS_TYPE; + Metadata.Type = FS_TYPE; break; } @@ -116,14 +116,12 @@ public sealed partial class PFS information = sbInformation.ToString(); - XmlFsType.CreationDate = + Metadata.CreationDate = DateHandlers.AmigaToDateTime(rootBlock.creationday, rootBlock.creationminute, rootBlock.creationtick); - XmlFsType.CreationDateSpecified = true; - XmlFsType.FreeClusters = rootBlock.blocksfree; - XmlFsType.FreeClustersSpecified = true; - XmlFsType.Clusters = rootBlock.diskSize; - XmlFsType.ClusterSize = imagePlugin.Info.SectorSize; - XmlFsType.VolumeName = StringHandlers.PascalToString(rootBlock.diskname, Encoding); + Metadata.FreeClusters = rootBlock.blocksfree; + Metadata.Clusters = rootBlock.diskSize; + Metadata.ClusterSize = imagePlugin.Info.SectorSize; + Metadata.VolumeName = StringHandlers.PascalToString(rootBlock.diskname, Encoding); } } \ No newline at end of file diff --git a/Aaru.Filesystems/PFS/PFS.cs b/Aaru.Filesystems/PFS/PFS.cs index a4049eed6..11d2bb056 100644 --- a/Aaru.Filesystems/PFS/PFS.cs +++ b/Aaru.Filesystems/PFS/PFS.cs @@ -30,8 +30,8 @@ using System; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -40,7 +40,7 @@ namespace Aaru.Filesystems; public sealed partial class PFS : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/ProDOS/Info.cs b/Aaru.Filesystems/ProDOS/Info.cs index fca60323e..d3939815d 100644 --- a/Aaru.Filesystems/ProDOS/Info.cs +++ b/Aaru.Filesystems/ProDOS/Info.cs @@ -32,13 +32,13 @@ using System; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Console; using Claunia.Encoding; -using Schemas; using Encoding = System.Text.Encoding; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -294,22 +294,20 @@ public sealed partial class ProDOSPlugin information = sbInformation.ToString(); - XmlFsType = new FileSystemType + Metadata = new FileSystem { - VolumeName = rootDirectoryKeyBlock.header.volume_name, - Files = rootDirectoryKeyBlock.header.file_count, - FilesSpecified = true, - Clusters = rootDirectoryKeyBlock.header.total_blocks, - Type = FS_TYPE + VolumeName = rootDirectoryKeyBlock.header.volume_name, + Files = rootDirectoryKeyBlock.header.file_count, + Clusters = rootDirectoryKeyBlock.header.total_blocks, + Type = FS_TYPE }; - XmlFsType.ClusterSize = (uint)((partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize / - XmlFsType.Clusters); + Metadata.ClusterSize = (uint)((partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize / + Metadata.Clusters); if(!dateCorrect) return; - XmlFsType.CreationDate = rootDirectoryKeyBlock.header.creation_time; - XmlFsType.CreationDateSpecified = true; + Metadata.CreationDate = rootDirectoryKeyBlock.header.creation_time; } } \ No newline at end of file diff --git a/Aaru.Filesystems/ProDOS/ProDOS.cs b/Aaru.Filesystems/ProDOS/ProDOS.cs index 7fb6eebb3..1330d17f6 100644 --- a/Aaru.Filesystems/ProDOS/ProDOS.cs +++ b/Aaru.Filesystems/ProDOS/ProDOS.cs @@ -31,8 +31,8 @@ using System; using System.Diagnostics.CodeAnalysis; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -43,7 +43,7 @@ namespace Aaru.Filesystems; public sealed partial class ProDOSPlugin : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/QNX4/Info.cs b/Aaru.Filesystems/QNX4/Info.cs index 2492db9e1..6f20e912e 100644 --- a/Aaru.Filesystems/QNX4/Info.cs +++ b/Aaru.Filesystems/QNX4/Info.cs @@ -29,11 +29,11 @@ using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -177,17 +177,15 @@ public sealed partial class QNX4 string.Format(Localization.Created_on_0, DateHandlers.UnixUnsignedToDateTime(qnxSb.rootDir.di_ftime)) + "\n"; - XmlFsType = new FileSystemType + Metadata = new FileSystem { - Type = FS_TYPE, - Clusters = partition.Length, - ClusterSize = 512, - CreationDate = DateHandlers.UnixUnsignedToDateTime(qnxSb.rootDir.di_ftime), - CreationDateSpecified = true, - ModificationDate = DateHandlers.UnixUnsignedToDateTime(qnxSb.rootDir.di_mtime), - ModificationDateSpecified = true + Type = FS_TYPE, + Clusters = partition.Length, + ClusterSize = 512, + CreationDate = DateHandlers.UnixUnsignedToDateTime(qnxSb.rootDir.di_ftime), + ModificationDate = DateHandlers.UnixUnsignedToDateTime(qnxSb.rootDir.di_mtime) }; - XmlFsType.Bootable |= qnxSb.boot.di_size != 0 || qnxSb.altBoot.di_size != 0; + Metadata.Bootable |= qnxSb.boot.di_size != 0 || qnxSb.altBoot.di_size != 0; } } \ No newline at end of file diff --git a/Aaru.Filesystems/QNX4/QNX4.cs b/Aaru.Filesystems/QNX4/QNX4.cs index f3df0c5d0..d8b30014b 100644 --- a/Aaru.Filesystems/QNX4/QNX4.cs +++ b/Aaru.Filesystems/QNX4/QNX4.cs @@ -29,8 +29,8 @@ using System; using System.Diagnostics.CodeAnalysis; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -40,7 +40,7 @@ namespace Aaru.Filesystems; public sealed partial class QNX4 : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/QNX6/Info.cs b/Aaru.Filesystems/QNX6/Info.cs index 20bec07bd..15a626396 100644 --- a/Aaru.Filesystems/QNX6/Info.cs +++ b/Aaru.Filesystems/QNX6/Info.cs @@ -27,11 +27,11 @@ // ****************************************************************************/ using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -108,17 +108,15 @@ public sealed partial class QNX6 audiSb.freeBlocks * audiSb.blockSize, audiSb.numBlocks, audiSb.numBlocks * audiSb.blockSize).AppendLine(); - XmlFsType = new FileSystemType + Metadata = new FileSystem { - Type = FS_TYPE, - Clusters = audiSb.numBlocks, - ClusterSize = audiSb.blockSize, - Bootable = true, - Files = audiSb.numInodes - audiSb.freeInodes, - FilesSpecified = true, - FreeClusters = audiSb.freeBlocks, - FreeClustersSpecified = true, - VolumeSerial = $"{audiSb.serial:X16}" + Type = FS_TYPE, + Clusters = audiSb.numBlocks, + ClusterSize = audiSb.blockSize, + Bootable = true, + Files = audiSb.numInodes - audiSb.freeInodes, + FreeClusters = audiSb.freeBlocks, + VolumeSerial = $"{audiSb.serial:X16}" }; //xmlFSType.VolumeName = CurrentEncoding.GetString(audiSb.id); @@ -145,21 +143,17 @@ public sealed partial class QNX6 qnxSb.freeBlocks * qnxSb.blockSize, qnxSb.numBlocks, qnxSb.numBlocks * qnxSb.blockSize). AppendLine(); - XmlFsType = new FileSystemType + Metadata = new FileSystem { - Type = FS_TYPE, - Clusters = qnxSb.numBlocks, - ClusterSize = qnxSb.blockSize, - Bootable = true, - Files = qnxSb.numInodes - qnxSb.freeInodes, - FilesSpecified = true, - FreeClusters = qnxSb.freeBlocks, - FreeClustersSpecified = true, - VolumeSerial = $"{qnxSb.serial:X16}", - CreationDate = DateHandlers.UnixUnsignedToDateTime(qnxSb.ctime), - CreationDateSpecified = true, - ModificationDate = DateHandlers.UnixUnsignedToDateTime(qnxSb.atime), - ModificationDateSpecified = true + Type = FS_TYPE, + Clusters = qnxSb.numBlocks, + ClusterSize = qnxSb.blockSize, + Bootable = true, + Files = qnxSb.numInodes - qnxSb.freeInodes, + FreeClusters = qnxSb.freeBlocks, + VolumeSerial = $"{qnxSb.serial:X16}", + CreationDate = DateHandlers.UnixUnsignedToDateTime(qnxSb.ctime), + ModificationDate = DateHandlers.UnixUnsignedToDateTime(qnxSb.atime) }; //xmlFSType.VolumeName = CurrentEncoding.GetString(qnxSb.volumeid); diff --git a/Aaru.Filesystems/QNX6/QNX6.cs b/Aaru.Filesystems/QNX6/QNX6.cs index 6d046c832..880123bb8 100644 --- a/Aaru.Filesystems/QNX6/QNX6.cs +++ b/Aaru.Filesystems/QNX6/QNX6.cs @@ -28,8 +28,8 @@ using System; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -38,7 +38,7 @@ namespace Aaru.Filesystems; public sealed partial class QNX6 : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/RBF/Info.cs b/Aaru.Filesystems/RBF/Info.cs index 97462b254..50f2f5e4e 100644 --- a/Aaru.Filesystems/RBF/Info.cs +++ b/Aaru.Filesystems/RBF/Info.cs @@ -27,12 +27,12 @@ // ****************************************************************************/ using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Console; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -192,18 +192,16 @@ public sealed partial class RBF : IFilesystem sb.AppendFormat(Localization.Volume_name_0, StringHandlers.CToString(rbf9000Sb.rid_name, Encoding)). AppendLine(); - XmlFsType = new FileSystemType + Metadata = new FileSystem { - Type = FS_TYPE, - Bootable = rbf9000Sb.rid_bootfile > 0, - ClusterSize = rbf9000Sb.rid_blocksize, - Clusters = rbf9000Sb.rid_totblocks, - CreationDate = DateHandlers.UnixToDateTime(rbf9000Sb.rid_ctime), - CreationDateSpecified = true, - ModificationDate = DateHandlers.UnixToDateTime(rbf9000Sb.rid_mtime), - ModificationDateSpecified = true, - VolumeName = StringHandlers.CToString(rbf9000Sb.rid_name, Encoding), - VolumeSerial = $"{rbf9000Sb.rid_diskid:X8}" + Type = FS_TYPE, + Bootable = rbf9000Sb.rid_bootfile > 0, + ClusterSize = rbf9000Sb.rid_blocksize, + Clusters = rbf9000Sb.rid_totblocks, + CreationDate = DateHandlers.UnixToDateTime(rbf9000Sb.rid_ctime), + ModificationDate = DateHandlers.UnixToDateTime(rbf9000Sb.rid_mtime), + VolumeName = StringHandlers.CToString(rbf9000Sb.rid_name, Encoding), + VolumeSerial = $"{rbf9000Sb.rid_diskid:X8}" }; } else @@ -257,16 +255,15 @@ public sealed partial class RBF : IFilesystem sb.AppendFormat(Localization.Path_descriptor_options_0, StringHandlers.CToString(rbfSb.dd_opt, Encoding)). AppendLine(); - XmlFsType = new FileSystemType + Metadata = new FileSystem { - Type = FS_TYPE, - Bootable = LSNToUInt32(rbfSb.dd_bt) > 0 && rbfSb.dd_bsz > 0, - ClusterSize = (uint)(rbfSb.dd_bit * (256 << rbfSb.dd_lsnsize)), - Clusters = LSNToUInt32(rbfSb.dd_tot), - CreationDate = DateHandlers.Os9ToDateTime(rbfSb.dd_dat), - CreationDateSpecified = true, - VolumeName = StringHandlers.CToString(rbfSb.dd_nam, Encoding), - VolumeSerial = $"{rbfSb.dd_dsk:X4}" + Type = FS_TYPE, + Bootable = LSNToUInt32(rbfSb.dd_bt) > 0 && rbfSb.dd_bsz > 0, + ClusterSize = (uint)(rbfSb.dd_bit * (256 << rbfSb.dd_lsnsize)), + Clusters = LSNToUInt32(rbfSb.dd_tot), + CreationDate = DateHandlers.Os9ToDateTime(rbfSb.dd_dat), + VolumeName = StringHandlers.CToString(rbfSb.dd_nam, Encoding), + VolumeSerial = $"{rbfSb.dd_dsk:X4}" }; } diff --git a/Aaru.Filesystems/RBF/RBF.cs b/Aaru.Filesystems/RBF/RBF.cs index d1f2b3927..3d69095e3 100644 --- a/Aaru.Filesystems/RBF/RBF.cs +++ b/Aaru.Filesystems/RBF/RBF.cs @@ -28,8 +28,8 @@ using System; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -38,7 +38,7 @@ namespace Aaru.Filesystems; public sealed partial class RBF : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/RT11/Info.cs b/Aaru.Filesystems/RT11/Info.cs index e5cdb8b2e..9f2568a24 100644 --- a/Aaru.Filesystems/RT11/Info.cs +++ b/Aaru.Filesystems/RT11/Info.cs @@ -32,13 +32,13 @@ using System; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Helpers; using Claunia.Encoding; -using Schemas; using Encoding = System.Text.Encoding; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -110,7 +110,7 @@ public sealed partial class RT11 imagePlugin.ReadSector(0, out byte[] bootBlock); - XmlFsType = new FileSystemType + Metadata = new FileSystem { Type = FS_TYPE, ClusterSize = (uint)(homeblock.cluster * 512), diff --git a/Aaru.Filesystems/RT11/RT11.cs b/Aaru.Filesystems/RT11/RT11.cs index 82021f0b5..da512905e 100644 --- a/Aaru.Filesystems/RT11/RT11.cs +++ b/Aaru.Filesystems/RT11/RT11.cs @@ -32,8 +32,8 @@ using System; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -43,7 +43,7 @@ namespace Aaru.Filesystems; public sealed partial class RT11 : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/ReFS/Info.cs b/Aaru.Filesystems/ReFS/Info.cs index dbb8e5000..3476a547a 100644 --- a/Aaru.Filesystems/ReFS/Info.cs +++ b/Aaru.Filesystems/ReFS/Info.cs @@ -29,12 +29,12 @@ using System; using System.Linq; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Console; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -136,7 +136,7 @@ public sealed partial class ReFS : IFilesystem information = sb.ToString(); - XmlFsType = new FileSystemType + Metadata = new FileSystem { Type = FS_TYPE, ClusterSize = vhdr.bytesPerSector * vhdr.sectorsPerCluster, diff --git a/Aaru.Filesystems/ReFS/ReFS.cs b/Aaru.Filesystems/ReFS/ReFS.cs index 94d7cec7f..f61a7fef0 100644 --- a/Aaru.Filesystems/ReFS/ReFS.cs +++ b/Aaru.Filesystems/ReFS/ReFS.cs @@ -28,8 +28,8 @@ using System; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -42,7 +42,7 @@ public sealed partial class ReFS : IFilesystem /// public Guid Id => new("37766C4E-EBF5-4113-A712-B758B756ABD6"); /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/Reiser/Info.cs b/Aaru.Filesystems/Reiser/Info.cs index b775a3d56..551c90248 100644 --- a/Aaru.Filesystems/Reiser/Info.cs +++ b/Aaru.Filesystems/Reiser/Info.cs @@ -28,11 +28,11 @@ using System.Linq; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -136,20 +136,19 @@ public sealed partial class Reiser : IFilesystem information = sb.ToString(); - XmlFsType = new FileSystemType + Metadata = new FileSystem { - Type = FS_TYPE, - ClusterSize = reiserSb.blocksize, - Clusters = reiserSb.block_count, - FreeClusters = reiserSb.free_blocks, - FreeClustersSpecified = true, - Dirty = reiserSb.umount_state == 2 + Type = FS_TYPE, + ClusterSize = reiserSb.blocksize, + Clusters = reiserSb.block_count, + FreeClusters = reiserSb.free_blocks, + Dirty = reiserSb.umount_state == 2 }; if(reiserSb.version < 2) return; - XmlFsType.VolumeName = StringHandlers.CToString(reiserSb.label, Encoding); - XmlFsType.VolumeSerial = reiserSb.uuid.ToString(); + Metadata.VolumeName = StringHandlers.CToString(reiserSb.label, Encoding); + Metadata.VolumeSerial = reiserSb.uuid.ToString(); } } \ No newline at end of file diff --git a/Aaru.Filesystems/Reiser/Reiser.cs b/Aaru.Filesystems/Reiser/Reiser.cs index 9010d96d9..19a18b2f5 100644 --- a/Aaru.Filesystems/Reiser/Reiser.cs +++ b/Aaru.Filesystems/Reiser/Reiser.cs @@ -28,8 +28,8 @@ using System; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -38,7 +38,7 @@ namespace Aaru.Filesystems; public sealed partial class Reiser : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/Reiser4/Info.cs b/Aaru.Filesystems/Reiser4/Info.cs index c2d058080..2b54e2617 100644 --- a/Aaru.Filesystems/Reiser4/Info.cs +++ b/Aaru.Filesystems/Reiser4/Info.cs @@ -28,11 +28,11 @@ using System.Linq; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -114,7 +114,7 @@ public sealed partial class Reiser4 information = sb.ToString(); - XmlFsType = new FileSystemType + Metadata = new FileSystem { Type = FS_TYPE, ClusterSize = reiserSb.blocksize, diff --git a/Aaru.Filesystems/Reiser4/Reiser4.cs b/Aaru.Filesystems/Reiser4/Reiser4.cs index c44bbd51d..883ce4b7e 100644 --- a/Aaru.Filesystems/Reiser4/Reiser4.cs +++ b/Aaru.Filesystems/Reiser4/Reiser4.cs @@ -28,8 +28,8 @@ using System; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -38,7 +38,7 @@ namespace Aaru.Filesystems; public sealed partial class Reiser4 : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/SFS/Info.cs b/Aaru.Filesystems/SFS/Info.cs index 92bd51cb9..303b3f145 100644 --- a/Aaru.Filesystems/SFS/Info.cs +++ b/Aaru.Filesystems/SFS/Info.cs @@ -27,11 +27,11 @@ // ****************************************************************************/ using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -106,13 +106,12 @@ public sealed partial class SFS information = sbInformation.ToString(); - XmlFsType = new FileSystemType + Metadata = new FileSystem { - CreationDate = DateHandlers.UnixUnsignedToDateTime(rootBlock.datecreated).AddYears(8), - CreationDateSpecified = true, - Clusters = rootBlock.totalblocks, - ClusterSize = rootBlock.blocksize, - Type = FS_TYPE + CreationDate = DateHandlers.UnixUnsignedToDateTime(rootBlock.datecreated).AddYears(8), + Clusters = rootBlock.totalblocks, + ClusterSize = rootBlock.blocksize, + Type = FS_TYPE }; } } \ No newline at end of file diff --git a/Aaru.Filesystems/SFS/SFS.cs b/Aaru.Filesystems/SFS/SFS.cs index 3501e5b8a..d9344afab 100644 --- a/Aaru.Filesystems/SFS/SFS.cs +++ b/Aaru.Filesystems/SFS/SFS.cs @@ -28,8 +28,8 @@ using System; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -38,7 +38,7 @@ namespace Aaru.Filesystems; public sealed partial class SFS : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/SolarFS/Info.cs b/Aaru.Filesystems/SolarFS/Info.cs index 8228ac551..a50252817 100644 --- a/Aaru.Filesystems/SolarFS/Info.cs +++ b/Aaru.Filesystems/SolarFS/Info.cs @@ -28,12 +28,12 @@ using System; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Console; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -154,7 +154,7 @@ public sealed partial class SolarFS sb.AppendFormat(Localization._0_sectors_per_track, bpb.sptrk).AppendLine(); sb.AppendFormat(Localization.Volume_name_0, bpb.vol_name).AppendLine(); - XmlFsType = new FileSystemType + Metadata = new FileSystem { Type = FS_TYPE, Clusters = bpb.sectors, diff --git a/Aaru.Filesystems/SolarFS/SolarFS.cs b/Aaru.Filesystems/SolarFS/SolarFS.cs index e212fb1b3..dc1f6a4c2 100644 --- a/Aaru.Filesystems/SolarFS/SolarFS.cs +++ b/Aaru.Filesystems/SolarFS/SolarFS.cs @@ -28,8 +28,8 @@ using System; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -39,7 +39,7 @@ namespace Aaru.Filesystems; public sealed partial class SolarFS : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/Squash/Info.cs b/Aaru.Filesystems/Squash/Info.cs index 0a6036c20..0fb49be7c 100644 --- a/Aaru.Filesystems/Squash/Info.cs +++ b/Aaru.Filesystems/Squash/Info.cs @@ -28,11 +28,11 @@ using System; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -134,17 +134,14 @@ public sealed partial class Squash information = sbInformation.ToString(); - XmlFsType = new FileSystemType + Metadata = new FileSystem { - Type = FS_TYPE, + Type = FS_TYPE, CreationDate = DateHandlers.UnixUnsignedToDateTime(sqSb.mkfs_time), - CreationDateSpecified = true, - Clusters = (partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize / sqSb.block_size, - ClusterSize = sqSb.block_size, - Files = sqSb.inodes, - FilesSpecified = true, - FreeClusters = 0, - FreeClustersSpecified = true + Clusters = (partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize / sqSb.block_size, + ClusterSize = sqSb.block_size, + Files = sqSb.inodes, + FreeClusters = 0 }; } } \ No newline at end of file diff --git a/Aaru.Filesystems/Squash/Squash.cs b/Aaru.Filesystems/Squash/Squash.cs index 2443acdcd..d3106fc3a 100644 --- a/Aaru.Filesystems/Squash/Squash.cs +++ b/Aaru.Filesystems/Squash/Squash.cs @@ -28,8 +28,8 @@ using System; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -38,7 +38,7 @@ namespace Aaru.Filesystems; public sealed partial class Squash : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/SysV/Info.cs b/Aaru.Filesystems/SysV/Info.cs index 26e8c6ad1..627f099b8 100644 --- a/Aaru.Filesystems/SysV/Info.cs +++ b/Aaru.Filesystems/SysV/Info.cs @@ -32,11 +32,11 @@ using System; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -336,7 +336,7 @@ public sealed partial class SysVfs !xenix3) return; - XmlFsType = new FileSystemType(); + Metadata = new FileSystem(); if(xenix || xenix3) { @@ -417,25 +417,25 @@ public sealed partial class SysVfs uint bs = 512; sb.AppendLine(Localization.XENIX_filesystem); - XmlFsType.Type = FS_TYPE_XENIX; + Metadata.Type = FS_TYPE_XENIX; switch(xnx_sb.s_type) { case 1: sb.AppendLine(Localization._512_bytes_per_block); - XmlFsType.ClusterSize = 512; + Metadata.ClusterSize = 512; break; case 2: sb.AppendLine(Localization._1024_bytes_per_block); - bs = 1024; - XmlFsType.ClusterSize = 1024; + bs = 1024; + Metadata.ClusterSize = 1024; break; case 3: sb.AppendLine(Localization._2048_bytes_per_block); - bs = 2048; - XmlFsType.ClusterSize = 2048; + bs = 2048; + Metadata.ClusterSize = 2048; break; default: @@ -494,12 +494,11 @@ public sealed partial class SysVfs if(xnx_sb.s_time != 0) { - XmlFsType.ModificationDate = DateHandlers.UnixToDateTime(xnx_sb.s_time); - XmlFsType.ModificationDateSpecified = true; + Metadata.ModificationDate = DateHandlers.UnixToDateTime(xnx_sb.s_time); } sb.AppendFormat(Localization.Volume_name_0, xnx_sb.s_fname).AppendLine(); - XmlFsType.VolumeName = xnx_sb.s_fname; + Metadata.VolumeName = xnx_sb.s_fname; sb.AppendFormat(Localization.Pack_name_0, xnx_sb.s_fpack).AppendLine(); if(xnx_sb.s_clean == 0x46) @@ -507,7 +506,7 @@ public sealed partial class SysVfs else { sb.AppendLine(Localization.Volume_is_dirty); - XmlFsType.Dirty = true; + Metadata.Dirty = true; } } @@ -533,17 +532,17 @@ public sealed partial class SysVfs switch(sysv_sb.s_type) { case 1: - XmlFsType.ClusterSize = 512; + Metadata.ClusterSize = 512; break; case 2: - bs = 1024; - XmlFsType.ClusterSize = 1024; + bs = 1024; + Metadata.ClusterSize = 1024; break; case 3: - bs = 2048; - XmlFsType.ClusterSize = 2048; + bs = 2048; + Metadata.ClusterSize = 2048; break; default: @@ -583,7 +582,7 @@ public sealed partial class SysVfs Array.Copy(sb_sector, 0x1BC + offset, sysv_strings, 0, 6); sysv_sb.s_fpack = StringHandlers.CToString(sysv_strings, Encoding); sb.AppendLine(Localization.System_V_Release_4_filesystem); - XmlFsType.Type = FS_TYPE_SVR4; + Metadata.Type = FS_TYPE_SVR4; } else { @@ -609,7 +608,7 @@ public sealed partial class SysVfs Array.Copy(sb_sector, 0x1B6 + offset, sysv_strings, 0, 6); sysv_sb.s_fpack = StringHandlers.CToString(sysv_strings, Encoding); sb.AppendLine(Localization.System_V_Release_2_filesystem); - XmlFsType.Type = FS_TYPE_SVR2; + Metadata.Type = FS_TYPE_SVR2; } if(bigEndian) @@ -631,7 +630,7 @@ public sealed partial class SysVfs sb.AppendFormat(Localization._0_bytes_per_block, bs).AppendLine(); - XmlFsType.Clusters = sysv_sb.s_fsize; + Metadata.Clusters = sysv_sb.s_fsize; sb.AppendFormat(Localization._0_zones_on_volume_1_bytes, sysv_sb.s_fsize, sysv_sb.s_fsize * bs). AppendLine(); @@ -669,12 +668,11 @@ public sealed partial class SysVfs if(sysv_sb.s_time != 0) { - XmlFsType.ModificationDate = DateHandlers.UnixUnsignedToDateTime(sysv_sb.s_time); - XmlFsType.ModificationDateSpecified = true; + Metadata.ModificationDate = DateHandlers.UnixUnsignedToDateTime(sysv_sb.s_time); } sb.AppendFormat(Localization.Volume_name_0, sysv_sb.s_fname).AppendLine(); - XmlFsType.VolumeName = sysv_sb.s_fname; + Metadata.VolumeName = sysv_sb.s_fname; sb.AppendFormat(Localization.Pack_name_0, sysv_sb.s_fpack).AppendLine(); if(sysv_sb.s_state == 0x7C269D38 - sysv_sb.s_time) @@ -682,7 +680,7 @@ public sealed partial class SysVfs else { sb.AppendLine(Localization.Volume_is_dirty); - XmlFsType.Dirty = true; + Metadata.Dirty = true; } } @@ -714,9 +712,9 @@ public sealed partial class SysVfs Array.Copy(sb_sector, 0x1EA, coh_strings, 0, 6); coh_sb.s_fpack = StringHandlers.CToString(coh_strings, Encoding); - XmlFsType.Type = FS_TYPE_COHERENT; - XmlFsType.ClusterSize = 512; - XmlFsType.Clusters = coh_sb.s_fsize; + Metadata.Type = FS_TYPE_COHERENT; + Metadata.ClusterSize = 512; + Metadata.Clusters = coh_sb.s_fsize; sb.AppendLine(Localization.Coherent_UNIX_filesystem); @@ -754,12 +752,11 @@ public sealed partial class SysVfs if(coh_sb.s_time != 0) { - XmlFsType.ModificationDate = DateHandlers.UnixUnsignedToDateTime(coh_sb.s_time); - XmlFsType.ModificationDateSpecified = true; + Metadata.ModificationDate = DateHandlers.UnixUnsignedToDateTime(coh_sb.s_time); } sb.AppendFormat(Localization.Volume_name_0, coh_sb.s_fname).AppendLine(); - XmlFsType.VolumeName = coh_sb.s_fname; + Metadata.VolumeName = coh_sb.s_fname; sb.AppendFormat(Localization.Pack_name_0, coh_sb.s_fpack).AppendLine(); } @@ -791,9 +788,9 @@ public sealed partial class SysVfs Array.Copy(sb_sector, 0x1B2, sys7_strings, 0, 6); v7_sb.s_fpack = StringHandlers.CToString(sys7_strings, Encoding); - XmlFsType.Type = FS_TYPE_UNIX7; - XmlFsType.ClusterSize = 512; - XmlFsType.Clusters = v7_sb.s_fsize; + Metadata.Type = FS_TYPE_UNIX7; + Metadata.ClusterSize = 512; + Metadata.Clusters = v7_sb.s_fsize; sb.AppendLine(Localization.UNIX_7th_Edition_filesystem); if(imagePlugin.Info.SectorSize != 512) @@ -830,12 +827,11 @@ public sealed partial class SysVfs if(v7_sb.s_time != 0) { - XmlFsType.ModificationDate = DateHandlers.UnixUnsignedToDateTime(v7_sb.s_time); - XmlFsType.ModificationDateSpecified = true; + Metadata.ModificationDate = DateHandlers.UnixUnsignedToDateTime(v7_sb.s_time); } sb.AppendFormat(Localization.Volume_name_0, v7_sb.s_fname).AppendLine(); - XmlFsType.VolumeName = v7_sb.s_fname; + Metadata.VolumeName = v7_sb.s_fname; sb.AppendFormat(Localization.Pack_name_0, v7_sb.s_fpack).AppendLine(); } diff --git a/Aaru.Filesystems/SysV/SysV.cs b/Aaru.Filesystems/SysV/SysV.cs index 5bd48d1cf..7c1be4763 100644 --- a/Aaru.Filesystems/SysV/SysV.cs +++ b/Aaru.Filesystems/SysV/SysV.cs @@ -31,8 +31,8 @@ using System; using System.Diagnostics.CodeAnalysis; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -44,7 +44,7 @@ namespace Aaru.Filesystems; public sealed partial class SysVfs : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/UCSDPascal/Info.cs b/Aaru.Filesystems/UCSDPascal/Info.cs index a1d61d754..992cfc803 100644 --- a/Aaru.Filesystems/UCSDPascal/Info.cs +++ b/Aaru.Filesystems/UCSDPascal/Info.cs @@ -32,14 +32,14 @@ using System; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Console; using Aaru.Helpers; using Claunia.Encoding; -using Schemas; using Encoding = System.Text.Encoding; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -202,15 +202,14 @@ public sealed partial class PascalPlugin imagePlugin.ReadSectors(partition.Start, _multiplier * 2, out byte[] boot); - XmlFsType = new FileSystemType + Metadata = new FileSystem { - Bootable = !ArrayHelpers.ArrayIsNullOrEmpty(boot), - Clusters = (ulong)volEntry.Blocks, - ClusterSize = imagePlugin.Info.SectorSize, - Files = (ulong)volEntry.Files, - FilesSpecified = true, - Type = FS_TYPE, - VolumeName = StringHandlers.PascalToString(volEntry.VolumeName, Encoding) + Bootable = !ArrayHelpers.ArrayIsNullOrEmpty(boot), + Clusters = (ulong)volEntry.Blocks, + ClusterSize = imagePlugin.Info.SectorSize, + Files = (ulong)volEntry.Files, + Type = FS_TYPE, + VolumeName = StringHandlers.PascalToString(volEntry.VolumeName, Encoding) }; } } \ No newline at end of file diff --git a/Aaru.Filesystems/UCSDPascal/Super.cs b/Aaru.Filesystems/UCSDPascal/Super.cs index 5779eed03..aca9ba8f1 100644 --- a/Aaru.Filesystems/UCSDPascal/Super.cs +++ b/Aaru.Filesystems/UCSDPascal/Super.cs @@ -32,14 +32,14 @@ using System; using System.Collections.Generic; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Structs; using Aaru.Helpers; using Claunia.Encoding; -using Schemas; using Encoding = System.Text.Encoding; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -133,15 +133,14 @@ public sealed partial class PascalPlugin if(errno != ErrorNumber.NoError) return errno; - XmlFsType = new FileSystemType + Metadata = new FileSystem { - Bootable = !ArrayHelpers.ArrayIsNullOrEmpty(_bootBlocks), - Clusters = (ulong)_mountedVolEntry.Blocks, - ClusterSize = _device.Info.SectorSize, - Files = (ulong)_mountedVolEntry.Files, - FilesSpecified = true, - Type = FS_TYPE, - VolumeName = StringHandlers.PascalToString(_mountedVolEntry.VolumeName, Encoding) + Bootable = !ArrayHelpers.ArrayIsNullOrEmpty(_bootBlocks), + Clusters = (ulong)_mountedVolEntry.Blocks, + ClusterSize = _device.Info.SectorSize, + Files = (ulong)_mountedVolEntry.Files, + Type = FS_TYPE, + VolumeName = StringHandlers.PascalToString(_mountedVolEntry.VolumeName, Encoding) }; _mounted = true; diff --git a/Aaru.Filesystems/UCSDPascal/UCSDPascal.cs b/Aaru.Filesystems/UCSDPascal/UCSDPascal.cs index 9f28e40da..37f1c5ae3 100644 --- a/Aaru.Filesystems/UCSDPascal/UCSDPascal.cs +++ b/Aaru.Filesystems/UCSDPascal/UCSDPascal.cs @@ -33,9 +33,9 @@ using System; using System.Collections.Generic; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -55,7 +55,7 @@ public sealed partial class PascalPlugin : IReadOnlyFilesystem uint _multiplier; /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public string Name => Localization.PascalPlugin_Name; /// diff --git a/Aaru.Filesystems/UDF/Info.cs b/Aaru.Filesystems/UDF/Info.cs index 43ce1be1b..086509384 100644 --- a/Aaru.Filesystems/UDF/Info.cs +++ b/Aaru.Filesystems/UDF/Info.cs @@ -30,12 +30,12 @@ using System; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Console; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -366,23 +366,20 @@ public sealed partial class UDF Convert.ToInt32($"{(lvidiu.maximumWriteUDF & 0xFF00) >> 8}", 10), Convert.ToInt32($"{lvidiu.maximumWriteUDF & 0xFF}", 10)).AppendLine(); - XmlFsType = new FileSystemType + Metadata = new FileSystem { - Type = FS_TYPE, - ApplicationIdentifier = Encoding.GetString(pvd.implementationIdentifier.identifier).TrimEnd('\u0000'), - ClusterSize = lvd.logicalBlockSize, - ModificationDate = EcmaToDateTime(lvid.recordingDateTime), - ModificationDateSpecified = true, - Files = lvidiu.files, - FilesSpecified = true, - VolumeName = StringHandlers.DecompressUnicode(lvd.logicalVolumeIdentifier), - VolumeSetIdentifier = StringHandlers.DecompressUnicode(pvd.volumeSetIdentifier), - VolumeSerial = StringHandlers.DecompressUnicode(pvd.volumeSetIdentifier), - SystemIdentifier = Encoding.GetString(pvd.implementationIdentifier.identifier).TrimEnd('\u0000') + Type = FS_TYPE, + ApplicationIdentifier = Encoding.GetString(pvd.implementationIdentifier.identifier).TrimEnd('\u0000'), + ClusterSize = lvd.logicalBlockSize, + ModificationDate = EcmaToDateTime(lvid.recordingDateTime), + Files = lvidiu.files, + VolumeName = StringHandlers.DecompressUnicode(lvd.logicalVolumeIdentifier), + VolumeSetIdentifier = StringHandlers.DecompressUnicode(pvd.volumeSetIdentifier), + VolumeSerial = StringHandlers.DecompressUnicode(pvd.volumeSetIdentifier), + SystemIdentifier = Encoding.GetString(pvd.implementationIdentifier.identifier).TrimEnd('\u0000') }; - XmlFsType.Clusters = (partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize / - XmlFsType.ClusterSize; + Metadata.Clusters = (partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize / Metadata.ClusterSize; information = sbInformation.ToString(); } diff --git a/Aaru.Filesystems/UDF/UDF.cs b/Aaru.Filesystems/UDF/UDF.cs index 8e9c487fd..777bbd857 100644 --- a/Aaru.Filesystems/UDF/UDF.cs +++ b/Aaru.Filesystems/UDF/UDF.cs @@ -29,8 +29,8 @@ using System; using System.Diagnostics.CodeAnalysis; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -41,7 +41,7 @@ namespace Aaru.Filesystems; public sealed partial class UDF : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/UNICOS/Info.cs b/Aaru.Filesystems/UNICOS/Info.cs index bb9b2a52c..81fd92151 100644 --- a/Aaru.Filesystems/UNICOS/Info.cs +++ b/Aaru.Filesystems/UNICOS/Info.cs @@ -29,17 +29,17 @@ // UNICOS is ILP64 so let's think everything is 64-bit using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Console; using Aaru.Helpers; -using Schemas; using blkno_t = System.Int64; using daddr_t = System.Int64; using dev_t = System.Int64; using extent_t = System.Int64; using ino_t = System.Int64; +using Partition = Aaru.CommonTypes.Partition; using time_t = System.Int64; namespace Aaru.Filesystems; @@ -129,16 +129,15 @@ public sealed partial class UNICOS information = sb.ToString(); - XmlFsType = new FileSystemType + Metadata = new FileSystem { - Type = FS_TYPE, - ClusterSize = 4096, - Clusters = (ulong)unicosSb.s_fsize, - VolumeName = StringHandlers.CToString(unicosSb.s_fname, Encoding), - ModificationDate = DateHandlers.UnixToDateTime(unicosSb.s_time), - ModificationDateSpecified = true + Type = FS_TYPE, + ClusterSize = 4096, + Clusters = (ulong)unicosSb.s_fsize, + VolumeName = StringHandlers.CToString(unicosSb.s_fname, Encoding), + ModificationDate = DateHandlers.UnixToDateTime(unicosSb.s_time) }; - XmlFsType.Dirty |= unicosSb.s_error > 0; + Metadata.Dirty |= unicosSb.s_error > 0; } } \ No newline at end of file diff --git a/Aaru.Filesystems/UNICOS/UNICOS.cs b/Aaru.Filesystems/UNICOS/UNICOS.cs index 509bfd0fa..3bd0442b7 100644 --- a/Aaru.Filesystems/UNICOS/UNICOS.cs +++ b/Aaru.Filesystems/UNICOS/UNICOS.cs @@ -30,8 +30,8 @@ using System; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; using blkno_t = System.Int64; using daddr_t = System.Int64; using dev_t = System.Int64; @@ -46,7 +46,7 @@ namespace Aaru.Filesystems; public sealed partial class UNICOS : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/UNIXBFS/Info.cs b/Aaru.Filesystems/UNIXBFS/Info.cs index 125d983d6..e228b22b7 100644 --- a/Aaru.Filesystems/UNIXBFS/Info.cs +++ b/Aaru.Filesystems/UNIXBFS/Info.cs @@ -28,12 +28,12 @@ using System; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Console; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -106,7 +106,7 @@ public sealed partial class BFS sb.AppendFormat(Localization.Filesystem_name_0, bfsSb.s_fsname).AppendLine(); sb.AppendFormat(Localization.Volume_name_0, bfsSb.s_volume).AppendLine(); - XmlFsType = new FileSystemType + Metadata = new FileSystem { Type = FS_TYPE, VolumeName = bfsSb.s_volume, diff --git a/Aaru.Filesystems/UNIXBFS/UNIXBFS.cs b/Aaru.Filesystems/UNIXBFS/UNIXBFS.cs index 5d00b3937..110ecd9ef 100644 --- a/Aaru.Filesystems/UNIXBFS/UNIXBFS.cs +++ b/Aaru.Filesystems/UNIXBFS/UNIXBFS.cs @@ -28,8 +28,8 @@ using System; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -39,7 +39,7 @@ namespace Aaru.Filesystems; public sealed partial class BFS : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/VMfs/Info.cs b/Aaru.Filesystems/VMfs/Info.cs index fe3572998..9dd7a7263 100644 --- a/Aaru.Filesystems/VMfs/Info.cs +++ b/Aaru.Filesystems/VMfs/Info.cs @@ -29,11 +29,11 @@ using System; using System.Diagnostics.CodeAnalysis; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -104,16 +104,14 @@ public sealed partial class VMfs information = sbInformation.ToString(); - XmlFsType = new FileSystemType + Metadata = new FileSystem { - Type = FS_TYPE, - CreationDate = DateHandlers.UnixUnsignedToDateTime(ctimeSecs, ctimeNanoSecs), - CreationDateSpecified = true, - ModificationDate = DateHandlers.UnixUnsignedToDateTime(mtimeSecs, mtimeNanoSecs), - ModificationDateSpecified = true, - Clusters = volInfo.size * 256 / imagePlugin.Info.SectorSize, - ClusterSize = imagePlugin.Info.SectorSize, - VolumeSerial = volInfo.uuid.ToString() + Type = FS_TYPE, + CreationDate = DateHandlers.UnixUnsignedToDateTime(ctimeSecs, ctimeNanoSecs), + ModificationDate = DateHandlers.UnixUnsignedToDateTime(mtimeSecs, mtimeNanoSecs), + Clusters = volInfo.size * 256 / imagePlugin.Info.SectorSize, + ClusterSize = imagePlugin.Info.SectorSize, + VolumeSerial = volInfo.uuid.ToString() }; } } \ No newline at end of file diff --git a/Aaru.Filesystems/VMfs/VMfs.cs b/Aaru.Filesystems/VMfs/VMfs.cs index f7dc3fe09..1b01c507b 100644 --- a/Aaru.Filesystems/VMfs/VMfs.cs +++ b/Aaru.Filesystems/VMfs/VMfs.cs @@ -29,8 +29,8 @@ using System; using System.Diagnostics.CodeAnalysis; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -41,7 +41,7 @@ namespace Aaru.Filesystems; public sealed partial class VMfs : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/VxFS/Info.cs b/Aaru.Filesystems/VxFS/Info.cs index 82c8ae05b..ff5e6a6a2 100644 --- a/Aaru.Filesystems/VxFS/Info.cs +++ b/Aaru.Filesystems/VxFS/Info.cs @@ -28,11 +28,11 @@ using System; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -98,18 +98,15 @@ public sealed partial class VxFS information = sbInformation.ToString(); - XmlFsType = new FileSystemType + Metadata = new FileSystem { - Type = FS_TYPE, - CreationDate = DateHandlers.UnixUnsignedToDateTime(vxSb.vs_ctime, vxSb.vs_cutime), - CreationDateSpecified = true, - ModificationDate = DateHandlers.UnixUnsignedToDateTime(vxSb.vs_wtime, vxSb.vs_wutime), - ModificationDateSpecified = true, - Clusters = (ulong)vxSb.vs_size, - ClusterSize = (uint)vxSb.vs_bsize, - Dirty = vxSb.vs_clean != 0, - FreeClusters = (ulong)vxSb.vs_free, - FreeClustersSpecified = true + Type = FS_TYPE, + CreationDate = DateHandlers.UnixUnsignedToDateTime(vxSb.vs_ctime, vxSb.vs_cutime), + ModificationDate = DateHandlers.UnixUnsignedToDateTime(vxSb.vs_wtime, vxSb.vs_wutime), + Clusters = (ulong)vxSb.vs_size, + ClusterSize = (uint)vxSb.vs_bsize, + Dirty = vxSb.vs_clean != 0, + FreeClusters = (ulong)vxSb.vs_free }; } } \ No newline at end of file diff --git a/Aaru.Filesystems/VxFS/VxFS.cs b/Aaru.Filesystems/VxFS/VxFS.cs index 0192f1525..5a0aa5ee0 100644 --- a/Aaru.Filesystems/VxFS/VxFS.cs +++ b/Aaru.Filesystems/VxFS/VxFS.cs @@ -28,8 +28,8 @@ using System; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -38,7 +38,7 @@ namespace Aaru.Filesystems; public sealed partial class VxFS : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/XFS/Info.cs b/Aaru.Filesystems/XFS/Info.cs index 99014763b..4b0172e38 100644 --- a/Aaru.Filesystems/XFS/Info.cs +++ b/Aaru.Filesystems/XFS/Info.cs @@ -28,12 +28,12 @@ using System; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Console; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -48,7 +48,7 @@ public sealed partial class XFS return false; // Misaligned - if(imagePlugin.Info.XmlMediaType == XmlMediaType.OpticalDisc) + if(imagePlugin.Info.MetadataMediaType == MetadataMediaType.OpticalDisc) { uint sbSize = (uint)((Marshal.SizeOf() + 0x400) / imagePlugin.Info.SectorSize); @@ -126,7 +126,7 @@ public sealed partial class XFS var xfsSb = new Superblock(); // Misaligned - if(imagePlugin.Info.XmlMediaType == XmlMediaType.OpticalDisc) + if(imagePlugin.Info.MetadataMediaType == MetadataMediaType.OpticalDisc) { uint sbSize = (uint)((Marshal.SizeOf() + 0x400) / imagePlugin.Info.SectorSize); @@ -207,18 +207,16 @@ public sealed partial class XFS information = sb.ToString(); - XmlFsType = new FileSystemType + Metadata = new FileSystem { - Type = FS_TYPE, - ClusterSize = xfsSb.blocksize, - Clusters = xfsSb.dblocks, - FreeClusters = xfsSb.fdblocks, - FreeClustersSpecified = true, - Files = xfsSb.icount - xfsSb.ifree, - FilesSpecified = true, - Dirty = xfsSb.inprogress > 0, - VolumeName = StringHandlers.CToString(xfsSb.fname, Encoding), - VolumeSerial = xfsSb.uuid.ToString() + Type = FS_TYPE, + ClusterSize = xfsSb.blocksize, + Clusters = xfsSb.dblocks, + FreeClusters = xfsSb.fdblocks, + Files = xfsSb.icount - xfsSb.ifree, + Dirty = xfsSb.inprogress > 0, + VolumeName = StringHandlers.CToString(xfsSb.fname, Encoding), + VolumeSerial = xfsSb.uuid.ToString() }; } } \ No newline at end of file diff --git a/Aaru.Filesystems/XFS/XFS.cs b/Aaru.Filesystems/XFS/XFS.cs index bcbe9cd06..e0e2f573b 100644 --- a/Aaru.Filesystems/XFS/XFS.cs +++ b/Aaru.Filesystems/XFS/XFS.cs @@ -28,8 +28,8 @@ using System; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -38,7 +38,7 @@ namespace Aaru.Filesystems; public sealed partial class XFS : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/Xia/Info.cs b/Aaru.Filesystems/Xia/Info.cs index e9f82a0c9..32f493dde 100644 --- a/Aaru.Filesystems/Xia/Info.cs +++ b/Aaru.Filesystems/Xia/Info.cs @@ -28,11 +28,11 @@ using System.Diagnostics.CodeAnalysis; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -113,7 +113,7 @@ public sealed partial class Xia sb.AppendFormat(Localization.First_kernel_zone_0, supblk.s_firstkernzone).AppendLine(); - XmlFsType = new FileSystemType + Metadata = new FileSystem { Bootable = !ArrayHelpers.ArrayIsNullOrEmpty(supblk.s_boot_segment), Clusters = supblk.s_nzones, diff --git a/Aaru.Filesystems/Xia/Xia.cs b/Aaru.Filesystems/Xia/Xia.cs index c393f7637..e7e77fd62 100644 --- a/Aaru.Filesystems/Xia/Xia.cs +++ b/Aaru.Filesystems/Xia/Xia.cs @@ -29,8 +29,8 @@ using System; using System.Diagnostics.CodeAnalysis; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -41,7 +41,7 @@ namespace Aaru.Filesystems; public sealed partial class Xia : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/ZFS/Info.cs b/Aaru.Filesystems/ZFS/Info.cs index 85640fa80..0e8a8cc75 100644 --- a/Aaru.Filesystems/ZFS/Info.cs +++ b/Aaru.Filesystems/ZFS/Info.cs @@ -30,10 +30,10 @@ using System; using System.Collections.Generic; using System.Diagnostics.CodeAnalysis; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -154,18 +154,18 @@ public sealed partial class ZFS information = sb.ToString(); - XmlFsType = new FileSystemType + Metadata = new FileSystem { Type = FS_TYPE }; if(decodedNvList.TryGetValue("name", out NVS_Item tmpObj)) - XmlFsType.VolumeName = (string)tmpObj.value; + Metadata.VolumeName = (string)tmpObj.value; if(decodedNvList.TryGetValue("guid", out tmpObj)) - XmlFsType.VolumeSerial = $"{(ulong)tmpObj.value}"; + Metadata.VolumeSerial = $"{(ulong)tmpObj.value}"; if(decodedNvList.TryGetValue("pool_guid", out tmpObj)) - XmlFsType.VolumeSetIdentifier = $"{(ulong)tmpObj.value}"; + Metadata.VolumeSetIdentifier = $"{(ulong)tmpObj.value}"; } } \ No newline at end of file diff --git a/Aaru.Filesystems/ZFS/ZFS.cs b/Aaru.Filesystems/ZFS/ZFS.cs index 1c7c13801..ffe182683 100644 --- a/Aaru.Filesystems/ZFS/ZFS.cs +++ b/Aaru.Filesystems/ZFS/ZFS.cs @@ -29,8 +29,8 @@ using System; using System.Diagnostics.CodeAnalysis; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -60,7 +60,7 @@ namespace Aaru.Filesystems; public sealed partial class ZFS : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/dump/Info.cs b/Aaru.Filesystems/dump/Info.cs index f966624ca..80e8a40ef 100644 --- a/Aaru.Filesystems/dump/Info.cs +++ b/Aaru.Filesystems/dump/Info.cs @@ -32,12 +32,12 @@ using System.Diagnostics.CodeAnalysis; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Console; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; using ufs_daddr_t = System.Int32; namespace Aaru.Filesystems; @@ -151,7 +151,7 @@ public sealed partial class dump var sb = new StringBuilder(); - XmlFsType = new FileSystemType + Metadata = new FileSystem { ClusterSize = 1024, Clusters = partition.Size / 1024 @@ -159,75 +159,70 @@ public sealed partial class dump if(useOld) { - XmlFsType.Type = Localization.Old_16_bit_dump_8; - sb.AppendLine(XmlFsType.Type); + Metadata.Type = Localization.Old_16_bit_dump_8; + sb.AppendLine(Metadata.Type); if(oldHdr.c_date > 0) { - XmlFsType.CreationDate = DateHandlers.UnixToDateTime(oldHdr.c_date); - XmlFsType.CreationDateSpecified = true; - sb.AppendFormat(Localization.Dump_created_on_0, XmlFsType.CreationDate).AppendLine(); + Metadata.CreationDate = DateHandlers.UnixToDateTime(oldHdr.c_date); + sb.AppendFormat(Localization.Dump_created_on_0, Metadata.CreationDate).AppendLine(); } if(oldHdr.c_ddate > 0) { - XmlFsType.BackupDate = DateHandlers.UnixToDateTime(oldHdr.c_ddate); - XmlFsType.BackupDateSpecified = true; - sb.AppendFormat(Localization.Previous_dump_created_on_0, XmlFsType.BackupDate).AppendLine(); + Metadata.BackupDate = DateHandlers.UnixToDateTime(oldHdr.c_ddate); + sb.AppendFormat(Localization.Previous_dump_created_on_0, Metadata.BackupDate).AppendLine(); } sb.AppendFormat(Localization.Dump_volume_number_0, oldHdr.c_volume).AppendLine(); } else if(useAix) { - XmlFsType.Type = FS_TYPE; - sb.AppendLine(XmlFsType.Type); + Metadata.Type = FS_TYPE; + sb.AppendLine(Metadata.Type); if(aixHdr.c_date > 0) { - XmlFsType.CreationDate = DateHandlers.UnixToDateTime(aixHdr.c_date); - XmlFsType.CreationDateSpecified = true; - sb.AppendFormat(Localization.Dump_created_on_0, XmlFsType.CreationDate).AppendLine(); + Metadata.CreationDate = DateHandlers.UnixToDateTime(aixHdr.c_date); + + sb.AppendFormat(Localization.Dump_created_on_0, Metadata.CreationDate).AppendLine(); } if(aixHdr.c_ddate > 0) { - XmlFsType.BackupDate = DateHandlers.UnixToDateTime(aixHdr.c_ddate); - XmlFsType.BackupDateSpecified = true; - sb.AppendFormat(Localization.Previous_dump_created_on_0, XmlFsType.BackupDate).AppendLine(); + Metadata.BackupDate = DateHandlers.UnixToDateTime(aixHdr.c_ddate); + sb.AppendFormat(Localization.Previous_dump_created_on_0, Metadata.BackupDate).AppendLine(); } sb.AppendFormat(Localization.Dump_volume_number_0, aixHdr.c_volume).AppendLine(); } else { - XmlFsType.Type = FS_TYPE; - sb.AppendLine(XmlFsType.Type); + Metadata.Type = FS_TYPE; + sb.AppendLine(Metadata.Type); if(newHdr.c_ndate > 0) { - XmlFsType.CreationDate = DateHandlers.UnixToDateTime(newHdr.c_ndate); - XmlFsType.CreationDateSpecified = true; - sb.AppendFormat(Localization.Dump_created_on_0, XmlFsType.CreationDate).AppendLine(); + Metadata.CreationDate = DateHandlers.UnixToDateTime(newHdr.c_ndate); + + sb.AppendFormat(Localization.Dump_created_on_0, Metadata.CreationDate).AppendLine(); } else if(newHdr.c_date > 0) { - XmlFsType.CreationDate = DateHandlers.UnixToDateTime(newHdr.c_date); - XmlFsType.CreationDateSpecified = true; - sb.AppendFormat(Localization.Dump_created_on_0, XmlFsType.CreationDate).AppendLine(); + Metadata.CreationDate = DateHandlers.UnixToDateTime(newHdr.c_date); + + sb.AppendFormat(Localization.Dump_created_on_0, Metadata.CreationDate).AppendLine(); } if(newHdr.c_nddate > 0) { - XmlFsType.BackupDate = DateHandlers.UnixToDateTime(newHdr.c_nddate); - XmlFsType.BackupDateSpecified = true; - sb.AppendFormat(Localization.Previous_dump_created_on_0, XmlFsType.BackupDate).AppendLine(); + Metadata.BackupDate = DateHandlers.UnixToDateTime(newHdr.c_nddate); + sb.AppendFormat(Localization.Previous_dump_created_on_0, Metadata.BackupDate).AppendLine(); } else if(newHdr.c_ddate > 0) { - XmlFsType.BackupDate = DateHandlers.UnixToDateTime(newHdr.c_ddate); - XmlFsType.BackupDateSpecified = true; - sb.AppendFormat(Localization.Previous_dump_created_on_0, XmlFsType.BackupDate).AppendLine(); + Metadata.BackupDate = DateHandlers.UnixToDateTime(newHdr.c_ddate); + sb.AppendFormat(Localization.Previous_dump_created_on_0, Metadata.BackupDate).AppendLine(); } sb.AppendFormat(Localization.Dump_volume_number_0, newHdr.c_volume).AppendLine(); @@ -236,7 +231,7 @@ public sealed partial class dump if(!string.IsNullOrEmpty(dumpname)) { - XmlFsType.VolumeName = dumpname; + Metadata.VolumeName = dumpname; sb.AppendFormat(Localization.Dump_label_0, dumpname).AppendLine(); } diff --git a/Aaru.Filesystems/dump/dump.cs b/Aaru.Filesystems/dump/dump.cs index 4092a78c4..62c60afb4 100644 --- a/Aaru.Filesystems/dump/dump.cs +++ b/Aaru.Filesystems/dump/dump.cs @@ -33,8 +33,8 @@ using System; using System.Diagnostics.CodeAnalysis; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; using ufs_daddr_t = System.Int32; namespace Aaru.Filesystems; @@ -51,7 +51,7 @@ public sealed partial class dump : IFilesystem /// public Guid Id => new("E53B4D28-C858-4800-B092-DDAE80D361B9"); /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public string Author => Authors.NataliaPortillo; } \ No newline at end of file diff --git a/Aaru.Filesystems/exFAT/Info.cs b/Aaru.Filesystems/exFAT/Info.cs index cf64b42c8..8ae47d88f 100644 --- a/Aaru.Filesystems/exFAT/Info.cs +++ b/Aaru.Filesystems/exFAT/Info.cs @@ -30,11 +30,11 @@ using System; using System.Diagnostics.CodeAnalysis; using System.Linq; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -72,7 +72,7 @@ public sealed partial class exFAT information = ""; var sb = new StringBuilder(); - XmlFsType = new FileSystemType(); + Metadata = new FileSystem(); ErrorNumber errno = imagePlugin.ReadSector(0 + partition.Start, out byte[] vbrSector); @@ -160,11 +160,11 @@ public sealed partial class exFAT sb.AppendFormat(Localization.Checksum_0_X8, chksector.checksum[0]).AppendLine(); - XmlFsType.ClusterSize = (uint)((1 << vbr.sectorShift) * (1 << vbr.clusterShift)); - XmlFsType.Clusters = vbr.clusterHeapLength; - XmlFsType.Dirty = vbr.flags.HasFlag(VolumeFlags.VolumeDirty); - XmlFsType.Type = FS_TYPE; - XmlFsType.VolumeSerial = $"{vbr.volumeSerial:X8}"; + Metadata.ClusterSize = (uint)((1 << vbr.sectorShift) * (1 << vbr.clusterShift)); + Metadata.Clusters = vbr.clusterHeapLength; + Metadata.Dirty = vbr.flags.HasFlag(VolumeFlags.VolumeDirty); + Metadata.Type = FS_TYPE; + Metadata.VolumeSerial = $"{vbr.volumeSerial:X8}"; information = sb.ToString(); } diff --git a/Aaru.Filesystems/exFAT/exFAT.cs b/Aaru.Filesystems/exFAT/exFAT.cs index 1aafebe3e..a1aec7ec1 100644 --- a/Aaru.Filesystems/exFAT/exFAT.cs +++ b/Aaru.Filesystems/exFAT/exFAT.cs @@ -29,8 +29,8 @@ using System; using System.Diagnostics.CodeAnalysis; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -43,7 +43,7 @@ namespace Aaru.Filesystems; public sealed partial class exFAT : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/ext2FS/Info.cs b/Aaru.Filesystems/ext2FS/Info.cs index 20bb1d99f..1f9425bf9 100644 --- a/Aaru.Filesystems/ext2FS/Info.cs +++ b/Aaru.Filesystems/ext2FS/Info.cs @@ -33,11 +33,11 @@ using System; using System.Diagnostics.CodeAnalysis; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.Helpers; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -113,13 +113,13 @@ public sealed partial class ext2FS Array.Copy(sbSector, sbOff, sblock, 0, sbSizeInBytes); SuperBlock supblk = Marshal.ByteArrayToStructureLittleEndian(sblock); - XmlFsType = new FileSystemType(); + Metadata = new FileSystem(); switch(supblk.magic) { case EXT2_MAGIC_OLD: sb.AppendLine(Localization.ext2_old_filesystem); - XmlFsType.Type = FS_TYPE_EXT2; + Metadata.Type = FS_TYPE_EXT2; break; case EXT2_MAGIC: @@ -146,19 +146,19 @@ public sealed partial class ext2FS if(newExt2) { sb.AppendLine(Localization.ext2_filesystem); - XmlFsType.Type = FS_TYPE_EXT2; + Metadata.Type = FS_TYPE_EXT2; } if(ext3) { sb.AppendLine(Localization.ext3_filesystem); - XmlFsType.Type = FS_TYPE_EXT3; + Metadata.Type = FS_TYPE_EXT3; } if(ext4) { sb.AppendLine(Localization.ext4_filesystem); - XmlFsType.Type = FS_TYPE_EXT4; + Metadata.Type = FS_TYPE_EXT4; } break; @@ -178,15 +178,14 @@ public sealed partial class ext2FS _ => string.Format(Localization.Unknown_OS_0, supblk.creator_os) }; - XmlFsType.SystemIdentifier = extOs; + Metadata.SystemIdentifier = extOs; if(supblk.mkfs_t > 0) { sb.AppendFormat(Localization.Volume_was_created_on_0_for_1, DateHandlers.UnixUnsignedToDateTime(supblk.mkfs_t), extOs).AppendLine(); - XmlFsType.CreationDate = DateHandlers.UnixUnsignedToDateTime(supblk.mkfs_t); - XmlFsType.CreationDateSpecified = true; + Metadata.CreationDate = DateHandlers.UnixUnsignedToDateTime(supblk.mkfs_t); } else sb.AppendFormat(Localization.Volume_was_created_for_0, extOs).AppendLine(); @@ -245,8 +244,8 @@ public sealed partial class ext2FS sb.AppendFormat(Localization.Volume_has_0_blocks_of_1_bytes_for_a_total_of_2_bytes, blocks, 1024 << (int)supblk.block_size, blocks * (ulong)(1024 << (int)supblk.block_size)).AppendLine(); - XmlFsType.Clusters = blocks; - XmlFsType.ClusterSize = (uint)(1024 << (int)supblk.block_size); + Metadata.Clusters = blocks; + Metadata.ClusterSize = (uint)(1024 << (int)supblk.block_size); if(supblk.mount_t > 0 || supblk.mount_c > 0) @@ -303,19 +302,18 @@ public sealed partial class ext2FS sb.AppendFormat(Localization.Last_written_on_0, DateHandlers.UnixUnsignedToDateTime(supblk.write_t)). AppendLine(); - XmlFsType.ModificationDate = DateHandlers.UnixUnsignedToDateTime(supblk.write_t); - XmlFsType.ModificationDateSpecified = true; + Metadata.ModificationDate = DateHandlers.UnixUnsignedToDateTime(supblk.write_t); } else sb.AppendLine("Volume has never been written"); - XmlFsType.Dirty = true; + Metadata.Dirty = true; switch(supblk.state) { case EXT2_VALID_FS: sb.AppendLine(Localization.Volume_is_clean); - XmlFsType.Dirty = false; + Metadata.Dirty = false; break; case EXT2_ERROR_FS: @@ -337,7 +335,7 @@ public sealed partial class ext2FS sb.AppendFormat(Localization.Volume_name_0, StringHandlers.CToString(supblk.volume_name, Encoding)). AppendLine(); - XmlFsType.VolumeName = StringHandlers.CToString(supblk.volume_name, Encoding); + Metadata.VolumeName = StringHandlers.CToString(supblk.volume_name, Encoding); } switch(supblk.err_behaviour) @@ -367,15 +365,14 @@ public sealed partial class ext2FS if(supblk.uuid != Guid.Empty) { sb.AppendFormat(Localization.Volume_UUID_0, supblk.uuid).AppendLine(); - XmlFsType.VolumeSerial = supblk.uuid.ToString(); + Metadata.VolumeSerial = supblk.uuid.ToString(); } if(supblk.kbytes_written > 0) sb.AppendFormat(Localization._0_KiB_has_been_written_on_volume, supblk.kbytes_written).AppendLine(); sb.AppendFormat(Localization._0_reserved_and_1_free_blocks, reserved, free).AppendLine(); - XmlFsType.FreeClusters = free; - XmlFsType.FreeClustersSpecified = true; + Metadata.FreeClusters = free; sb.AppendFormat(Localization._0_inodes_with_1_free_inodes_2, supblk.inodes, supblk.free_inodes, supblk.free_inodes * 100 / supblk.inodes).AppendLine(); diff --git a/Aaru.Filesystems/ext2FS/ext2FS.cs b/Aaru.Filesystems/ext2FS/ext2FS.cs index dd9841019..c3c868229 100644 --- a/Aaru.Filesystems/ext2FS/ext2FS.cs +++ b/Aaru.Filesystems/ext2FS/ext2FS.cs @@ -33,8 +33,8 @@ using System; using System.Diagnostics.CodeAnalysis; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -47,7 +47,7 @@ namespace Aaru.Filesystems; public sealed partial class ext2FS : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public Encoding Encoding { get; private set; } /// diff --git a/Aaru.Filesystems/extFS/Info.cs b/Aaru.Filesystems/extFS/Info.cs index 6b603a122..51e48f28e 100644 --- a/Aaru.Filesystems/extFS/Info.cs +++ b/Aaru.Filesystems/extFS/Info.cs @@ -28,10 +28,10 @@ using System; using System.Text; -using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; -using Schemas; +using Partition = Aaru.CommonTypes.Partition; namespace Aaru.Filesystems; @@ -122,13 +122,12 @@ public sealed partial class extFS sb.AppendFormat(Localization.Log_zone_size_0, extSb.logzonesize); sb.AppendFormat(Localization.Max_zone_size_0, extSb.maxsize); - XmlFsType = new FileSystemType + Metadata = new FileSystem { - Type = FS_TYPE, - FreeClusters = extSb.freecountblk, - FreeClustersSpecified = true, - ClusterSize = 1024, - Clusters = (partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize / 1024 + Type = FS_TYPE, + FreeClusters = extSb.freecountblk, + ClusterSize = 1024, + Clusters = (partition.End - partition.Start + 1) * imagePlugin.Info.SectorSize / 1024 }; information = sb.ToString(); diff --git a/Aaru.Filesystems/extFS/extFS.cs b/Aaru.Filesystems/extFS/extFS.cs index 76a2213e7..7a8b0bc03 100644 --- a/Aaru.Filesystems/extFS/extFS.cs +++ b/Aaru.Filesystems/extFS/extFS.cs @@ -28,8 +28,8 @@ using System; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; -using Schemas; namespace Aaru.Filesystems; @@ -41,7 +41,7 @@ namespace Aaru.Filesystems; public sealed partial class extFS : IFilesystem { /// - public FileSystemType XmlFsType { get; private set; } + public FileSystem Metadata { get; private set; } /// public string Name => Localization.extFS_Name; /// diff --git a/Aaru.Gui/ViewModels/Panels/FileSystemViewModel.cs b/Aaru.Gui/ViewModels/Panels/FileSystemViewModel.cs index e2080e9d4..756cf0ccd 100644 --- a/Aaru.Gui/ViewModels/Panels/FileSystemViewModel.cs +++ b/Aaru.Gui/ViewModels/Panels/FileSystemViewModel.cs @@ -30,59 +30,57 @@ // Copyright © 2011-2023 Natalia Portillo // ****************************************************************************/ +using Aaru.CommonTypes.AaruMetadata; using Aaru.Localization; using JetBrains.Annotations; -using Schemas; namespace Aaru.Gui.ViewModels.Panels; public sealed class FileSystemViewModel { - public FileSystemViewModel([NotNull] FileSystemType xmlFsType, string information) + public FileSystemViewModel([NotNull] FileSystem metadata, string information) { - TypeText = string.Format(Localization.Core.Filesystem_type_0, xmlFsType.Type); - VolumeNameText = string.Format(Localization.Core.Volume_name_0, xmlFsType.VolumeName); - SerialNumberText = string.Format(Localization.Core.Volume_serial_0, xmlFsType.VolumeSerial); + TypeText = string.Format(Localization.Core.Filesystem_type_0, metadata.Type); + VolumeNameText = string.Format(Localization.Core.Volume_name_0, metadata.VolumeName); + SerialNumberText = string.Format(Localization.Core.Volume_serial_0, metadata.VolumeSerial); ApplicationIdentifierText = - string.Format(Localization.Core.Application_identifier_0, xmlFsType.ApplicationIdentifier); + string.Format(Localization.Core.Application_identifier_0, metadata.ApplicationIdentifier); - SystemIdentifierText = string.Format(Localization.Core.System_identifier_0, xmlFsType.SystemIdentifier); + SystemIdentifierText = string.Format(Localization.Core.System_identifier_0, metadata.SystemIdentifier); VolumeSetIdentifierText = - string.Format(Localization.Core.Volume_set_identifier_0, xmlFsType.VolumeSetIdentifier); + string.Format(Localization.Core.Volume_set_identifier_0, metadata.VolumeSetIdentifier); DataPreparerIdentifierText = - string.Format(Localization.Core.Data_preparer_identifier_0, xmlFsType.DataPreparerIdentifier); + string.Format(Localization.Core.Data_preparer_identifier_0, metadata.DataPreparerIdentifier); - PublisherIdentifierText = - string.Format(Localization.Core.Publisher_identifier_0, xmlFsType.PublisherIdentifier); + PublisherIdentifierText = string.Format(Localization.Core.Publisher_identifier_0, metadata.PublisherIdentifier); - CreationDateText = string.Format(Localization.Core.Volume_created_on_0, xmlFsType.CreationDate); - EffectiveDateText = string.Format(Localization.Core.Volume_effective_from_0, xmlFsType.EffectiveDate); - ModificationDateText = string.Format(Localization.Core.Volume_last_modified_on_0, xmlFsType.ModificationDate); - ExpirationDateText = string.Format(Localization.Core.Volume_expired_on_0, xmlFsType.ExpirationDate); - BackupDateText = string.Format(Localization.Core.Volume_last_backed_up_on_0, xmlFsType.BackupDate); + CreationDateText = string.Format(Localization.Core.Volume_created_on_0, metadata.CreationDate); + EffectiveDateText = string.Format(Localization.Core.Volume_effective_from_0, metadata.EffectiveDate); + ModificationDateText = string.Format(Localization.Core.Volume_last_modified_on_0, metadata.ModificationDate); + ExpirationDateText = string.Format(Localization.Core.Volume_expired_on_0, metadata.ExpirationDate); + BackupDateText = string.Format(Localization.Core.Volume_last_backed_up_on_0, metadata.BackupDate); ClustersText = string.Format(Localization.Core.Volume_has_0_clusters_of_1_bytes_each_total_of_2_bytes, - xmlFsType.Clusters, xmlFsType.ClusterSize, - xmlFsType.Clusters * xmlFsType.ClusterSize); + metadata.Clusters, metadata.ClusterSize, metadata.Clusters * metadata.ClusterSize); - FreeClustersText = string.Format(Localization.Core.Volume_has_0_clusters_free_1, xmlFsType.FreeClusters, - xmlFsType.FreeClusters / xmlFsType.Clusters); + FreeClustersText = string.Format(Localization.Core.Volume_has_0_clusters_free_1, metadata.FreeClusters, + metadata.FreeClusters / metadata.Clusters); - FilesText = string.Format(Localization.Core.Volume_contains_0_files, xmlFsType.Files); - BootableChecked = xmlFsType.Bootable; - DirtyChecked = xmlFsType.Dirty; + FilesText = string.Format(Localization.Core.Volume_contains_0_files, metadata.Files); + BootableChecked = metadata.Bootable; + DirtyChecked = metadata.Dirty; InformationText = information; - CreationDateVisible = xmlFsType.CreationDateSpecified; - EffectiveDateVisible = xmlFsType.EffectiveDateSpecified; - ModificationDateVisible = xmlFsType.ModificationDateSpecified; - ExpirationDateVisible = xmlFsType.ExpirationDateSpecified; - BackupDateVisible = xmlFsType.BackupDateSpecified; - FreeClustersVisible = xmlFsType.FreeClustersSpecified; - FilesVisible = xmlFsType.FilesSpecified; + CreationDateVisible = metadata.CreationDate != null; + EffectiveDateVisible = metadata.EffectiveDate != null; + ModificationDateVisible = metadata.ModificationDate != null; + ExpirationDateVisible = metadata.ExpirationDate != null; + BackupDateVisible = metadata.BackupDate != null; + FreeClustersVisible = metadata.FreeClusters != null; + FilesVisible = metadata.Files != null; } public string BootableLabel => Localization.Core.Filesystem_contains_boot_code; diff --git a/Aaru.Gui/ViewModels/Panels/ImageInfoViewModel.cs b/Aaru.Gui/ViewModels/Panels/ImageInfoViewModel.cs index 984c8d207..7600c1a72 100644 --- a/Aaru.Gui/ViewModels/Panels/ImageInfoViewModel.cs +++ b/Aaru.Gui/ViewModels/Panels/ImageInfoViewModel.cs @@ -35,9 +35,9 @@ using System.Collections.ObjectModel; using System.Linq; using System.Reactive; using System.Text; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; -using Aaru.CommonTypes.Structs; using Aaru.CommonTypes.Structs.Devices.SCSI; using Aaru.Decoders.CD; using Aaru.Decoders.DVD; @@ -55,9 +55,9 @@ using Avalonia.Controls; using Avalonia.Media.Imaging; using Avalonia.Platform; using ReactiveUI; -using Schemas; using Inquiry = Aaru.CommonTypes.Structs.Devices.SCSI.Inquiry; using Session = Aaru.CommonTypes.Structs.Session; +using Track = Aaru.CommonTypes.Structs.Track; namespace Aaru.Gui.ViewModels.Panels; @@ -107,9 +107,9 @@ public sealed class ImageInfoViewModel : ViewModelBase MediaLogo = assets.Exists(mediaResource) ? new Bitmap(assets.Open(mediaResource)) - : imageFormat.Info.XmlMediaType == XmlMediaType.BlockMedia + : imageFormat.Info.MetadataMediaType == MetadataMediaType.BlockMedia ? genericHddIcon - : imageFormat.Info.XmlMediaType == XmlMediaType.OpticalDisc + : imageFormat.Info.MetadataMediaType == MetadataMediaType.OpticalDisc ? genericOpticalIcon : genericFolderIcon; @@ -130,7 +130,7 @@ public sealed class ImageInfoViewModel : ViewModelBase imageFormat.Info.Sectors * imageFormat.Info.SectorSize); MediaTypeText = string.Format(Localization.Core.Contains_a_media_of_type_0_and_XML_type_1, - imageFormat.Info.MediaType, imageFormat.Info.XmlMediaType); + imageFormat.Info.MediaType, imageFormat.Info.MetadataMediaType); HasPartitionsText = imageFormat.Info.HasPartitions ? UI.Has_partitions : UI.Doesnt_have_partitions; HasSessionsText = imageFormat.Info.HasSessions ? UI.Has_sessions : UI.Doesnt_have_sessions; @@ -189,9 +189,9 @@ public sealed class ImageInfoViewModel : ViewModelBase if(!string.IsNullOrWhiteSpace(imageFormat.Info.DriveFirmwareRevision)) DriveFirmwareRevisionText = string.Format(UI.Drive_firmware_info_0, imageFormat.Info.DriveFirmwareRevision); - if(imageFormat.Info.Cylinders > 0 && - imageFormat.Info is { Heads: > 0, SectorsPerTrack: > 0 } && - imageFormat.Info.XmlMediaType != XmlMediaType.OpticalDisc && + if(imageFormat.Info.Cylinders > 0 && + imageFormat.Info is { Heads: > 0, SectorsPerTrack: > 0 } && + imageFormat.Info.MetadataMediaType != MetadataMediaType.OpticalDisc && imageFormat is not ITapeImage { IsTape: true }) MediaGeometryText = string.Format(UI.Media_geometry_0_cylinders_1_heads_2_sectors_per_track, imageFormat.Info.Cylinders, imageFormat.Info.Heads, @@ -655,9 +655,9 @@ public sealed class ImageInfoViewModel : ViewModelBase if(imageFormat.DumpHardware is null) return; - foreach(DumpHardwareType dump in imageFormat.DumpHardware) + foreach(DumpHardware dump in imageFormat.DumpHardware) { - foreach(ExtentType extent in dump.Extents) + foreach(Extent extent in dump.Extents) DumpHardwareList.Add(new DumpHardwareModel { Manufacturer = dump.Manufacturer, @@ -770,7 +770,7 @@ public sealed class ImageInfoViewModel : ViewModelBase public string VerifyLabel => UI.ButtonLabel_Verify; public string ChecksumLabel => UI.ButtonLabel_Checksum; public string ConvertLabel => UI.ButtonLabel_Convert_to; - public string CreateSidecarLabel => UI.ButtonLabel_Create_CICM_XML_sidecar; + public string CreateSidecarLabel => UI.ButtonLabel_Create_Aaru_Metadata_sidecar; public string ViewSectorsLabel => UI.ButtonLabel_View_sectors; public string DecodeMediaTagLabel => UI.ButtonLabel_Decode_media_tags; diff --git a/Aaru.Gui/ViewModels/Windows/ImageChecksumViewModel.cs b/Aaru.Gui/ViewModels/Windows/ImageChecksumViewModel.cs index 7c9bdfed8..fdcaf5ddc 100644 --- a/Aaru.Gui/ViewModels/Windows/ImageChecksumViewModel.cs +++ b/Aaru.Gui/ViewModels/Windows/ImageChecksumViewModel.cs @@ -45,7 +45,6 @@ using Aaru.Localization; using Avalonia.Controls; using Avalonia.Threading; using ReactiveUI; -using Schemas; namespace Aaru.Gui.ViewModels.Windows; @@ -611,11 +610,11 @@ public sealed class ImageChecksumViewModel : ViewModelBase if(trackChecksum == null) return; - foreach(ChecksumType chk in trackChecksum.End()) + foreach(CommonTypes.AaruMetadata.Checksum chk in trackChecksum.End()) TrackChecksums.Add(new ChecksumModel { Track = currentTrack.Sequence.ToString(), - Algorithm = chk.type.ToString(), + Algorithm = chk.Type.ToString(), Hash = chk.Value }); }); @@ -654,10 +653,10 @@ public sealed class ImageChecksumViewModel : ViewModelBase if(mediaChecksum == null) return; - foreach(ChecksumType chk in mediaChecksum.End()) + foreach(CommonTypes.AaruMetadata.Checksum chk in mediaChecksum.End()) MediaChecksums.Add(new ChecksumModel { - Algorithm = chk.type.ToString(), + Algorithm = chk.Type.ToString(), Hash = chk.Value }); }); @@ -754,10 +753,10 @@ public sealed class ImageChecksumViewModel : ViewModelBase await Dispatcher.UIThread.InvokeAsync(() => { - foreach(ChecksumType chk in mediaChecksum.End()) + foreach(CommonTypes.AaruMetadata.Checksum chk in mediaChecksum.End()) MediaChecksums.Add(new ChecksumModel { - Algorithm = chk.type.ToString(), + Algorithm = chk.Type.ToString(), Hash = chk.Value }); }); diff --git a/Aaru.Gui/ViewModels/Windows/ImageConvertViewModel.cs b/Aaru.Gui/ViewModels/Windows/ImageConvertViewModel.cs index 0017792c6..6475ff7d9 100644 --- a/Aaru.Gui/ViewModels/Windows/ImageConvertViewModel.cs +++ b/Aaru.Gui/ViewModels/Windows/ImageConvertViewModel.cs @@ -42,10 +42,10 @@ using System.Threading; using System.Threading.Tasks; using System.Xml.Serialization; using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Metadata; -using Aaru.CommonTypes.Structs; using Aaru.Console; using Aaru.Core; using Aaru.Core.Media; @@ -59,6 +59,7 @@ using MessageBox.Avalonia.Enums; using ReactiveUI; using Schemas; using ImageInfo = Aaru.CommonTypes.Structs.ImageInfo; +using Track = Aaru.CommonTypes.Structs.Track; using Version = Aaru.CommonTypes.Interop.Version; namespace Aaru.Gui.ViewModels.Windows; @@ -66,68 +67,68 @@ namespace Aaru.Gui.ViewModels.Windows; [SuppressMessage("ReSharper", "AsyncVoidLambda")] public sealed class ImageConvertViewModel : ViewModelBase { - readonly IMediaImage _inputFormat; - readonly Window _view; - bool _cancel; - CICMMetadataType _cicmMetadata; - bool _cicmXmlFromImageVisible; - string _cicmXmlText; - bool _closeVisible; - string _commentsText; - bool _commentsVisible; - string _creatorText; - bool _creatorVisible; - bool _destinationEnabled; - string _destinationText; - bool _destinationVisible; - string _driveFirmwareRevisionText; - bool _driveFirmwareRevisionVisible; - string _driveManufacturerText; - bool _driveManufacturerVisible; - string _driveModelText; - bool _driveModelVisible; - string _driveSerialNumberText; - bool _driveSerialNumberVisible; - List _dumpHardware; - bool _forceChecked; - bool _formatReadOnly; - double _lastMediaSequenceValue; - bool _lastMediaSequenceVisible; - string _mediaBarcodeText; - bool _mediaBarcodeVisible; - string _mediaManufacturerText; - bool _mediaManufacturerVisible; - string _mediaModelText; - bool _mediaModelVisible; - string _mediaPartNumberText; - bool _mediaPartNumberVisible; - double _mediaSequenceValue; - bool _mediaSequenceVisible; - string _mediaSerialNumberText; - bool _mediaSerialNumberVisible; - string _mediaTitleText; - bool _mediaTitleVisible; - bool _optionsVisible; - bool _progress1Visible; - bool _progress2Indeterminate; - double _progress2MaxValue; - string _progress2Text; - double _progress2Value; - bool _progress2Visible; - bool _progressIndeterminate; - double _progressMaxValue; - string _progressText; - double _progressValue; - bool _progressVisible; - bool _resumeFileFromImageVisible; - string _resumeFileText; - double _sectorsValue; - ImagePluginModel _selectedPlugin; - string _sourceText; - bool _startVisible; - bool _stopEnabled; - bool _stopVisible; - string _title; + readonly IMediaImage _inputFormat; + readonly Window _view; + bool _cancel; + Metadata _aaruMetadata; + bool _aaruMetadataFromImageVisible; + string _metadataJsonText; + bool _closeVisible; + string _commentsText; + bool _commentsVisible; + string _creatorText; + bool _creatorVisible; + bool _destinationEnabled; + string _destinationText; + bool _destinationVisible; + string _driveFirmwareRevisionText; + bool _driveFirmwareRevisionVisible; + string _driveManufacturerText; + bool _driveManufacturerVisible; + string _driveModelText; + bool _driveModelVisible; + string _driveSerialNumberText; + bool _driveSerialNumberVisible; + List _dumpHardware; + bool _forceChecked; + bool _formatReadOnly; + double _lastMediaSequenceValue; + bool _lastMediaSequenceVisible; + string _mediaBarcodeText; + bool _mediaBarcodeVisible; + string _mediaManufacturerText; + bool _mediaManufacturerVisible; + string _mediaModelText; + bool _mediaModelVisible; + string _mediaPartNumberText; + bool _mediaPartNumberVisible; + double _mediaSequenceValue; + bool _mediaSequenceVisible; + string _mediaSerialNumberText; + bool _mediaSerialNumberVisible; + string _mediaTitleText; + bool _mediaTitleVisible; + bool _optionsVisible; + bool _progress1Visible; + bool _progress2Indeterminate; + double _progress2MaxValue; + string _progress2Text; + double _progress2Value; + bool _progress2Visible; + bool _progressIndeterminate; + double _progressMaxValue; + string _progressText; + double _progressValue; + bool _progressVisible; + bool _resumeFileFromImageVisible; + string _resumeFileText; + double _sectorsValue; + ImagePluginModel _selectedPlugin; + string _sourceText; + bool _startVisible; + bool _stopEnabled; + bool _stopVisible; + string _title; public string SourceImageLabel => UI.Source_image; public string OutputFormatLabel => UI.Output_format; @@ -177,7 +178,7 @@ public sealed class ImageConvertViewModel : ViewModelBase DriveSerialNumberCommand = ReactiveCommand.Create(ExecuteDriveSerialNumberCommand); DriveFirmwareRevisionCommand = ReactiveCommand.Create(ExecuteDriveFirmwareRevisionCommand); CommentsCommand = ReactiveCommand.Create(ExecuteCommentsCommand); - CicmXmlFromImageCommand = ReactiveCommand.Create(ExecuteCicmXmlFromImageCommand); + AaruMetadataFromImageCommand = ReactiveCommand.Create(ExecuteAaruMetadataFromImageCommand); CicmXmlCommand = ReactiveCommand.Create(ExecuteCicmXmlCommand); ResumeFileFromImageCommand = ReactiveCommand.Create(ExecuteResumeFileFromImageCommand); ResumeFileCommand = ReactiveCommand.Create(ExecuteResumeFileCommand); @@ -211,14 +212,14 @@ public sealed class ImageConvertViewModel : ViewModelBase Plugin = plugin }); - CicmXmlFromImageVisible = inputFormat.CicmMetadata != null; - ResumeFileFromImageVisible = inputFormat.DumpHardware?.Any() == true; - _cicmMetadata = inputFormat.CicmMetadata; + AaruMetadataFromImageVisible = inputFormat.AaruMetadata != null; + ResumeFileFromImageVisible = inputFormat.DumpHardware?.Any() == true; + _aaruMetadata = inputFormat.AaruMetadata; _dumpHardware = inputFormat.DumpHardware?.Any() == true ? inputFormat.DumpHardware : null; - CicmXmlText = _cicmMetadata == null ? "" : UI._From_image_; - ResumeFileText = _dumpHardware == null ? "" : UI._From_image_; + MetadataJsonText = _aaruMetadata == null ? "" : UI._From_image_; + ResumeFileText = _dumpHardware == null ? "" : UI._From_image_; } public string Title @@ -349,10 +350,10 @@ public sealed class ImageConvertViewModel : ViewModelBase set => this.RaiseAndSetIfChanged(ref _commentsText, value); } - public string CicmXmlText + public string MetadataJsonText { - get => _cicmXmlText; - set => this.RaiseAndSetIfChanged(ref _cicmXmlText, value); + get => _metadataJsonText; + set => this.RaiseAndSetIfChanged(ref _metadataJsonText, value); } public string ResumeFileText @@ -535,10 +536,10 @@ public sealed class ImageConvertViewModel : ViewModelBase set => this.RaiseAndSetIfChanged(ref _driveFirmwareRevisionVisible, value); } - public bool CicmXmlFromImageVisible + public bool AaruMetadataFromImageVisible { - get => _cicmXmlFromImageVisible; - set => this.RaiseAndSetIfChanged(ref _cicmXmlFromImageVisible, value); + get => _aaruMetadataFromImageVisible; + set => this.RaiseAndSetIfChanged(ref _aaruMetadataFromImageVisible, value); } public bool ResumeFileFromImageVisible @@ -568,7 +569,7 @@ public sealed class ImageConvertViewModel : ViewModelBase public ReactiveCommand DriveSerialNumberCommand { get; } public ReactiveCommand DriveFirmwareRevisionCommand { get; } public ReactiveCommand CommentsCommand { get; } - public ReactiveCommand CicmXmlFromImageCommand { get; } + public ReactiveCommand AaruMetadataFromImageCommand { get; } public ReactiveCommand CicmXmlCommand { get; } public ReactiveCommand ResumeFileFromImageCommand { get; } public ReactiveCommand ResumeFileCommand { get; } @@ -703,7 +704,7 @@ public sealed class ImageConvertViewModel : ViewModelBase if(_dumpHardware != null) ProgressMaxValue++; - if(_cicmMetadata != null) + if(_aaruMetadata != null) ProgressMaxValue++; ProgressMaxValue++; @@ -836,7 +837,7 @@ public sealed class ImageConvertViewModel : ViewModelBase }; if(!_cancel) - if(!outputFormat.SetMetadata(metadata)) + if(!outputFormat.SetImageInfo(metadata)) { if(ForceChecked != true) { @@ -1729,19 +1730,19 @@ public sealed class ImageConvertViewModel : ViewModelBase ret = false; - if(_cicmMetadata != null && + if(_aaruMetadata != null && !_cancel) { await Dispatcher.UIThread.InvokeAsync(() => { - ProgressText = UI.Writing_CICM_XML_metadata_to_output_image; + ProgressText = UI.Writing_Aaru_Metadata_to_output_image; ProgressValue++; }); - outputFormat.SetCicmMetadata(_cicmMetadata); + outputFormat.SetMetadata(_aaruMetadata); if(!ret) - AaruConsole.WriteLine(UI.Error_0_writing_CICM_XML_metadata_to_output_image, outputFormat.ErrorMessage); + AaruConsole.WriteLine(UI.Error_0_writing_Aaru_Metadata_to_output_image, outputFormat.ErrorMessage); } await Dispatcher.UIThread.InvokeAsync(() => @@ -1998,16 +1999,16 @@ public sealed class ImageConvertViewModel : ViewModelBase void ExecuteDriveFirmwareRevisionCommand() => DriveFirmwareRevisionText = _inputFormat.Info.DriveFirmwareRevision; - void ExecuteCicmXmlFromImageCommand() + void ExecuteAaruMetadataFromImageCommand() { - CicmXmlText = UI._From_image_; - _cicmMetadata = _inputFormat.CicmMetadata; + MetadataJsonText = UI._From_image_; + _aaruMetadata = _inputFormat.AaruMetadata; } async Task ExecuteCicmXmlCommand() { - _cicmMetadata = null; - CicmXmlText = ""; + _aaruMetadata = null; + MetadataJsonText = ""; var dlgMetadata = new OpenFileDialog { @@ -2016,7 +2017,7 @@ public sealed class ImageConvertViewModel : ViewModelBase dlgMetadata.Filters?.Add(new FileDialogFilter { - Name = UI.Dialog_CICM_XML_metadata, + Name = UI.Dialog_Aaru_Metadata, Extensions = new List(new[] { ".xml" @@ -2034,9 +2035,10 @@ public sealed class ImageConvertViewModel : ViewModelBase try { var sr = new StreamReader(result[0]); - _cicmMetadata = (CICMMetadataType)sidecarXs.Deserialize(sr); + + // _aaruMetadata = (CICMMetadataType)sidecarXs.Deserialize(sr); sr.Close(); - CicmXmlText = result[0]; + MetadataJsonText = result[0]; } catch { @@ -2063,7 +2065,7 @@ public sealed class ImageConvertViewModel : ViewModelBase dlgMetadata.Filters?.Add(new FileDialogFilter { - Name = UI.Dialog_CICM_XML_metadata, + Name = UI.Dialog_Aaru_Metadata, Extensions = new List(new[] { ".xml" diff --git a/Aaru.Gui/ViewModels/Windows/ImageSidecarViewModel.cs b/Aaru.Gui/ViewModels/Windows/ImageSidecarViewModel.cs index c8a7f39c9..7f1987519 100644 --- a/Aaru.Gui/ViewModels/Windows/ImageSidecarViewModel.cs +++ b/Aaru.Gui/ViewModels/Windows/ImageSidecarViewModel.cs @@ -36,9 +36,11 @@ using System.Diagnostics.CodeAnalysis; using System.IO; using System.Reactive; using System.Text; +using System.Text.Json; +using System.Text.Json.Serialization; using System.Threading; using System.Threading.Tasks; -using System.Xml.Serialization; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Interfaces; using Aaru.Console; using Aaru.Core; @@ -46,7 +48,6 @@ using Aaru.Localization; using Avalonia.Controls; using Avalonia.Threading; using ReactiveUI; -using Schemas; namespace Aaru.Gui.ViewModels.Windows; @@ -88,7 +89,7 @@ public sealed class ImageSidecarViewModel : ViewModelBase _encoding = encoding; DestinationText = Path.Combine(Path.GetDirectoryName(imageSource) ?? "", - Path.GetFileNameWithoutExtension(imageSource) + ".cicm.xml"); + Path.GetFileNameWithoutExtension(imageSource) + ".metadata.json"); DestinationEnabled = true; StartVisible = true; @@ -250,15 +251,19 @@ public sealed class ImageSidecarViewModel : ViewModelBase _sidecarClass.InitProgressEvent2 += InitProgress2; _sidecarClass.UpdateProgressEvent2 += UpdateProgress2; _sidecarClass.EndProgressEvent2 += EndProgress2; - CICMMetadataType sidecar = _sidecarClass.Create(); + Metadata sidecar = _sidecarClass.Create(); AaruConsole.WriteLine(Localization.Core.Writing_metadata_sidecar); - var xmlFs = new FileStream(DestinationText, FileMode.Create); + var jsonFs = new FileStream(DestinationText, FileMode.Create); - var xmlSer = new XmlSerializer(typeof(CICMMetadataType)); - xmlSer.Serialize(xmlFs, sidecar); - xmlFs.Close(); + await JsonSerializer.SerializeAsync(jsonFs, sidecar, new JsonSerializerOptions + { + DefaultIgnoreCondition = JsonIgnoreCondition.WhenWritingNull, + WriteIndented = true + }); + + jsonFs.Close(); await Dispatcher.UIThread.InvokeAsync(() => { @@ -339,10 +344,10 @@ public sealed class ImageSidecarViewModel : ViewModelBase dlgDestination.Filters?.Add(new FileDialogFilter { - Name = UI.Dialog_CICM_XML_metadata, + Name = UI.Dialog_Aaru_Metadata, Extensions = new List(new[] { - "*.xml" + "*.json" }) }); @@ -356,7 +361,7 @@ public sealed class ImageSidecarViewModel : ViewModelBase } if(string.IsNullOrEmpty(Path.GetExtension(result))) - result += ".xml"; + result += ".json"; DestinationText = result; } diff --git a/Aaru.Gui/ViewModels/Windows/MainWindowViewModel.cs b/Aaru.Gui/ViewModels/Windows/MainWindowViewModel.cs index c5935856a..4f7b6da2c 100644 --- a/Aaru.Gui/ViewModels/Windows/MainWindowViewModel.cs +++ b/Aaru.Gui/ViewModels/Windows/MainWindowViewModel.cs @@ -181,7 +181,7 @@ public sealed class MainWindowViewModel : ViewModelBase public string CalculateEntropyLabel => UI.ButtonLabel_Calculate_entropy; public string VerifyImageLabel => UI.ButtonLabel_Verify; public string ChecksumImageLabel => UI.ButtonLabel_Checksum; - public string CreateSidecarLabel => UI.ButtonLabel_Create_CICM_XML_sidecar; + public string CreateSidecarLabel => UI.ButtonLabel_Create_Aaru_Metadata_sidecar; public string ViewImageSectorsLabel => UI.ButtonLabel_View_sectors; public string DecodeImageMediaTagsLabel => UI.ButtonLabel_Decode_media_tags; @@ -577,9 +577,9 @@ public sealed class MainWindowViewModel : ViewModelBase Path = result[0], Icon = _assets.Exists(mediaResource) ? new Bitmap(_assets.Open(mediaResource)) - : imageFormat.Info.XmlMediaType == XmlMediaType.BlockMedia + : imageFormat.Info.MetadataMediaType == MetadataMediaType.BlockMedia ? _genericHddIcon - : imageFormat.Info.XmlMediaType == XmlMediaType.OpticalDisc + : imageFormat.Info.MetadataMediaType == MetadataMediaType.OpticalDisc ? _genericOpticalIcon : _genericFolderIcon, FileName = Path.GetFileName(result[0]), @@ -655,11 +655,11 @@ public sealed class MainWindowViewModel : ViewModelBase var filesystemModel = new FileSystemModel { VolumeName = - plugin.XmlFsType.VolumeName is null ? $"{plugin.XmlFsType.Type}" - : $"{plugin.XmlFsType.VolumeName} ({plugin.XmlFsType.Type})", + plugin.Metadata.VolumeName is null ? $"{plugin.Metadata.Type}" + : $"{plugin.Metadata.VolumeName} ({plugin.Metadata.Type})", Filesystem = plugin, ReadOnlyFilesystem = fsPlugin, - ViewModel = new FileSystemViewModel(plugin.XmlFsType, information) + ViewModel = new FileSystemViewModel(plugin.Metadata, information) }; // TODO: Trap expanding item @@ -675,7 +675,7 @@ public sealed class MainWindowViewModel : ViewModelBase Statistics.AddCommand("ls"); } - Statistics.AddFilesystem(plugin.XmlFsType.Type); + Statistics.AddFilesystem(plugin.Metadata.Type); partitionModel.FileSystems.Add(filesystemModel); } } @@ -722,11 +722,11 @@ public sealed class MainWindowViewModel : ViewModelBase var filesystemModel = new FileSystemModel { - VolumeName = plugin.XmlFsType.VolumeName is null ? $"{plugin.XmlFsType.Type}" - : $"{plugin.XmlFsType.VolumeName} ({plugin.XmlFsType.Type})", + VolumeName = plugin.Metadata.VolumeName is null ? $"{plugin.Metadata.Type}" + : $"{plugin.Metadata.VolumeName} ({plugin.Metadata.Type})", Filesystem = plugin, ReadOnlyFilesystem = fsPlugin, - ViewModel = new FileSystemViewModel(plugin.XmlFsType, information) + ViewModel = new FileSystemViewModel(plugin.Metadata, information) }; // TODO: Trap expanding item @@ -742,7 +742,7 @@ public sealed class MainWindowViewModel : ViewModelBase Statistics.AddCommand("ls"); } - Statistics.AddFilesystem(plugin.XmlFsType.Type); + Statistics.AddFilesystem(plugin.Metadata.Type); imageModel.PartitionSchemesOrFileSystems.Add(filesystemModel); } } diff --git a/Aaru.Gui/ViewModels/Windows/MediaDumpViewModel.cs b/Aaru.Gui/ViewModels/Windows/MediaDumpViewModel.cs index f1a805cbd..3055fda7c 100644 --- a/Aaru.Gui/ViewModels/Windows/MediaDumpViewModel.cs +++ b/Aaru.Gui/ViewModels/Windows/MediaDumpViewModel.cs @@ -44,6 +44,7 @@ using System.Threading; using System.Threading.Tasks; using System.Xml.Serialization; using Aaru.CommonTypes; +using Aaru.CommonTypes.AaruMetadata; using Aaru.CommonTypes.Enums; using Aaru.CommonTypes.Interfaces; using Aaru.CommonTypes.Metadata; @@ -63,6 +64,8 @@ using MessageBox.Avalonia.Enums; using ReactiveUI; using Schemas; using DeviceInfo = Aaru.Core.Devices.Info.DeviceInfo; +using Dump = Aaru.Core.Devices.Dumping.Dump; +using File = System.IO.File; using MediaType = Aaru.CommonTypes.MediaType; namespace Aaru.Gui.ViewModels.Windows; @@ -100,7 +103,7 @@ public sealed class MediaDumpViewModel : ViewModelBase double _retries; EncodingModel _selectedEncoding; ImagePluginModel _selectedPlugin; - CICMMetadataType _sidecar; + Metadata _sidecar; double _skipped; bool _startVisible; bool _stopEnabled; @@ -252,7 +255,7 @@ public sealed class MediaDumpViewModel : ViewModelBase public string ResumeLabel => UI.Create_use_resume_mapfile; public string Track1PregapLabel => UI.Try_to_read_track_1_pregap; public string SkippedLabel => UI.Skipped_sectors_on_error; - public string SidecarLabel => UI.Create_CICM_XML_metadata_sidecar; + public string SidecarLabel => UI.Create_Aaru_Metadata_sidecar; public string TrimLabel => UI.Trim_errors_from_skipped_sectors; public string ExistingMetadataLabel => UI.Take_metadata_from_existing_CICM_XML_sidecar; public string EncodingLabel => UI.Encoding_to_use_on_metadata_sidecar_creation; @@ -509,7 +512,7 @@ public sealed class MediaDumpViewModel : ViewModelBase dlgMetadata.Filters?.Add(new FileDialogFilter { - Name = UI.Dialog_CICM_XML_metadata, + Name = UI.Dialog_Aaru_Metadata, Extensions = new List(new[] { ".xml" @@ -530,7 +533,8 @@ public sealed class MediaDumpViewModel : ViewModelBase try { var sr = new StreamReader(result[0]); - _sidecar = (CICMMetadataType)sidecarXs.Deserialize(sr); + + // _sidecar = (CICMMetadataType)sidecarXs.Deserialize(sr); sr.Close(); } catch diff --git a/Aaru.Gui/Views/Windows/ImageConvert.xaml b/Aaru.Gui/Views/Windows/ImageConvert.xaml index 6fa03fd65..b3ba7fbd6 100644 --- a/Aaru.Gui/Views/Windows/ImageConvert.xaml +++ b/Aaru.Gui/Views/Windows/ImageConvert.xaml @@ -193,8 +193,9 @@ - -