osu/osu.Game/Input/BindingStore.cs

48 lines
1.3 KiB
C#
Raw Normal View History

2017-08-09 06:15:41 +00:00
// Copyright (c) 2007-2017 ppy Pty Ltd <contact@ppy.sh>.
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
using System;
using osu.Framework.Platform;
using osu.Game.Database;
2017-08-11 07:11:46 +00:00
using osu.Game.Input.Bindings;
using SQLite.Net;
namespace osu.Game.Input
{
public class BindingStore : DatabaseBackedStore
{
public BindingStore(SQLiteConnection connection, Storage storage = null)
: base(connection, storage)
{
}
protected override int StoreVersion => 2;
protected override void PerformMigration(int currentVersion, int targetVersion)
{
base.PerformMigration(currentVersion, targetVersion);
while (currentVersion++ < targetVersion)
{
switch (currentVersion)
{
case 1:
// cannot migrate; breaking underlying changes.
Reset();
break;
}
}
}
protected override void Prepare(bool reset = false)
{
2017-08-11 07:11:46 +00:00
Connection.CreateTable<DatabasedKeyBinding>();
}
protected override Type[] ValidTypes => new[]
{
2017-08-11 07:11:46 +00:00
typeof(DatabasedKeyBinding)
};
}
}