示例#1
0
 /// <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);
        }
示例#3
0
 public bool Exists(string filePath, long expectedFileSize, byte[] expectedHash)
 {
     try
     {
         return(_files.Exists(filePath, expectedFileSize, expectedHash));
     }
     catch (Exception e)
     {
         throw new RemoteNodeException(_machine, e);
     }
 }
示例#4
0
        /// <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);
        }
示例#5
0
        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();
     }
 }
示例#7
0
        /// <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);
        }
示例#8
0
 private bool Exists(string destinationFilePath, long expectedFileSize, byte[] expectedHash)
 {
     return(_files.Exists(destinationFilePath, expectedFileSize, expectedHash));
 }