Exemplo n.º 1
0
        public static StorageConfiguration GetConfiguration()
        {
            StorageConfiguration configuration = null;

            Platform.GetService <IStorageConfiguration>(
                s => configuration = s.GetConfiguration(new GetStorageConfigurationRequest()).Configuration);
            return(configuration);
        }
Exemplo n.º 2
0
 public static void UpdateConfiguration(StorageConfiguration configuration)
 {
     Platform.GetService <IStorageConfiguration>(
         s => s.UpdateConfiguration(new UpdateStorageConfigurationRequest
     {
         Configuration = configuration
     }));
 }
        // TODO (CR Jun 2012): Move to a helper class?

        #region Implementation of IStorageConfiguration

        public GetStorageConfigurationResult GetConfiguration(GetStorageConfigurationRequest request)
        {
            var storageSettings  = new StorageSettings();
            var deletionSettings = new StudyDeletionSettings();

            var configuration = new StorageConfiguration
            {
                FileStoreDirectory      = storageSettings.FileStoreDirectory,
                MinimumFreeSpacePercent = storageSettings.MinimumFreeSpacePercent,

                DefaultDeletionRule = new StorageConfiguration.DeletionRule
                {
                    Enabled   = deletionSettings.Enabled,
                    TimeUnit  = deletionSettings.TimeUnit,
                    TimeValue = deletionSettings.TimeValue
                }
            };

            Complete(configuration);
            return(new GetStorageConfigurationResult {
                Configuration = configuration
            });
        }
        private void Complete(StorageConfiguration configuration)
        {
            if (String.IsNullOrEmpty(configuration.FileStoreDirectory))
            {
                configuration.FileStoreDirectory = DefaultFileStoreLocation;
            }

            if (configuration.AutoCalculateMinimumFreeSpacePercent)
            {
                configuration.MinimumFreeSpaceBytes = ComputeMinimumFreeSpaceBytes(configuration.FileStoreDirectory);
            }

            if (configuration.DefaultDeletionRule == null)
            {
                configuration.DefaultDeletionRule = new StorageConfiguration.DeletionRule
                {
                    Enabled   = false,
                    TimeUnit  = TimeUnit.Weeks,
                    TimeValue = 1
                }
            }
            ;
        }