This commit is contained in:
Matt Nadareski
2020-06-05 22:26:44 -07:00
parent 916d2a3b51
commit ac2a9fabb7
37 changed files with 722 additions and 269 deletions

View File

@@ -21,6 +21,7 @@ namespace SabreTools.Library.FileTypes
public long? Size { get; set; }
public byte[] CRC { get; set; }
public byte[] MD5 { get; set; }
public byte[] RIPEMD160 { get; set; }
public byte[] SHA1 { get; set; }
public byte[] SHA256 { get; set; }
public byte[] SHA384 { get; set; }
@@ -49,13 +50,13 @@ namespace SabreTools.Library.FileTypes
if (getHashes)
{
BaseFile temp = Utilities.GetFileInfo(this.Filename);
if (temp != null)
{
this.Parent = temp.Parent;
this.Date = temp.Date;
this.CRC = temp.CRC;
this.MD5 = temp.MD5;
this.RIPEMD160 = temp.RIPEMD160;
this.SHA1 = temp.SHA1;
this.SHA256 = temp.SHA256;
this.SHA384 = temp.SHA384;
@@ -77,13 +78,13 @@ namespace SabreTools.Library.FileTypes
if (getHashes)
{
BaseFile temp = Utilities.GetStreamInfo(stream, stream.Length);
if(temp != null)
{
this.Parent = temp.Parent;
this.Date = temp.Date;
this.CRC = temp.CRC;
this.MD5 = temp.MD5;
this.RIPEMD160 = temp.RIPEMD160;
this.SHA1 = temp.SHA1;
this.SHA256 = temp.SHA256;
this.SHA384 = temp.SHA384;
@@ -93,31 +94,6 @@ namespace SabreTools.Library.FileTypes
}
/// <summary>
/// Create a new BaseFile from the given metadata
/// </summary>
/// <param name="filename">Name of the file to use</param>
/// <param name="parent">Parent folder or archive</param>
/// <param name="date">File date</param>
/// <param name="crc">CRC hash as a byte array</param>
/// <param name="md5">MD5 hash as a byte array</param>
/// <param name="sha1">SHA-1 hash as a byte array</param>
/// <param name="sha256">SHA-256 hash as a byte array</param>
/// <param name="sha384">SHA-384 hash as a byte array</param>
/// <param name="sha512">SHA-512 hash as a byte array</param>
public BaseFile(string filename, string parent, string date, byte[] crc, byte[] md5, byte[] sha1, byte[] sha256, byte[] sha384, byte[] sha512)
{
this.Filename = filename;
this.Parent = parent;
this.Date = date;
this.CRC = crc;
this.MD5 = md5;
this.SHA1 = sha1;
this.SHA256 = sha256;
this.SHA384 = sha384;
this.SHA512 = sha512;
}
#endregion
}
}