using System;
using SabreTools.Hashing;
namespace SabreTools.DatFiles
{
///
/// Depot information wrapper
///
public class DepotInformation : ICloneable
{
///
/// Name or path of the Depot
///
public string? Name { get; }
///
/// Whether to use this Depot or not
///
public bool IsActive { get; }
///
/// Depot byte-depth
///
public int Depth { get; }
///
/// Constructor
///
/// Set active state
/// Set depth between 0 and SHA-1's byte length
public DepotInformation(bool isActive, int depth)
: this(null, isActive, depth)
{
}
///
/// Constructor
///
/// Identifier for the depot
/// Set active state
/// Set depth between 0 and SHA-1's byte length
public DepotInformation(string? name, bool isActive, int depth)
{
Name = name;
IsActive = isActive;
Depth = depth;
// Limit depth value
if (Depth == Int32.MinValue)
Depth = 4;
else if (Depth < 0)
Depth = 0;
else if (Depth > ZeroHash.SHA1Arr.Length)
Depth = ZeroHash.SHA1Arr.Length;
}
#region Cloning
///
/// Clone the current object
///
public object Clone() => new DepotInformation(Name, IsActive, Depth);
#endregion
}
}