protected TSnapshot LoadSnapshot <TSnapshot>(FileSystemConnectionContext connectionContext) where TSnapshot : Snapshot { _fileSystem.CreateDirectoryIfItDoesntExist(connectionContext.DataRoot); var contractName = Activator.CreateInstance <TSnapshot>().ContractName; var info = _fileSystem.GetFileInfos(connectionContext.DataRoot, $"snapshot--{contractName}-*.json") .OrderByDescending(item => item.CreationTimeUtc) .FirstOrDefault(); if (info != null) { var contents = _fileSystem.ReadAllText(info.FullName); return(JsonConvert.DeserializeObject <TSnapshot>(contents)); } return(null); }
public int GetCurrentDay(FileSystemConnectionContext connectionContext) { var files = _fileSystemWrapper.GetFileInfos(connectionContext.DataRoot, "event--advance-day-*.json"); return(files != null ? files.Count : 0); }