public ISnapshotWriter CreateWriter(string potName) { PotDirectory potDirectory = PotDirectory.FromPotName(potName); if (!potDirectory.IsValid) { throw new Exception($"There is no pot with name '{potName}'."); } SnapshotFile snapshotFile = potDirectory.CreateSnapshotFile(DateTime.UtcNow); JSnapshotWriter jSnapshotWriter = snapshotFile.OpenWriter(); return(new JsonSnapshotWriter(jSnapshotWriter)); }
public void Add(string potName, Snapshot snapshot) { PotDirectory potDirectory = PotDirectory.FromPotName(potName); if (!potDirectory.IsValid) { throw new Exception($"There is no pot with name '{potName}'."); } SnapshotFile snapshotFile = potDirectory.CreateSnapshotFile(snapshot.CreationTime); snapshotFile.Open(); snapshotFile.Snapshot = snapshot.ToJSnapshot(); snapshotFile.Save(); }