Code/Runtime/SuiGeneratedFileManifest.cs
using System.Collections.Generic;
namespace SboxUiDesigner.Runtime;
/// <summary>
/// Manifest tracking which files were generated by this .sui document and
/// their content hashes at last write. Used by the compile pipeline to detect
/// hand-edits and conflicts before overwriting.
/// </summary>
public sealed class SuiGeneratedFileManifest
{
public List<SuiGeneratedFileEntry> GeneratedFiles { get; set; } = new();
public SuiGeneratedFileManifest Clone()
{
var clone = new SuiGeneratedFileManifest();
foreach ( var entry in GeneratedFiles )
clone.GeneratedFiles.Add( entry.Clone() );
return clone;
}
public SuiGeneratedFileEntry FindByPath( string path )
{
foreach ( var entry in GeneratedFiles )
{
if ( string.Equals( entry.Path, path, System.StringComparison.OrdinalIgnoreCase ) )
return entry;
}
return null;
}
}
/// <summary>
/// One entry in the manifest — represents a single file owned by this document.
/// </summary>
public sealed class SuiGeneratedFileEntry
{
public SuiGeneratedFileKind Kind { get; set; }
/// <summary>Project-relative path of the generated file.</summary>
public string Path { get; set; }
/// <summary>Sha256 of the file content at last successful write.</summary>
public string LastHash { get; set; }
/// <summary>DocumentId of the .sui that owns this file.</summary>
public string OwnedByDocumentId { get; set; }
/// <summary>Generator version string at last write.</summary>
public string GeneratorVersion { get; set; }
public SuiGeneratedFileEntry Clone() => new()
{
Kind = Kind,
Path = Path,
LastHash = LastHash,
OwnedByDocumentId = OwnedByDocumentId,
GeneratorVersion = GeneratorVersion,
};
}