NHSE/NHSE.Core/Hashing/FileHashInfo.cs
2026-01-13 16:02:58 -06:00

24 lines
641 B
C#

using System.Collections.Generic;
using System.Linq;
namespace NHSE.Core;
public sealed class FileHashInfo
{
private readonly IReadOnlyDictionary<uint, FileHashDetails> List;
public FileHashInfo(FileHashInfo dupe) : this(dupe.List.Values) { }
public FileHashInfo(IEnumerable<FileHashDetails> hashSets)
{
var list = new Dictionary<uint, FileHashDetails>();
foreach (var hashSet in hashSets)
list[hashSet.FileSize] = hashSet;
List = list;
}
public FileHashDetails? GetFile(string nameData)
{
return List.Values.FirstOrDefault(z => z.FileName == nameData);
}
}