From ffa712dccbd5bdef12d69a90d54e7dd723303932 Mon Sep 17 00:00:00 2001 From: smoogipoo Date: Sat, 24 Mar 2018 15:19:45 +0900 Subject: [PATCH] Fix post-merge issues --- osu-framework | 2 +- osu-resources | 2 +- osu.Desktop/Program.cs | 6 +- osu.Game/Beatmaps/BeatmapManager.cs | 92 ------------------- osu.Game/Database/ArchiveModelManager.cs | 4 +- .../Screens/Compose/Layers/SelectionLayer.cs | 1 + 6 files changed, 10 insertions(+), 97 deletions(-) diff --git a/osu-framework b/osu-framework index 86079714a5..9b628d7f51 160000 --- a/osu-framework +++ b/osu-framework @@ -1 +1 @@ -Subproject commit 86079714a5f5c2678c4cc91df6c0257f33c43bcf +Subproject commit 9b628d7f51104ac94af2a4739480be0113ad551b diff --git a/osu-resources b/osu-resources index 883ff04e79..db406143da 160000 --- a/osu-resources +++ b/osu-resources @@ -1 +1 @@ -Subproject commit 883ff04e79a76f5eb1f89c4f59bd7476a803b42b +Subproject commit db406143da9e791efa04cdac4418c85a6831b739 diff --git a/osu.Desktop/Program.cs b/osu.Desktop/Program.cs index e878167536..5e6b5cc701 100644 --- a/osu.Desktop/Program.cs +++ b/osu.Desktop/Program.cs @@ -4,10 +4,12 @@ using System; using System.IO; using System.Linq; -using System.Runtime; using osu.Framework; using osu.Framework.Platform; using osu.Game.IPC; +#if NET_FRAMEWORK +using System.Runtime; +#endif namespace osu.Desktop { @@ -58,9 +60,11 @@ namespace osu.Desktop private static void useMulticoreJit() { +#if NET_FRAMEWORK var directory = Directory.CreateDirectory(Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Profiles")); ProfileOptimization.SetProfileRoot(directory.FullName); ProfileOptimization.StartProfile("Startup.Profile"); +#endif } } } diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs index 46fef78c4e..1113e38d7a 100644 --- a/osu.Game/Beatmaps/BeatmapManager.cs +++ b/osu.Game/Beatmaps/BeatmapManager.cs @@ -20,8 +20,6 @@ using osu.Game.Online.API; using osu.Game.Online.API.Requests; using osu.Game.Overlays.Notifications; using osu.Game.Rulesets; -using osu.Game.Utils; -using osu.Game.Storyboards; namespace osu.Game.Beatmaps { @@ -197,96 +195,6 @@ namespace osu.Game.Beatmaps /// The object if it exists, or null. public DownloadBeatmapSetRequest GetExistingDownload(BeatmapSetInfo beatmap) => currentDownloads.Find(d => d.BeatmapSet.OnlineBeatmapSetID == beatmap.OnlineBeatmapSetID); - /// - /// Delete a beatmap from the manager. - /// Is a no-op for already deleted beatmaps. - /// - /// The beatmap set to delete. - public void Delete(BeatmapSetInfo beatmapSet) - { - lock (importContextLock) - { - var context = importContext.Value; - - using (var transaction = context.BeginTransaction()) - { - context.ChangeTracker.AutoDetectChangesEnabled = false; - - // re-fetch the beatmap set on the import context. - // ReSharper disable once AccessToModifiedClosure - beatmapSet = context.BeatmapSetInfo.Include(s => s.Files).ThenInclude(f => f.FileInfo).First(s => s.ID == beatmapSet.ID); - - // create local stores so we can isolate and thread safely, and share a context/transaction. - var iFiles = new FileStore(() => context, storage); - var iBeatmaps = createBeatmapStore(() => context); - - if (iBeatmaps.Delete(beatmapSet)) - { - if (!beatmapSet.Protected) - iFiles.Dereference(beatmapSet.Files.Select(f => f.FileInfo).ToArray()); - } - - context.ChangeTracker.AutoDetectChangesEnabled = true; - context.SaveChanges(transaction); - } - } - } - - public void UndeleteAll() - { - var deleteMaps = QueryBeatmapSets(bs => bs.DeletePending).ToList(); - - if (!deleteMaps.Any()) return; - - var notification = new ProgressNotification - { - CompletionText = "Restored all deleted beatmaps!", - Progress = 0, - State = ProgressNotificationState.Active, - }; - - PostNotification?.Invoke(notification); - - int i = 0; - - foreach (var bs in deleteMaps) - { - if (notification.State == ProgressNotificationState.Cancelled) - // user requested abort - return; - - notification.Text = $"Restoring ({i} of {deleteMaps.Count})"; - notification.Progress = (float)++i / deleteMaps.Count; - Undelete(bs); - } - - notification.State = ProgressNotificationState.Completed; - } - - public void Undelete(BeatmapSetInfo beatmapSet) - { - if (beatmapSet.Protected) - return; - - lock (importContextLock) - { - var context = importContext.Value; - - using (var transaction = context.BeginTransaction()) - { - context.ChangeTracker.AutoDetectChangesEnabled = false; - - var iFiles = new FileStore(() => context, storage); - var iBeatmaps = createBeatmapStore(() => context); - - undelete(iBeatmaps, iFiles, beatmapSet); - - context.ChangeTracker.AutoDetectChangesEnabled = true; - context.SaveChanges(transaction); - } - } - } - /// /// Delete a beatmap difficulty. /// diff --git a/osu.Game/Database/ArchiveModelManager.cs b/osu.Game/Database/ArchiveModelManager.cs index f0e67a7185..7050e34712 100644 --- a/osu.Game/Database/ArchiveModelManager.cs +++ b/osu.Game/Database/ArchiveModelManager.cs @@ -5,7 +5,6 @@ using System; using System.Collections.Generic; using System.IO; using System.Linq; -using Ionic.Zip; using Microsoft.EntityFrameworkCore; using osu.Framework.Logging; using osu.Framework.Platform; @@ -13,6 +12,7 @@ using osu.Game.IO; using osu.Game.IO.Archives; using osu.Game.IPC; using osu.Game.Overlays.Notifications; +using osu.Game.Utils; using SharpCompress.Common; using FileInfo = osu.Game.IO.FileInfo; @@ -336,7 +336,7 @@ namespace osu.Game.Database /// A reader giving access to the archive's content. private ArchiveReader getReaderFrom(string path) { - if (ZipFile.IsZipFile(path)) + if (ZipUtils.IsZipArchive(path)) return new ZipArchiveReader(Files.Storage.GetStream(path), Path.GetFileName(path)); if (Directory.Exists(path)) return new LegacyFilesystemReader(path); diff --git a/osu.Game/Screens/Edit/Screens/Compose/Layers/SelectionLayer.cs b/osu.Game/Screens/Edit/Screens/Compose/Layers/SelectionLayer.cs index 8c66007bb7..ab51385980 100644 --- a/osu.Game/Screens/Edit/Screens/Compose/Layers/SelectionLayer.cs +++ b/osu.Game/Screens/Edit/Screens/Compose/Layers/SelectionLayer.cs @@ -14,6 +14,7 @@ using osu.Game.Rulesets.Objects.Drawables; using osu.Game.Rulesets.UI; using OpenTK; using OpenTK.Graphics; +using RectangleF = osu.Framework.Graphics.Primitives.RectangleF; namespace osu.Game.Screens.Edit.Screens.Compose.Layers {