Files
Aaru/Aaru.Images/DiskDupe/Structs.cs

118 lines
3.2 KiB
C#
Raw Permalink Normal View History

2021-03-07 18:09:30 +01:00
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Structs.cs
// Author(s) : Michael Drüing <michael@drueing.de>
//
// Component : Disk image plugins.
//
// --[ Description ] ----------------------------------------------------------
//
// Contains structures for DiskDupe DDI disk images.
//
// --[ License ] --------------------------------------------------------------
//
// This library is free software; you can redistribute it and/or modify
// it under the terms of the GNU Lesser General Public License as
// published by the Free Software Foundation; either version 2.1 of the
// License, or (at your option) any later version.
//
// This library is distributed in the hope that it will be useful, but
// WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
// Lesser General Public License for more details.
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, see <http://www.gnu.org/licenses/>.
//
// ----------------------------------------------------------------------------
2024-12-19 10:45:18 +00:00
// Copyright © 2021-2025 Michael Drüing
// Copyright © 2011-2025 Natalia Portillo
2021-03-07 18:09:30 +01:00
// ****************************************************************************/
using System.Diagnostics.CodeAnalysis;
using System.Runtime.InteropServices;
namespace Aaru.Images;
2022-03-06 13:29:38 +00:00
[SuppressMessage("ReSharper", "UnusedType.Local")]
public sealed partial class DiskDupe
2021-03-07 18:09:30 +01:00
{
2022-03-06 13:29:38 +00:00
readonly DiskType[] _diskTypes =
2024-05-01 04:39:38 +01:00
[
new()
2021-08-17 21:23:10 +01:00
{
2022-03-06 13:29:38 +00:00
cyl = 0,
hd = 0,
spt = 0
}, // Type 0 - invalid
new()
2021-08-17 21:23:10 +01:00
{
2022-03-06 13:29:38 +00:00
cyl = 40,
hd = 2,
spt = 9
}, // Type 1 - 360k
new()
2022-03-06 13:29:38 +00:00
{
cyl = 80,
hd = 2,
spt = 15
}, // Type 2 - 1.2m
new()
2021-03-07 18:09:30 +01:00
{
2022-03-06 13:29:38 +00:00
cyl = 80,
hd = 2,
spt = 9
}, // Type 3 - 720k
new()
2022-03-06 13:29:38 +00:00
{
cyl = 80,
hd = 2,
spt = 18
} // Type 4 - 1.44m
2024-05-01 04:39:38 +01:00
];
2022-03-06 13:29:38 +00:00
2023-10-03 23:34:59 +01:00
#region Nested type: DiskType
[SuppressMessage("ReSharper", "InconsistentNaming")]
struct DiskType
2022-03-06 13:29:38 +00:00
{
2023-10-03 23:34:59 +01:00
public byte cyl;
public byte hd;
public byte spt;
2022-03-06 13:29:38 +00:00
}
2023-10-03 23:34:59 +01:00
#endregion
#region Nested type: FileHeader
2022-03-06 13:29:38 +00:00
/// <summary>The global header of a DDI image file</summary>
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct FileHeader
{
/// <summary>The file signature</summary>
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 10)]
public byte[] signature;
2021-03-07 18:09:30 +01:00
2022-03-06 13:29:38 +00:00
/// <summary>Disk type</summary>
public byte diskType;
2021-03-07 18:09:30 +01:00
}
2023-10-03 23:34:59 +01:00
#endregion
#region Nested type: TrackInfo
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct TrackInfo
{
public byte present; // 1 = present, 0 = absent
public byte trackNumber;
public byte zero1;
public byte zero2;
public byte zero3;
public byte unknown; // always 1?
2023-10-03 23:34:59 +01:00
}
#endregion
2021-08-17 21:23:10 +01:00
}