Commit Graph

19 Commits

Author SHA1 Message Date
Huo Yaoyuan f05b83d7d4 Use typeparamref. 2019-11-17 20:48:23 +08:00
Bartłomiej Dach 7c2c537bc9 Allow fallback decoder overwrite
To fix the runtime crashes in difficulty calculation components, remove
the check for pre-existing fallback registration along with
the exception. The xmldoc for the registration function has been
extended to make users aware of possible consequences of calling it.
2019-10-04 18:20:20 +02:00
Bartłomiej Dach dd9f620c23 Fix misleading xmldoc 2019-09-15 01:28:07 +02:00
Bartłomiej Dach 86588778b1 Implement fallback decoder registration
After the preparatory introduction of LineBufferedReader, it is now
possible to introduce registration of fallback decoders that won't drop
input supplied in the first line of the file.

A fallback decoder is used when the magic in the first line of the file
does not match any of the other known decoders. In such a case,
the fallback decoder is constructed and provided a LineBufferedReader
instance. The process of matching magic only peeks the first non-empty
line, so it is available for re-reading in Decode() using ReadLine().

There can be only one fallback decoder per type; a second attempt of
registering a fallback will result in an exception to avoid bugs.

To address the issue of parsing failing on badly or non-headered files,
set the legacy decoders for Beatmaps and Storyboards as the fallbacks.

Due to non-trivial logic, several new, passing unit tests with possible
edge cases also included.
2019-09-15 01:28:07 +02:00
Bartłomiej Dach 11eda44d34 Migrate decoding to line-buffered reader
Migrate all usages of StreamReader in the context of decoding beatmaps,
storyboards or skins to the new LineBufferedReader.
2019-09-15 01:28:07 +02:00
Dean Herbert 612db31c38 Apply newline additions 2019-04-01 12:16:32 +09:00
Dean Herbert 8617aaa2a7 Update licence header (and remove year) 2019-01-24 17:43:03 +09:00
smoogipoo 55370165c0 Compare with invariant culture 2018-08-24 10:12:30 +09:00
smoogipoo 407968bb7e Log the format line when a decoder isn't found 2018-08-24 10:03:56 +09:00
Dean Herbert b16e25c3e9 Add error handling on a per-line level in LegacyDecoder
Resolves #2306.
2018-04-20 18:32:24 +09:00
Dean Herbert 32a74f95a5 Normalize all the line endings 2018-04-13 18:26:38 +09:00
Huo Yaoyuan b842f682eb Use Linq.Append and Prepend. 2018-04-02 12:06:34 +08:00
Dean Herbert 217dd2ecdc Initial push for better decoders 2018-03-09 21:24:15 +09:00
Dan Balasescu 86581b6451
Remove extra braces 2018-01-11 17:02:09 +09:00
james58899 fbffc8bb89
fix load storyboard in osu file 2018-01-10 18:55:04 +08:00
Dean Herbert 37d393bca0 Update licence headers 2018-01-05 20:21:19 +09:00
smoogipoo 58859f2ffb Rework registration/instantiation of decoders to not rely on reflection 2017-12-21 15:34:00 +09:00
Aergwyn c466296b14 reverted split at Decoder, moved logic down
I'm done experimenting, sorry
- `Decoder` only returns a "Beatmap"`Decoder` now
- "Storyboard"`Decoder` is retrieved from a "Beatmap"`Decoder`
- moved parse methods down in the hierarchy where I forgot to do that
- renamed `OsuLegacyDecoderTest` to `LegacyDecoderTest`
2017-12-01 22:05:01 +01:00
Aergwyn a49f3479a2 Split retrieving of beatmap and storyboard decoder
Storyboard works again. Not satisfied with the solution though.
2017-12-01 19:11:52 +01:00