diff --git a/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs b/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs
index 44eb385e22..7a1c6d9b89 100644
--- a/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs
+++ b/osu.Game.Tests/Beatmaps/IO/OszArchiveReaderTest.cs
@@ -5,9 +5,9 @@ using System.IO;
using System.Linq;
using NUnit.Framework;
using osu.Game.Beatmaps;
-using osu.Game.Beatmaps.IO;
using osu.Game.Tests.Resources;
using osu.Game.Beatmaps.Formats;
+using osu.Game.IO.Archives;
namespace osu.Game.Tests.Beatmaps.IO
{
@@ -19,7 +19,7 @@ namespace osu.Game.Tests.Beatmaps.IO
{
using (var osz = Resource.OpenResource("Beatmaps.241526 Soleily - Renatus.osz"))
{
- var reader = new OszArchiveReader(osz);
+ var reader = new ZipArchiveReader(osz);
string[] expected =
{
"Soleily - Renatus (Deif) [Platter].osu",
@@ -46,7 +46,7 @@ namespace osu.Game.Tests.Beatmaps.IO
{
using (var osz = Resource.OpenResource("Beatmaps.241526 Soleily - Renatus.osz"))
{
- var reader = new OszArchiveReader(osz);
+ var reader = new ZipArchiveReader(osz);
BeatmapMetadata meta;
using (var stream = new StreamReader(reader.GetStream("Soleily - Renatus (Deif) [Platter].osu")))
@@ -71,7 +71,7 @@ namespace osu.Game.Tests.Beatmaps.IO
{
using (var osz = Resource.OpenResource("Beatmaps.241526 Soleily - Renatus.osz"))
{
- var reader = new OszArchiveReader(osz);
+ var reader = new ZipArchiveReader(osz);
using (var stream = new StreamReader(
reader.GetStream("Soleily - Renatus (Deif) [Platter].osu")))
{
diff --git a/osu.Game/Beatmaps/BeatmapManager.cs b/osu.Game/Beatmaps/BeatmapManager.cs
index 802993bc58..8bc1f72c1f 100644
--- a/osu.Game/Beatmaps/BeatmapManager.cs
+++ b/osu.Game/Beatmaps/BeatmapManager.cs
@@ -12,9 +12,9 @@ using osu.Framework.Extensions;
using osu.Framework.Logging;
using osu.Framework.Platform;
using osu.Game.Beatmaps.Formats;
-using osu.Game.Beatmaps.IO;
using osu.Game.Database;
using osu.Game.Graphics;
+using osu.Game.IO.Archives;
using osu.Game.Online.API;
using osu.Game.Online.API.Requests;
using osu.Game.Overlays.Notifications;
@@ -25,23 +25,13 @@ namespace osu.Game.Beatmaps
///
/// Handles the storage and retrieval of Beatmaps/WorkingBeatmaps.
///
- public partial class BeatmapManager : ArchiveModelImportManager
+ public partial class BeatmapManager : ArchiveModelManager
{
- ///
- /// Fired when a new becomes available in the database.
- ///
- public event Action BeatmapSetAdded;
-
///
/// Fired when a single difficulty has been hidden.
///
public event Action BeatmapHidden;
- ///
- /// Fired when a is removed from the database.
- ///
- public event Action BeatmapSetRemoved;
-
///
/// Fired when a single difficulty has been restored.
///
@@ -76,8 +66,6 @@ namespace osu.Game.Beatmaps
: base(storage, contextFactory, new BeatmapStore(contextFactory), importHost)
{
beatmaps = (BeatmapStore)ModelStore;
- beatmaps.BeatmapSetAdded += s => BeatmapSetAdded?.Invoke(s);
- beatmaps.BeatmapSetRemoved += s => BeatmapSetRemoved?.Invoke(s);
beatmaps.BeatmapHidden += b => BeatmapHidden?.Invoke(b);
beatmaps.BeatmapRestored += b => BeatmapRestored?.Invoke(b);
@@ -121,12 +109,6 @@ namespace osu.Game.Beatmaps
return null;
}
- ///
- /// Import a beatmap from a .
- ///
- /// The beatmap to be imported.
- public void Import(BeatmapSetInfo beatmapSet) => beatmaps.Add(beatmapSet);
-
///
/// Downloads a beatmap.
/// This will post notifications tracking progress.
@@ -171,7 +153,7 @@ namespace osu.Game.Beatmaps
{
// This gets scheduled back to the update thread, but we want the import to run in the background.
using (var stream = new MemoryStream(data))
- using (var archive = new OszArchiveReader(stream, beatmapSetInfo.ToString()))
+ using (var archive = new ZipArchiveReader(stream, beatmapSetInfo.ToString()))
Import(archive);
downloadNotification.State = ProgressNotificationState.Completed;
@@ -217,63 +199,6 @@ namespace osu.Game.Beatmaps
/// The beatmap set to update.
public void Update(BeatmapSetInfo beatmap) => beatmaps.Update(beatmap);
- ///
- /// Restore all beatmaps that were previously deleted.
- /// This will post notifications tracking progress.
- ///
- 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;
- }
-
- ///
- /// Restore a beatmap that was previously deleted. Is a no-op if the beatmap is not in a deleted state, or has its protected flag set.
- ///
- /// The beatmap to restore
- public void Undelete(BeatmapSetInfo beatmapSet)
- {
- if (beatmapSet.Protected)
- return;
-
- using (var usage = ContextFactory.GetForWrite())
- {
- usage.Context.ChangeTracker.AutoDetectChangesEnabled = false;
-
- if (!beatmaps.Undelete(beatmapSet)) return;
-
- if (!beatmapSet.Protected)
- Files.Reference(beatmapSet.Files.Select(f => f.FileInfo).ToArray());
-
- usage.Context.ChangeTracker.AutoDetectChangesEnabled = true;
- }
- }
-
///
/// Delete a beatmap difficulty.
///
diff --git a/osu.Game/Beatmaps/BeatmapStore.cs b/osu.Game/Beatmaps/BeatmapStore.cs
index 330b5db853..3e4840f4e1 100644
--- a/osu.Game/Beatmaps/BeatmapStore.cs
+++ b/osu.Game/Beatmaps/BeatmapStore.cs
@@ -6,18 +6,14 @@ using System.Linq;
using System.Linq.Expressions;
using Microsoft.EntityFrameworkCore;
using osu.Game.Database;
-using osu.Game.IO;
namespace osu.Game.Beatmaps
{
///
/// Handles the storage and retrieval of Beatmaps/BeatmapSets to the database backing
///
- public class BeatmapStore : DatabaseBackedStore, IMutableStore
+ public class BeatmapStore : MutableDatabaseBackedStore
{
- public event Action BeatmapSetAdded;
- public event Action BeatmapSetRemoved;
-
public event Action BeatmapHidden;
public event Action BeatmapRestored;
@@ -26,88 +22,6 @@ namespace osu.Game.Beatmaps
{
}
- ///
- /// Add a to the database.
- ///
- /// The beatmap to add.
- public void Add(BeatmapSetInfo beatmapSet)
- {
- using (var usage = ContextFactory.GetForWrite())
- {
- var context = usage.Context;
-
- foreach (var beatmap in beatmapSet.Beatmaps.Where(b => b.Metadata != null))
- {
- // If we detect a new metadata object it'll be attached to the current context so it can be reused
- // to prevent duplicate entries when persisting. To accomplish this we look in the cache (.Local)
- // of the corresponding table (.Set()) for matching entries to our criteria.
- var contextMetadata = context.Set().Local.SingleOrDefault(e => e.Equals(beatmap.Metadata));
- if (contextMetadata != null)
- beatmap.Metadata = contextMetadata;
- else
- context.BeatmapMetadata.Attach(beatmap.Metadata);
- }
-
- context.BeatmapSetInfo.Attach(beatmapSet);
-
- BeatmapSetAdded?.Invoke(beatmapSet);
- }
- }
-
- ///
- /// Update a in the database. TODO: This only supports very basic updates currently.
- ///
- /// The beatmap to update.
- public void Update(BeatmapSetInfo beatmapSet)
- {
- BeatmapSetRemoved?.Invoke(beatmapSet);
-
- using (var usage = ContextFactory.GetForWrite())
- usage.Context.BeatmapSetInfo.Update(beatmapSet);
-
- BeatmapSetAdded?.Invoke(beatmapSet);
- }
-
- ///
- /// Delete a from the database.
- ///
- /// The beatmap to delete.
- /// Whether the beatmap's was changed.
- public bool Delete(BeatmapSetInfo beatmapSet)
- {
- using (ContextFactory.GetForWrite())
- {
- Refresh(ref beatmapSet, BeatmapSets);
-
- if (beatmapSet.Protected || beatmapSet.DeletePending) return false;
-
- beatmapSet.DeletePending = true;
- }
-
- BeatmapSetRemoved?.Invoke(beatmapSet);
- return true;
- }
-
- ///
- /// Restore a previously deleted .
- ///
- /// The beatmap to restore.
- /// Whether the beatmap's was changed.
- public bool Undelete(BeatmapSetInfo beatmapSet)
- {
- using (ContextFactory.GetForWrite())
- {
- Refresh(ref beatmapSet, BeatmapSets);
-
- if (!beatmapSet.DeletePending) return false;
-
- beatmapSet.DeletePending = false;
- }
-
- BeatmapSetAdded?.Invoke(beatmapSet);
- return true;
- }
-
///
/// Hide a in the database.
///
diff --git a/osu.Game/Database/ArchiveModelImportManager.cs b/osu.Game/Database/ArchiveModelManager.cs
similarity index 57%
rename from osu.Game/Database/ArchiveModelImportManager.cs
rename to osu.Game/Database/ArchiveModelManager.cs
index 6b780a2866..9c558a6c12 100644
--- a/osu.Game/Database/ArchiveModelImportManager.cs
+++ b/osu.Game/Database/ArchiveModelManager.cs
@@ -6,16 +6,21 @@ using Ionic.Zip;
using Microsoft.EntityFrameworkCore;
using osu.Framework.Logging;
using osu.Framework.Platform;
-using osu.Game.Beatmaps;
-using osu.Game.Beatmaps.IO;
using osu.Game.IO;
+using osu.Game.IO.Archives;
using osu.Game.IPC;
using osu.Game.Overlays.Notifications;
using FileInfo = osu.Game.IO.FileInfo;
namespace osu.Game.Database
{
- public abstract class ArchiveModelImportManager : ICanImportArchives
+ ///
+ /// Encapsulates a model store class to give it import functionality.
+ /// Adds cross-functionality with to give access to the central file store for the provided model.
+ ///
+ /// The model type.
+ /// The associated file join type.
+ public abstract class ArchiveModelManager : ICanImportArchives
where TModel : class, IHasFiles, IHasPrimaryKey, ISoftDelete
where TFileModel : INamedFileInfo, new()
{
@@ -24,21 +29,35 @@ namespace osu.Game.Database
///
public Action PostNotification { protected get; set; }
+ ///
+ /// Fired when a new becomes available in the database.
+ ///
+ public event Action ItemAdded;
+
+ ///
+ /// Fired when a is removed from the database.
+ ///
+ public event Action ItemRemoved;
+
public virtual string[] HandledExtensions => new[] { ".zip" };
protected readonly FileStore Files;
protected readonly IDatabaseContextFactory ContextFactory;
- protected readonly IMutableStore ModelStore;
+ protected readonly MutableDatabaseBackedStore ModelStore;
// ReSharper disable once NotAccessedField.Local (we should keep a reference to this so it is not finalised)
private ArchiveImportIPCChannel ipc;
- protected ArchiveModelImportManager(Storage storage, IDatabaseContextFactory contextFactory, IMutableStore modelStore, IIpcHost importHost = null)
+ protected ArchiveModelManager(Storage storage, IDatabaseContextFactory contextFactory, MutableDatabaseBackedStore modelStore, IIpcHost importHost = null)
{
ContextFactory = contextFactory;
+
ModelStore = modelStore;
+ ModelStore.ItemAdded += s => ItemAdded?.Invoke(s);
+ ModelStore.ItemRemoved += s => ItemRemoved?.Invoke(s);
+
Files = new FileStore(contextFactory, storage);
if (importHost != null)
@@ -46,10 +65,10 @@ namespace osu.Game.Database
}
///
- /// Import one or more from filesystem .
+ /// Import one or more items from filesystem .
/// This will post notifications tracking progress.
///
- /// One or more beatmap locations on disk.
+ /// One or more archive locations on disk.
public void Import(params string[] paths)
{
var notification = new ProgressNotification
@@ -80,7 +99,7 @@ namespace osu.Game.Database
notification.Progress = (float)++i / paths.Length;
// We may or may not want to delete the file depending on where it is stored.
- // e.g. reconstructing/repairing database with beatmaps from default storage.
+ // e.g. reconstructing/repairing database with items from default storage.
// Also, not always a single file, i.e. for LegacyFilesystemReader
// TODO: Add a check to prevent files from storage to be deleted.
try
@@ -96,7 +115,7 @@ namespace osu.Game.Database
catch (Exception e)
{
e = e.InnerException ?? e;
- Logger.Error(e, $@"Could not import beatmap set ({Path.GetFileName(path)})");
+ Logger.Error(e, $@"Could not import ({Path.GetFileName(path)})");
}
}
@@ -104,37 +123,43 @@ namespace osu.Game.Database
}
///
- /// Import a model from an .
+ /// Import an item from an .
///
- /// The beatmap to be imported.
+ /// The archive to be imported.
public TModel Import(ArchiveReader archive)
{
using (ContextFactory.GetForWrite()) // used to share a context for full import. keep in mind this will block all writes.
{
- // create a new set info (don't yet add to database)
- var model = CreateModel(archive);
+ // create a new model (don't yet add to database)
+ var item = CreateModel(archive);
- var existing = CheckForExisting(model);
+ var existing = CheckForExisting(item);
if (existing != null) return existing;
- model.Files = createFileInfos(archive, Files);
+ item.Files = createFileInfos(archive, Files);
- Populate(model, archive);
+ Populate(item, archive);
// import to store
- ModelStore.Add(model);
+ ModelStore.Add(item);
- return model;
+ return item;
}
}
///
- /// Delete a model from the manager.
- /// Is a no-op for already deleted models.
+ /// Import an item from a .
///
- /// The model to delete.
- public void Delete(TModel model)
+ /// The model to be imported.
+ public void Import(TModel item) => ModelStore.Add(item);
+
+ ///
+ /// Delete an item from the manager.
+ /// Is a no-op for already deleted items.
+ ///
+ /// The item to delete.
+ public void Delete(TModel item)
{
using (var usage = ContextFactory.GetForWrite())
{
@@ -143,9 +168,9 @@ namespace osu.Game.Database
context.ChangeTracker.AutoDetectChangesEnabled = false;
// re-fetch the model on the import context.
- var foundModel = ContextFactory.Get().Set().Include(s => s.Files).ThenInclude(f => f.FileInfo).First(s => s.ID == model.ID);
+ var foundModel = queryModel().Include(s => s.Files).ThenInclude(f => f.FileInfo).First(s => s.ID == item.ID);
- if (foundModel.DeletePending || !CheckCanDelete(foundModel)) return;
+ if (foundModel.DeletePending) return;
if (ModelStore.Delete(foundModel))
Files.Dereference(foundModel.Files.Select(f => f.FileInfo).ToArray());
@@ -154,6 +179,59 @@ namespace osu.Game.Database
}
}
+ ///
+ /// Restore all items that were previously deleted.
+ /// This will post notifications tracking progress.
+ ///
+ public void UndeleteAll()
+ {
+ var deletedItems = queryModel().Where(m => m.DeletePending).ToList();
+
+ if (!deletedItems.Any()) return;
+
+ var notification = new ProgressNotification
+ {
+ CompletionText = "Restored all deleted items!",
+ Progress = 0,
+ State = ProgressNotificationState.Active,
+ };
+
+ PostNotification?.Invoke(notification);
+
+ int i = 0;
+
+ foreach (var item in deletedItems)
+ {
+ if (notification.State == ProgressNotificationState.Cancelled)
+ // user requested abort
+ return;
+
+ notification.Text = $"Restoring ({i} of {deletedItems.Count})";
+ notification.Progress = (float)++i / deletedItems.Count;
+ Undelete(item);
+ }
+
+ notification.State = ProgressNotificationState.Completed;
+ }
+
+ ///
+ /// Restore an item that was previously deleted. Is a no-op if the item is not in a deleted state, or has its protected flag set.
+ ///
+ /// The item to restore
+ public void Undelete(TModel item)
+ {
+ using (var usage = ContextFactory.GetForWrite())
+ {
+ usage.Context.ChangeTracker.AutoDetectChangesEnabled = false;
+
+ if (!ModelStore.Undelete(item)) return;
+
+ Files.Reference(item.Files.Select(f => f.FileInfo).ToArray());
+
+ usage.Context.ChangeTracker.AutoDetectChangesEnabled = true;
+ }
+ }
+
///
/// Create all required s for the provided archive, adding them to the global file store.
///
@@ -193,7 +271,7 @@ namespace osu.Game.Database
protected virtual TModel CheckForExisting(TModel model) => null;
- protected virtual bool CheckCanDelete(TModel model) => true;
+ private DbSet queryModel() => ContextFactory.Get().Set();
///
/// Creates an from a valid storage path.
@@ -203,7 +281,7 @@ namespace osu.Game.Database
private ArchiveReader getReaderFrom(string path)
{
if (ZipFile.IsZipFile(path))
- return new OszArchiveReader(Files.Storage.GetStream(path), Path.GetFileName(path));
+ return new ZipArchiveReader(Files.Storage.GetStream(path), Path.GetFileName(path));
return new LegacyFilesystemReader(path);
}
}
diff --git a/osu.Game/Database/MutableDatabaseBackedStore.cs b/osu.Game/Database/MutableDatabaseBackedStore.cs
new file mode 100644
index 0000000000..c6af1aa475
--- /dev/null
+++ b/osu.Game/Database/MutableDatabaseBackedStore.cs
@@ -0,0 +1,76 @@
+using System;
+using osu.Framework.Platform;
+
+namespace osu.Game.Database
+{
+ ///
+ /// A typed store which supports basic addition, deletion and updating for soft-deletable models.
+ ///
+ /// The databased model.
+ public abstract class MutableDatabaseBackedStore : DatabaseBackedStore
+ where T : class, IHasPrimaryKey, ISoftDelete
+ {
+ public event Action ItemAdded;
+ public event Action ItemRemoved;
+
+ protected MutableDatabaseBackedStore(IDatabaseContextFactory contextFactory, Storage storage = null)
+ : base(contextFactory, storage)
+ {
+ }
+
+ public void Add(T item)
+ {
+ using (var usage = ContextFactory.GetForWrite())
+ {
+ var context = usage.Context;
+ context.Attach(item);
+ }
+
+ ItemAdded?.Invoke(item);
+ }
+
+ ///
+ /// Update a in the database.
+ ///
+ /// The item to update.
+ public void Update(T item)
+ {
+ ItemRemoved?.Invoke(item);
+
+ using (var usage = ContextFactory.GetForWrite())
+ usage.Context.Update(item);
+
+ ItemAdded?.Invoke(item);
+ }
+
+ public bool Delete(T item)
+ {
+ using (ContextFactory.GetForWrite())
+ {
+ Refresh(ref item);
+
+ if (item.DeletePending) return false;
+
+ item.DeletePending = true;
+ }
+
+ ItemRemoved?.Invoke(item);
+ return true;
+ }
+
+ public bool Undelete(T item)
+ {
+ using (ContextFactory.GetForWrite())
+ {
+ Refresh(ref item);
+
+ if (!item.DeletePending) return false;
+
+ item.DeletePending = false;
+ }
+
+ ItemAdded?.Invoke(item);
+ return true;
+ }
+ }
+}
diff --git a/osu.Game/Beatmaps/IO/ArchiveReader.cs b/osu.Game/IO/Archives/ArchiveReader.cs
similarity index 94%
rename from osu.Game/Beatmaps/IO/ArchiveReader.cs
rename to osu.Game/IO/Archives/ArchiveReader.cs
index 7be03ffb1b..351a6dff39 100644
--- a/osu.Game/Beatmaps/IO/ArchiveReader.cs
+++ b/osu.Game/IO/Archives/ArchiveReader.cs
@@ -6,7 +6,7 @@ using System.Collections.Generic;
using System.IO;
using osu.Framework.IO.Stores;
-namespace osu.Game.Beatmaps.IO
+namespace osu.Game.IO.Archives
{
public abstract class ArchiveReader : IDisposable, IResourceStore
{
diff --git a/osu.Game/Beatmaps/IO/LegacyFilesystemReader.cs b/osu.Game/IO/Archives/LegacyFilesystemReader.cs
similarity index 93%
rename from osu.Game/Beatmaps/IO/LegacyFilesystemReader.cs
rename to osu.Game/IO/Archives/LegacyFilesystemReader.cs
index e0a54838e0..d6d80783db 100644
--- a/osu.Game/Beatmaps/IO/LegacyFilesystemReader.cs
+++ b/osu.Game/IO/Archives/LegacyFilesystemReader.cs
@@ -1,12 +1,12 @@
// Copyright (c) 2007-2018 ppy Pty Ltd .
// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-using osu.Framework.IO.File;
using System.Collections.Generic;
using System.IO;
using System.Linq;
+using osu.Framework.IO.File;
-namespace osu.Game.Beatmaps.IO
+namespace osu.Game.IO.Archives
{
///
/// Reads an extracted legacy beatmap from disk.
diff --git a/osu.Game/Beatmaps/IO/OszArchiveReader.cs b/osu.Game/IO/Archives/ZipArchiveReader.cs
similarity index 86%
rename from osu.Game/Beatmaps/IO/OszArchiveReader.cs
rename to osu.Game/IO/Archives/ZipArchiveReader.cs
index fbac5d79f3..a772382b5e 100644
--- a/osu.Game/Beatmaps/IO/OszArchiveReader.cs
+++ b/osu.Game/IO/Archives/ZipArchiveReader.cs
@@ -6,14 +6,14 @@ using System.IO;
using System.Linq;
using Ionic.Zip;
-namespace osu.Game.Beatmaps.IO
+namespace osu.Game.IO.Archives
{
- public sealed class OszArchiveReader : ArchiveReader
+ public sealed class ZipArchiveReader : ArchiveReader
{
private readonly Stream archiveStream;
private readonly ZipFile archive;
- public OszArchiveReader(Stream archiveStream, string name = null)
+ public ZipArchiveReader(Stream archiveStream, string name = null)
: base(name)
{
this.archiveStream = archiveStream;
diff --git a/osu.Game/IO/IMutableStore.cs b/osu.Game/IO/IMutableStore.cs
deleted file mode 100644
index ced1b29316..0000000000
--- a/osu.Game/IO/IMutableStore.cs
+++ /dev/null
@@ -1,16 +0,0 @@
-// Copyright (c) 2007-2018 ppy Pty Ltd .
-// Licensed under the MIT Licence - https://raw.githubusercontent.com/ppy/osu/master/LICENCE
-
-namespace osu.Game.IO
-{
- public interface IMutableStore
- {
- ///
- /// Add an object to the store.
- ///
- /// The object to add.
- void Add(T item);
-
- bool Delete(T item);
- }
-}
diff --git a/osu.Game/Overlays/BeatmapSet/Header.cs b/osu.Game/Overlays/BeatmapSet/Header.cs
index 36b6a9964a..3ce0dfee31 100644
--- a/osu.Game/Overlays/BeatmapSet/Header.cs
+++ b/osu.Game/Overlays/BeatmapSet/Header.cs
@@ -223,13 +223,13 @@ namespace osu.Game.Overlays.BeatmapSet
tabsBg.Colour = colours.Gray3;
this.beatmaps = beatmaps;
- beatmaps.BeatmapSetAdded += handleBeatmapAdd;
+ beatmaps.ItemAdded += handleBeatmapAdd;
}
protected override void Dispose(bool isDisposing)
{
base.Dispose(isDisposing);
- if (beatmaps != null) beatmaps.BeatmapSetAdded -= handleBeatmapAdd;
+ if (beatmaps != null) beatmaps.ItemAdded -= handleBeatmapAdd;
}
private void handleBeatmapAdd(BeatmapSetInfo beatmap)
diff --git a/osu.Game/Overlays/DirectOverlay.cs b/osu.Game/Overlays/DirectOverlay.cs
index 05b5bba09c..8d8a4aebaa 100644
--- a/osu.Game/Overlays/DirectOverlay.cs
+++ b/osu.Game/Overlays/DirectOverlay.cs
@@ -185,7 +185,7 @@ namespace osu.Game.Overlays
resultCountsContainer.Colour = colours.Yellow;
- beatmaps.BeatmapSetAdded += setAdded;
+ beatmaps.ItemAdded += setAdded;
}
private void setAdded(BeatmapSetInfo set)
diff --git a/osu.Game/Overlays/Music/PlaylistOverlay.cs b/osu.Game/Overlays/Music/PlaylistOverlay.cs
index 2125984785..ac7ec6257b 100644
--- a/osu.Game/Overlays/Music/PlaylistOverlay.cs
+++ b/osu.Game/Overlays/Music/PlaylistOverlay.cs
@@ -74,8 +74,8 @@ namespace osu.Game.Overlays.Music
},
};
- beatmaps.BeatmapSetAdded += list.AddBeatmapSet;
- beatmaps.BeatmapSetRemoved += list.RemoveBeatmapSet;
+ beatmaps.ItemAdded += list.AddBeatmapSet;
+ beatmaps.ItemRemoved += list.RemoveBeatmapSet;
list.BeatmapSets = beatmaps.GetAllUsableBeatmapSets();
diff --git a/osu.Game/Screens/Menu/Intro.cs b/osu.Game/Screens/Menu/Intro.cs
index e0467d8f84..ce3c93ebcf 100644
--- a/osu.Game/Screens/Menu/Intro.cs
+++ b/osu.Game/Screens/Menu/Intro.cs
@@ -10,8 +10,8 @@ using osu.Framework.Screens;
using osu.Framework.Graphics;
using osu.Framework.MathUtils;
using osu.Game.Beatmaps;
-using osu.Game.Beatmaps.IO;
using osu.Game.Configuration;
+using osu.Game.IO.Archives;
using osu.Game.Screens.Backgrounds;
using OpenTK;
using OpenTK.Graphics;
@@ -62,7 +62,7 @@ namespace osu.Game.Screens.Menu
if (setInfo == null)
{
// we need to import the default menu background beatmap
- setInfo = beatmaps.Import(new OszArchiveReader(game.Resources.GetStream(@"Tracks/circles.osz"), "circles.osz"));
+ setInfo = beatmaps.Import(new ZipArchiveReader(game.Resources.GetStream(@"Tracks/circles.osz"), "circles.osz"));
setInfo.Protected = true;
beatmaps.Update(setInfo);
diff --git a/osu.Game/Screens/Select/SongSelect.cs b/osu.Game/Screens/Select/SongSelect.cs
index 2421a4fdfe..f35768d933 100644
--- a/osu.Game/Screens/Select/SongSelect.cs
+++ b/osu.Game/Screens/Select/SongSelect.cs
@@ -197,8 +197,8 @@ namespace osu.Game.Screens.Select
if (osu != null)
Ruleset.BindTo(osu.Ruleset);
- this.beatmaps.BeatmapSetAdded += onBeatmapSetAdded;
- this.beatmaps.BeatmapSetRemoved += onBeatmapSetRemoved;
+ this.beatmaps.ItemAdded += onBeatmapSetAdded;
+ this.beatmaps.ItemRemoved += onBeatmapSetRemoved;
this.beatmaps.BeatmapHidden += onBeatmapHidden;
this.beatmaps.BeatmapRestored += onBeatmapRestored;
@@ -401,8 +401,8 @@ namespace osu.Game.Screens.Select
if (beatmaps != null)
{
- beatmaps.BeatmapSetAdded -= onBeatmapSetAdded;
- beatmaps.BeatmapSetRemoved -= onBeatmapSetRemoved;
+ beatmaps.ItemAdded -= onBeatmapSetAdded;
+ beatmaps.ItemRemoved -= onBeatmapSetRemoved;
beatmaps.BeatmapHidden -= onBeatmapHidden;
beatmaps.BeatmapRestored -= onBeatmapRestored;
}
diff --git a/osu.Game/osu.Game.csproj b/osu.Game/osu.Game.csproj
index af2b1dfae5..91aaf9c092 100644
--- a/osu.Game/osu.Game.csproj
+++ b/osu.Game/osu.Game.csproj
@@ -274,7 +274,7 @@
-
+
@@ -282,10 +282,13 @@
+
-
+
+
+
@@ -378,8 +381,6 @@
-
-
@@ -394,7 +395,6 @@
-