Example #1
0
        public StorageErrorDialog(OsuStorage storage, OsuStorageError error)
        {
            HeaderText = "osu! 儲存錯誤";
            Icon       = FontAwesome.Solid.ExclamationTriangle;

            var buttons = new List <PopupDialogButton>();

            switch (error)
            {
            case OsuStorageError.NotAccessible:
                BodyText = $"指定的位置 (\"{storage.CustomStoragePath}\") 無法被訪問. 如果導向的目錄是外置硬碟, 請連接後再試一次.";

                buttons.AddRange(new PopupDialogButton[]
                {
                    new PopupDialogCancelButton
                    {
                        Text   = "再試一次",
                        Action = () =>
                        {
                            if (!storage.TryChangeToCustomStorage(out var nextError))
                            {
                                dialogOverlay.Push(new StorageErrorDialog(storage, nextError));
                            }
                        }
                    },
                    new PopupDialogCancelButton
                    {
                        Text = "先用默認位置 直到下一次開始遊戲",
                    },
                    new PopupDialogOkButton
                    {
                        Text   = "復原默認位置",
                        Action = storage.ResetCustomStoragePath
                    },
                });
Example #2
0
        public StorageErrorDialog(OsuStorage storage, OsuStorageError error)
        {
            HeaderText = "osu! storage error";
            Icon       = FontAwesome.Solid.ExclamationTriangle;

            var buttons = new List <PopupDialogButton>();

            switch (error)
            {
            case OsuStorageError.NotAccessible:
                BodyText = $"The specified osu! data location (\"{storage.CustomStoragePath}\") is not accessible. If it is on external storage, please reconnect the device and try again.";

                buttons.AddRange(new PopupDialogButton[]
                {
                    new PopupDialogCancelButton
                    {
                        Text   = "Try again",
                        Action = () =>
                        {
                            if (!storage.TryChangeToCustomStorage(out var nextError))
                            {
                                dialogOverlay.Push(new StorageErrorDialog(storage, nextError));
                            }
                        }
                    },
                    new PopupDialogCancelButton
                    {
                        Text = "Use default location until restart",
                    },
                    new PopupDialogOkButton
                    {
                        Text   = "Reset to default location",
                        Action = storage.ResetCustomStoragePath
                    },
                });
Example #3
0
        public override void SetHost(GameHost host)
        {
            base.SetHost(host);

            if (Storage == null) // may be non-null for certain tests
            {
                Storage = new OsuStorage(host);
            }

            if (LocalConfig == null)
            {
                LocalConfig = new OsuConfigManager(Storage);
            }
        }
Example #4
0
        protected void RunTestWithRealm(Action <RealmContextFactory, OsuStorage> testAction, [CallerMemberName] string caller = "")
        {
            using (HeadlessGameHost host = new CleanRunHeadlessGameHost(callingMethodName: caller))
            {
                host.Run(new RealmTestGame(() =>
                {
                    // ReSharper disable once AccessToDisposedClosure
                    var testStorage = new OsuStorage(host, storage.GetStorageForDirectory(caller));

                    using (var realmFactory = new RealmContextFactory(testStorage, "client"))
                    {
                        Logger.Log($"Running test using realm file {testStorage.GetFullPath(realmFactory.Filename)}");
                        testAction(realmFactory, testStorage);

                        realmFactory.Dispose();

                        Logger.Log($"Final database size: {getFileSize(testStorage, realmFactory)}");
                        realmFactory.Compact();
                        Logger.Log($"Final database size after compact: {getFileSize(testStorage, realmFactory)}");
                    }
                }));
            }
        }