/// <inheritdoc /> public IEnumerable <ImprovableForListing> GetAllImprovableForListings() { if (_fileSystem.Exists(IMPROVABLES)) { var json = _fileSystem.ReadAllText(IMPROVABLES); return(_serializer.FromJson <IEnumerable <ImprovableForListing> >(json)); } else { return(new ImprovableForListing[0]); } }
/// <inheritdoc /> public IEnumerable <Deployment> GetAll() { if (!_fileSystem.Exists(_deploymentsFile)) { return(new Deployment[0]); } var json = _fileSystem.ReadAllText(_deploymentsFile); var deployments = _serializer.FromJson <IEnumerable <Deployment> >(json); return(deployments); }
public bool Exists(string filePath, long expectedFileSize, byte[] expectedHash) { try { return(_files.Exists(filePath, expectedFileSize, expectedHash)); } catch (Exception e) { throw new RemoteNodeException(_machine, e); } }
/// <inheritdoc /> public IEnumerable <NotificationChannel> GetAll() { if (!_fileSystem.Exists(_notificationChannelsFils)) { return(new NotificationChannel[0]); } var json = _fileSystem.ReadAllText(_notificationChannelsFils); var notificationChannels = _serializer.FromJson <IEnumerable <NotificationChannel> >(json); return(notificationChannels); }
long GetNextInSequenceFromFile(string file) { var sequence = 0L; if (_files.Exists(_configuration.Path, file)) { sequence = long.Parse(_files.ReadString(_configuration.Path, file)); } sequence++; _files.WriteString(_configuration.Path, file, sequence.ToString()); return(sequence); }
/// <summary> /// Initializes a new instance of <see cref="AllImprovables"/> /// </summary> public AllImprovables(IFiles fileSystem, ISerializer serializer) { _fileSystem = fileSystem; if (_fileSystem.Exists(_improvablesFile)) { var json = _fileSystem.ReadAllText(_improvablesFile); Query = serializer.FromJson <IEnumerable <ImprovableForListing> >(json).AsQueryable(); } else { Query = new ImprovableForListing[0].AsQueryable(); } }
/// <inheritdoc/> public EventSourceVersion GetFor(IApplicationResourceIdentifier eventSource, EventSourceId eventSourceId) { var fileName = GetFileNameFor(eventSource, eventSourceId); var version = EventSourceVersion.Zero; if (_files.Exists(_path, fileName)) { var versionAsString = _files.ReadString(_path, fileName); version = EventSourceVersion.FromCombined(double.Parse(versionAsString)); } else { version = _eventStore.GetVersionFor(eventSource, eventSourceId); } return(version); }
private bool Exists(string destinationFilePath, long expectedFileSize, byte[] expectedHash) { return(_files.Exists(destinationFilePath, expectedFileSize, expectedHash)); }