53 lines
1.6 KiB
C#
53 lines
1.6 KiB
C#
namespace DatabaseExport
|
|
{
|
|
/// <summary>
|
|
/// generic base class for settings
|
|
/// </summary>
|
|
public abstract class Setting
|
|
{
|
|
protected string _propertyId;
|
|
/// <summary>
|
|
/// string id of property
|
|
/// </summary>
|
|
public string PropertyId => _propertyId;
|
|
protected int _propertyType;
|
|
// /// <summary>
|
|
// /// type of property (global or user specific)
|
|
// /// </summary>
|
|
// public PropertyTypes PropertyType { get { return (PropertyTypes)_propertyType; } }
|
|
protected string _propertyValue;
|
|
/// <summary>
|
|
/// value of property
|
|
/// does not currently do length checking and there is a max length
|
|
/// </summary>
|
|
public string PropertyValue => _propertyValue;
|
|
protected string _userId;
|
|
// /// <summary>
|
|
// /// User for user specific settings
|
|
// /// </summary>
|
|
// public string UserId { get { return _userId; } }
|
|
|
|
public enum PropertyTypes
|
|
{
|
|
User = 1 << 0,
|
|
Global = 1 << 1
|
|
}
|
|
|
|
public Setting(string id, PropertyTypes type, string defaultPropertyValue, string userId)
|
|
{
|
|
_userId = userId;
|
|
_propertyId = id;
|
|
_propertyType = (int)type;
|
|
GetPropertyValue(defaultPropertyValue);
|
|
}
|
|
|
|
protected abstract void GetPropertyValue(string defaultValue);
|
|
|
|
public void SetValue(string value)
|
|
{
|
|
_propertyValue = value;
|
|
//StoreInDB();
|
|
}
|
|
}
|
|
}
|