1
0
mirror of https://github.com/ppy/osu.git synced 2024-11-14 17:57:38 +08:00
osu-lazer/osu.Game/Configuration/DatabasedSetting.cs

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

52 lines
1.2 KiB
C#
Raw Normal View History

// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
2018-04-13 17:19:50 +08:00
2022-06-17 15:37:17 +08:00
#nullable disable
using System.ComponentModel.DataAnnotations.Schema;
using osu.Game.Database;
2018-04-13 17:19:50 +08:00
namespace osu.Game.Configuration
{
[Table("Settings")]
public class DatabasedSetting : IHasPrimaryKey // can be removed 20220315.
{
public int ID { get; set; }
2018-04-13 17:19:50 +08:00
public bool IsManaged => ID > 0;
public int? RulesetID { get; set; }
2018-04-13 17:19:50 +08:00
public int? Variant { get; set; }
2018-04-13 17:19:50 +08:00
public int? SkinInfoID { get; set; }
[Column("Key")]
public string Key { get; set; }
2018-04-13 17:19:50 +08:00
[Column("Value")]
public string StringValue
{
get => Value.ToString();
set => Value = value;
}
2018-04-13 17:19:50 +08:00
2018-01-24 16:59:49 +08:00
public object Value;
2018-04-13 17:19:50 +08:00
public DatabasedSetting(string key, object value)
2018-01-24 16:59:49 +08:00
{
Key = key;
Value = value;
}
2018-04-13 17:19:50 +08:00
2018-01-24 16:59:49 +08:00
/// <summary>
/// Constructor for derived classes that may require serialisation.
/// </summary>
public DatabasedSetting()
{
}
2018-04-13 17:19:50 +08:00
2018-01-24 16:59:49 +08:00
public override string ToString() => $"{Key}=>{Value}";
}
}