Adds the media library scan snapshot, staging and directory fingerprint data model

This commit is contained in:
BinaryAlley committed 2026-08-09 13:17:34 -07:00
1 parent 4fec67a1f8
commit 1dc3da3da1
37 files changed
+7315 -89

No files matched your search

@@ -1,14 +0,0 @@
#region ========================================================================= USING =====================================================================================
using System.Diagnostics;
using System.IO;
#endregion
namespace Lumina.Application.Common.Infrastructure.Models.MediaLibraryScanJobPayloads;
/// <summary>
/// Represents an item for the payload of the file hashing media library scan job.
/// </summary>
/// <param name="File">The file to whom <paramref name="FileHash"/> belongs.</param>
/// <param name="FileHash">The hash of <paramref name="File"/>.</param>
[DebuggerDisplay("File: {File}; FileHash: {FileHash}")]
public record ChangedFileSystemFile(FileInfo File, ulong FileHash);
@@ -0,0 +1,70 @@
#region ========================================================================= USING =====================================================================================
using System;
using System.Diagnostics;
using System.Runtime.InteropServices;
#endregion
namespace Lumina.Application.Common.Infrastructure.Models.MediaLibraryScanJobPayloads;
/// <summary>
/// Represents an item for the payload of the file hashing media library scan job.
/// </summary>
[DebuggerDisplay("Path = {Path}, CurrentHash = {CurrentHash}, OldHash = {OldHash}, Ticks = {Ticks}, Size = {Size}")]
[StructLayout(LayoutKind.Sequential)]
public struct HashedFileSystemFile : IEquatable<HashedFileSystemFile>
{
/// <summary>
/// The path of the file system file.
/// </summary>
public string Path { get; set; }
/// <summary>
/// The size of the file system file.
/// </summary>
public long Size { get; set; }
/// <summary>
/// The current hash obtained by sampling the file system file contents.
/// </summary>
public ulong CurrentHash { get; set; }
/// <summary>
/// The old hash of the file system file, stored at the previous scan.
/// </summary>
public ulong OldHash { get; set; }
/// <summary>
/// The time and date when the file system file was last modified, stored in ticks.
/// </summary>
public long Ticks { get; set; }
/// <inheritdoc/>
public readonly bool Equals(HashedFileSystemFile other)
{
return Size == other.Size && CurrentHash == other.CurrentHash && OldHash == other.OldHash && Ticks == other.Ticks && Path == other.Path;
}
/// <inheritdoc/>
public override readonly bool Equals(object? obj)
{
return obj is HashedFileSystemFile item && Equals(item);
}
/// <inheritdoc/>
public static bool operator ==(HashedFileSystemFile left, HashedFileSystemFile right)
{
return left.Equals(right);
}
/// <inheritdoc/>
public static bool operator !=(HashedFileSystemFile left, HashedFileSystemFile right)
{
return !(left == right);
}
/// <inheritdoc/>
public override readonly int GetHashCode()
{
return HashCode.Combine(Size, CurrentHash, OldHash, Ticks, Path);
}
}