示例#1
0
 public async Task <FeatureFlags> GetAsync()
 {
     using (var stream = await _storage.GetFileAsync(CoreConstants.Folders.ContentFolderName, CoreConstants.FeatureFlagsFileName))
     {
         return(ReadFeatureFlagsFromStream(stream));
     }
 }
 public async Task <FeatureFlags> GetAsync()
 {
     using (var stream = await _storage.GetFileAsync(CoreConstants.Folders.ContentFolderName, CoreConstants.FeatureFlagsFileName))
         using (var streamReader = new StreamReader(stream))
             using (var reader = new JsonTextReader(streamReader))
             {
                 return(Serializer.Deserialize <FeatureFlags>(reader));
             }
 }
示例#3
0
        public async Task <string> DownloadReadmeFileAsync(Package package)
        {
            if (package == null)
            {
                throw new ArgumentNullException(nameof(package));
            }

            var fileName = BuildReadmeFileName(package);

            using (var readmeFileStream = await _fileStorageService.GetFileAsync(_metadata.PackageContentFolderName, fileName))
            {
                if (readmeFileStream != null)
                {
                    using (var readMeMdReader = new StreamReader(readmeFileStream))
                    {
                        return(await readMeMdReader.ReadToEndAsync());
                    }
                }
            }
            return(null);
        }
示例#4
0
        public async Task <bool> IsHealthyAsync()
        {
            using (var stream = await _storage.GetFileAsync(_config.ContainerName, _config.StatusBlobName))
                using (var reader = new StreamReader(stream))
                {
                    var json = await reader.ReadToEndAsync();

                    var status    = JsonConvert.DeserializeObject <ServiceStatus>(json);
                    var component = status.ServiceRootComponent.GetByPath(_config.ComponentPath);

                    if (component == null)
                    {
                        _logger.LogError(
                            "Assuming that the service is unhealthy as the component path {ComponentPath} could not be found",
                            _config.ComponentPath);

                        return(false);
                    }

                    return(component.Status == ComponentStatus.Up);
                }
        }
        public Task <Stream> DownloadPackageFileAsync(Package package)
        {
            var fileName = BuildFileName(package, _metadata.FileSavePathTemplate, _metadata.FileExtension);

            return(_fileStorageService.GetFileAsync(_metadata.FileFolderName, fileName));
        }
示例#6
0
        public Task <Stream> DownloadPackageFileAsync(Package package)
        {
            var fileName = BuildFileName(package, CoreConstants.PackageFileSavePathTemplate, CoreConstants.NuGetPackageFileExtension);

            return(_fileStorageService.GetFileAsync(CoreConstants.PackagesFolderName, fileName));
        }
        public Task <Stream> DownloadLicenseFileAsync(Package package)
        {
            var fileName = BuildLicenseFileName(package);

            return(_fileStorageService.GetFileAsync(_metadata.PackageContentFolderName, fileName));
        }