forked from ravendb/ravendb
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'RavenDB-42' of https://github.com/arekais/ravendb
- Loading branch information
Showing
11 changed files
with
495 additions
and
114 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="BooleanSetting.cs" company="Hibernating Rhinos LTD"> | ||
// Copyright (c) Hibernating Rhinos LTD. All rights reserved. | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
namespace Raven.Database.Config.Settings | ||
{ | ||
public class BooleanSetting : Setting<bool> | ||
{ | ||
public BooleanSetting(string value, bool defaultValue) : base(value, defaultValue) | ||
{ | ||
} | ||
|
||
public override bool Value | ||
{ | ||
get | ||
{ | ||
return string.IsNullOrEmpty(value) == false ? bool.Parse(value) : defaultValue; | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="IntegerSetting.cs" company="Hibernating Rhinos LTD"> | ||
// Copyright (c) Hibernating Rhinos LTD. All rights reserved. | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
using System; | ||
|
||
namespace Raven.Database.Config.Settings | ||
{ | ||
public class IntegerSetting : Setting<int> | ||
{ | ||
public IntegerSetting(string value, int defaultValue) | ||
: base(value, defaultValue) | ||
{ | ||
} | ||
|
||
public IntegerSetting(string value, Func<int> getDefaultValue) : base(value, getDefaultValue) | ||
{ | ||
} | ||
|
||
public override int Value | ||
{ | ||
get | ||
{ | ||
return string.IsNullOrEmpty(value) == false | ||
? int.Parse(value) | ||
: (getDefaultValue != null ? getDefaultValue() : defaultValue); | ||
} | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
// ----------------------------------------------------------------------- | ||
// <copyright file="IntegerSettingWithMin.cs" company="Hibernating Rhinos LTD"> | ||
// Copyright (c) Hibernating Rhinos LTD. All rights reserved. | ||
// </copyright> | ||
// ----------------------------------------------------------------------- | ||
using System; | ||
|
||
namespace Raven.Database.Config.Settings | ||
{ | ||
public class IntegerSettingWithMin : Setting<int> | ||
{ | ||
private readonly int min; | ||
|
||
public IntegerSettingWithMin(string value, int defaultValue, int min) | ||
: base(value, defaultValue) | ||
{ | ||
this.min = min; | ||
} | ||
|
||
public override int Value | ||
{ | ||
get | ||
{ | ||
return string.IsNullOrEmpty(value) == false ? Math.Max(int.Parse(value), min) : defaultValue; | ||
} | ||
} | ||
|
||
public int Default | ||
{ | ||
get { return defaultValue; } | ||
} | ||
} | ||
} |
Oops, something went wrong.