/// <summary> /// Decodes hit objects. /// </summary> private void DecodeHitObjects(string line) { // If parser not found, use Osu standard mode as default. if (objectParser == null) { objectParser = new IO.Decoding.Osu.Standard.HitObjectParser(offset, formatVersion); } var obj = objectParser.Parse(line); if (obj != null) { map.HitObjects.Add(obj); } }
/// <summary> /// Decodes general data. /// </summary> private void DecodeGeneral(string line) { var data = GetKeyValue(line); var detail = map.Detail; var metadata = detail.Metadata; switch (data.Key) { case "AudioFilename": metadata.AudioFile = PathUtils.StandardPath(data.Value); break; case "AudioLeadIn": detail.AudioLeadIn = ParseUtils.ParseInt(data.Value); break; case "PreviewTime": metadata.PreviewTime = ParseUtils.ParseInt(data.Value) + offset; break; case "Countdown": detail.Countdown = ParseUtils.ParseInt(data.Value) == 1; break; case "SampleSet": defaultSampleType = (SampleType)Enum.Parse(typeof(SampleType), data.Value); break; case "SampleVolume": defaultSampleVolume = ParseUtils.ParseFloat(data.Value, 100) / 100f; break; case "StackLeniency": detail.StackLeniency = ParseUtils.ParseFloat(data.Value); break; case "Mode": detail.GameMode = (GameModeType)(ParseUtils.ParseInt(data.Value) + GameProviderType.Osu); switch (detail.GameMode) { // Osu Standard mode case GameModeType.OsuStandard: objectParser = new Standard.HitObjectParser(offset, formatVersion); break; // TODO: Osu Taiko mode // case GameModes.OsuTaiko: // break; // TODO: Osu Catch mode // case GameModes.OsuCatch: // break; // TODO: Osu Mania mode // case GameModes.OsuMania: // break; } break; case "LetterboxInBreaks": detail.LetterboxInBreaks = ParseUtils.ParseInt(data.Value) == 1; break; // TODO: Osu file contains a SpecialStyle property but it seems it's not being used anywhere. // May have to come back in future once I confirm this. case "SpecialStyle": break; case "WidescreenStoryboard": detail.WidescreenStoryboard = ParseUtils.ParseInt(data.Value) == 1; break; } }