Esempio n. 1
0
        private void updateThreadStateChanged(ValueChangedEvent <GameThreadState> state)
        {
            switch (state.NewValue)
            {
            case GameThreadState.Running:
                blocking?.Dispose();
                blocking = null;
                break;

            case GameThreadState.Paused:
                blocking = realmFactory.BlockAllOperations();
                break;
            }
        }
Esempio n. 2
0
        public void Migrate(string path)
        {
            Logger.Log($@"Migrating osu! data from ""{Storage.GetFullPath(string.Empty)}"" to ""{path}""...");

            IDisposable realmBlocker = null;

            try
            {
                ManualResetEventSlim readyToRun = new ManualResetEventSlim();

                Scheduler.Add(() =>
                {
                    realmBlocker = realmFactory.BlockAllOperations();
                    contextFactory.FlushConnections();

                    readyToRun.Set();
                }, false);

                readyToRun.Wait();

                (Storage as OsuStorage)?.Migrate(Host.GetStorage(path));
            }
            finally
            {
                realmBlocker?.Dispose();
            }

            Logger.Log(@"Migration complete!");
        }
Esempio n. 3
0
 public void Migrate(string path)
 {
     using (realmFactory.BlockAllOperations())
     {
         contextFactory.FlushConnections();
         (Storage as OsuStorage)?.Migrate(Host.GetStorage(path));
     }
 }