diff --git a/Quaver.API/Helpers/Objects.cs b/Quaver.API/Helpers/Objects.cs deleted file mode 100644 index d0e2c7fbe..000000000 --- a/Quaver.API/Helpers/Objects.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System.IO; -using System.Runtime.Serialization.Formatters.Binary; - -namespace Quaver.API.Helpers -{ - public static class Objects - { - /// - /// Clones an entire object. - /// - /// - /// - /// - public static T DeepClone(T obj) - { - using (var ms = new MemoryStream()) - { - var formatter = new BinaryFormatter(); - formatter.Serialize(ms, obj); - ms.Position = 0; - - return (T)formatter.Deserialize(ms); - } - } - } -} \ No newline at end of file diff --git a/Quaver.API/Maps/Qua.cs b/Quaver.API/Maps/Qua.cs index 82a973738..0e0fc4b86 100644 --- a/Quaver.API/Maps/Qua.cs +++ b/Quaver.API/Maps/Qua.cs @@ -13,6 +13,7 @@ using System.Linq; using System.Reflection; using System.Text; +using Force.DeepCloner; using MonoGame.Extended.Collections; using Quaver.API.Enums; using Quaver.API.Helpers; @@ -353,7 +354,7 @@ public string Serialize() // the bookmarks in the file. if (Bookmarks.Count == 0) Bookmarks = null; - + var serializer = new Serializer(); var stringWriter = new StringWriter {NewLine = "\r\n"}; serializer.Serialize(stringWriter, this); @@ -629,7 +630,7 @@ public DifficultyProcessor SolveDifficulty(ModIdentifier mods = ModIdentifier.No // Create a new version of the qua with modifiers applied, and use that for calculations. if (applyMods) { - qua = Objects.DeepClone(qua); + qua = qua.DeepClone(); qua.ApplyMods(mods); } @@ -952,7 +953,7 @@ public void RandomizeLanes(int seed) public void MirrorHitObjects() { var keyCount = GetKeyCount(); - + for (var i = 0; i < HitObjects.Count; i++) { var temp = HitObjects[i]; @@ -1400,4 +1401,4 @@ public string GetAudioPath() return $"{Path.GetDirectoryName(FilePath)}/{AudioFile}"; } } -} +} \ No newline at end of file diff --git a/Quaver.API/Quaver.API.csproj b/Quaver.API/Quaver.API.csproj index 36cb08ed3..a79e963b6 100644 --- a/Quaver.API/Quaver.API.csproj +++ b/Quaver.API/Quaver.API.csproj @@ -12,6 +12,7 @@ + @@ -21,4 +22,4 @@ - + \ No newline at end of file