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

View File

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

View File

@ -10,7 +10,6 @@ using osu.Game.Beatmaps.Formats;
using osu.Game.Audio; using osu.Game.Audio;
using System.Linq; using System.Linq;
using JetBrains.Annotations; using JetBrains.Annotations;
using osu.Framework.Logging;
using osu.Framework.MathUtils; using osu.Framework.MathUtils;
namespace osu.Game.Rulesets.Objects.Legacy namespace osu.Game.Rulesets.Objects.Legacy
@ -40,8 +39,6 @@ namespace osu.Game.Rulesets.Objects.Legacy
[CanBeNull] [CanBeNull]
public override HitObject Parse(string text) public override HitObject Parse(string text)
{
try
{ {
string[] split = text.Split(','); string[] split = text.Split(',');
@ -219,10 +216,7 @@ namespace osu.Game.Rulesets.Objects.Legacy
} }
if (result == null) if (result == null)
{ throw new InvalidDataException($"Unknown hit object type: {type}");
Logger.Log($"Unknown hit object type: {type}. Skipped.", level: LogLevel.Error);
return null;
}
result.StartTime = startTime; result.StartTime = startTime;
@ -233,17 +227,6 @@ namespace osu.Game.Rulesets.Objects.Legacy
return result; 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) private void readCustomSampleBanks(string str, SampleBankInfo bankInfo)
{ {