NHSE/NHSE.Core/Hashing/FileHashInfo.cs
2020-03-31 17:44:20 -07:00

25 lines
763 B
C#

using System.Collections.Generic;
using System.Linq;
namespace NHSE.Core
{
#pragma warning disable CA2237 // Mark ISerializable types with serializable
public sealed class FileHashInfo : Dictionary<uint, FileHashDetails>
#pragma warning restore CA2237 // Mark ISerializable types with serializable
{
public readonly uint RevisionId; // Custom to us
public FileHashInfo(uint revisionId, FileHashDetails[] hashSets)
{
RevisionId = revisionId;
foreach (var hashSet in hashSets)
this[hashSet.FileSize] = hashSet;
}
public FileHashDetails? GetFile(string nameData)
{
return this.FirstOrDefault(z => z.Value.FileName == nameData).Value;
}
}
}