Exemplo n.º 1
0
 private static Beatmap readFromFile(string filename)
 {
     using (var stream = File.OpenRead(filename))
         using (var reader = new LineBufferedReader(stream))
             return(Decoder.GetDecoder <Beatmap>(reader).Decode(reader));
 }
Exemplo n.º 2
0
        public void TestDecodeBeatmapTimingPoints()
        {
            var decoder = new LegacyBeatmapDecoder {
                ApplyOffsets = false
            };

            using (var resStream = TestResources.OpenResource("Soleily - Renatus (Gamu) [Insane].osu"))
                using (var stream = new LineBufferedReader(resStream))
                {
                    var beatmap       = decoder.Decode(stream);
                    var controlPoints = beatmap.ControlPointInfo;

                    Assert.AreEqual(4, controlPoints.TimingPoints.Count);
                    Assert.AreEqual(5, controlPoints.DifficultyPoints.Count);
                    Assert.AreEqual(34, controlPoints.SamplePoints.Count);
                    Assert.AreEqual(8, controlPoints.EffectPoints.Count);

                    var timingPoint = controlPoints.TimingPointAt(0);
                    Assert.AreEqual(956, timingPoint.Time);
                    Assert.AreEqual(329.67032967033, timingPoint.BeatLength);
                    Assert.AreEqual(TimeSignatures.SimpleQuadruple, timingPoint.TimeSignature);

                    timingPoint = controlPoints.TimingPointAt(48428);
                    Assert.AreEqual(956, timingPoint.Time);
                    Assert.AreEqual(329.67032967033d, timingPoint.BeatLength);
                    Assert.AreEqual(TimeSignatures.SimpleQuadruple, timingPoint.TimeSignature);

                    timingPoint = controlPoints.TimingPointAt(119637);
                    Assert.AreEqual(119637, timingPoint.Time);
                    Assert.AreEqual(659.340659340659, timingPoint.BeatLength);
                    Assert.AreEqual(TimeSignatures.SimpleQuadruple, timingPoint.TimeSignature);

                    var difficultyPoint = controlPoints.DifficultyPointAt(0);
                    Assert.AreEqual(0, difficultyPoint.Time);
                    Assert.AreEqual(1.0, difficultyPoint.SpeedMultiplier);

                    difficultyPoint = controlPoints.DifficultyPointAt(48428);
                    Assert.AreEqual(0, difficultyPoint.Time);
                    Assert.AreEqual(1.0, difficultyPoint.SpeedMultiplier);

                    difficultyPoint = controlPoints.DifficultyPointAt(116999);
                    Assert.AreEqual(116999, difficultyPoint.Time);
                    Assert.AreEqual(0.75, difficultyPoint.SpeedMultiplier, 0.1);

                    var soundPoint = controlPoints.SamplePointAt(0);
                    Assert.AreEqual(956, soundPoint.Time);
                    Assert.AreEqual("soft", soundPoint.SampleBank);
                    Assert.AreEqual(60, soundPoint.SampleVolume);

                    soundPoint = controlPoints.SamplePointAt(53373);
                    Assert.AreEqual(53373, soundPoint.Time);
                    Assert.AreEqual("soft", soundPoint.SampleBank);
                    Assert.AreEqual(60, soundPoint.SampleVolume);

                    soundPoint = controlPoints.SamplePointAt(119637);
                    Assert.AreEqual(119637, soundPoint.Time);
                    Assert.AreEqual("soft", soundPoint.SampleBank);
                    Assert.AreEqual(80, soundPoint.SampleVolume);

                    var effectPoint = controlPoints.EffectPointAt(0);
                    Assert.AreEqual(0, effectPoint.Time);
                    Assert.IsFalse(effectPoint.KiaiMode);
                    Assert.IsFalse(effectPoint.OmitFirstBarLine);

                    effectPoint = controlPoints.EffectPointAt(53703);
                    Assert.AreEqual(53703, effectPoint.Time);
                    Assert.IsTrue(effectPoint.KiaiMode);
                    Assert.IsFalse(effectPoint.OmitFirstBarLine);

                    effectPoint = controlPoints.EffectPointAt(119637);
                    Assert.AreEqual(95901, effectPoint.Time);
                    Assert.IsFalse(effectPoint.KiaiMode);
                    Assert.IsFalse(effectPoint.OmitFirstBarLine);
                }
        }
Exemplo n.º 3
0
 private IBeatmap decode(byte[] state)
 {
     using (var stream = new MemoryStream(state))
         using (var reader = new LineBufferedReader(stream))
             return(Decoder.GetDecoder <Beatmap>(reader).Decode(reader));
 }
Exemplo n.º 4
0
 protected override void ParseStreamInto(LineBufferedReader stream, Storyboard storyboard)
 {
     this.storyboard = storyboard;
     base.ParseStreamInto(stream, storyboard);
 }
Exemplo n.º 5
0
        public void TestDecodeStoryboardEvents()
        {
            var decoder = new LegacyStoryboardDecoder();

            using (var resStream = TestResources.OpenResource("Himeringo - Yotsuya-san ni Yoroshiku (RLC) [Winber1's Extreme].osu"))
                using (var stream = new LineBufferedReader(resStream))
                {
                    var storyboard = decoder.Decode(stream);

                    Assert.IsTrue(storyboard.HasDrawable);
                    Assert.AreEqual(6, storyboard.Layers.Count());

                    StoryboardLayer background = storyboard.Layers.FirstOrDefault(l => l.Depth == 3);
                    Assert.IsNotNull(background);
                    Assert.AreEqual(16, background.Elements.Count);
                    Assert.IsTrue(background.VisibleWhenFailing);
                    Assert.IsTrue(background.VisibleWhenPassing);
                    Assert.AreEqual("Background", background.Name);

                    StoryboardLayer fail = storyboard.Layers.FirstOrDefault(l => l.Depth == 2);
                    Assert.IsNotNull(fail);
                    Assert.AreEqual(0, fail.Elements.Count);
                    Assert.IsTrue(fail.VisibleWhenFailing);
                    Assert.IsFalse(fail.VisibleWhenPassing);
                    Assert.AreEqual("Fail", fail.Name);

                    StoryboardLayer pass = storyboard.Layers.FirstOrDefault(l => l.Depth == 1);
                    Assert.IsNotNull(pass);
                    Assert.AreEqual(0, pass.Elements.Count);
                    Assert.IsFalse(pass.VisibleWhenFailing);
                    Assert.IsTrue(pass.VisibleWhenPassing);
                    Assert.AreEqual("Pass", pass.Name);

                    StoryboardLayer foreground = storyboard.Layers.FirstOrDefault(l => l.Depth == 0);
                    Assert.IsNotNull(foreground);
                    Assert.AreEqual(151, foreground.Elements.Count);
                    Assert.IsTrue(foreground.VisibleWhenFailing);
                    Assert.IsTrue(foreground.VisibleWhenPassing);
                    Assert.AreEqual("Foreground", foreground.Name);

                    StoryboardLayer overlay = storyboard.Layers.FirstOrDefault(l => l.Depth == int.MinValue);
                    Assert.IsNotNull(overlay);
                    Assert.IsEmpty(overlay.Elements);
                    Assert.IsTrue(overlay.VisibleWhenFailing);
                    Assert.IsTrue(overlay.VisibleWhenPassing);
                    Assert.AreEqual("Overlay", overlay.Name);

                    int spriteCount    = background.Elements.Count(x => x.GetType() == typeof(StoryboardSprite));
                    int animationCount = background.Elements.Count(x => x.GetType() == typeof(StoryboardAnimation));
                    int sampleCount    = background.Elements.Count(x => x.GetType() == typeof(StoryboardSampleInfo));

                    Assert.AreEqual(15, spriteCount);
                    Assert.AreEqual(1, animationCount);
                    Assert.AreEqual(0, sampleCount);
                    Assert.AreEqual(background.Elements.Count, spriteCount + animationCount + sampleCount);

                    var sprite = background.Elements.ElementAt(0) as StoryboardSprite;
                    Assert.NotNull(sprite);
                    Assert.IsTrue(sprite.HasCommands);
                    Assert.AreEqual(new Vector2(320, 240), sprite.InitialPosition);
                    Assert.IsTrue(sprite.IsDrawable);
                    Assert.AreEqual(Anchor.Centre, sprite.Origin);
                    Assert.AreEqual("SB/lyric/ja-21.png", sprite.Path);

                    var animation = background.Elements.OfType <StoryboardAnimation>().First();
                    Assert.NotNull(animation);
                    Assert.AreEqual(141175, animation.EndTime);
                    Assert.AreEqual(10, animation.FrameCount);
                    Assert.AreEqual(30, animation.FrameDelay);
                    Assert.IsTrue(animation.HasCommands);
                    Assert.AreEqual(new Vector2(320, 240), animation.InitialPosition);
                    Assert.IsTrue(animation.IsDrawable);
                    Assert.AreEqual(AnimationLoopType.LoopForever, animation.LoopType);
                    Assert.AreEqual(Anchor.Centre, animation.Origin);
                    Assert.AreEqual("SB/red jitter/red_0000.jpg", animation.Path);
                    Assert.AreEqual(78993, animation.StartTime);
                }
        }
Exemplo n.º 6
0
 private static Beatmap createTestBeatmap()
 {
     using (var stream = new MemoryStream(Encoding.UTF8.GetBytes(test_beatmap_data)))
         using (var reader = new LineBufferedReader(stream))
             return(Decoder.GetDecoder <Beatmap>(reader).Decode(reader));
 }
Exemplo n.º 7
0
Arquivo: Decoder.cs Projeto: Wieku/osu
 protected abstract void ParseStreamInto(LineBufferedReader stream, TOutput output);
Exemplo n.º 8
0
 private static Beatmap readFromStream(Stream stream)
 {
     using (var reader = new LineBufferedReader(stream))
         return(Decoder.GetDecoder <Beatmap>(reader).Decode(reader));
 }
Exemplo n.º 9
0
 private LoaderWorkingBeatmap(LineBufferedReader reader)
     : this(Decoder.GetDecoder <Beatmap>(reader).Decode(reader))
 {
 }
Exemplo n.º 10
0
 private static Beatmap createTestBeatmap()
 {
     using (var stream = TestResources.OpenBeatmapResource("karaoke-file-samples"))
         using (var reader = new LineBufferedReader(stream))
             return(Decoder.GetDecoder <Beatmap>(reader).Decode(reader));
 }
        protected override void ParseLine(Beatmap beatmap, Section section, string line)
        {
            if (section != Section.HitObjects)
            {
                base.ParseLine(beatmap, section, line);
                return;
            }

            if (line.ToLower().StartsWith("@ruby", StringComparison.Ordinal) || line.ToLower().StartsWith("@romaji", StringComparison.Ordinal))
            {
                // lrc queue
                lrcLines.Add(line);
            }
            else if (line.ToLower().StartsWith("@note", StringComparison.Ordinal))
            {
                // add tone line queue
                noteLines.Add(line);
            }
            else if (line.ToLower().StartsWith("@style", StringComparison.Ordinal))
            {
                // add style queue
                lyricStyles.Add(line);
            }
            else if (line.ToLower().StartsWith("@tr", StringComparison.Ordinal))
            {
                // add translate queue
                translates.Add(line);
            }
            else if (line.StartsWith("@", StringComparison.Ordinal))
            {
                // Remove @ in time tag and add into lrc queue
                lrcLines.Add(line.Substring(1));
            }
            else if (line.ToLower() == "end")
            {
                // Start processing file
                using (var stream = new MemoryStream())
                    using (var writer = new StreamWriter(stream))
                        using (var reader = new LineBufferedReader(stream))
                        {
                            // Create stream
                            writer.Write(string.Join("\n", lrcLines));
                            writer.Flush();
                            stream.Position = 0;

                            // Create lec decoder
                            var decoder    = new LrcDecoder();
                            var lrcBeatmap = decoder.Decode(reader);

                            // Apply hitobjects
                            beatmap.HitObjects = lrcBeatmap.HitObjects;
                        }

                processNotes(beatmap, noteLines);
                processTranslate(beatmap, translates);

                if (lyricStyles.Any())
                {
                    processStyle(beatmap, lyricStyles);
                }
            }
        }
Exemplo n.º 12
0
        /// <summary>
        /// Prepares bare minimum information about beatmap
        /// </summary>
        /// <param name="file">beatmap path</param>
        /// <returns></returns>
        public Beatmap LoadBeatmap(string file)
        {
            IBeatmap             lazerBeatmap;
            DifficultyAttributes difficultyAttributes;

            using (var raw = File.OpenRead(file))
                using (var ms = new MemoryStream())
                    using (var sr = new LineBufferedReader(ms))
                    {
                        raw.CopyTo(ms);
                        ms.Position = 0;

                        var decoder = Decoder.GetDecoder <osu.Game.Beatmaps.Beatmap>(sr);
                        lazerBeatmap = decoder.Decode(sr);

                        lazerBeatmap.BeatmapInfo.Path    = Path.GetFileName(file);
                        lazerBeatmap.BeatmapInfo.MD5Hash = ms.ComputeMD5Hash();

                        var ruleset = Rulesets.GetOrDefault(lazerBeatmap.BeatmapInfo.RulesetID);
                        lazerBeatmap.BeatmapInfo.Ruleset = ruleset.RulesetInfo;
                        difficultyAttributes             = ruleset?.CreateDifficultyCalculator(new DummyConversionBeatmap(lazerBeatmap)).Calculate();

                        lazerBeatmap.BeatmapInfo.StarDifficulty = Math.Round(difficultyAttributes?.StarRating ?? 0, 2);
                        lazerBeatmap.BeatmapInfo.Length         = CalculateLength(lazerBeatmap);
                    }

            short circles, sliders, spinners;

            circles = sliders = spinners = 0;
            if (difficultyAttributes is OsuDifficultyAttributes osuAttributes)
            {
                circles  = (short)osuAttributes.HitCircleCount;
                spinners = (short)osuAttributes.SpinnerCount;
                sliders  = (short)osuAttributes.SliderCount;
            }

            return(new Beatmap
            {
                PlayMode = (PlayMode)lazerBeatmap.BeatmapInfo.RulesetID,
                ArtistRoman = lazerBeatmap.Metadata.Artist,
                ArtistUnicode = lazerBeatmap.Metadata.ArtistUnicode,
                TitleRoman = lazerBeatmap.Metadata.Title,
                TitleUnicode = lazerBeatmap.Metadata.TitleUnicode,
                DiffName = lazerBeatmap.BeatmapInfo.Version,
                Md5 = lazerBeatmap.BeatmapInfo.MD5Hash,
                MapId = lazerBeatmap.BeatmapInfo.OnlineBeatmapID ?? 0,
                ModPpStars = new PlayModeStars {
                    { (PlayMode)lazerBeatmap.BeatmapInfo.RulesetID, new StarRating {
                          { (int)Mods.Omod, lazerBeatmap.BeatmapInfo.StarDifficulty }
                      } }
                },
                MainBpm = Math.Round(lazerBeatmap.ControlPointInfo.BPMMode),
                MinBpm = Math.Round(lazerBeatmap.ControlPointInfo.BPMMinimum),
                MaxBpm = Math.Round(lazerBeatmap.ControlPointInfo.BPMMaximum),
                Creator = lazerBeatmap.Metadata.AuthorString,
                ApproachRate = lazerBeatmap.BeatmapInfo.BaseDifficulty.ApproachRate,
                CircleSize = lazerBeatmap.BeatmapInfo.BaseDifficulty.CircleSize,
                SliderVelocity = lazerBeatmap.BeatmapInfo.BaseDifficulty.SliderMultiplier,
                OverallDifficulty = lazerBeatmap.BeatmapInfo.BaseDifficulty.OverallDifficulty,
                Circles = circles,
                Dir = Path.GetFileName(Path.GetDirectoryName(file)),
                MapSetId = lazerBeatmap.BeatmapInfo.BeatmapSet.OnlineBeatmapSetID ?? 0,
                Mp3Name = lazerBeatmap.Metadata.AudioFile,
                PreviewTime = Convert.ToInt32(lazerBeatmap.BeatmapInfo.Metadata.PreviewTime),
                Sliders = sliders,
                Source = lazerBeatmap.Metadata.Source,
                Spinners = spinners,
                StackLeniency = lazerBeatmap.BeatmapInfo.StackLeniency,
                Tags = lazerBeatmap.Metadata.Tags,
                TotalTime = Convert.ToInt32(lazerBeatmap.BeatmapInfo.Length),
                OsuFileName = Path.GetFileName(file),
                AudioOffset = 0,
                DrainingTime = 0,
                ThreadId = 0,
                EditDate = DateTime.UtcNow,
                LastPlayed = DateTime.MinValue,
                LastSync = DateTime.MinValue
            });
        }
 private Beatmap createTestBeatmap()
 {
     using (var beatmapStream = getBeatmapStream())
         using (var beatmapReader = new LineBufferedReader(beatmapStream))
             return(Decoder.GetDecoder <Beatmap>(beatmapReader).Decode(beatmapReader));
 }
Exemplo n.º 14
0
 private IBeatmap readBeatmap(byte[] state)
 {
     using (var stream = new MemoryStream(state))
         using (var reader = new LineBufferedReader(stream, true))
             return(new PassThroughWorkingBeatmap(Decoder.GetDecoder <Beatmap>(reader).Decode(reader)).GetPlayableBeatmap(editorBeatmap.BeatmapInfo.Ruleset));
 }
Exemplo n.º 15
0
Arquivo: Skin.cs Projeto: bdach/osu
 protected virtual void ParseConfigurationStream(Stream stream)
 {
     using (LineBufferedReader reader = new LineBufferedReader(stream, true))
         Configuration = new LegacySkinDecoder().Decode(reader);
 }
Exemplo n.º 16
0
        protected override void ParseStreamInto(LineBufferedReader stream, KaraokeSkin output)
        {
            Project nicoKaraProject;

            using (TextReader sr = new StringReader(stream.ReadToEnd()))
            {
                nicoKaraProject = new Parser().Deserialize(sr);
            }

            // Clean-up layout
            output.Layouts = new List <KaraokeLayout>();

            foreach (var karaokeLayout in nicoKaraProject.KaraokeLayouts)
            {
                Enum.TryParse(karaokeLayout.SmartHorizon.ToString(), out KaraokeTextSmartHorizon smartHorizon);
                Enum.TryParse(karaokeLayout.RubyAlignment.ToString(), out LyricTextAlignment rubyAlignment);

                output.Layouts.Add(new KaraokeLayout
                {
                    Name             = karaokeLayout.Name,
                    Alignment        = convertAnchor(karaokeLayout.HorizontalAlignment, karaokeLayout.VerticalAlignment),
                    HorizontalMargin = karaokeLayout.HorizontalMargin,
                    VerticalMargin   = karaokeLayout.VerticalMargin,
                    Continuous       = karaokeLayout.Continuous,
                    SmartHorizon     = smartHorizon,
                    LyricsInterval   = karaokeLayout.LyricsInterval,
                    RubyInterval     = karaokeLayout.RubyInterval,
                    RubyAlignment    = rubyAlignment,
                    RubyMargin       = karaokeLayout.RubyMargin
                });
            }

            // Clean-up style
            output.Fonts = new List <KaraokeFont>();

            foreach (var nicoKaraFont in nicoKaraProject.KaraokeFonts)
            {
                output.Fonts.Add(new KaraokeFont
                {
                    Name               = nicoKaraFont.Name,
                    UseShadow          = nicoKaraFont.UseShadow,
                    ShadowOffset       = convertShadowSlide(nicoKaraFont.ShadowSlide),
                    FrontTextBrushInfo = new KaraokeFont.TextBrushInfo
                    {
                        TextBrush   = convertBrushInfo(nicoKaraFont.BrushInfos[0]),
                        BorderBrush = convertBrushInfo(nicoKaraFont.BrushInfos[1]),
                        ShadowBrush = convertBrushInfo(nicoKaraFont.BrushInfos[2]),
                    },
                    BackTextBrushInfo = new KaraokeFont.TextBrushInfo
                    {
                        TextBrush   = convertBrushInfo(nicoKaraFont.BrushInfos[3]),
                        BorderBrush = convertBrushInfo(nicoKaraFont.BrushInfos[4]),
                        ShadowBrush = convertBrushInfo(nicoKaraFont.BrushInfos[5]),
                    },
                    LyricTextFontInfo = new KaraokeFont.TextFontInfo
                    {
                        LyricTextFontInfo = convertFontInfo(nicoKaraFont.FontInfos[0]),
                        NakaTextFontInfo  = convertFontInfo(nicoKaraFont.FontInfos[1]),
                        EnTextFontInfo    = convertFontInfo(nicoKaraFont.FontInfos[2]),
                    },
                    RubyTextFontInfo = new KaraokeFont.TextFontInfo
                    {
                        LyricTextFontInfo = convertFontInfo(nicoKaraFont.FontInfos[3]),
                        NakaTextFontInfo  = convertFontInfo(nicoKaraFont.FontInfos[4]),
                        EnTextFontInfo    = convertFontInfo(nicoKaraFont.FontInfos[5]),
                    },
                    RomajiTextFontInfo = new KaraokeFont.TextFontInfo
                    {
                        // Just copied from ruby setting
                        LyricTextFontInfo = convertFontInfo(nicoKaraFont.FontInfos[3]),
                        NakaTextFontInfo  = convertFontInfo(nicoKaraFont.FontInfos[4]),
                        EnTextFontInfo    = convertFontInfo(nicoKaraFont.FontInfos[5]),
                    }
                });
            }
Exemplo n.º 17
0
        private List <RealmBeatmap> createBeatmapDifficulties(IList <RealmNamedFileUsage> files, Realm realm)
        {
            var beatmaps = new List <RealmBeatmap>();

            foreach (var file in files.Where(f => f.Filename.EndsWith(".osu", StringComparison.OrdinalIgnoreCase)))
            {
                using (var memoryStream = new MemoryStream(Files.Store.Get(file.File.StoragePath))) // we need a memory stream so we can seek
                {
                    IBeatmap decoded;
                    using (var lineReader = new LineBufferedReader(memoryStream, true))
                        decoded = Decoder.GetDecoder <Beatmap>(lineReader).Decode(lineReader);

                    string hash = memoryStream.ComputeSHA2Hash();

                    if (beatmaps.Any(b => b.Hash == hash))
                    {
                        Logger.Log($"Skipping import of {file.Filename} due to duplicate file content.", LoggingTarget.Database);
                        continue;
                    }

                    var decodedInfo       = decoded.BeatmapInfo;
                    var decodedDifficulty = decodedInfo.BaseDifficulty;

                    var ruleset = realm.All <RealmRuleset>().FirstOrDefault(r => r.OnlineID == decodedInfo.RulesetID);

                    if (ruleset?.Available != true)
                    {
                        Logger.Log($"Skipping import of {file.Filename} due to missing local ruleset {decodedInfo.RulesetID}.", LoggingTarget.Database);
                        continue;
                    }

                    var difficulty = new RealmBeatmapDifficulty
                    {
                        DrainRate         = decodedDifficulty.DrainRate,
                        CircleSize        = decodedDifficulty.CircleSize,
                        OverallDifficulty = decodedDifficulty.OverallDifficulty,
                        ApproachRate      = decodedDifficulty.ApproachRate,
                        SliderMultiplier  = decodedDifficulty.SliderMultiplier,
                        SliderTickRate    = decodedDifficulty.SliderTickRate,
                    };

                    var metadata = new RealmBeatmapMetadata
                    {
                        Title         = decoded.Metadata.Title,
                        TitleUnicode  = decoded.Metadata.TitleUnicode,
                        Artist        = decoded.Metadata.Artist,
                        ArtistUnicode = decoded.Metadata.ArtistUnicode,
                        Author        =
                        {
                            OnlineID = decoded.Metadata.Author.Id,
                            Username = decoded.Metadata.Author.Username
                        },
                        Source         = decoded.Metadata.Source,
                        Tags           = decoded.Metadata.Tags,
                        PreviewTime    = decoded.Metadata.PreviewTime,
                        AudioFile      = decoded.Metadata.AudioFile,
                        BackgroundFile = decoded.Metadata.BackgroundFile,
                    };

                    var beatmap = new RealmBeatmap(ruleset, difficulty, metadata)
                    {
                        Hash                     = hash,
                        DifficultyName           = decodedInfo.DifficultyName,
                        OnlineID                 = decodedInfo.OnlineID ?? -1,
                        AudioLeadIn              = decodedInfo.AudioLeadIn,
                        StackLeniency            = decodedInfo.StackLeniency,
                        SpecialStyle             = decodedInfo.SpecialStyle,
                        LetterboxInBreaks        = decodedInfo.LetterboxInBreaks,
                        WidescreenStoryboard     = decodedInfo.WidescreenStoryboard,
                        EpilepsyWarning          = decodedInfo.EpilepsyWarning,
                        SamplesMatchPlaybackRate = decodedInfo.SamplesMatchPlaybackRate,
                        DistanceSpacing          = decodedInfo.DistanceSpacing,
                        BeatDivisor              = decodedInfo.BeatDivisor,
                        GridSize                 = decodedInfo.GridSize,
                        TimelineZoom             = decodedInfo.TimelineZoom,
                        MD5Hash                  = memoryStream.ComputeMD5Hash(),
                    };

                    updateBeatmapStatistics(beatmap, decoded);

                    beatmaps.Add(beatmap);
                }
            }

            return(beatmaps);
        }
Exemplo n.º 18
0
 private Beatmap ReadBeatmap(string beatmapPath)
 {
     using (var stream = File.OpenRead(beatmapPath))
         using (var streamReader = new LineBufferedReader(stream))
             return(osu.Game.Beatmaps.Formats.Decoder.GetDecoder <Beatmap>(streamReader).Decode(streamReader));
 }