mirror of
https://github.com/aaru-dps/Aaru.Server.git
synced 2025-12-16 19:24:27 +00:00
REFACTOR: Final cleanup of DiscImageChef.Helpers.
This commit is contained in:
@@ -32,7 +32,7 @@ namespace DiscImageChef
|
||||
public static partial class ArrayHelpers
|
||||
{
|
||||
/// <summary>
|
||||
/// Fills an array with the specified value
|
||||
/// Fills an array with the specified value
|
||||
/// </summary>
|
||||
/// <param name="destinationArray">Array</param>
|
||||
/// <param name="value">Value</param>
|
||||
@@ -44,7 +44,7 @@ namespace DiscImageChef
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fills an array with the contents of the specified array
|
||||
/// Fills an array with the contents of the specified array
|
||||
/// </summary>
|
||||
/// <param name="destinationArray">Array</param>
|
||||
/// <param name="value">Value</param>
|
||||
@@ -53,7 +53,8 @@ namespace DiscImageChef
|
||||
{
|
||||
if(destinationArray == null) throw new ArgumentNullException(nameof(destinationArray));
|
||||
|
||||
if(value.Length > destinationArray.Length) throw new ArgumentException("Length of value array must not be more than length of destination");
|
||||
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);
|
||||
@@ -61,13 +62,14 @@ namespace DiscImageChef
|
||||
int arrayToFillHalfLength = destinationArray.Length / 2;
|
||||
int copyLength;
|
||||
|
||||
for(copyLength = value.Length; copyLength < arrayToFillHalfLength; copyLength <<= 1) Array.Copy(destinationArray, 0, destinationArray, copyLength, 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);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a byte array to its hexadecimal representation
|
||||
/// Converts a byte array to its hexadecimal representation
|
||||
/// </summary>
|
||||
/// <param name="array">Byte array</param>
|
||||
/// <param name="upper"><c>true</c> to use uppercase</param>
|
||||
|
||||
Reference in New Issue
Block a user