Пример #1
0
        private async Task SaveAsync(PackageMonitoringStatus status, CancellationToken token)
        {
            var storage = GetStorage(status.State);

            var packageStatusJson = JsonConvert.SerializeObject(status, JsonSerializerUtility.SerializerSettings);
            var storageContent    = new StringStorageContent(packageStatusJson, "application/json");

            var packageUri = GetPackageUri(storage, status.Package);

            await storage.SaveAsync(packageUri, storageContent, token);
        }
        public static void UpdateFromExisting(PackageMonitoringStatus status, PackageMonitoringStatus existingStatus)
        {
            foreach (var state in Enum.GetValues(typeof(PackageState)).Cast <PackageState>())
            {
                status.ExistingState[state] = AccessCondition.GenerateIfNotExistsCondition();
            }

            if (existingStatus != null)
            {
                status.ExistingState[existingStatus.State] = existingStatus.AccessCondition;
            }
        }
Пример #3
0
        public async Task UpdateAsync(PackageMonitoringStatus status, CancellationToken token)
        {
            // Save the new status first.
            // If we save it after deleting the existing status, the save could fail and then we'd lose the data.
            await SaveAsync(status, token);

            foreach (int stateInt in _packageStateValues)
            {
                var state = (PackageState)stateInt;
                if (state != status.State)
                {
                    // Delete the existing status.
                    await DeleteAsync(status.Package, state, token);
                }
            }
        }
Пример #4
0
 public PackageValidatorContext(PackageMonitoringStatus status)
     : this(status.Package, status.ValidationResult?.CatalogEntries)
 {
 }