Refactor image classes and split them to smaller files.

This commit is contained in:
2018-07-23 23:25:43 +01:00
parent 55ca2d23b6
commit ed88989642
445 changed files with 50086 additions and 34342 deletions

View File

@@ -0,0 +1,77 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : BlindWrite4.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Disc image plugins.
//
// --[ Description ] ----------------------------------------------------------
//
// Manages BlindWrite 4 disc 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2018 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using System.IO;
using DiscImageChef.CommonTypes.Enums;
using DiscImageChef.CommonTypes.Interfaces;
using DiscImageChef.CommonTypes.Structs;
namespace DiscImageChef.DiscImages
{
// TODO: Too many unknowns, plus a completely unknown footer, to make this writable
public partial class BlindWrite4 : IMediaImage
{
List<Bw4TrackDescriptor> bwTracks;
IFilter dataFilter, subFilter;
Bw4Header header;
ImageInfo imageInfo;
Stream imageStream;
Dictionary<uint, ulong> offsetmap;
Dictionary<uint, byte> trackFlags;
public BlindWrite4()
{
imageInfo = new ImageInfo
{
ReadableSectorTags = new List<SectorTagType>(),
ReadableMediaTags = new List<MediaTagType>(),
HasPartitions = true,
HasSessions = true,
Version = null,
ApplicationVersion = null,
MediaTitle = null,
Creator = null,
MediaManufacturer = null,
MediaModel = null,
MediaPartNumber = null,
MediaSequence = 0,
LastMediaSequence = 0,
DriveManufacturer = null,
DriveModel = null,
DriveSerialNumber = null,
DriveFirmwareRevision = null
};
}
}
}

View File

@@ -0,0 +1,44 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Constants.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Disk image plugins.
//
// --[ Description ] ----------------------------------------------------------
//
// Contains constants for BlindWrite 4 disc 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2018 Natalia Portillo
// ****************************************************************************/
namespace DiscImageChef.DiscImages
{
public partial class BlindWrite4
{
/// <summary>"BLINDWRITE TOC FILE"</summary>
readonly byte[] bw4Signature =
{
0x42, 0x4C, 0x49, 0x4E, 0x44, 0x57, 0x52, 0x49, 0x54, 0x45, 0x20, 0x54, 0x4F, 0x43, 0x20, 0x46, 0x49, 0x4C,
0x45
};
}
}

View File

@@ -0,0 +1,44 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Enums.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Disk image plugins.
//
// --[ Description ] ----------------------------------------------------------
//
// Contains enumerations for BlindWrite 4 disc 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2018 Natalia Portillo
// ****************************************************************************/
namespace DiscImageChef.DiscImages
{
public partial class BlindWrite4
{
enum Bw4TrackType : byte
{
Audio = 0,
Mode1 = 1,
Mode2 = 2
}
}
}

View File

@@ -0,0 +1,53 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Identify.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Disk image plugins.
//
// --[ Description ] ----------------------------------------------------------
//
// Identifies BlindWrite 4 disc 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2018 Natalia Portillo
// ****************************************************************************/
using System.IO;
using System.Linq;
using DiscImageChef.CommonTypes.Interfaces;
namespace DiscImageChef.DiscImages
{
public partial class BlindWrite4
{
public bool Identify(IFilter imageFilter)
{
Stream stream = imageFilter.GetDataForkStream();
stream.Seek(0, SeekOrigin.Begin);
if(stream.Length < 19) return false;
byte[] signature = new byte[19];
stream.Read(signature, 0, 19);
return bw4Signature.SequenceEqual(signature);
}
}
}

View File

@@ -0,0 +1,58 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Properties.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Disk image plugins.
//
// --[ Description ] ----------------------------------------------------------
//
// Contains properties for BlindWrite 4 disc 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2018 Natalia Portillo
// ****************************************************************************/
using System;
using System.Collections.Generic;
using DiscImageChef.CommonTypes;
using DiscImageChef.CommonTypes.Structs;
using Schemas;
namespace DiscImageChef.DiscImages
{
public partial class BlindWrite4
{
public ImageInfo Info => imageInfo;
public string Name => "BlindWrite 4";
public Guid Id => new Guid("664568B2-15D4-4E64-8A7A-20BDA8B8386F");
public string Format => "BlindWrite 4 TOC file";
public List<Partition> Partitions { get; set; }
public List<Track> Tracks { get; set; }
public List<Session> Sessions { get; set; }
public List<DumpHardwareType> DumpHardware => null;
public CICMMetadataType CicmMetadata => null;
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,151 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : Structs.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Disk image plugins.
//
// --[ Description ] ----------------------------------------------------------
//
// Contains structures for BlindWrite 4 disc 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2018 Natalia Portillo
// ****************************************************************************/
using System.Runtime.InteropServices;
using DiscImageChef.CommonTypes.Interfaces;
namespace DiscImageChef.DiscImages
{
public partial class BlindWrite4
{
struct Bw4Header
{
public byte[] Signature;
public uint Unknown1;
public ulong Timestamp;
public uint VolumeIdLength;
public byte[] VolumeIdBytes;
public uint SysIdLength;
public byte[] SysIdBytes;
public uint CommentsLength;
public byte[] CommentsBytes;
public uint TrackDescriptors;
public uint DataFileLength;
public byte[] DataFileBytes;
public uint SubchannelFileLength;
public byte[] SubchannelFileBytes;
public uint Unknown2;
public byte Unknown3;
public byte[] Unknown4;
// On memory only
#pragma warning disable 649
public string VolumeIdentifier;
public string SystemIdentifier;
public string Comments;
public IFilter DataFilter;
public IFilter SubchannelFilter;
public string DataFile;
public string SubchannelFile;
#pragma warning restore 649
}
[StructLayout(LayoutKind.Sequential, Pack = 1)]
struct Bw4TrackDescriptor
{
public uint filenameLen;
public byte[] filenameBytes;
public uint offset;
public byte subchannel;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 3)]
public byte[] unknown1;
public uint unknown2;
public byte unknown3;
public byte session;
public byte unknown4;
public byte adrCtl;
public byte unknown5;
public Bw4TrackType trackMode;
public byte unknown6;
public byte point;
public uint unknown7;
public uint unknown8;
public uint unknown9;
public uint unknown10;
public ushort unknown11;
public uint lastSector;
public byte unknown12;
public int pregap;
public int startSector;
[MarshalAs(UnmanagedType.ByValArray, SizeConst = 2)]
public uint[] unknown13;
public uint titleLen;
public byte[] titleBytes;
public uint performerLen;
public byte[] performerBytes;
public uint unkStrLen1;
public byte[] unkStrBytes1;
public uint unkStrLen2;
public byte[] unkStrBytes2;
public uint unkStrLen3;
public byte[] unkStrBytes3;
public uint unkStrLen4;
public byte[] unkStrBytes4;
public uint discIdLen;
public byte[] discIdBytes;
public uint unkStrLen5;
public byte[] unkStrBytes5;
public uint unkStrLen6;
public byte[] unkStrBytes6;
public uint unkStrLen7;
public byte[] unkStrBytes7;
public uint unkStrLen8;
public byte[] unkStrBytes8;
public uint unkStrLen9;
public byte[] unkStrBytes9;
public uint unkStrLen10;
public byte[] unkStrBytes10;
public uint unkStrLen11;
public byte[] unkStrBytes11;
public uint isrcLen;
public byte[] isrcBytes;
// On memory only
public string filename;
public string title;
public string performer;
public string unkString1;
public string unkString2;
public string unkString3;
public string unkString4;
public string discId;
public string unkString5;
public string unkString6;
public string unkString7;
public string unkString8;
public string unkString9;
public string unkString10;
public string unkString11;
public string isrcUpc;
}
}
}