2017-08-08 13:40:32 +01:00
|
|
|
|
// /***************************************************************************
|
2020-02-27 12:31:25 +00:00
|
|
|
|
// Aaru Data Preservation Suite
|
2017-08-08 13:40:32 +01:00
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// Filename : LinearMedia.cs
|
2017-12-19 03:50:57 +00:00
|
|
|
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
2017-08-08 13:40:32 +01:00
|
|
|
|
//
|
2017-12-19 03:50:57 +00:00
|
|
|
|
// Component : Core algorithms.
|
2017-08-08 13:40:32 +01:00
|
|
|
|
//
|
|
|
|
|
|
// --[ Description ] ----------------------------------------------------------
|
|
|
|
|
|
//
|
2017-12-19 03:50:57 +00:00
|
|
|
|
// Contains logic to create sidecar from a linear media dump.
|
2017-08-08 13:40:32 +01:00
|
|
|
|
//
|
|
|
|
|
|
// --[ License ] --------------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
|
|
// it under the terms of the GNU General Public License as
|
|
|
|
|
|
// published by the Free Software Foundation, either version 3 of the
|
|
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
|
|
//
|
|
|
|
|
|
// This program 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 General Public License for more details.
|
|
|
|
|
|
//
|
|
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
//
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2024-12-19 10:45:18 +00:00
|
|
|
|
// Copyright © 2011-2025 Natalia Portillo
|
2017-08-08 13:40:32 +01:00
|
|
|
|
// ****************************************************************************/
|
2017-12-19 03:50:57 +00:00
|
|
|
|
|
2017-12-21 14:30:38 +00:00
|
|
|
|
using System;
|
2017-08-08 13:40:32 +01:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
using System.IO;
|
2017-12-26 06:05:12 +00:00
|
|
|
|
using System.Text;
|
2023-10-05 13:47:59 +01:00
|
|
|
|
using Aaru.CommonTypes;
|
2022-12-15 22:21:07 +00:00
|
|
|
|
using Aaru.CommonTypes.AaruMetadata;
|
2020-02-27 00:33:26 +00:00
|
|
|
|
using Aaru.CommonTypes.Interfaces;
|
2017-08-08 13:40:32 +01:00
|
|
|
|
|
2023-10-05 01:05:23 +01:00
|
|
|
|
// ReSharper disable UnusedParameter.Local
|
|
|
|
|
|
|
2022-11-15 15:58:43 +00:00
|
|
|
|
namespace Aaru.Core;
|
|
|
|
|
|
|
2021-11-14 01:38:37 +00:00
|
|
|
|
public sealed partial class Sidecar
|
2017-08-08 13:40:32 +01:00
|
|
|
|
{
|
2021-11-14 01:38:37 +00:00
|
|
|
|
// TODO: Complete it
|
|
|
|
|
|
/// <summary>Creates a metadata sidecar for linear media (e.g. ROM chip)</summary>
|
|
|
|
|
|
/// <param name="image">Image</param>
|
|
|
|
|
|
/// <param name="filterId">Filter uuid</param>
|
|
|
|
|
|
/// <param name="imagePath">Image path</param>
|
|
|
|
|
|
/// <param name="fi">Image file information</param>
|
|
|
|
|
|
/// <param name="plugins">Image plugins</param>
|
|
|
|
|
|
/// <param name="imgChecksums">List of image checksums</param>
|
|
|
|
|
|
/// <param name="sidecar">Metadata sidecar</param>
|
|
|
|
|
|
/// <param name="encoding">Encoding to be used for filesystem plugins</param>
|
2024-05-01 04:39:38 +01:00
|
|
|
|
static void LinearMedia(IByteAddressableImage image, Guid filterId, string imagePath, FileInfo fi,
|
|
|
|
|
|
PluginRegister plugins, List<CommonTypes.AaruMetadata.Checksum> imgChecksums,
|
|
|
|
|
|
ref Metadata sidecar, Encoding encoding) => sidecar.LinearMedias =
|
2025-11-24 19:38:40 +00:00
|
|
|
|
[
|
|
|
|
|
|
new LinearMedia
|
|
|
|
|
|
{
|
|
|
|
|
|
Checksums = imgChecksums,
|
|
|
|
|
|
Image = new Image
|
|
|
|
|
|
{
|
|
|
|
|
|
Format = image.Format,
|
|
|
|
|
|
Offset = 0,
|
|
|
|
|
|
Value = Path.GetFileName(imagePath)
|
|
|
|
|
|
},
|
|
|
|
|
|
Size = image.Info.Sectors
|
|
|
|
|
|
}
|
|
|
|
|
|
];
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|