Add converters from CICM Metadata to Aaru Metadata.

This commit is contained in:
2022-12-16 01:16:41 +00:00
parent 4cdf541a09
commit 647d3fac26
32 changed files with 1649 additions and 22 deletions

View File

@@ -36,14 +36,21 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
// ReSharper disable UnusedMember.Global
// ReSharper disable ClassNeverInstantiated.Global
using System;
using Schemas;
namespace Aaru.CommonTypes.AaruMetadata;
public class ATA
{
public Dump Identify { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator ATA(ATAType cicm) => cicm is null ? null : new ATA
{
Identify = cicm.Identify
};
}

View File

@@ -38,6 +38,7 @@
using System;
using System.Collections.Generic;
using Schemas;
// ReSharper disable UnusedMember.Global
// ReSharper disable ClassNeverInstantiated.Global
@@ -77,5 +78,136 @@ public class Metadata
public List<LinearMedia> LinearMedias { get; set; }
public List<Pci> PciCards { get; set; }
public List<BlockMedia> BlockMedias { get; set; }
public List<AudioMedia> AudioMedia { get; set; }
public List<AudioMedia> AudioMedias { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator Metadata(CICMMetadataType cicm)
{
if(cicm is null)
return null;
var metadata = new Metadata
{
Developers = cicm.Developer is null ? null : new List<string>(cicm.Developer),
Publishers = cicm.Publisher is null ? null : new List<string>(cicm.Publisher),
Authors = cicm.Author is null ? null : new List<string>(cicm.Author),
Performers = cicm.Performer is null ? null : new List<string>(cicm.Performer),
Name = cicm.Name,
Version = cicm.Version,
Release = cicm.ReleaseTypeSpecified ? (ReleaseType)cicm.ReleaseType : null,
ReleaseDate = cicm.ReleaseDateSpecified ? cicm.ReleaseDate : null,
PartNumber = cicm.PartNumber,
SerialNumber = cicm.SerialNumber,
Keywords = cicm.Keywords is null ? null : new List<string>(cicm.Keywords),
Categories = cicm.Categories is null ? null : new List<string>(cicm.Categories),
Subcategories = cicm.Subcategories is null ? null : new List<string>(cicm.Subcategories),
Systems = cicm.Systems is null ? null : new List<string>(cicm.Systems)
};
if(cicm.Barcodes is not null)
{
metadata.Barcodes = new List<Barcode>();
foreach(Schemas.BarcodeType code in cicm.Barcodes)
metadata.Barcodes.Add(code);
}
if(cicm.Magazine is not null)
{
metadata.Magazines = new List<Magazine>();
foreach(MagazineType magazine in cicm.Magazine)
metadata.Magazines.Add(magazine);
}
if(cicm.Book is not null)
{
metadata.Books = new List<Book>();
foreach(BookType book in cicm.Book)
metadata.Books.Add(book);
}
if(cicm.Languages is not null)
{
metadata.Languages = new List<Language>();
foreach(LanguagesTypeLanguage lng in cicm.Languages)
metadata.Languages.Add((Language)lng);
}
if(cicm.Architectures is not null)
{
metadata.Architectures = new List<Architecture>();
foreach(ArchitecturesTypeArchitecture arch in cicm.Architectures)
metadata.Architectures.Add((Architecture)arch);
}
if(cicm.RequiredOperatingSystems is not null)
{
metadata.RequiredOperatingSystems = new List<RequiredOperatingSystem>();
foreach(RequiredOperatingSystemType os in cicm.RequiredOperatingSystems)
metadata.RequiredOperatingSystems.Add(os);
}
if(cicm.UserManual is not null)
{
metadata.UserManuals = new List<UserManual>();
foreach(UserManualType manual in cicm.UserManual)
metadata.UserManuals.Add(manual);
}
if(cicm.OpticalDisc is not null)
{
metadata.OpticalDiscs = new List<OpticalDisc>();
foreach(OpticalDiscType disc in cicm.OpticalDisc)
metadata.OpticalDiscs.Add(disc);
}
if(cicm.Advertisement is not null)
{
metadata.Advertisements = new List<Advertisement>();
foreach(AdvertisementType adv in cicm.Advertisement)
metadata.Advertisements.Add(adv);
}
if(cicm.LinearMedia is not null)
{
metadata.LinearMedias = new List<LinearMedia>();
foreach(LinearMediaType media in cicm.LinearMedia)
metadata.LinearMedias.Add(media);
}
if(cicm.PCICard is not null)
{
metadata.PciCards = new List<Pci>();
foreach(PCIType pci in cicm.PCICard)
metadata.PciCards.Add(pci);
}
if(cicm.BlockMedia is not null)
{
metadata.BlockMedias = new List<BlockMedia>();
foreach(BlockMediaType media in cicm.BlockMedia)
metadata.BlockMedias.Add(media);
}
if(cicm.AudioMedia is not null)
{
metadata.AudioMedias = new List<AudioMedia>();
foreach(AudioMediaType media in cicm.AudioMedia)
metadata.AudioMedias.Add(media);
}
return metadata;
}
}

View File

@@ -36,7 +36,9 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using Schemas;
// ReSharper disable UnusedMember.Global
// ReSharper disable ClassNeverInstantiated.Global
@@ -57,4 +59,59 @@ public class Advertisement
public List<VideoTrack> VideoTracks { get; set; }
public List<SubtitleTrack> SubtitleTracks { get; set; }
public Recording Recording { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator Advertisement(AdvertisementType cicm)
{
if(cicm is null)
return null;
var adv = new Advertisement
{
Manufacturer = cicm.Manufacturer,
Product = cicm.Product,
File = cicm.File,
FileSize = cicm.FileSize,
Frames = cicm.FramesSpecified ? cicm.Frames : null,
Duration = cicm.Duration,
MeanFrameRate = cicm.MeanFrameRateSpecified ? cicm.MeanFrameRate : null,
Recording = cicm.Recording
};
if(cicm.Checksums is not null)
{
adv.Checksums = new List<Checksum>();
foreach(Schemas.ChecksumType chk in cicm.Checksums)
adv.Checksums.Add(chk);
}
if(cicm.AudioTrack is not null)
{
adv.AudioTracks = new List<AudioTrack>();
foreach(AudioTracksType trk in cicm.AudioTrack)
adv.AudioTracks.Add(trk);
}
if(cicm.VideoTrack is not null)
{
adv.VideoTracks = new List<VideoTrack>();
foreach(VideoTracksType trk in cicm.VideoTrack)
adv.VideoTracks.Add(trk);
}
if(cicm.SubtitleTrack is null)
return adv;
{
adv.SubtitleTracks = new List<SubtitleTrack>();
foreach(SubtitleTracksType trk in cicm.SubtitleTrack)
adv.SubtitleTracks.Add(trk);
}
return adv;
}
}

View File

@@ -36,7 +36,9 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using Schemas;
// ReSharper disable UnusedMember.Global
// ReSharper disable ClassNeverInstantiated.Global
@@ -59,6 +61,54 @@ public class AudioMedia
public DimensionsNew Dimensions { get; set; }
public Scans Scans { get; set; }
public List<DumpHardware> DumpHardware { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator AudioMedia(AudioMediaType cicm)
{
if(cicm is null)
return null;
var media = new AudioMedia
{
Image = cicm.Image,
Size = cicm.Size,
Sequence = cicm.Sequence,
PartNumber = cicm.PartNumber,
SerialNumber = cicm.SerialNumber,
Manufacturer = cicm.Manufacturer,
Model = cicm.Model,
AccoustID = cicm.AccoustID,
CopyProtection = cicm.CopyProtection,
Dimensions = cicm.Dimensions,
Scans = cicm.Scans
};
if(cicm.Checksums is not null)
{
media.Checksums = new List<Checksum>();
foreach(Schemas.ChecksumType chk in cicm.Checksums)
media.Checksums.Add(chk);
}
if(cicm.Block is not null)
{
media.Blocks = new List<AudioBlock>();
foreach(AudioBlockType blk in cicm.Block)
media.Blocks.Add(blk);
}
if(cicm.DumpHardwareArray is null)
return media;
media.DumpHardware = new List<DumpHardware>();
foreach(DumpHardwareType hw in cicm.DumpHardwareArray)
media.DumpHardware.Add(hw);
return media;
}
}
public class AudioBlock
@@ -68,4 +118,29 @@ public class AudioBlock
public string AccoustID { get; set; }
public List<Checksum> Checksums { get; set; }
public string Format { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator AudioBlock(AudioBlockType cicm)
{
if(cicm is null)
return null;
var blk = new AudioBlock
{
Image = cicm.Image,
Size = cicm.Size,
AccoustID = cicm.AccoustID,
Format = cicm.Format
};
if(cicm.Checksums is null)
return blk;
blk.Checksums = new List<Checksum>();
foreach(Schemas.ChecksumType chk in cicm.Checksums)
blk.Checksums.Add(chk);
return blk;
}
}

View File

@@ -40,6 +40,7 @@ using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Text.Json.Serialization;
using Schemas;
// ReSharper disable UnusedMember.Global
// ReSharper disable ClassNeverInstantiated.Global
@@ -55,6 +56,33 @@ public class AudioTrack
public uint Channels { get; set; }
public double SampleRate { get; set; }
public long MeanBitrate { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator AudioTrack(AudioTracksType cicm)
{
if(cicm is null)
return null;
var trk = new AudioTrack
{
Number = cicm.TrackNumber,
AccoustID = cicm.AccoustID,
Codec = cicm.Codec,
Channels = cicm.Channels,
SampleRate = cicm.SampleRate,
MeanBitrate = cicm.MeanBitrate
};
if(cicm.Languages is null)
return trk;
trk.Languages = new List<Language>();
foreach(LanguagesTypeLanguage lng in cicm.Languages)
trk.Languages.Add((Language)lng);
return trk;
}
}
public class VideoTrack
@@ -67,6 +95,33 @@ public class VideoTrack
public long MeanBitrate { get; set; }
[JsonPropertyName("3D")]
public bool ThreeD { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator VideoTrack(VideoTracksType cicm)
{
if(cicm is null)
return null;
var trk = new VideoTrack
{
Number = cicm.TrackNumber,
Codec = cicm.Codec,
Horizontal = cicm.Horizontal,
Vertical = cicm.Vertical,
MeanBitrate = cicm.MeanBitrate,
ThreeD = cicm.ThreeD
};
if(cicm.Languages is null)
return trk;
trk.Languages = new List<Language>();
foreach(LanguagesTypeLanguage lng in cicm.Languages)
trk.Languages.Add((Language)lng);
return trk;
}
}
public class SubtitleTrack
@@ -74,6 +129,29 @@ public class SubtitleTrack
public List<Language> Languages { get; set; }
public uint Number { get; set; }
public string Codec { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator SubtitleTrack(SubtitleTracksType cicm)
{
if(cicm is null)
return null;
var sub = new SubtitleTrack
{
Number = cicm.TrackNumber,
Codec = cicm.Codec
};
if(cicm.Languages is null)
return sub;
sub.Languages = new List<Language>();
foreach(LanguagesTypeLanguage lng in cicm.Languages)
sub.Languages.Add((Language)lng);
return sub;
}
}
public class Recording
@@ -84,12 +162,45 @@ public class Recording
public DateTime Timestamp { get; set; }
public List<Software> Software { get; set; }
public Coordinates Coordinates { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator Recording(RecordingType cicm)
{
if(cicm is null)
return null;
var recording = new Recording
{
Broadcaster = cicm.Broadcaster,
BroadcastPlatform = cicm.BroadcastPlatform,
SourceFormat = (SourceFormat)cicm.SourceFormat,
Timestamp = cicm.Timestamp,
Coordinates = cicm.Coordinates
};
if(cicm.Software is null)
return recording;
recording.Software = new List<Software>();
foreach(SoftwareType sw in cicm.Software)
recording.Software.Add(sw);
return recording;
}
}
public class Coordinates
{
public double Latitude { get; set; }
public double Longitude { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator Coordinates(CoordinatesType cicm) => cicm is null ? null : new Coordinates
{
Latitude = cicm.Latitude,
Longitude = cicm.Longitude
};
}
[JsonConverter(typeof(JsonStringEnumMemberConverter)), SuppressMessage("ReSharper", "InconsistentNaming")]

View File

@@ -36,11 +36,11 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
// ReSharper disable UnusedMember.Global
// ReSharper disable ClassNeverInstantiated.Global
using System;
namespace Aaru.CommonTypes.AaruMetadata;
public enum BarcodeType
@@ -61,4 +61,11 @@ public class Barcode
{
public BarcodeType Type { get; set; }
public string Value { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator Barcode(Schemas.BarcodeType cicm) => cicm is null ? null : new Barcode
{
Type = (BarcodeType)cicm.type,
Value = cicm.Value
};
}

View File

@@ -36,7 +36,9 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using Schemas;
// ReSharper disable UnusedMember.Global
// ReSharper disable ClassNeverInstantiated.Global
@@ -81,6 +83,96 @@ public class BlockMedia
public string MediaType { get; set; }
public string MediaSubType { get; set; }
public string Interface { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator BlockMedia(BlockMediaType cicm)
{
if(cicm is null)
return null;
var media = new BlockMedia
{
Image = cicm.Image,
Size = cicm.Size,
Sequence = cicm.Sequence,
Manufacturer = cicm.Manufacturer,
Model = cicm.Model,
Serial = cicm.Serial,
Firmware = cicm.Firmware,
PartNumber = cicm.PartNumber,
SerialNumber = cicm.SerialNumber,
PhysicalBlockSize = cicm.PhysicalBlockSize,
LogicalBlockSize = cicm.LogicalBlockSize,
LogicalBlocks = cicm.LogicalBlocks,
Scans = cicm.Scans,
ATA = cicm.ATA,
Pci = cicm.PCI,
Pcmcia = cicm.PCMCIA,
SecureDigital = cicm.SecureDigital,
MultiMediaCard = cicm.MultiMediaCard,
SCSI = cicm.SCSI,
Usb = cicm.USB,
Mam = cicm.MAM,
Heads = cicm.HeadsSpecified ? cicm.Heads : null,
Cylinders = cicm.CylindersSpecified ? cicm.Cylinders : null,
SectorsPerTrack = cicm.SectorsPerTrackSpecified ? cicm.SectorsPerTrack : null,
CopyProtection = cicm.CopyProtection,
Dimensions = cicm.Dimensions,
MediaType = cicm.DiskType,
MediaSubType = cicm.DiskSubType,
Interface = cicm.Interface
};
if(cicm.Checksums is not null)
{
media.Checksums = new List<Checksum>();
foreach(Schemas.ChecksumType chk in cicm.Checksums)
media.Checksums.Add(chk);
}
if(cicm.ContentChecksums is not null)
{
media.ContentChecksums = new List<Checksum>();
foreach(Schemas.ChecksumType chk in cicm.ContentChecksums)
media.ContentChecksums.Add(chk);
}
if(cicm.VariableBlockSize is not null)
{
media.VariableBlockSize = new List<BlockSize>();
foreach(BlockSizeType blkSize in cicm.VariableBlockSize)
media.VariableBlockSize.Add(blkSize);
}
if(cicm.TapeInformation is not null)
{
media.TapeInformation = new List<TapePartition>();
foreach(TapePartitionType tapeInformation in cicm.TapeInformation)
media.TapeInformation.Add(tapeInformation);
}
if(cicm.FileSystemInformation is not null)
{
media.FileSystemInformation = new List<Partition>();
foreach(PartitionType fsInfo in cicm.FileSystemInformation)
media.FileSystemInformation.Add(fsInfo);
}
if(cicm.DumpHardwareArray is null)
return media;
media.DumpHardware = new List<DumpHardware>();
foreach(DumpHardwareType hw in cicm.DumpHardwareArray)
media.DumpHardware.Add(hw);
return media;
}
}
public class BlockTrack
@@ -95,4 +187,34 @@ public class BlockTrack
public uint BytesPerSector { get; set; }
public List<Checksum> Checksums { get; set; }
public string Format { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator BlockTrack(BlockTrackType cicm)
{
if(cicm is null)
return null;
var trk = new BlockTrack
{
Image = cicm.Image,
Size = cicm.Size,
Head = cicm.Head,
Cylinder = cicm.Cylinder,
StartSector = cicm.StartSector,
EndSector = cicm.EndSector,
Sectors = cicm.Sectors,
BytesPerSector = cicm.BytesPerSector,
Format = cicm.Format
};
if(cicm.Checksums is null)
return trk;
trk.Checksums = new List<Checksum>();
foreach(Schemas.ChecksumType chk in cicm.Checksums)
trk.Checksums.Add(chk);
return trk;
}
}

View File

@@ -38,6 +38,7 @@
using System;
using System.Collections.Generic;
using Schemas;
// ReSharper disable UnusedMember.Global
// ReSharper disable ClassNeverInstantiated.Global
@@ -56,4 +57,41 @@ public class Book
public uint? Pages { get; set; }
public string PageSize { get; set; }
public Scan Scan { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator Book(BookType cicm)
{
if(cicm is null)
return null;
var book = new Book
{
Cover = cicm.Cover,
Name = cicm.Name,
Editorial = cicm.Editorial,
Author = cicm.Author,
PublicationDate = cicm.PublicationDateSpecified ? cicm.PublicationDate : null,
Pages = cicm.PagesSpecified ? cicm.Pages : null,
PageSize = cicm.PageSize,
Scan = cicm.Scan
};
if(cicm.Barcodes is not null)
{
book.Barcodes = new List<Barcode>();
foreach(Schemas.BarcodeType code in cicm.Barcodes)
book.Barcodes.Add(code);
}
if(cicm.Language is null)
return book;
book.Languages = new List<Language>();
foreach(LanguagesTypeLanguage lng in cicm.Language)
book.Languages.Add((Language)lng);
return book;
}
}

View File

@@ -36,17 +36,24 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
// ReSharper disable UnusedMember.Global
// ReSharper disable ClassNeverInstantiated.Global
using System;
namespace Aaru.CommonTypes.AaruMetadata;
public class Checksum
{
public ChecksumType Type { get; set; }
public string Value { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator Checksum(Schemas.ChecksumType cicm) => cicm is null ? null : new Checksum
{
Value = cicm.Value,
Type = (ChecksumType)cicm.type
};
}
public enum ChecksumType

View File

@@ -38,6 +38,7 @@
using System;
using System.Collections.Generic;
using Schemas;
// ReSharper disable UnusedMember.Global
// ReSharper disable ClassNeverInstantiated.Global
@@ -49,6 +50,36 @@ public class FilesystemContents
public List<ContentsFile> Files { get; set; }
public List<Directory> Directories { get; set; }
public string Namespace { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator FilesystemContents(FilesystemContentsType cicm)
{
if(cicm is null)
return null;
var fs = new FilesystemContents
{
Namespace = cicm.@namespace
};
if(cicm.File is not null)
{
fs.Files = new List<ContentsFile>();
foreach(ContentsFileType file in cicm.File)
fs.Files.Add(file);
}
if(cicm.Directory is null)
return fs;
fs.Directories = new List<Directory>();
foreach(DirectoryType dir in cicm.Directory)
fs.Directories.Add(dir);
return fs;
}
}
public class ContentsFile
@@ -69,6 +100,49 @@ public class ContentsFile
public ulong Links { get; set; }
public ulong? PosixUserId { get; set; }
public ulong Length { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator ContentsFile(ContentsFileType cicm)
{
if(cicm is null)
return null;
var file = new ContentsFile
{
Name = cicm.name,
CreationTime = cicm.creationTimeSpecified ? cicm.creationTime : null,
AccessTime = cicm.accessTimeSpecified ? cicm.accessTime : null,
StatusChangeTime = cicm.statusChangeTimeSpecified ? cicm.statusChangeTime : null,
BackupTime = cicm.backupTimeSpecified ? cicm.backupTime : null,
LastWriteTime = cicm.lastWriteTimeSpecified ? cicm.lastWriteTime : null,
Attributes = cicm.attributes,
PosixMode = cicm.posixModeSpecified ? cicm.posixMode : null,
DeviceNumber = cicm.deviceNumberSpecified ? cicm.deviceNumber : null,
PosixGroupId = cicm.posixGroupIdSpecified ? cicm.posixGroupId : null,
Inode = cicm.inode,
Links = cicm.links,
PosixUserId = cicm.posixUserIdSpecified ? cicm.posixUserId : null,
Length = cicm.length
};
if(cicm.Checksums is not null)
{
file.Checksums = new List<Checksum>();
foreach(Schemas.ChecksumType chk in cicm.Checksums)
file.Checksums.Add(chk);
}
if(cicm.ExtendedAttributes is null)
return file;
file.ExtendedAttributes = new List<ExtendedAttribute>();
foreach(ExtendedAttributeType xa in cicm.ExtendedAttributes)
file.ExtendedAttributes.Add(xa);
return file;
}
}
public class ExtendedAttribute
@@ -76,6 +150,29 @@ public class ExtendedAttribute
public List<Checksum> Checksums { get; set; }
public string Name { get; set; }
public ulong Length { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator ExtendedAttribute(ExtendedAttributeType cicm)
{
if(cicm is null)
return null;
var xa = new ExtendedAttribute
{
Name = cicm.name,
Length = cicm.length
};
if(cicm.Checksums is null)
return xa;
xa.Checksums = new List<Checksum>();
foreach(Schemas.ChecksumType chk in cicm.Checksums)
xa.Checksums.Add(chk);
return xa;
}
}
public class Directory
@@ -95,4 +192,46 @@ public class Directory
public ulong? Inode { get; set; }
public ulong? Links { get; set; }
public ulong? PosixUserId { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator Directory(DirectoryType cicm)
{
if(cicm is null)
return null;
var dir = new Directory
{
Name = cicm.name,
CreationTime = cicm.creationTimeSpecified ? cicm.creationTime : null,
AccessTime = cicm.accessTimeSpecified ? cicm.accessTime : null,
StatusChangeTime = cicm.statusChangeTimeSpecified ? cicm.statusChangeTime : null,
BackupTime = cicm.backupTimeSpecified ? cicm.backupTime : null,
LastWriteTime = cicm.lastWriteTimeSpecified ? cicm.lastWriteTime : null,
Attributes = cicm.attributes,
PosixMode = cicm.posixModeSpecified ? cicm.posixMode : null,
DeviceNumber = cicm.deviceNumberSpecified ? cicm.deviceNumber : null,
PosixGroupId = cicm.posixGroupIdSpecified ? cicm.posixGroupId : null,
Inode = cicm.inodeSpecified ? cicm.inode : null,
Links = cicm.linksSpecified ? cicm.links : null,
PosixUserId = cicm.posixUserIdSpecified ? cicm.posixUserId : null
};
if(cicm.Directory is not null)
{
dir.Directories = new List<Directory>();
foreach(DirectoryType d in cicm.Directory)
dir.Directories.Add(d);
}
if(cicm.File is null)
return dir;
dir.Files = new List<ContentsFile>();
foreach(ContentsFileType file in cicm.File)
dir.Files.Add(file);
return dir;
}
}

View File

@@ -36,11 +36,12 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
// ReSharper disable UnusedMember.Global
// ReSharper disable ClassNeverInstantiated.Global
using System;
using Schemas;
namespace Aaru.CommonTypes.AaruMetadata;
public class DimensionsNew
@@ -49,4 +50,13 @@ public class DimensionsNew
public double? Height { get; set; }
public double? Width { get; set; }
public double Thickness { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator DimensionsNew(DimensionsType cicm) => cicm is null ? null : new DimensionsNew
{
Diameter = cicm.DiameterSpecified ? cicm.Diameter : null,
Height = cicm.HeightSpecified ? cicm.Height : null,
Width = cicm.WidthSpecified ? cicm.Width : null,
Thickness = cicm.Thickness
};
}

View File

@@ -36,7 +36,9 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using Schemas;
// ReSharper disable UnusedMember.Global
// ReSharper disable ClassNeverInstantiated.Global
@@ -48,6 +50,14 @@ public class Image
public string Format { get; set; }
public ulong? Offset { get; set; }
public string Value { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator Image(ImageType cicm) => cicm is null ? null : new Image
{
Format = cicm.format,
Offset = cicm.offsetSpecified ? cicm.offset : null,
Value = cicm.Value
};
}
public class Dump
@@ -55,6 +65,29 @@ public class Dump
public string Image { get; set; }
public ulong Size { get; set; }
public List<Checksum> Checksums { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator Dump(DumpType cicm)
{
if(cicm is null)
return null;
Dump dump = new()
{
Image = cicm.Image,
Size = cicm.Size
};
if(cicm.Checksums is null)
return dump;
dump.Checksums = new List<Checksum>();
foreach(Schemas.ChecksumType chk in cicm.Checksums)
dump.Checksums.Add(chk);
return dump;
}
}
public class Border
@@ -63,16 +96,54 @@ public class Border
public ulong Size { get; set; }
public List<Checksum> Checksums { get; set; }
public uint? Session { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator Border(BorderType cicm)
{
if(cicm is null)
return null;
var border = new Border
{
Image = cicm.Image,
Size = cicm.Size,
Session = cicm.sessionSpecified ? cicm.session : null
};
if(cicm.Checksums is null)
return border;
border.Checksums = new List<Checksum>();
foreach(Schemas.ChecksumType chk in cicm.Checksums)
border.Checksums.Add(chk);
return border;
}
}
public class File
{
public string Format { get; set; }
public string Value { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator File(FileType cicm) => cicm is null ? null : new File
{
Format = cicm.format,
Value = cicm.Value
};
}
public class BlockSize
{
public uint StartingBlock { get; set; }
public uint Value { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator BlockSize(BlockSizeType cicm) => cicm is null ? null : new BlockSize
{
StartingBlock = cicm.startingBlock,
Value = cicm.Value
};
}

View File

@@ -36,7 +36,9 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using Schemas;
// ReSharper disable UnusedMember.Global
// ReSharper disable ClassNeverInstantiated.Global
@@ -52,12 +54,46 @@ public class DumpHardware
public string Serial { get; set; }
public List<Extent> Extents { get; set; }
public Software Software { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator DumpHardware(DumpHardwareType cicm)
{
if(cicm is null)
return null;
var hw = new DumpHardware
{
Manufacturer = cicm.Manufacturer,
Model = cicm.Model,
Revision = cicm.Revision,
Firmware = cicm.Firmware,
Serial = cicm.Serial,
Software = cicm.Software
};
if(cicm.Extents is null)
return hw;
hw.Extents = new List<Extent>();
foreach(ExtentType ext in cicm.Extents)
hw.Extents.Add(ext);
return hw;
}
}
public class Extent
{
public ulong Start { get; set; }
public ulong End { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator Extent(ExtentType cicm) => cicm is null ? null : new Extent
{
Start = cicm.Start,
End = cicm.End
};
}
public class Software
@@ -65,4 +101,12 @@ public class Software
public string Name { get; set; }
public string Version { get; set; }
public string OperatingSystem { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator Software(SoftwareType cicm) => cicm is null ? null : new Software
{
Name = cicm.Name,
Version = cicm.Version,
OperatingSystem = cicm.OperatingSystem
};
}

View File

@@ -37,6 +37,7 @@
// ****************************************************************************/
using System;
using Schemas;
// ReSharper disable UnusedMember.Global
// ReSharper disable ClassNeverInstantiated.Global
@@ -65,4 +66,29 @@ public class FileSystem
public string DataPreparerIdentifier { get; set; }
public string ApplicationIdentifier { get; set; }
public FilesystemContents Contents { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator FileSystem(FileSystemType cicm) => cicm is null ? null : new FileSystem
{
Type = cicm.Type,
CreationDate = cicm.CreationDateSpecified ? cicm.CreationDate : null,
ModificationDate = cicm.ModificationDateSpecified ? cicm.ModificationDate : null,
BackupDate = cicm.BackupDateSpecified ? cicm.BackupDate : null,
ClusterSize = cicm.ClusterSize,
Clusters = cicm.Clusters,
Files = cicm.FilesSpecified ? cicm.Files : null,
Bootable = cicm.Bootable,
VolumeSerial = cicm.VolumeSerial,
VolumeName = cicm.VolumeName,
FreeClusters = cicm.FreeClustersSpecified ? cicm.FreeClusters : null,
Dirty = cicm.Dirty,
ExpirationDate = cicm.ExpirationDateSpecified ? cicm.ExpirationDate : null,
EffectiveDate = cicm.EffectiveDateSpecified ? cicm.EffectiveDate : null,
SystemIdentifier = cicm.SystemIdentifier,
VolumeSetIdentifier = cicm.VolumeSetIdentifier,
PublisherIdentifier = cicm.PublisherIdentifier,
DataPreparerIdentifier = cicm.DataPreparerIdentifier,
ApplicationIdentifier = cicm.ApplicationIdentifier,
Contents = cicm.Contents
};
}

View File

@@ -36,8 +36,10 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Schemas;
// ReSharper disable UnusedMember.Global
// ReSharper disable ClassNeverInstantiated.Global
@@ -48,6 +50,28 @@ public class Layers
{
public List<Sectors> Sectors { get; set; }
public LayerType? Type { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator Layers(LayersType cicm)
{
if(cicm is null)
return null;
var layers = new Layers
{
Type = cicm.typeSpecified ? (LayerType)cicm.type : null
};
if(cicm.Sectors is null)
return layers;
layers.Sectors = new List<Sectors>();
foreach(SectorsType sec in cicm.Sectors)
layers.Sectors.Add(sec);
return layers;
}
}
[SuppressMessage("ReSharper", "InconsistentNaming")]
@@ -60,10 +84,24 @@ public class LayeredText
{
public uint? Layer { get; set; }
public string Text { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator LayeredText(LayeredTextType cicm) => cicm is null ? null : new LayeredText
{
Layer = cicm.layerSpecified ? cicm.layer : null,
Text = cicm.Value
};
}
public class Sectors
{
public uint? Layer { get; set; }
public ulong Value { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator Sectors(SectorsType cicm) => cicm is null ? null : new Sectors
{
Layer = cicm.layerSpecified ? cicm.layer : null,
Value = cicm.Value
};
}

View File

@@ -36,7 +36,9 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using Schemas;
// ReSharper disable UnusedMember.Global
// ReSharper disable ClassNeverInstantiated.Global
@@ -64,4 +66,57 @@ public class LinearMedia
public List<DumpHardware> DumpHardware { get; set; }
public Pcmcia Pcmcia { get; set; }
public string CopyProtection { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator LinearMedia(LinearMediaType cicm)
{
if(cicm is null)
return null;
var linearMedia = new LinearMedia
{
Image = cicm.Image,
Size = cicm.Size,
PartNumber = cicm.PartNumber,
SerialNumber = cicm.SerialNumber,
Title = cicm.Title,
Sequence = cicm.SequenceSpecified ? cicm.Sequence : null,
ImageInterleave = cicm.ImageInterleaveSpecified ? cicm.ImageInterleave : null,
Interleave = cicm.InterleaveSpecified ? cicm.Interleave : null,
Manufacturer = cicm.Manufacturer,
Model = cicm.Model,
Package = cicm.Package,
Interface = cicm.Interface,
Dimensions = cicm.Dimensions,
Scans = cicm.Scans,
Pcmcia = cicm.PCMCIA,
CopyProtection = cicm.CopyProtection
};
if(cicm.ImageChecksums is not null)
{
linearMedia.ImageChecksums = new List<Checksum>();
foreach(Schemas.ChecksumType chk in cicm.ImageChecksums)
linearMedia.ImageChecksums.Add(chk);
}
if(cicm.Checksums is not null)
{
linearMedia.Checksums = new List<Checksum>();
foreach(Schemas.ChecksumType chk in cicm.Checksums)
linearMedia.Checksums.Add(chk);
}
if(cicm.DumpHardwareArray is null)
return linearMedia;
linearMedia.DumpHardware = new List<DumpHardware>();
foreach(DumpHardwareType hw in cicm.DumpHardwareArray)
linearMedia.DumpHardware.Add(hw);
return linearMedia;
}
}

View File

@@ -38,6 +38,7 @@
using System;
using System.Collections.Generic;
using Schemas;
// ReSharper disable UnusedMember.Global
// ReSharper disable ClassNeverInstantiated.Global
@@ -56,4 +57,38 @@ public class Magazine
public uint? Pages { get; set; }
public string PageSize { get; set; }
public Scan Scan { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator Magazine(MagazineType cicm)
{
if(cicm is null)
return null;
var magazine = new Magazine
{
Cover = cicm.Cover,
Name = cicm.Name,
Editorial = cicm.Editorial,
PublicationDate = cicm.PublicationDateSpecified ? cicm.PublicationDate : null,
Number = cicm.NumberSpecified ? cicm.Number : null,
Pages = cicm.PagesSpecified ? cicm.Pages : null,
Scan = cicm.Scan
};
if(cicm.Barcodes is not null)
{
magazine.Barcodes = new List<Barcode>();
foreach(Schemas.BarcodeType code in cicm.Barcodes)
magazine.Barcodes.Add(code);
}
if(cicm.Language is null)
return magazine;
foreach(LanguagesTypeLanguage lng in cicm.Language)
magazine.Languages.Add((Language)lng);
return magazine;
}
}

View File

@@ -36,11 +36,12 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
// ReSharper disable UnusedMember.Global
// ReSharper disable ClassNeverInstantiated.Global
using System;
using Schemas;
namespace Aaru.CommonTypes.AaruMetadata;
public class MultiMediaCard
@@ -49,4 +50,13 @@ public class MultiMediaCard
public Dump CSD { get; set; }
public Dump ExtendedCSD { get; set; }
public Dump OCR { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator MultiMediaCard(MultiMediaCardType cicm) => cicm is null ? null : new MultiMediaCard
{
CSD = cicm.CSD,
CID = cicm.CID,
ExtendedCSD = cicm.ExtendedCSD,
OCR = cicm.OCR
};
}

View File

@@ -36,7 +36,9 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using Schemas;
// ReSharper disable UnusedMember.Global
// ReSharper disable ClassNeverInstantiated.Global
@@ -92,6 +94,142 @@ public class OpticalDisc
public string MediaCatalogueNumber { get; set; }
public List<Track> Track { get; set; }
public List<DumpHardware> DumpHardware { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator OpticalDisc(OpticalDiscType cicm)
{
if(cicm is null)
return null;
var disc = new OpticalDisc
{
Image = cicm.Image,
Size = cicm.Size,
Sequence = cicm.Sequence,
Layers = cicm.Layers,
PartNumber = cicm.PartNumber,
SerialNumber = cicm.SerialNumber,
DiscType = cicm.DiscType,
DiscSubType = cicm.DiscSubType,
Offset = cicm.OffsetSpecified ? cicm.Offset : null,
Tracks = cicm.Tracks,
Sessions = cicm.Sessions,
CopyProtection = cicm.CopyProtection,
Dimensions = cicm.Dimensions,
Case = cicm.Case,
Scans = cicm.Scans,
Pfi = cicm.PFI,
Dmi = cicm.DMI,
Cmi = cicm.CMI,
Bca = cicm.BCA,
Atip = cicm.ATIP,
Adip = cicm.ADIP,
Pma = cicm.PMA,
Dds = cicm.DDS,
Sai = cicm.SAI,
LastRmd = cicm.LastRMD,
Pri = cicm.PRI,
MediaID = cicm.MediaID,
Pfir = cicm.PFIR,
Dcb = cicm.DCB,
Pac = cicm.PAC,
Toc = cicm.TOC,
LeadInCdText = cicm.LeadInCdText,
Xbox = cicm.Xbox,
Ps3Encryption = cicm.PS3Encryption,
MediaCatalogueNumber = cicm.MediaCatalogueNumber
};
if(cicm.Checksums is not null)
{
disc.Checksums = new List<Checksum>();
foreach(Schemas.ChecksumType chk in cicm.Checksums)
disc.Checksums.Add(chk);
}
if(cicm.RingCode is not null)
{
disc.RingCode = new List<LayeredText>();
foreach(LayeredTextType lt in cicm.RingCode)
disc.RingCode.Add(lt);
}
if(cicm.MasteringSID is not null)
{
disc.MasteringSid = new List<LayeredText>();
foreach(LayeredTextType lt in cicm.MasteringSID)
disc.MasteringSid.Add(lt);
}
if(cicm.Toolstamp is not null)
{
disc.Toolstamp = new List<LayeredText>();
foreach(LayeredTextType lt in cicm.Toolstamp)
disc.Toolstamp.Add(lt);
}
if(cicm.MouldSID is not null)
{
disc.MouldSid = new List<LayeredText>();
foreach(LayeredTextType lt in cicm.MouldSID)
disc.MouldSid.Add(lt);
}
if(cicm.MouldText is not null)
{
disc.MouldText = new List<LayeredText>();
foreach(LayeredTextType lt in cicm.MouldText)
disc.MouldText.Add(lt);
}
if(cicm.FirstTrackPregrap is not null)
{
disc.FirstTrackPregrap = new List<Border>();
foreach(BorderType lt in cicm.FirstTrackPregrap)
disc.FirstTrackPregrap.Add(lt);
}
if(cicm.LeadIn is not null)
{
disc.LeadIn = new List<Border>();
foreach(BorderType lt in cicm.LeadIn)
disc.LeadIn.Add(lt);
}
if(cicm.LeadOut is not null)
{
disc.LeadOut = new List<Border>();
foreach(BorderType lt in cicm.LeadOut)
disc.LeadOut.Add(lt);
}
if(cicm.Track is not null)
{
disc.Track = new List<Track>();
foreach(Schemas.TrackType lt in cicm.Track)
disc.Track.Add(lt);
}
if(cicm.DumpHardwareArray is null)
return cicm;
disc.DumpHardware = new List<DumpHardware>();
foreach(DumpHardwareType hw in cicm.DumpHardwareArray)
disc.DumpHardware.Add(hw);
return cicm;
}
}
public class Track
@@ -112,18 +250,82 @@ public class Track
public List<Checksum> Checksums { get; set; }
public SubChannel SubChannel { get; set; }
public List<Partition> FileSystemInformation { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator Track(Schemas.TrackType cicm)
{
if(cicm is null)
return null;
var trk = new Track
{
Image = cicm.Image,
Size = cicm.Size,
Sequence = cicm.Sequence,
StartMsf = cicm.StartMSF,
EndMsf = cicm.EndMSF,
StartSector = cicm.StartSector,
EndSector = cicm.EndSector,
Flags = cicm.Flags,
ISRC = cicm.ISRC,
Type = (TrackType)cicm.TrackType1,
BytesPerSector = cicm.BytesPerSector,
AccoustID = cicm.AccoustID,
SubChannel = cicm.SubChannel
};
if(cicm.Indexes is not null)
{
trk.Indexes = new List<TrackIndex>();
foreach(TrackIndexType idx in cicm.Indexes)
trk.Indexes.Add(idx);
}
if(cicm.Checksums is not null)
{
trk.Checksums = new List<Checksum>();
foreach(Schemas.ChecksumType chk in cicm.Checksums)
trk.Checksums.Add(chk);
}
if(cicm.FileSystemInformation is null)
return trk;
trk.FileSystemInformation = new List<Partition>();
foreach(PartitionType fs in cicm.FileSystemInformation)
trk.FileSystemInformation.Add(fs);
return trk;
}
}
public class TrackSequence
{
public uint Number { get; set; }
public uint Session { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator TrackSequence(TrackSequenceType cicm) => cicm is null ? null : new TrackSequence
{
Number = cicm.TrackNumber,
Session = cicm.Session
};
}
public class TrackIndex
{
public ushort Index { get; set; }
public int Value { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator TrackIndex(TrackIndexType cicm) => cicm is null ? null : new TrackIndex
{
Index = cicm.index,
Value = cicm.Value
};
}
public class TrackFlags
@@ -132,6 +334,15 @@ public class TrackFlags
public bool Data { get; set; }
public bool CopyPermitted { get; set; }
public bool PreEmphasis { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator TrackFlags(TrackFlagsType cicm) => cicm is null ? null : new TrackFlags
{
CopyPermitted = cicm.CopyPermitted,
Data = cicm.Data,
PreEmphasis = cicm.PreEmphasis,
Quadraphonic = cicm.Quadraphonic
};
}
public enum TrackType
@@ -147,4 +358,27 @@ public class SubChannel
public Image Image { get; set; }
public ulong Size { get; set; }
public List<Checksum> Checksums { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator SubChannel(SubChannelType cicm)
{
if(cicm is null)
return null;
var subchannel = new SubChannel
{
Image = cicm.Image,
Size = cicm.Size
};
if(cicm.Checksums is null)
return subchannel;
subchannel.Checksums = new List<Checksum>();
foreach(Schemas.ChecksumType chk in cicm.Checksums)
subchannel.Checksums.Add(chk);
return subchannel;
}
}

View File

@@ -36,11 +36,12 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
// ReSharper disable UnusedMember.Global
// ReSharper disable ClassNeverInstantiated.Global
using System;
using Schemas;
namespace Aaru.CommonTypes.AaruMetadata;
public class Pci
@@ -52,4 +53,13 @@ public class Pci
public Dump Configuration { get; set; }
public LinearMedia ExpansionRom { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator Pci(PCIType cicm) => cicm is null ? null : new Pci
{
VendorID = cicm.VendorID,
DeviceID = cicm.DeviceID,
Configuration = cicm.Configuration,
ExpansionRom = cicm.ExpansionROM
};
}

View File

@@ -36,7 +36,9 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using Schemas;
// ReSharper disable UnusedMember.Global
// ReSharper disable ClassNeverInstantiated.Global
@@ -52,4 +54,16 @@ public class Pcmcia
public string Manufacturer { get; set; }
public string ProductName { get; set; }
public List<string> AdditionalInformation { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator Pcmcia(PCMCIAType cicm) => cicm is null ? null : new Pcmcia
{
Cis = cicm.CIS,
Compliance = cicm.Compliance,
ManufacturerCode = cicm.ManufacturerCodeSpecified ? cicm.ManufacturerCode : null,
CardCode = cicm.CardCodeSpecified ? cicm.CardCode : null,
Manufacturer = cicm.Manufacturer,
ProductName = cicm.ProductName,
AdditionalInformation = cicm.AdditionalInformation is null ? null : new List<string>(cicm.AdditionalInformation)
};
}

View File

@@ -36,15 +36,23 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
// ReSharper disable UnusedMember.Global
// ReSharper disable ClassNeverInstantiated.Global
using System;
using Schemas;
namespace Aaru.CommonTypes.AaruMetadata;
public class Ps3Encryption
{
public string Key { get; set; }
public string Serial { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator Ps3Encryption(PS3EncryptionType cicm) => cicm is null ? null : new Ps3Encryption
{
Key = cicm.Key,
Serial = cicm.Serial
};
}

View File

@@ -36,7 +36,9 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using Schemas;
// ReSharper disable UnusedMember.Global
// ReSharper disable ClassNeverInstantiated.Global
@@ -52,4 +54,31 @@ public class Partition
public ulong EndSector { get; set; }
public string Description { get; set; }
public List<FileSystem> FileSystems { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator Partition(PartitionType cicm)
{
if(cicm is null)
return null;
var part = new Partition
{
Sequence = cicm.Sequence,
Name = cicm.Name,
Type = cicm.Type,
StartSector = cicm.StartSector,
EndSector = cicm.EndSector,
Description = cicm.Description
};
if(cicm.FileSystems is null)
return part;
part.FileSystems = new List<FileSystem>();
foreach(FileSystemType fs in cicm.FileSystems)
part.FileSystems.Add(fs);
return part;
}
}

View File

@@ -36,7 +36,9 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using Schemas;
// ReSharper disable UnusedMember.Global
// ReSharper disable ClassNeverInstantiated.Global
@@ -47,4 +49,12 @@ public class RequiredOperatingSystem
{
public string Name { get; set; }
public List<string> Versions { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator RequiredOperatingSystem(RequiredOperatingSystemType cicm) =>
cicm is null ? null : new RequiredOperatingSystem
{
Name = cicm.Name,
Versions = cicm.Version is null ? null : new List<string>(cicm.Version)
};
}

View File

@@ -36,7 +36,9 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using Schemas;
// ReSharper disable UnusedMember.Global
// ReSharper disable ClassNeverInstantiated.Global
@@ -50,6 +52,31 @@ public class SCSI
public Dump ModeSense { get; set; }
public Dump ModeSense10 { get; set; }
public Dump LogSense { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator SCSI(SCSIType cicm)
{
if(cicm is null)
return null;
var scsi = new SCSI
{
Inquiry = cicm.Inquiry,
LogSense = cicm.LogSense,
ModeSense = cicm.ModeSense,
ModeSense10 = cicm.ModeSense10
};
if(cicm.EVPD is null)
return cicm;
scsi.Evpds = new List<Evpd>();
foreach(EVPDType evpd in cicm.EVPD)
scsi.Evpds.Add(evpd);
return scsi;
}
}
public class Evpd
@@ -58,4 +85,28 @@ public class Evpd
public ulong Size { get; set; }
public List<Checksum> Checksums { get; set; }
public byte? Page { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator Evpd(EVPDType cicm)
{
if(cicm is null)
return null;
var evpd = new Evpd
{
Image = cicm.Image,
Size = cicm.Size,
Page = cicm.pageSpecified ? cicm.page : null
};
if(cicm.Checksums is null)
return evpd;
evpd.Checksums = new List<Checksum>();
foreach(Schemas.ChecksumType chk in cicm.Checksums)
evpd.Checksums.Add(chk);
return evpd;
}
}

View File

@@ -36,7 +36,9 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using Schemas;
// ReSharper disable UnusedMember.Global
// ReSharper disable ClassNeverInstantiated.Global
@@ -50,6 +52,50 @@ public class Scan
public List<Scanner> Scanner { get; set; }
public List<ScanProcessing> ScanProcessing { get; set; }
public List<OCR> OCR { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator Scan(ScanType cicm)
{
if(cicm is null)
return null;
var scan = new Scan();
scan.File = cicm.File;
if(cicm.Checksums is not null)
{
scan.Checksums = new List<Checksum>();
foreach(Schemas.ChecksumType chk in cicm.Checksums)
scan.Checksums.Add(chk);
}
if(cicm.Scanner is not null)
{
scan.Scanner = new List<Scanner>();
foreach(ScannerType scanner in cicm.Scanner)
scan.Scanner.Add(scanner);
}
if(cicm.ScanProcessing is not null)
{
scan.ScanProcessing = new List<ScanProcessing>();
foreach(ScanProcessingType processing in cicm.ScanProcessing)
scan.ScanProcessing.Add(processing);
}
if(cicm.OCR is null)
return scan;
scan.OCR = new List<OCR>();
foreach(OCRType ocr in cicm.OCR)
scan.OCR.Add(ocr);
return scan;
}
}
public class Cover
@@ -57,12 +103,42 @@ public class Cover
public File File { get; set; }
public List<Checksum> Checksums { get; set; }
public byte[] Thumbnail { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator Cover(CoverType cicm)
{
if(cicm is null)
return null;
var cover = new Cover
{
File = cicm.File,
Thumbnail = cicm.Thumbnail
};
if(cicm.Checksums is null)
return cover;
cover.Checksums = new List<Checksum>();
foreach(Schemas.ChecksumType chk in cicm.Checksums)
cover.Checksums.Add(chk);
return cover;
}
}
public class Case
{
public CaseType Type { get; set; }
public Scans Scans { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator Case(Schemas.CaseType cicm) => cicm is null ? null : new Case
{
Type = (CaseType)cicm.CaseType1,
Scans = cicm.Scans
};
}
public enum CaseType
@@ -82,12 +158,26 @@ public class Scans
{
public CaseScan Case { get; set; }
public MediaScan Media { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator Scans(ScansType cicm) => cicm is null ? null : new Scans
{
Case = cicm.CaseScan,
Media = cicm.Scan
};
}
public class CaseScan
{
public CaseScanElement Element { get; set; }
public Scan Scan { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator CaseScan(CaseScanType cicm) => cicm is null ? null : new CaseScan
{
Element = (CaseScanElement)cicm.CaseScanElement,
Scan = cicm.Scan
};
}
public enum CaseScanElement
@@ -101,6 +191,13 @@ public class MediaScan
{
public MediaScanElement Element { get; set; }
public Scan Scan { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator MediaScan(MediaScanType cicm) => cicm is null ? null : new MediaScan
{
Element = (MediaScanElement)cicm.MediaScanElement,
Scan = cicm.Scan
};
}
public enum MediaScanElement
@@ -117,6 +214,17 @@ public class Scanner
public string Serial { get; set; }
public string Software { get; set; }
public string SoftwareVersion { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator Scanner(ScannerType cicm) => cicm is null ? null : new Scanner
{
Author = cicm.Author,
Manufacturer = cicm.Manufacturer,
Model = cicm.Model,
Serial = cicm.Serial,
Software = cicm.Software,
SoftwareVersion = cicm.SoftwareVersion
};
}
public class ScanProcessing
@@ -124,6 +232,14 @@ public class ScanProcessing
public string Author { get; set; }
public string Software { get; set; }
public string SoftwareVersion { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator ScanProcessing(ScanProcessingType cicm) => cicm is null ? null : new ScanProcessing
{
Author = cicm.Author,
Software = cicm.Software,
SoftwareVersion = cicm.SoftwareVersion
};
}
public class OCR
@@ -132,4 +248,28 @@ public class OCR
public string Software { get; set; }
public string SoftwareVersion { get; set; }
public List<Language> Language { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator OCR(OCRType cicm)
{
if(cicm is null)
return null;
var ocr = new OCR
{
Author = cicm.Author,
Software = cicm.Software,
SoftwareVersion = cicm.SoftwareVersion
};
if(cicm.Language is null)
return ocr;
ocr.Language = new List<Language>();
foreach(Language lng in cicm.Language)
ocr.Language.Add(lng);
return ocr;
}
}

View File

@@ -36,11 +36,12 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
// ReSharper disable UnusedMember.Global
// ReSharper disable ClassNeverInstantiated.Global
using System;
using Schemas;
namespace Aaru.CommonTypes.AaruMetadata;
public class SecureDigital
@@ -49,4 +50,13 @@ public class SecureDigital
public Dump CSD { get; set; }
public Dump SCR { get; set; }
public Dump OCR { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator SecureDigital(SecureDigitalType cicm) => cicm is null ? null : new SecureDigital
{
CID = cicm.CID,
CSD = cicm.CSD,
SCR = cicm.SCR,
OCR = cicm.OCR
};
}

View File

@@ -36,11 +36,12 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
// ReSharper disable UnusedMember.Global
// ReSharper disable ClassNeverInstantiated.Global
using System;
using Schemas;
namespace Aaru.CommonTypes.AaruMetadata;
public class Sequence
@@ -50,4 +51,14 @@ public class Sequence
public uint TotalMedia { get; set; }
public byte? Side { get; set; }
public byte? Layer { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator Sequence(SequenceType cicm) => cicm is null ? null : new Sequence
{
Title = cicm.MediaTitle,
MediaSequence = cicm.MediaSequence,
TotalMedia = cicm.TotalMedia,
Side = cicm.SideSpecified ? cicm.Side : null,
Layer = cicm.LayerSpecified ? cicm.Layer : null
};
}

View File

@@ -36,7 +36,9 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using Schemas;
// ReSharper disable UnusedMember.Global
// ReSharper disable ClassNeverInstantiated.Global
@@ -51,7 +53,41 @@ public class TapePartition
public ulong StartBlock { get; set; }
public ulong EndBlock { get; set; }
public List<Checksum> Checksums { get; set; }
public List<TapeFile> File { get; set; }
public List<TapeFile> Files { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator TapePartition(TapePartitionType cicm)
{
if(cicm is null)
return null;
TapePartition partition = new()
{
Image = cicm.Image,
Size = cicm.Size,
Sequence = cicm.Sequence,
StartBlock = cicm.StartBlock,
EndBlock = cicm.EndBlock
};
if(cicm.Checksums is not null)
{
partition.Checksums = new List<Checksum>();
foreach(Schemas.ChecksumType chk in cicm.Checksums)
partition.Checksums.Add(chk);
}
if(cicm.File is null)
return partition;
partition.Files = new List<TapeFile>();
foreach(TapeFileType file in cicm.File)
partition.Files.Add(file);
return partition;
}
}
public class TapeFile
@@ -63,4 +99,31 @@ public class TapeFile
public ulong StartBlock { get; set; }
public ulong EndBlock { get; set; }
public List<Checksum> Checksums { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator TapeFile(TapeFileType cicm)
{
if(cicm is null)
return null;
var file = new TapeFile
{
Image = cicm.Image,
Size = cicm.Size,
Sequence = cicm.Sequence,
BlockSize = cicm.BlockSize,
StartBlock = cicm.StartBlock,
EndBlock = cicm.EndBlock
};
if(cicm.Checksums is null)
return file;
file.Checksums = new List<Checksum>();
foreach(Schemas.ChecksumType chk in cicm.Checksums)
file.Checksums.Add(chk);
return file;
}
}

View File

@@ -36,11 +36,12 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
// ReSharper disable UnusedMember.Global
// ReSharper disable ClassNeverInstantiated.Global
using System;
using Schemas;
namespace Aaru.CommonTypes.AaruMetadata;
public class Usb
@@ -48,4 +49,12 @@ public class Usb
public ushort VendorID { get; set; }
public ushort ProductID { get; set; }
public Dump Descriptors { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator Usb(USBType cicm) => cicm is null ? null : new Usb
{
VendorID = cicm.VendorID,
ProductID = cicm.ProductID,
Descriptors = cicm.Descriptors
};
}

View File

@@ -36,7 +36,9 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using Schemas;
// ReSharper disable UnusedMember.Global
// ReSharper disable ClassNeverInstantiated.Global
@@ -49,4 +51,26 @@ public class UserManual
public uint Pages { get; set; }
public string PageSize { get; set; }
public Scan Scan { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator UserManual(UserManualType cicm)
{
if(cicm is null)
return null;
var manual = new UserManual();
manual.Pages = cicm.Pages;
manual.PageSize = cicm.PageSize;
manual.Scan = cicm.Scan;
if(cicm.Language is null)
return manual;
manual.Language = new List<Language>();
foreach(LanguagesTypeLanguage lng in cicm.Language)
manual.Language.Add((Language)lng);
return manual;
}
}

View File

@@ -36,7 +36,9 @@
// Copyright © 2011-2023 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using Schemas;
// ReSharper disable UnusedMember.Global
// ReSharper disable ClassNeverInstantiated.Global
@@ -48,6 +50,25 @@ public class Xbox
public Dump Pfi { get; set; }
public Dump Dmi { get; set; }
public List<XboxSecuritySector> SecuritySectors { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator Xbox(XboxType cicm)
{
if(cicm is null)
return null;
Xbox xbox = new();
xbox.Pfi = cicm.PFI;
xbox.Dmi = cicm.DMI;
if(cicm.SecuritySectors is null)
return xbox;
foreach(XboxSecuritySectorsType ss in cicm.SecuritySectors)
xbox.SecuritySectors.Add(ss);
return xbox;
}
}
public class XboxSecuritySector
@@ -55,4 +76,13 @@ public class XboxSecuritySector
public uint RequestVersion { get; set; }
public uint RequestNumber { get; set; }
public Dump SecuritySectors { get; set; }
[Obsolete("Will be removed in Aaru 7")]
public static implicit operator XboxSecuritySector(XboxSecuritySectorsType cicm) =>
cicm is null ? null : new XboxSecuritySector
{
RequestNumber = cicm.RequestNumber,
RequestVersion = cicm.RequestVersion,
SecuritySectors = cicm.SecuritySectors
};
}