Remove unused code

This commit is contained in:
2021-08-17 16:47:47 +01:00
parent da4c666250
commit 770066e53f
29 changed files with 5 additions and 232 deletions

View File

@@ -456,26 +456,6 @@ namespace Aaru.Devices.Windows
return error;
}
/// <summary>Gets the device number for a specified handle</summary>
/// <param name="deviceHandle">Device handle</param>
/// <returns>Device number</returns>
static uint GetDeviceNumber(SafeFileHandle deviceHandle)
{
var sdn = new StorageDeviceNumber
{
deviceNumber = -1
};
uint k = 0;
if(!Extern.DeviceIoControlGetDeviceNumber(deviceHandle, WindowsIoctl.IoctlStorageGetDeviceNumber,
IntPtr.Zero, 0, ref sdn, (uint)Marshal.SizeOf(sdn), ref k,
IntPtr.Zero))
return uint.MaxValue;
return (uint)sdn.deviceNumber;
}
/// <summary>Returns true if the specified handle is controlled by a SFFDISK (aka SDHCI) driver</summary>
/// <param name="fd">Device handle</param>
/// <returns><c>true</c> if SDHCI, false otherwise</returns>

View File

@@ -50,7 +50,6 @@ namespace Aaru.Filesystems
/// <summary>Cached <see cref="FileSystemInfo" /></summary>
FileSystemInfo _cpmStat;
bool _debug;
/// <summary>Cached file passwords, decoded</summary>
Dictionary<string, byte[]> _decodedPasswordCache;

View File

@@ -57,11 +57,6 @@ namespace Aaru.Filesystems
_device = imagePlugin;
Encoding = encoding ?? Encoding.GetEncoding("IBM437");
options ??= GetDefaultOptions();
if(options.TryGetValue("debug", out string debugString))
bool.TryParse(debugString, out _debug);
// As the identification is so complex, just call Identify() and relay on its findings
if(!Identify(_device, partition) ||
!_cpmFound ||

View File

@@ -87,16 +87,13 @@ namespace Aaru.Filesystems.LisaFS
return Errno.NoError;
}
Errno ReadDir(short dirId, out List<string> contents)
{
void ReadDir(short dirId, out List<string> contents) =>
// Do same trick as Mac OS X, replace filesystem '/' with '-',
// as '-' is the path separator in Lisa OS
contents = (from entry in _catalogCache where entry.parentID == dirId
select StringHandlers.CToString(entry.filename, Encoding).Replace('/', '-')).ToList();
return Errno.NoError;
}
/// <summary>Reads, interprets and caches the Catalog File</summary>
Errno ReadCatalog()
{

View File

@@ -31,6 +31,7 @@
// ****************************************************************************/
using System;
using System.Diagnostics.CodeAnalysis;
using System.Text;
using Aaru.CommonTypes;
using Aaru.CommonTypes.Interfaces;

View File

@@ -549,12 +549,6 @@ namespace Aaru.Filters
/// <inheritdoc />
public override void Close() => _baseStream.Close();
new void Dispose()
{
_baseStream.Dispose();
base.Dispose();
}
/// <inheritdoc />
public override int EndRead(IAsyncResult asyncResult) => _baseStream.EndRead(asyncResult);

View File

@@ -263,17 +263,6 @@ namespace Aaru.Filters
_position = 0;
}
new void Dispose()
{
foreach(Stream stream in _baseStreams.Values)
stream.Dispose();
_baseStreams.Clear();
_position = 0;
base.Dispose();
}
/// <inheritdoc />
public override int EndRead(IAsyncResult asyncResult) =>
throw new NotSupportedException("Asynchronous I/O is not supported.");

View File

@@ -103,7 +103,6 @@
<Compile Include="AppleDOS\Unsupported.cs" />
<Compile Include="AppleDOS\Write.cs" />
<Compile Include="AppleNIB\Constants.cs" />
<Compile Include="AppleNIB\Helpers.cs" />
<Compile Include="AppleNIB\Identify.cs" />
<Compile Include="AppleNIB\Properties.cs" />
<Compile Include="AppleNIB\Read.cs" />

View File

@@ -308,15 +308,5 @@ namespace Aaru.DiscImages
return failingLbas.Count <= 0;
}
public bool? VerifySector(ulong sectorAddress, uint track)
{
if(_imageInfo.XmlMediaType != XmlMediaType.OpticalDisc)
return null;
byte[] buffer = ReadSectorLong(sectorAddress, track);
return CdChecksums.CheckCdSector(buffer);
}
}
}

View File

@@ -369,7 +369,7 @@ namespace Aaru.DiscImages
if(!_alcTracks.TryGetValue(alcSes.lastTrack, out Track endingTrack))
break;
if(!_alcTrackExtras.TryGetValue(alcSes.firstTrack, out TrackExtra startingTrackExtra))
if(!_alcTrackExtras.TryGetValue(alcSes.firstTrack, out _))
break;
if(!_alcTrackExtras.TryGetValue(alcSes.lastTrack, out TrackExtra endingTrackExtra))

View File

@@ -113,12 +113,5 @@ namespace Aaru.DiscImages
return failingLbas.Count <= 0;
}
public bool? VerifySector(ulong sectorAddress, uint track)
{
byte[] buffer = ReadSectorLong(sectorAddress, track);
return CdChecksums.CheckCdSector(buffer);
}
}
}

View File

@@ -1,49 +0,0 @@
// /***************************************************************************
// Aaru Data Preservation Suite
// ----------------------------------------------------------------------------
//
// Filename : Helpers.cs
// Author(s) : Natalia Portillo <claunia@claunia.com>
//
// Component : Disk image plugins.
//
// --[ Description ] ----------------------------------------------------------
//
// Contains helpers for Apple nibbelized 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/>.
//
// ----------------------------------------------------------------------------
// Copyright © 2011-2021 Natalia Portillo
// ****************************************************************************/
using Aaru.CommonTypes;
namespace Aaru.DiscImages
{
public sealed partial class AppleNib
{
MediaType GetMediaType()
{
switch(_imageInfo.Sectors)
{
case 455: return MediaType.Apple32SS;
case 560: return MediaType.Apple33SS;
default: return MediaType.Unknown;
}
}
}
}

View File

@@ -113,12 +113,5 @@ namespace Aaru.DiscImages
return failingLbas.Count <= 0;
}
public bool? VerifySector(ulong sectorAddress, uint track)
{
byte[] buffer = ReadSectorLong(sectorAddress, track);
return CdChecksums.CheckCdSector(buffer);
}
}
}

View File

@@ -113,12 +113,5 @@ namespace Aaru.DiscImages
return failingLbas.Count <= 0;
}
public bool? VerifySector(ulong sectorAddress, uint track)
{
byte[] buffer = ReadSectorLong(sectorAddress, track);
return CdChecksums.CheckCdSector(buffer);
}
}
}

View File

@@ -37,22 +37,6 @@ namespace Aaru.DiscImages
{
public sealed partial class Cdrdao
{
static ushort CdrdaoTrackTypeToBytesPerSector(string trackType)
{
switch(trackType)
{
case CDRDAO_TRACK_TYPE_MODE1:
case CDRDAO_TRACK_TYPE_MODE2_FORM1: return 2048;
case CDRDAO_TRACK_TYPE_MODE2_FORM2: return 2324;
case CDRDAO_TRACK_TYPE_MODE2:
case CDRDAO_TRACK_TYPE_MODE2_MIX: return 2336;
case CDRDAO_TRACK_TYPE_AUDIO:
case CDRDAO_TRACK_TYPE_MODE1_RAW:
case CDRDAO_TRACK_TYPE_MODE2_RAW: return 2352;
default: return 0;
}
}
static ushort CdrdaoTrackTypeToCookedBytesPerSector(string trackType)
{
switch(trackType)

View File

@@ -113,12 +113,5 @@ namespace Aaru.DiscImages
return failingLbas.Count <= 0;
}
public bool? VerifySector(ulong sectorAddress, uint track)
{
byte[] buffer = ReadSectorLong(sectorAddress, track);
return CdChecksums.CheckCdSector(buffer);
}
}
}

View File

@@ -224,12 +224,5 @@ namespace Aaru.DiscImages
return failingLbas.Count <= 0;
}
public bool? VerifySector(ulong sectorAddress, uint track)
{
byte[] buffer = ReadSectorLong(sectorAddress, track);
return CdChecksums.CheckCdSector(buffer);
}
}
}

View File

@@ -153,13 +153,5 @@ namespace Aaru.DiscImages
return _expectedChecksum.SequenceEqual(calculated);
}
public bool? VerifySector(ulong sectorAddress, uint track)
{
if(_isHdd)
throw new FeaturedNotSupportedByDiscImageException("Cannot access optical tracks on a hard disk image");
return VerifySector(GetAbsoluteSector(sectorAddress, track));
}
}
}

View File

@@ -39,8 +39,5 @@ namespace Aaru.DiscImages
static long MsfToLba((byte minute, byte second, byte frame) msf) =>
(msf.minute * 60 * 75) + (msf.second * 75) + msf.frame - 150;
static (byte minute, byte second, byte frame) LbaToMsf(ulong sector) =>
((byte)((sector + 150) / 75 / 60), (byte)((sector + 150) / 75 % 60), (byte)((sector + 150) % 75));
}
}

View File

@@ -113,12 +113,5 @@ namespace Aaru.DiscImages
return failingLbas.Count <= 0;
}
public bool? VerifySector(ulong sectorAddress, uint track)
{
byte[] buffer = ReadSectorLong(sectorAddress, track);
return CdChecksums.CheckCdSector(buffer);
}
}
}

View File

@@ -113,12 +113,5 @@ namespace Aaru.DiscImages
return failingLbas.Count <= 0;
}
public bool? VerifySector(ulong sectorAddress, uint track)
{
byte[] buffer = ReadSectorLong(sectorAddress, track);
return CdChecksums.CheckCdSector(buffer);
}
}
}

View File

@@ -70,12 +70,6 @@ namespace Aaru.DiscImages
/// </summary>
public sealed partial class DiskDupe : IMediaImage
{
/// <summary>Every track that has been read is cached here</summary>
readonly Dictionary<int, byte[]> _trackCache = new Dictionary<int, byte[]>();
/// <summary>The offset in the file where each track starts, or -1 if the track is not present</summary>
readonly Dictionary<int, long> _trackOffset = new Dictionary<int, long>();
/// <summary>The DDI file header after the image has been opened</summary>
FileHeader _fileHeader;

View File

@@ -42,12 +42,6 @@ namespace Aaru.DiscImages
{
public sealed partial class DiskDupe
{
public List<Partition> Partitions =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
public List<Track> Tracks =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
public List<Session> Sessions =>
throw new FeatureUnsupportedImageException("Feature not supported by image format");
/// <inheritdoc />
public string Name => "DiskDupe DDI Disk Image";
/// <inheritdoc />

View File

@@ -113,12 +113,5 @@ namespace Aaru.DiscImages
return failingLbas.Count <= 0;
}
public bool? VerifySector(ulong sectorAddress, uint track)
{
byte[] buffer = ReadSectorLong(sectorAddress, track);
return CdChecksums.CheckCdSector(buffer);
}
}
}

View File

@@ -46,13 +46,6 @@ namespace Aaru.DiscImages
return CdChecksums.CheckCdSector(buffer);
}
public bool? VerifySector(ulong sectorAddress, uint track)
{
byte[] buffer = ReadSectorLong(sectorAddress, track);
return CdChecksums.CheckCdSector(buffer);
}
/// <inheritdoc />
public bool? VerifySectors(ulong sectorAddress, uint length, out List<ulong> failingLbas,
out List<ulong> unknownLbas)

View File

@@ -464,9 +464,6 @@ namespace Aaru.DiscImages
_blockAllocationTable = new uint[_thisDynamic.MaxTableEntries];
// How many sectors uses the BAT
int batSectorCount = (int)Math.Ceiling((double)_thisDynamic.MaxTableEntries * 4 / 512);
byte[] bat = new byte[_thisDynamic.MaxTableEntries * 4];
imageStream.Seek((long)_thisDynamic.TableOffset, SeekOrigin.Begin);
imageStream.Read(bat, 0, bat.Length);

View File

@@ -48,12 +48,5 @@ namespace Aaru.DiscImages
return (_sectorBitmap[index] & val) == val;
}
static uint VhdxChecksum(IEnumerable<byte> data)
{
uint checksum = data.Aggregate<byte, uint>(0, (current, b) => current + b);
return ~checksum;
}
}
}

View File

@@ -139,15 +139,5 @@ namespace Aaru.DiscImages
return failingLbas.Count <= 0;
}
public bool? VerifySector(ulong sectorAddress, uint track)
{
if(!_rawCompactDisc)
return null;
byte[] buffer = ReadSectorLong(sectorAddress, track);
return CdChecksums.CheckCdSector(buffer);
}
}
}