public UpdateStorageConfigurationResult UpdateConfiguration(UpdateStorageConfigurationRequest request)
        {
            Platform.CheckForNullReference(request, "request");
            Platform.CheckForNullReference(request.Configuration, "Configuration");
            Platform.CheckForEmptyString(request.Configuration.FileStoreDirectory, "FileStoreDirectory");

            var newConfiguration = request.Configuration.Clone();

            //Trim before saving.
            newConfiguration.FileStoreDirectory = request.Configuration.FileStoreDirectory.Trim();
            Complete(newConfiguration);

            var storageSettings  = new StorageSettings();
            var deletionSettings = new StudyDeletionSettings();
            var storageProxy     = storageSettings.GetProxy();

            storageProxy.FileStoreDirectory      = newConfiguration.FileStoreDirectory;
            storageProxy.MinimumFreeSpacePercent = newConfiguration.MinimumFreeSpacePercent;
            storageProxy.Save();

            if (newConfiguration.DefaultDeletionRule == null)
            {
                deletionSettings.Reset();
                deletionSettings.Save();
            }
            else
            {
                var rule          = newConfiguration.DefaultDeletionRule;
                var deletionProxy = deletionSettings.GetProxy();
                deletionProxy.Enabled   = rule.Enabled;
                deletionProxy.TimeUnit  = rule.TimeUnit;
                deletionProxy.TimeValue = rule.TimeValue;
                deletionProxy.Save();
            }

            return(new UpdateStorageConfigurationResult());
        }
Exemple #2
0
 public void Save()
 {
     _settings.Save();
 }