1
0
mirror of https://github.com/ppy/osu.git synced 2025-01-19 14:23:14 +08:00

Throw exceptions and let LegacyDecoder handle them

This commit is contained in:
smoogipoo 2019-08-08 14:44:04 +09:00
parent 54ee0cabd8
commit ac2060f1cf
3 changed files with 223 additions and 259 deletions

View File

@ -5,7 +5,6 @@ using System;
using System.IO;
using System.Linq;
using osu.Framework.IO.File;
using osu.Framework.Logging;
using osu.Game.Beatmaps.Timing;
using osu.Game.Rulesets.Objects.Legacy;
using osu.Game.Beatmaps.ControlPoints;
@ -292,10 +291,7 @@ namespace osu.Game.Beatmaps.Formats
EventType type;
if (!Enum.TryParse(split[0], out type))
{
Logger.Log($"Unknown beatmap event of type {split[0]} could not be parsed and will be ignored.", LoggingTarget.Runtime, LogLevel.Important);
return;
}
throw new InvalidDataException($@"Unknown event type: {split[0]}");
switch (type)
{
@ -322,8 +318,6 @@ namespace osu.Game.Beatmaps.Formats
}
private void handleTimingPoint(string line)
{
try
{
string[] split = line.Split(',');
@ -399,15 +393,6 @@ namespace osu.Game.Beatmaps.Formats
AutoGenerated = timingChange
});
}
catch (FormatException)
{
Logger.Log("A timing point could not be parsed correctly and will be ignored", LoggingTarget.Runtime, LogLevel.Important);
}
catch (OverflowException)
{
Logger.Log("A timing point could not be parsed correctly and will be ignored", LoggingTarget.Runtime, LogLevel.Important);
}
}
private void handleTimingControlPoint(TimingControlPoint newPoint)
{

View File

@ -10,7 +10,6 @@ using osuTK;
using osuTK.Graphics;
using osu.Framework.Graphics;
using osu.Framework.IO.File;
using osu.Framework.Logging;
using osu.Game.Storyboards;
namespace osu.Game.Beatmaps.Formats
@ -85,10 +84,7 @@ namespace osu.Game.Beatmaps.Formats
EventType type;
if (!Enum.TryParse(split[0], out type))
{
Logger.Log($"Unknown storyboard event of type {split[0]} could not be parsed and will be ignored.", LoggingTarget.Runtime, LogLevel.Important);
return;
}
throw new InvalidDataException($@"Unknown event type: {split[0]}");
switch (type)
{

View File

@ -10,7 +10,6 @@ using osu.Game.Beatmaps.Formats;
using osu.Game.Audio;
using System.Linq;
using JetBrains.Annotations;
using osu.Framework.Logging;
using osu.Framework.MathUtils;
namespace osu.Game.Rulesets.Objects.Legacy
@ -40,8 +39,6 @@ namespace osu.Game.Rulesets.Objects.Legacy
[CanBeNull]
public override HitObject Parse(string text)
{
try
{
string[] split = text.Split(',');
@ -219,10 +216,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
}
if (result == null)
{
Logger.Log($"Unknown hit object type: {type}. Skipped.", level: LogLevel.Error);
return null;
}
throw new InvalidDataException($"Unknown hit object type: {type}");
result.StartTime = startTime;
@ -233,17 +227,6 @@ namespace osu.Game.Rulesets.Objects.Legacy
return result;
}
catch (FormatException)
{
Logger.Log("A hitobject could not be parsed correctly and will be ignored", LoggingTarget.Runtime, LogLevel.Important);
}
catch (OverflowException)
{
Logger.Log("A hitobject could not be parsed correctly and will be ignored", LoggingTarget.Runtime, LogLevel.Important);
}
return null;
}
private void readCustomSampleBanks(string str, SampleBankInfo bankInfo)
{