Store databased settings based on string keys rather than ints

Allows for rearranging/removal from enums without consequence.
This commit is contained in:
Dean Herbert
2019-05-25 15:00:53 +09:00
parent 05c0df53dc
commit 127858d398
5 changed files with 29 additions and 13 deletions

View File

@ -1,4 +1,4 @@
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// 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.
using System.ComponentModel.DataAnnotations.Schema;
@ -16,11 +16,7 @@ namespace osu.Game.Configuration
public int? Variant { get; set; }
[Column("Key")]
public int IntKey
{
get => (int)Key;
private set => Key = value;
}
public string Key { get; set; }
[Column("Value")]
public string StringValue
@ -29,10 +25,9 @@ namespace osu.Game.Configuration
set => Value = value;
}
public object Key;
public object Value;
public DatabasedSetting(object key, object value)
public DatabasedSetting(string key, object value)
{
Key = key;
Value = value;