2021-03-07 21:10:27 +00:00
|
|
|
using System.Collections.Generic;
|
2021-05-31 18:21:39 +01:00
|
|
|
using System.Text;
|
2021-03-01 21:18:02 +00:00
|
|
|
using Aaru.CommonTypes;
|
2021-03-02 02:59:20 +00:00
|
|
|
using Aaru.CommonTypes.Structs;
|
2021-03-01 21:18:02 +00:00
|
|
|
|
2022-11-15 15:58:43 +00:00
|
|
|
namespace Aaru.Tests;
|
|
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
/// <summary>Class to define expected data when testing media info</summary>
|
|
|
|
|
public class MediaInfoTest
|
2021-03-01 21:18:02 +00:00
|
|
|
{
|
2022-03-06 13:29:38 +00:00
|
|
|
/// <summary>Expected media type</summary>
|
|
|
|
|
public MediaType MediaType;
|
|
|
|
|
/// <summary>Expected number of sectors in media</summary>
|
|
|
|
|
public ulong Sectors;
|
|
|
|
|
/// <summary>Expected media sector size</summary>
|
|
|
|
|
public uint SectorSize;
|
|
|
|
|
/// <summary>File that contains the image to test</summary>
|
|
|
|
|
public string TestFile;
|
2021-03-01 21:18:02 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
public override string ToString() => TestFile;
|
|
|
|
|
}
|
2021-03-01 21:18:02 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
/// <inheritdoc />
|
|
|
|
|
/// <summary>Class to define expected data when testing filesystem info</summary>
|
|
|
|
|
public class FileSystemTest : MediaInfoTest
|
|
|
|
|
{
|
|
|
|
|
/// <summary>Application ID</summary>
|
|
|
|
|
public string ApplicationId;
|
|
|
|
|
/// <summary>Can the volume boot?</summary>
|
|
|
|
|
public bool Bootable;
|
|
|
|
|
/// <summary>Clusters in volume</summary>
|
|
|
|
|
public long Clusters;
|
|
|
|
|
/// <summary>Bytes per cluster</summary>
|
|
|
|
|
public uint ClusterSize;
|
|
|
|
|
public Dictionary<string, FileData> Contents;
|
|
|
|
|
public string ContentsJson;
|
|
|
|
|
public Encoding Encoding;
|
|
|
|
|
public string Namespace;
|
|
|
|
|
/// <summary>System or OEM ID</summary>
|
|
|
|
|
public string SystemId;
|
|
|
|
|
/// <summary>Filesystem type. null if always the same, as defined in test class</summary>
|
|
|
|
|
public string Type;
|
|
|
|
|
/// <summary>Volume name</summary>
|
|
|
|
|
public string VolumeName;
|
|
|
|
|
/// <summary>Volume serial number or set identifier</summary>
|
|
|
|
|
public string VolumeSerial;
|
|
|
|
|
}
|
2021-03-02 02:59:20 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
public class BlockImageTestExpected : MediaInfoTest
|
|
|
|
|
{
|
2022-03-15 01:37:37 +00:00
|
|
|
public string Md5;
|
2022-03-06 13:29:38 +00:00
|
|
|
public BlockPartitionVolumes[] Partitions;
|
|
|
|
|
}
|
2021-03-02 02:59:20 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
public class TrackInfoTestExpected
|
|
|
|
|
{
|
|
|
|
|
public ulong End;
|
|
|
|
|
public FileSystemTest[] FileSystems;
|
|
|
|
|
public byte? Flags;
|
|
|
|
|
public byte Number;
|
|
|
|
|
public ulong Pregap;
|
|
|
|
|
public int Session;
|
|
|
|
|
public ulong Start;
|
|
|
|
|
}
|
2021-03-02 02:59:20 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
public class OpticalImageTestExpected : BlockImageTestExpected
|
|
|
|
|
{
|
2022-03-15 01:37:37 +00:00
|
|
|
public string LongMd5;
|
|
|
|
|
public string SubchannelMd5;
|
2022-03-06 13:29:38 +00:00
|
|
|
public TrackInfoTestExpected[] Tracks;
|
|
|
|
|
}
|
2021-03-02 02:59:20 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
public class TapeImageTestExpected : BlockImageTestExpected
|
|
|
|
|
{
|
2022-11-15 01:35:06 +00:00
|
|
|
public TapeFile[] Files;
|
|
|
|
|
public new TapePartition[] Partitions;
|
2022-03-06 13:29:38 +00:00
|
|
|
}
|
2021-03-03 15:11:22 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
public class PartitionTest
|
|
|
|
|
{
|
|
|
|
|
public Partition[] Partitions;
|
|
|
|
|
/// <summary>File that contains the partition scheme to test</summary>
|
|
|
|
|
public string TestFile;
|
|
|
|
|
}
|
2021-03-07 21:10:27 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
public class FsExtractHashData
|
|
|
|
|
{
|
|
|
|
|
public PartitionVolumes[] Partitions;
|
|
|
|
|
}
|
2021-03-07 21:10:27 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
public class PartitionVolumes
|
|
|
|
|
{
|
|
|
|
|
public VolumeData[] Volumes;
|
|
|
|
|
}
|
2021-03-07 21:10:27 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
public class FileData
|
|
|
|
|
{
|
|
|
|
|
public Dictionary<string, FileData> Children { get; set; }
|
|
|
|
|
public FileEntryInfo Info { get; set; }
|
|
|
|
|
public string LinkTarget { get; set; }
|
2022-03-15 01:37:37 +00:00
|
|
|
public string Md5 { get; set; }
|
2022-03-06 13:29:38 +00:00
|
|
|
public Dictionary<string, string> XattrsWithMd5 { get; set; }
|
|
|
|
|
}
|
2021-03-07 23:04:58 +00:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
public class VolumeData
|
|
|
|
|
{
|
|
|
|
|
public List<string> Directories;
|
|
|
|
|
public Dictionary<string, FileData> Files;
|
|
|
|
|
public string VolumeName;
|
|
|
|
|
}
|
2021-07-12 19:02:57 +01:00
|
|
|
|
2022-03-06 13:29:38 +00:00
|
|
|
public class BlockPartitionVolumes
|
|
|
|
|
{
|
2023-10-05 01:05:23 +01:00
|
|
|
public ulong Length;
|
|
|
|
|
public ulong Start;
|
2021-03-01 21:18:02 +00:00
|
|
|
}
|