Add interfaces for logical block addressable sequential (aka streaming tapes) images.

This commit is contained in:
2019-04-30 22:49:32 +01:00
parent bba17b988c
commit 9f7da82b41
6 changed files with 237 additions and 0 deletions

View File

@@ -130,11 +130,13 @@
<e p="IPartitionableMediaImage.cs" t="Include" />
<e p="IPluginRegister.cs" t="Include" />
<e p="IReadOnlyFilesystem.cs" t="Include" />
<e p="ITapeImage.cs" t="Include" />
<e p="IVerifiableImage.cs" t="Include" />
<e p="IVerifiableSectorsImage.cs" t="Include" />
<e p="IWritableFloppyImage.cs" t="Include" />
<e p="IWritableImage.cs" t="Include" />
<e p="IWritableOpticalImage.cs" t="Include" />
<e p="IWritableTapeImage.cs" t="Include" />
</e>
<e p="Interop" t="Include">
<e p="DetectOS.cs" t="Include" />
@@ -158,6 +160,8 @@
<e p="Structs" t="Include">
<e p="Filesystems.cs" t="Include" />
<e p="Images.cs" t="Include" />
<e p="TapeFile.cs" t="Include" />
<e p="TapePartition.cs" t="Include" />
</e>
<e p="bin" t="ExcludeRecursive" />
<e p="obj" t="ExcludeRecursive">

View File

@@ -74,11 +74,13 @@
<Compile Include="Interfaces\IPartitionableMediaImage.cs" />
<Compile Include="Interfaces\IPluginRegister.cs" />
<Compile Include="Interfaces\IReadOnlyFilesystem.cs" />
<Compile Include="Interfaces\ITapeImage.cs" />
<Compile Include="Interfaces\IVerifiableImage.cs" />
<Compile Include="Interfaces\IVerifiableSectorsImage.cs" />
<Compile Include="Interfaces\IWritableFloppyImage.cs" />
<Compile Include="Interfaces\IWritableImage.cs" />
<Compile Include="Interfaces\IWritableOpticalImage.cs" />
<Compile Include="Interfaces\IWritableTapeImage.cs" />
<Compile Include="Interop\DetectOS.cs" />
<Compile Include="Interop\PlatformID.cs" />
<Compile Include="Interop\Version.cs" />
@@ -96,6 +98,8 @@
<Compile Include="PluginBase.cs" />
<Compile Include="Structs\Filesystems.cs" />
<Compile Include="Structs\Images.cs" />
<Compile Include="Structs\TapeFile.cs" />
<Compile Include="Structs\TapePartition.cs" />
</ItemGroup>
<ItemGroup>
<PackageReference Include="Newtonsoft.Json" Version="12.0.2" />

View File

@@ -0,0 +1,56 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : ITapeImage.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Disc image plugins.
//
// --[ Description ] ----------------------------------------------------------
//
// Defines interface to be implemented by block addressable sequential tape
// image plugins.
//
// --[ License ] --------------------------------------------------------------
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using System.Collections.Generic;
using DiscImageChef.CommonTypes.Structs;
namespace DiscImageChef.CommonTypes.Interfaces
{
public interface ITapeImage : IMediaImage
{
/// <summary>
/// Gets a list of all the files registered in the image
/// </summary>
List<TapeFile> Files { get; }
/// <summary>
/// Gets a list of all the partitions registered in the image
/// </summary>
List<TapePartition> Partitions { get; }
}
}

View File

@@ -0,0 +1,59 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : IWritableTapeImage.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Disc image plugins.
//
// --[ Description ] ----------------------------------------------------------
//
// Defines interface to be implemented by writable block addressable
// sequential tape image plugins.
//
// --[ License ] --------------------------------------------------------------
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
using DiscImageChef.CommonTypes.Structs;
namespace DiscImageChef.CommonTypes.Interfaces
{
public interface IWritableTapeImage : ITapeImage
{
/// <summary>
/// Registers a new file in the image
/// </summary>
/// <param name="file">Tape file descriptor</param>
/// <returns><c>true</c> if successful, <c>false</c> otherwise</returns>
bool AddFile(TapeFile file);
/// <summary>
/// Registers a new partition
/// </summary>
/// <param name="partition">Tape partition descriptor</param>
/// <returns><c>true</c> if successful, <c>false</c> otherwise</returns>
bool AddPartition(TapePartition partition);
}
}

View File

@@ -0,0 +1,59 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : TapeFile.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Disc image plugins.
//
// --[ Description ] ----------------------------------------------------------
//
// Defines a structure to hold information about a tape file object.
//
// --[ License ] --------------------------------------------------------------
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
namespace DiscImageChef.CommonTypes.Structs
{
public struct TapeFile
{
/// <summary>
/// File number
/// </summary>
public uint File;
/// <summary>
/// Partition number
/// </summary>
public byte Partition;
/// <summary>
/// First block, inclusive, of the file
/// </summary>
public ulong FirstBlock;
/// <summary>
/// Last block, inclusive, of the file
/// </summary>
public ulong LastBlock;
}
}

View File

@@ -0,0 +1,55 @@
// /***************************************************************************
// The Disc Image Chef
// ----------------------------------------------------------------------------
//
// Filename : TapeFile.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Disc image plugins.
//
// --[ Description ] ----------------------------------------------------------
//
// Defines a structure to hold information about a tape partition.
//
// --[ License ] --------------------------------------------------------------
//
// Permission is hereby granted, free of charge, to any person obtaining a
// copy of this software and associated documentation files (the
// "Software"), to deal in the Software without restriction, including
// without limitation the rights to use, copy, modify, merge, publish,
// distribute, sublicense, and/or sell copies of the Software, and to
// permit persons to whom the Software is furnished to do so, subject to
// the following conditions:
//
// The above copyright notice and this permission notice shall be included
// in all copies or substantial portions of the Software.
//
// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
// OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
// IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
// CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
// TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
// SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2019 Natalia Portillo
// ****************************************************************************/
namespace DiscImageChef.CommonTypes.Structs
{
public struct TapePartition
{
/// <summary>
/// Partition number
/// </summary>
public uint Number;
/// <summary>
/// First block, inclusive, of the partition
/// </summary>
public ulong FirstBlock;
/// <summary>
/// Last block, inclusive, of the partition
/// </summary>
public ulong LastBlock;
}
}