24 行
852 B
C#
24 行
852 B
C#
using System.Text.Json.Serialization;
|
|
|
|
namespace UndoTree;
|
|
|
|
internal sealed record UndoTreeRecordCommand(string Kind, string Target, string Member, string Detail);
|
|
|
|
internal sealed record UndoTreeRecordNode(int Id, int Parent, string Label, DateTime Time, IReadOnlyList<UndoTreeRecordCommand> Commands, string Tag = "", bool Saved = false);
|
|
|
|
internal sealed record UndoTreeRecord(DateTime SavedAt, IReadOnlyList<UndoTreeRecordNode> Nodes)
|
|
{
|
|
[JsonIgnore]
|
|
public bool HasEdits => Nodes.Count > 1;
|
|
}
|
|
|
|
internal sealed record UndoTreeRecordFile(int Version, string ProjectPath, UndoTreeRecord? Previous, UndoTreeRecord? Current)
|
|
{
|
|
public const int CurrentVersion = 1;
|
|
|
|
[JsonIgnore]
|
|
public UndoTreeRecord? Latest => Current is { HasEdits: true } ? Current : Previous;
|
|
}
|
|
|
|
internal sealed record UndoTreeRecordUsage(int Count, long Bytes);
|