コード例 #1
0
        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));
        }
コード例 #2
0
        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();
        }