Пример #1
0
		private static Dictionary<string, string> UpdateSettings(NewDatabase newDatabase, NewDatabase bundles, CreateSettingsModel settingsData)
		{
			var settings = new Dictionary<string, string>
			{
				{
					Constants.RavenDataDir, newDatabase.ShowAdvanced.IsChecked == true
					                 	? newDatabase.DbPath.Text
					                 	: Path.Combine("~", Path.Combine("Databases", newDatabase.DbName.Text))
					},
				{Constants.ActiveBundles, string.Join(";", bundles.Bundles)}
			};

			if (!string.IsNullOrWhiteSpace(newDatabase.LogsPath.Text))
				settings.Add(Constants.RavenLogsPath, newDatabase.LogsPath.Text);
			if (!string.IsNullOrWhiteSpace(newDatabase.IndexPath.Text))
				settings.Add(Constants.RavenIndexPath, newDatabase.IndexPath.Text);

            var quotasData = settingsData.GetSection<QuotaSettingsSectionModel>();

            if (quotasData != null)
			{
                settings[Constants.DocsHardLimit] = (quotasData.MaxDocs).ToString(CultureInfo.InvariantCulture);
                settings[Constants.DocsSoftLimit] = (quotasData.WarnDocs).ToString(CultureInfo.InvariantCulture);
                settings[Constants.SizeHardLimitInKB] = (quotasData.MaxSize * 1024).ToString(CultureInfo.InvariantCulture);
                settings[Constants.SizeSoftLimitInKB] = (quotasData.WarnSize * 1024).ToString(CultureInfo.InvariantCulture);
			}

			return settings;
		}
Пример #2
0
	    private static CreateSettingsModel ConfigureSettingsModel(NewDatabase newDatabase)
	    {
	        CreateSettingsModel bundlesModel;
	        bundlesModel = new CreateSettingsModel();

	        if (newDatabase.Quotas.IsChecked == true)
	        {
	            AddSection(bundlesModel, new QuotaSettingsSectionModel()
	            {
	                MaxSize = 50,
	                WarnSize = 45,
	                MaxDocs = 10000,
	                WarnDocs = 8000,
	            });
	        }
	        if (newDatabase.Replication.IsChecked == true)
	        {
	            AddSection(bundlesModel,
	                       new ReplicationSettingsSectionModel() {ReplicationDestinations = {new ReplicationDestination()}});
	        }
	        if (newDatabase.Versioning.IsChecked == true)
	        {
	            AddSection(bundlesModel, new VersioningSettingsSectionModel(true)
	            {
	                VersioningConfigurations =
	                {
	                    new VersioningConfiguration()
	                    {
	                        Exclude = false,
	                        Id = "Raven/Versioning/DefaultConfiguration",
	                        MaxRevisions = 5
	                    }
	                }
	            });
	        }
            if(newDatabase.Authorization.IsChecked == true)
            {
                AddSection(bundlesModel, new AuthorizationSettingsSectionModel());
            }
	        return bundlesModel;
	    }