Esempio n. 1
0
        protected override Beatmap GetBeatmap()
        {
            try
            {
                Beatmap beatmap;

                using (var reader = getReader())
                {
                    BeatmapDecoder decoder;
                    using (var stream = new StreamReader(reader.GetStream(BeatmapInfo.Path)))
                    {
                        decoder = BeatmapDecoder.GetDecoder(stream);
                        beatmap = decoder?.Decode(stream);
                    }

                    if (WithStoryboard && beatmap != null && BeatmapSetInfo.StoryboardFile != null)
                    {
                        using (var stream = new StreamReader(reader.GetStream(BeatmapSetInfo.StoryboardFile)))
                            decoder.Decode(stream, beatmap);
                    }
                }

                return(beatmap);
            }
            catch { return(null); }
        }
Esempio n. 2
0
            protected override Beatmap GetBeatmap()
            {
                try
                {
                    Beatmap beatmap;

                    BeatmapDecoder decoder;
                    using (var stream = new StreamReader(store.GetStream(getPathForFile(BeatmapInfo.Path))))
                    {
                        decoder = BeatmapDecoder.GetDecoder(stream);
                        beatmap = decoder.Decode(stream);
                    }

                    if (beatmap == null || BeatmapSetInfo.StoryboardFile == null)
                    {
                        return(beatmap);
                    }

                    using (var stream = new StreamReader(store.GetStream(getPathForFile(BeatmapSetInfo.StoryboardFile))))
                        decoder.Decode(stream, beatmap);


                    return(beatmap);
                }
                catch
                {
                    return(null);
                }
            }
Esempio n. 3
0
        private void Osu_Signal(string line)
        {
            var data = line.Split('|');

            if (data.Length != 5)
            {
                return;
            }
            // [ time, audioPath, audioCurrentTime, audioPlaybackRate, beatmapPath ]
            // 재생 중인 곡이 바꼈다!
            if (data[1] != curAudio.Path)
            {
                using (var fs = new FileStream(data[1], FileMode.Open, FileAccess.Read))
                {
                    curAudio = AudioDecoder.GetDecoder(fs)?.Decode(fs);
                }
                curAudio.Path = data[1];
                using (var sr = new StreamReader(data[4]))
                {
                    curAudio.Beatmap = BeatmapDecoder.GetDecoder(sr)?.Decode(sr);
                }
                UpdateLyrics();
            }
            curTime = DateTimeOffset.Now.Subtract(
                DateTimeOffset.FromFileTime(Convert.ToInt64(data[0], 16))
                ).TotalSeconds + Convert.ToDouble(data[2]);
            _playbackRate = 1 + Convert.ToDouble(data[3]) / 100;
        }
Esempio n. 4
0
        public void Import(params string[] paths)
        {
            foreach (string p in paths)
            {
                var    path = p;
                string hash = null;

                BeatmapMetadata metadata;

                using (var reader = ArchiveReader.GetReader(storage, path))
                    metadata = reader.ReadMetadata();

                if (connection.Table <BeatmapSetInfo>().Count(b => b.BeatmapSetID == metadata.BeatmapSetID) != 0)
                {
                    return;            // TODO: Update this beatmap instead
                }
                if (File.Exists(path)) // Not always the case, i.e. for LegacyFilesystemReader
                {
                    using (var md5 = MD5.Create())
                        using (var input = storage.GetStream(path))
                        {
                            hash = BitConverter.ToString(md5.ComputeHash(input)).Replace("-", "").ToLowerInvariant();
                            input.Seek(0, SeekOrigin.Begin);
                            path = Path.Combine(@"beatmaps", hash.Remove(1), hash.Remove(2), hash);
                            using (var output = storage.GetStream(path, FileAccess.Write))
                                input.CopyTo(output);
                        }
                }
                var beatmapSet = new BeatmapSetInfo
                {
                    BeatmapSetID = metadata.BeatmapSetID,
                    Beatmaps     = new List <BeatmapInfo>(),
                    Path         = path,
                    Hash         = hash,
                    Metadata     = metadata
                };

                using (var reader = ArchiveReader.GetReader(storage, path))
                {
                    string[] mapNames = reader.ReadBeatmaps();
                    foreach (var name in mapNames)
                    {
                        using (var stream = new StreamReader(reader.GetStream(name)))
                        {
                            var     decoder = BeatmapDecoder.GetDecoder(stream);
                            Beatmap beatmap = decoder.Decode(stream);
                            beatmap.BeatmapInfo.Path = name;

                            // TODO: Diff beatmap metadata with set metadata and leave it here if necessary
                            beatmap.BeatmapInfo.Metadata = null;

                            beatmapSet.Beatmaps.Add(beatmap.BeatmapInfo);
                        }
                    }
                }

                Import(new[] { beatmapSet });
            }
        }
Esempio n. 5
0
        protected virtual Beatmap CreateBeatmap()
        {
            Beatmap beatmap;

            using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(test_beatmap_data)))
                using (var reader = new StreamReader(stream))
                    beatmap = BeatmapDecoder.GetDecoder(reader).Decode(reader);

            return(beatmap);
        }
Esempio n. 6
0
 public LegacyFilesystemReader(string path)
 {
     basePath = path;
     beatmaps = Directory.GetFiles(basePath, @"*.osu").Select(f => Path.GetFileName(f)).ToArray();
     if (beatmaps.Length == 0)
     {
         throw new FileNotFoundException(@"This directory contains no beatmaps");
     }
     using (var stream = new StreamReader(GetStream(beatmaps[0])))
     {
         var decoder = BeatmapDecoder.GetDecoder(stream);
         firstMap = decoder.Decode(stream);
     }
 }
Esempio n. 7
0
 public LegacyFilesystemReader(string path)
 {
     basePath         = path;
     BeatmapFilenames = Directory.GetFiles(basePath, @"*.osu").Select(Path.GetFileName).ToArray();
     if (BeatmapFilenames.Length == 0)
     {
         throw new FileNotFoundException(@"This directory contains no beatmaps");
     }
     StoryboardFilename = Directory.GetFiles(basePath, @"*.osb").Select(Path.GetFileName).FirstOrDefault();
     using (var stream = new StreamReader(GetStream(BeatmapFilenames[0])))
     {
         var decoder = BeatmapDecoder.GetDecoder(stream);
         firstMap = decoder.Decode(stream);
     }
 }
Esempio n. 8
0
 public OszArchiveReader(Stream archiveStream)
 {
     this.archiveStream = archiveStream;
     archive            = ZipFile.Read(archiveStream);
     beatmaps           = archive.Entries.Where(e => e.FileName.EndsWith(@".osu"))
                          .Select(e => e.FileName).ToArray();
     if (beatmaps.Length == 0)
     {
         throw new FileNotFoundException(@"This directory contains no beatmaps");
     }
     using (var stream = new StreamReader(GetStream(beatmaps[0])))
     {
         var decoder = BeatmapDecoder.GetDecoder(stream);
         firstMap = decoder.Decode(stream);
     }
 }
Esempio n. 9
0
        public Beatmap GetBeatmap(BeatmapInfo beatmapInfo)
        {
            var beatmapSet = Query <BeatmapSetInfo>()
                             .Where(s => s.BeatmapSetID == beatmapInfo.BeatmapSetID).FirstOrDefault();

            if (beatmapSet == null)
            {
                throw new InvalidOperationException(
                          $@"Beatmap set {beatmapInfo.BeatmapSetID} is not in the local database.");
            }
            using (var reader = GetReader(beatmapSet))
                using (var stream = new StreamReader(reader.ReadFile(beatmapInfo.Path)))
                {
                    var decoder = BeatmapDecoder.GetDecoder(stream);
                    return(decoder.Decode(stream));
                }
        }
Esempio n. 10
0
        public void TestReadMetadata()
        {
            using (var osz = Resource.OpenResource("Beatmaps.241526 Soleily - Renatus.osz"))
            {
                var reader = new OszArchiveReader(osz);

                BeatmapMetadata meta;
                using (var stream = new StreamReader(reader.GetStream("Soleily - Renatus (Deif) [Platter].osu")))
                    meta = BeatmapDecoder.GetDecoder(stream).Decode(stream).Metadata;

                Assert.AreEqual(241526, meta.OnlineBeatmapSetID);
                Assert.AreEqual("Soleily", meta.Artist);
                Assert.AreEqual("Soleily", meta.ArtistUnicode);
                Assert.AreEqual("03. Renatus - Soleily 192kbps.mp3", meta.AudioFile);
                Assert.AreEqual("Deif", meta.Author);
                Assert.AreEqual("machinetop_background.jpg", meta.BackgroundFile);
                Assert.AreEqual(164471, meta.PreviewTime);
                Assert.AreEqual(string.Empty, meta.Source);
                Assert.AreEqual("MBC7 Unisphere 地球ヤバイEP Chikyu Yabai", meta.Tags);
                Assert.AreEqual("Renatus", meta.Title);
                Assert.AreEqual("Renatus", meta.TitleUnicode);
            }
        }
Esempio n. 11
0
        private void loadPlayerFor(RulesetInfo r)
        {
            Beatmap beatmap;

            using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(test_beatmap_data)))
                using (var reader = new StreamReader(stream))
                    beatmap = BeatmapDecoder.GetDecoder(reader).Decode(reader);

            beatmap.BeatmapInfo.Ruleset = r;

            var instance = r.CreateInstance();

            WorkingBeatmap working = new TestWorkingBeatmap(beatmap);

            working.Mods.Value = new[] { instance.GetAllMods().First(m => m is ModNoFail) };

            if (Player != null)
            {
                Remove(Player);
            }

            Add(Player = CreatePlayer(working, instance));
        }
Esempio n. 12
0
        /// <summary>
        /// Import a beamap into our local <see cref="FileStore"/> storage.
        /// If the beatmap is already imported, the existing instance will be returned.
        /// </summary>
        /// <param name="files">The store to import beatmap files to.</param>
        /// <param name="beatmaps">The store to import beatmaps to.</param>
        /// <param name="reader">The beatmap archive to be read.</param>
        /// <returns>The imported beatmap, or an existing instance if it is already present.</returns>
        private BeatmapSetInfo importToStorage(FileStore files, BeatmapStore beatmaps, ArchiveReader reader)
        {
            // let's make sure there are actually .osu files to import.
            string mapName = reader.Filenames.FirstOrDefault(f => f.EndsWith(".osu"));

            if (string.IsNullOrEmpty(mapName))
            {
                throw new InvalidOperationException("No beatmap files found in the map folder.");
            }

            // for now, concatenate all .osu files in the set to create a unique hash.
            MemoryStream hashable = new MemoryStream();

            foreach (string file in reader.Filenames.Where(f => f.EndsWith(".osu")))
            {
                using (Stream s = reader.GetStream(file))
                    s.CopyTo(hashable);
            }

            var hash = hashable.ComputeSHA2Hash();

            // check if this beatmap has already been imported and exit early if so.
            var beatmapSet = beatmaps.BeatmapSets.FirstOrDefault(b => b.Hash == hash);

            if (beatmapSet != null)
            {
                undelete(beatmaps, files, beatmapSet);

                // ensure all files are present and accessible
                foreach (var f in beatmapSet.Files)
                {
                    if (!storage.Exists(f.FileInfo.StoragePath))
                    {
                        using (Stream s = reader.GetStream(f.Filename))
                            files.Add(s, false);
                    }
                }

                // todo: delete any files which shouldn't exist any more.

                return(beatmapSet);
            }

            List <BeatmapSetFileInfo> fileInfos = new List <BeatmapSetFileInfo>();

            // import files to manager
            foreach (string file in reader.Filenames)
            {
                using (Stream s = reader.GetStream(file))
                    fileInfos.Add(new BeatmapSetFileInfo
                    {
                        Filename = file,
                        FileInfo = files.Add(s)
                    });
            }

            BeatmapMetadata metadata;

            using (var stream = new StreamReader(reader.GetStream(mapName)))
                metadata = BeatmapDecoder.GetDecoder(stream).Decode(stream).Metadata;

            beatmapSet = new BeatmapSetInfo
            {
                OnlineBeatmapSetID = metadata.OnlineBeatmapSetID,
                Beatmaps           = new List <BeatmapInfo>(),
                Hash     = hash,
                Files    = fileInfos,
                Metadata = metadata
            };

            var mapNames = reader.Filenames.Where(f => f.EndsWith(".osu"));

            foreach (var name in mapNames)
            {
                using (var raw = reader.GetStream(name))
                    using (var ms = new MemoryStream()) //we need a memory stream so we can seek and shit
                        using (var sr = new StreamReader(ms))
                        {
                            raw.CopyTo(ms);
                            ms.Position = 0;

                            var     decoder = BeatmapDecoder.GetDecoder(sr);
                            Beatmap beatmap = decoder.Decode(sr);

                            beatmap.BeatmapInfo.Path    = name;
                            beatmap.BeatmapInfo.Hash    = ms.ComputeSHA2Hash();
                            beatmap.BeatmapInfo.MD5Hash = ms.ComputeMD5Hash();

                            // TODO: Diff beatmap metadata with set metadata and leave it here if necessary
                            beatmap.BeatmapInfo.Metadata = null;

                            RulesetInfo ruleset = rulesets.GetRuleset(beatmap.BeatmapInfo.RulesetID);

                            // TODO: this should be done in a better place once we actually need to dynamically update it.
                            beatmap.BeatmapInfo.Ruleset        = ruleset;
                            beatmap.BeatmapInfo.StarDifficulty = ruleset?.CreateInstance()?.CreateDifficultyCalculator(beatmap).Calculate() ?? 0;

                            beatmapSet.Beatmaps.Add(beatmap.BeatmapInfo);
                        }
            }

            return(beatmapSet);
        }
Esempio n. 13
0
        /// <summary>
        /// Duplicates content from <paramref name="path"/> to storage and returns a representing <see cref="BeatmapSetInfo"/>.
        /// </summary>
        /// <param name="path">Content location</param>
        /// <returns><see cref="BeatmapSetInfo"/></returns>
        private BeatmapSetInfo getBeatmapSet(string path)
        {
            string hash = null;

            BeatmapMetadata metadata;

            using (var reader = ArchiveReader.GetReader(storage, path))
                metadata = reader.ReadMetadata();

            if (File.Exists(path)) // Not always the case, i.e. for LegacyFilesystemReader
            {
                using (var input = storage.GetStream(path))
                {
                    hash = input.GetMd5Hash();
                    input.Seek(0, SeekOrigin.Begin);
                    path = Path.Combine(@"beatmaps", hash.Remove(1), hash.Remove(2), hash);
                    if (!storage.Exists(path))
                    {
                        using (var output = storage.GetStream(path, FileAccess.Write))
                            input.CopyTo(output);
                    }
                }
            }

            var existing = connection.Table <BeatmapSetInfo>().FirstOrDefault(b => b.Hash == hash);

            if (existing != null)
            {
                if (existing.DeletePending)
                {
                    existing.DeletePending = false;
                    Update(existing, false);
                    BeatmapSetAdded?.Invoke(existing);
                }

                return(existing);
            }

            var beatmapSet = new BeatmapSetInfo
            {
                OnlineBeatmapSetID = metadata.OnlineBeatmapSetID,
                Beatmaps           = new List <BeatmapInfo>(),
                Path     = path,
                Hash     = hash,
                Metadata = metadata
            };

            using (var archive = ArchiveReader.GetReader(storage, path))
            {
                string[] mapNames = archive.BeatmapFilenames;
                foreach (var name in mapNames)
                {
                    using (var raw = archive.GetStream(name))
                        using (var ms = new MemoryStream()) //we need a memory stream so we can seek and shit
                            using (var sr = new StreamReader(ms))
                            {
                                raw.CopyTo(ms);
                                ms.Position = 0;

                                var     decoder = BeatmapDecoder.GetDecoder(sr);
                                Beatmap beatmap = decoder.Decode(sr);

                                beatmap.BeatmapInfo.Path = name;
                                beatmap.BeatmapInfo.Hash = ms.GetMd5Hash();

                                // TODO: Diff beatmap metadata with set metadata and leave it here if necessary
                                beatmap.BeatmapInfo.Metadata = null;

                                beatmap.BeatmapInfo.StarDifficulty = beatmap.CalculateStarDifficulty();

                                beatmapSet.Beatmaps.Add(beatmap.BeatmapInfo);
                            }
                }
                beatmapSet.StoryboardFile = archive.StoryboardFilename;
            }

            return(beatmapSet);
        }
Esempio n. 14
0
        /// <summary>
        /// Import a beamap into our local <see cref="FileStore"/> storage.
        /// If the beatmap is already imported, the existing instance will be returned.
        /// </summary>
        /// <param name="reader">The beatmap archive to be read.</param>
        /// <returns>The imported beatmap, or an existing instance if it is already present.</returns>
        private BeatmapSetInfo importToStorage(ArchiveReader reader)
        {
            // for now, concatenate all .osu files in the set to create a unique hash.
            MemoryStream hashable = new MemoryStream();

            foreach (string file in reader.Filenames.Where(f => f.EndsWith(".osu")))
            {
                using (Stream s = reader.GetStream(file))
                    s.CopyTo(hashable);
            }

            var hash = hashable.ComputeSHA2Hash();

            // check if this beatmap has already been imported and exit early if so.
            var beatmapSet = beatmaps.QueryAndPopulate <BeatmapSetInfo>().FirstOrDefault(b => b.Hash == hash);

            if (beatmapSet != null)
            {
                Undelete(beatmapSet);
                return(beatmapSet);
            }

            List <FileInfo> fileInfos = new List <FileInfo>();

            // import files to manager
            foreach (string file in reader.Filenames)
            {
                using (Stream s = reader.GetStream(file))
                    fileInfos.Add(files.Add(s, file));
            }

            BeatmapMetadata metadata;

            using (var stream = new StreamReader(reader.GetStream(reader.Filenames.First(f => f.EndsWith(".osu")))))
                metadata = BeatmapDecoder.GetDecoder(stream).Decode(stream).Metadata;

            beatmapSet = new BeatmapSetInfo
            {
                OnlineBeatmapSetID = metadata.OnlineBeatmapSetID,
                Beatmaps           = new List <BeatmapInfo>(),
                Hash     = hash,
                Files    = fileInfos,
                Metadata = metadata
            };

            var mapNames = reader.Filenames.Where(f => f.EndsWith(".osu"));

            foreach (var name in mapNames)
            {
                using (var raw = reader.GetStream(name))
                    using (var ms = new MemoryStream()) //we need a memory stream so we can seek and shit
                        using (var sr = new StreamReader(ms))
                        {
                            raw.CopyTo(ms);
                            ms.Position = 0;

                            var     decoder = BeatmapDecoder.GetDecoder(sr);
                            Beatmap beatmap = decoder.Decode(sr);

                            beatmap.BeatmapInfo.Path = name;
                            beatmap.BeatmapInfo.Hash = ms.ComputeSHA2Hash();

                            // TODO: Diff beatmap metadata with set metadata and leave it here if necessary
                            beatmap.BeatmapInfo.Metadata = null;

                            // TODO: this should be done in a better place once we actually need to dynamically update it.
                            beatmap.BeatmapInfo.Ruleset        = rulesets.Query <RulesetInfo>().FirstOrDefault(r => r.ID == beatmap.BeatmapInfo.RulesetID);
                            beatmap.BeatmapInfo.StarDifficulty = rulesets.Query <RulesetInfo>().FirstOrDefault(r => r.ID == beatmap.BeatmapInfo.RulesetID)?.CreateInstance()?.CreateDifficultyCalculator(beatmap)
                                                                 .Calculate() ?? 0;

                            beatmapSet.Beatmaps.Add(beatmap.BeatmapInfo);
                        }
            }

            return(beatmapSet);
        }
Esempio n. 15
0
        /// <summary>
        /// Duplicates content from <paramref name="path"/> to storage and returns a representing <see cref="BeatmapSetInfo"/>.
        /// </summary>
        /// <param name="path">Content location</param>
        /// <returns><see cref="BeatmapSetInfo"/></returns>
        private BeatmapSetInfo getBeatmapSet(string path)
        {
            string hash = null;

            BeatmapMetadata metadata;

            using (var reader = ArchiveReader.GetReader(storage, path))
                metadata = reader.ReadMetadata();

            if (File.Exists(path)) // Not always the case, i.e. for LegacyFilesystemReader
            {
                using (var md5 = MD5.Create())
                    using (var input = storage.GetStream(path))
                    {
                        hash = BitConverter.ToString(md5.ComputeHash(input)).Replace("-", "").ToLowerInvariant();
                        input.Seek(0, SeekOrigin.Begin);
                        path = Path.Combine(@"beatmaps", hash.Remove(1), hash.Remove(2), hash);
                        if (!storage.Exists(path))
                        {
                            using (var output = storage.GetStream(path, FileAccess.Write))
                                input.CopyTo(output);
                        }
                    }
            }

            var existing = connection.Table <BeatmapSetInfo>().FirstOrDefault(b => b.Hash == hash);

            if (existing != null)
            {
                if (existing.DeletePending)
                {
                    existing.DeletePending = false;
                    Update(existing, false);
                    BeatmapSetAdded?.Invoke(existing);
                }

                return(existing);
            }

            var beatmapSet = new BeatmapSetInfo
            {
                OnlineBeatmapSetID = metadata.OnlineBeatmapSetID,
                Beatmaps           = new List <BeatmapInfo>(),
                Path     = path,
                Hash     = hash,
                Metadata = metadata
            };

            using (var reader = ArchiveReader.GetReader(storage, path))
            {
                string[] mapNames = reader.BeatmapFilenames;
                foreach (var name in mapNames)
                {
                    using (var stream = new StreamReader(reader.GetStream(name)))
                    {
                        var     decoder = BeatmapDecoder.GetDecoder(stream);
                        Beatmap beatmap = decoder.Decode(stream);
                        beatmap.BeatmapInfo.Path = name;

                        // TODO: Diff beatmap metadata with set metadata and leave it here if necessary
                        beatmap.BeatmapInfo.Metadata = null;

                        beatmapSet.Beatmaps.Add(beatmap.BeatmapInfo);
                    }
                }
                beatmapSet.StoryboardFile = reader.StoryboardFilename;
            }

            return(beatmapSet);
        }
Esempio n. 16
0
        private BeatmapSetInfo getBeatmapSet(ArchiveReader archiveReader)
        {
            BeatmapMetadata metadata;

            using (var stream = new StreamReader(archiveReader.GetStream(archiveReader.BeatmapFilenames[0])))
                metadata = BeatmapDecoder.GetDecoder(stream).Decode(stream).Metadata;

            string hash;
            string path;

            using (var input = archiveReader.GetUnderlyingStream())
            {
                hash = input.GetMd5Hash();
                input.Seek(0, SeekOrigin.Begin);
                path = Path.Combine(@"beatmaps", hash.Remove(1), hash.Remove(2), hash);
                if (!Storage.Exists(path))
                {
                    using (var output = Storage.GetStream(path, FileAccess.Write))
                        input.CopyTo(output);
                }
            }

            var existing = Connection.Table <BeatmapSetInfo>().FirstOrDefault(b => b.Hash == hash);

            if (existing != null)
            {
                GetChildren(existing);

                if (existing.DeletePending)
                {
                    existing.DeletePending = false;
                    Update(existing, false);
                    BeatmapSetAdded?.Invoke(existing);
                }

                return(existing);
            }

            var beatmapSet = new BeatmapSetInfo
            {
                OnlineBeatmapSetID = metadata.OnlineBeatmapSetID,
                Beatmaps           = new List <BeatmapInfo>(),
                Path     = path,
                Hash     = hash,
                Metadata = metadata
            };

            using (var archive = ArchiveReader.GetReader(Storage, path))
            {
                string[] mapNames = archive.BeatmapFilenames;
                foreach (var name in mapNames)
                {
                    using (var raw = archive.GetStream(name))
                        using (var ms = new MemoryStream()) //we need a memory stream so we can seek and shit
                            using (var sr = new StreamReader(ms))
                            {
                                raw.CopyTo(ms);
                                ms.Position = 0;

                                var     decoder = BeatmapDecoder.GetDecoder(sr);
                                Beatmap beatmap = decoder.Decode(sr);

                                beatmap.BeatmapInfo.Path = name;
                                beatmap.BeatmapInfo.Hash = ms.GetMd5Hash();

                                // TODO: Diff beatmap metadata with set metadata and leave it here if necessary
                                beatmap.BeatmapInfo.Metadata = null;

                                // TODO: this should be done in a better place once we actually need to dynamically update it.
                                beatmap.BeatmapInfo.Ruleset        = rulesets.Query <RulesetInfo>().FirstOrDefault(r => r.ID == beatmap.BeatmapInfo.RulesetID);
                                beatmap.BeatmapInfo.StarDifficulty = rulesets.Query <RulesetInfo>().FirstOrDefault(r => r.ID == beatmap.BeatmapInfo.RulesetID)?.CreateInstance()?.CreateDifficultyCalculator(beatmap).Calculate() ?? 0;

                                beatmapSet.Beatmaps.Add(beatmap.BeatmapInfo);
                            }
                }
                beatmapSet.StoryboardFile = archive.StoryboardFilename;
            }

            return(beatmapSet);
        }