mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
* FileSystemIDandChk/ArrayFill.cs:
* FileSystemIDandChk/FileSystemIDandChk.csproj: Added array filling class from mykohsu. * FileSystemIDandChk/Main.cs: Print disk type as identified by image plugin * FileSystemIDandChk/ImagePlugins/ImagePlugin.cs: Added more disk types * FileSystemIDandChk/ImagePlugins/TeleDisk.cs: Added link to Dave's document. Completely implemented OpenImage() for standard (non-compressed) teledisk images. Implemented GetImageSize(), GetSectors(), GetSectorSize(), ReadSectors(), GetImageVersion(), GetImageApplicationVersion(), GetImageCreationTime(), GetImageLastModificationtime(), GetImageName(), GetDiskType(), data sector decoders. * FileSystemIDandChk/TODO: Discovered a filesystem specification present on ECMA-67. Dunno if CP/M, FAT or a different one, must check. Teledisk plugin is working, but lacks "advanced compression" and variable sectors per track support.
This commit is contained in:
70
FileSystemIDandChk/ArrayFill.cs
Normal file
70
FileSystemIDandChk/ArrayFill.cs
Normal file
@@ -0,0 +1,70 @@
|
||||
/***************************************************************************
|
||||
FileSystem identifier and checker
|
||||
----------------------------------------------------------------------------
|
||||
|
||||
Filename : ArrayFill.cs
|
||||
Version : 1.0
|
||||
Author(s) : https://github.com/mykohsu
|
||||
|
||||
Component : Helpers
|
||||
|
||||
Revision : $Revision$
|
||||
Last change by : $Author$
|
||||
Date : $Date$
|
||||
|
||||
--[ Description ] ----------------------------------------------------------
|
||||
|
||||
Fills an array with a
|
||||
|
||||
--[ License ] --------------------------------------------------------------
|
||||
|
||||
No license specified by creator.
|
||||
|
||||
Published on https://github.com/mykohsu/Extensions/blob/master/ArrayExtensions.cs
|
||||
|
||||
Assuming open source.
|
||||
|
||||
----------------------------------------------------------------------------
|
||||
Copyright (C) 2014 mykohsu
|
||||
****************************************************************************/
|
||||
//$Id$
|
||||
using System;
|
||||
|
||||
namespace FileSystemIDandChk
|
||||
{
|
||||
public static class ArrayHelpers
|
||||
{
|
||||
public static void ArrayFill<T>(T[] destinationArray, T value)
|
||||
{
|
||||
// if called with a single value, wrap the value in an array and call the main function
|
||||
ArrayFill<T>(destinationArray, new T[] { value });
|
||||
}
|
||||
|
||||
public static void ArrayFill<T>(T[] destinationArray, T[] value)
|
||||
{
|
||||
if (destinationArray == null)
|
||||
{
|
||||
throw new ArgumentNullException("destinationArray");
|
||||
}
|
||||
|
||||
if (value.Length > destinationArray.Length)
|
||||
{
|
||||
throw new ArgumentException("Length of value array must not be more than length of destination");
|
||||
}
|
||||
|
||||
// set the initial array value
|
||||
Array.Copy(value, destinationArray, value.Length);
|
||||
|
||||
int arrayToFillHalfLength = destinationArray.Length / 2;
|
||||
int copyLength;
|
||||
|
||||
for(copyLength = value.Length; copyLength < arrayToFillHalfLength; copyLength <<= 1)
|
||||
{
|
||||
Array.Copy(destinationArray, 0, destinationArray, copyLength, copyLength);
|
||||
}
|
||||
|
||||
Array.Copy(destinationArray, 0, destinationArray, copyLength, destinationArray.Length - copyLength);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user