2018-01-24 16:35:37 +08:00
|
|
|
|
// Copyright (c) 2007-2018 ppy Pty Ltd <contact@ppy.sh>.
|
|
|
|
|
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
|
|
|
|
|
|
|
|
|
|
using System.ComponentModel.DataAnnotations.Schema;
|
|
|
|
|
using osu.Game.Database;
|
|
|
|
|
|
|
|
|
|
namespace osu.Game.Configuration
|
|
|
|
|
{
|
|
|
|
|
[Table("Settings")]
|
2018-01-24 16:59:49 +08:00
|
|
|
|
public class DatabasedSetting : IHasPrimaryKey
|
2018-01-24 16:35:37 +08:00
|
|
|
|
{
|
|
|
|
|
[DatabaseGenerated(DatabaseGeneratedOption.Identity)]
|
|
|
|
|
public int ID { get; set; }
|
|
|
|
|
|
|
|
|
|
public int? RulesetID { get; set; }
|
|
|
|
|
|
2018-01-25 22:41:03 +08:00
|
|
|
|
public int? Variant { get; set; }
|
|
|
|
|
|
2018-01-24 16:35:37 +08:00
|
|
|
|
[Column("Key")]
|
|
|
|
|
public int IntKey
|
|
|
|
|
{
|
|
|
|
|
get => (int)Key;
|
|
|
|
|
private set => Key = value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Column("Value")]
|
|
|
|
|
public string StringValue
|
|
|
|
|
{
|
|
|
|
|
get => Value.ToString();
|
|
|
|
|
set => Value = value;
|
|
|
|
|
}
|
2018-01-24 16:59:49 +08:00
|
|
|
|
|
|
|
|
|
public object Key;
|
|
|
|
|
public object Value;
|
|
|
|
|
|
|
|
|
|
public DatabasedSetting(object key, object value)
|
|
|
|
|
{
|
|
|
|
|
Key = key;
|
|
|
|
|
Value = value;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Constructor for derived classes that may require serialisation.
|
|
|
|
|
/// </summary>
|
|
|
|
|
public DatabasedSetting()
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override string ToString() => $"{Key}=>{Value}";
|
2018-01-24 16:35:37 +08:00
|
|
|
|
}
|
|
|
|
|
}
|