Files
OpenNest/OpenNest/Document.cs
T
aj 51eea6d1e6 refactor: wire EditNestForm to use Document for save state
EditNestForm now holds a Document instead of a bare Nest field,
eliminating duplicated LastSavePath, LastSaveDate, and SaveAs logic.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
2026-04-06 00:05:16 -04:00

31 lines
683 B
C#

using OpenNest.IO;
using System;
using System.IO;
namespace OpenNest
{
public class Document
{
public Nest Nest { get; set; }
public DateTime LastSaveDate { get; private set; }
public string LastSavePath { get; private set; }
public string Name => Nest?.Name;
public bool HasSavePath => File.Exists(LastSavePath);
public void SaveAs(string path)
{
var name = Path.GetFileNameWithoutExtension(path);
Nest.Name = name;
LastSaveDate = DateTime.Now;
LastSavePath = path;
var writer = new NestWriter(Nest);
writer.Write(path);
}
}
}