Commit Graph

137 Commits

Author SHA1 Message Date
092f5b6521 Fix incorrect reference + simplify 2020-06-03 17:41:05 +09:00
8aa8d2c880 Resolve NREs 2020-06-03 16:59:37 +09:00
6904d5d247 Remove unnecessary override 2020-05-25 13:12:53 +09:00
1977affe7e Fix OpenInNativeExplorer not working correctly for wrapped storages 2020-05-25 09:27:11 +09:00
6ca102bc3f Attempt delete operations more than once 2020-05-15 13:19:03 +09:00
9ed0e8891b Merge branch 'fix-nested-folder-migration-endless-copy' into migration-ui 2020-05-15 13:04:16 +09:00
0690d81bbb Add protection against migrating to a nested folder 2020-05-15 10:40:26 +09:00
25bbb02999 Throw better exceptions from OsuStorage 2020-05-15 10:28:03 +09:00
364aa5aa12 Add protection against migrating to a nested folder 2020-05-14 22:45:03 +09:00
827d75b152 Revert "Add protection against migrating to a nested folder"
This reverts commit ef8375b442.
2020-05-14 22:44:27 +09:00
ef8375b442 Add protection against migrating to a nested folder 2020-05-14 22:42:42 +09:00
06f507496a Delete migration source if no files exist after completion 2020-05-14 17:41:55 +09:00
cb0b25ac55 Throw better exceptions from OsuStorage 2020-05-14 17:41:55 +09:00
ad1d050fb4 Throw exception on copy timeout 2020-05-13 20:29:15 +09:00
49e616b7e5 Also check for directory presence before migrating 2020-05-13 20:19:14 +09:00
9de216f1b4 Merge branch 'master' into migration-backend 2020-05-13 20:15:22 +09:00
f07d95ac59 Use IReadOnlyList<T> for TypedListConverter. 2020-05-12 21:49:55 +08:00
f7d26688f4 Merge branch 'master' into json-converter 2020-05-12 21:43:02 +08:00
e4a23b3e7d Fix ignored excluding more than top level 2020-05-12 12:39:04 +09:00
984f27c107 Add simple retry logic on file copy failure (may be in use) 2020-05-11 21:39:44 +09:00
a11be07bb1 Move log storage location after migration complete 2020-05-11 21:39:44 +09:00
36640f5dda Merge branch 'master' into migration-backend 2020-05-11 18:52:36 +09:00
384862d48b Fix incorrect relative paths when using GetStorageForDirectory 2020-05-10 13:20:13 +09:00
bbebd26efb Use DirectoryInfo in more places 2020-05-09 20:13:31 +09:00
80a193a616 Use IEnumerable<T> for TypedListConverter. 2020-05-09 17:41:59 +08:00
74cbe9306c Use strongly-typed JsonConerter. 2020-05-09 16:39:46 +08:00
7a2020fd45 User copy operation instead of move 2020-05-07 22:12:24 +09:00
49a03f1c06 Add basic blocking migration, move not copy 2020-05-07 22:11:57 +09:00
7781408643 Update in line with framework storage changes 2020-05-06 18:28:24 +09:00
d27ca725f9 Use IEnumerable<T> instead 2020-04-22 09:04:44 +09:00
a702a521f8 Fix not being able to serialise converted beatmaps 2020-04-22 09:04:44 +09:00
f6f5de7ad1 Allow LineBufferedReader to keep underlying stream open 2020-03-31 10:13:50 +09:00
022465f546 Add encoding and import support 2020-03-24 14:51:52 +09:00
68ebe98fde Remove unused GetUnderlyingStream method 2020-03-24 14:08:25 +09:00
b14c7bd171 Use type switch in SearializationWriter. 2020-01-27 21:49:34 +08:00
40b43b85f1 CA1715: use prefix for generic parameters. 2019-12-17 13:00:25 +08:00
e46f6627e4 CA1052: make type static. 2019-12-17 13:00:13 +08:00
31cc0d13da Use 'out var'. 2019-11-12 19:55:26 +08:00
35be8f9dfb Share framework file-exclusion function 2019-10-30 19:34:17 +09:00
4b84564f47 Switch casing comparison mode to ordinal
Switch from InvariantCultureIgnoreCase to OrdinalIgnoreCase when
checking file paths in archives for substrings indicating the file can
be ignored for performance gains.

Co-Authored-By: Dan Balasescu <smoogipoo@smgi.me>
2019-10-11 09:24:41 +02:00
57bfa18359 Filter out OS-generated files from archives
Add a filename ignore list to ZipArchiveReader to filter out superfluous
OS-generated files from archives during the import process. In addition
to decreasing the size of files imported this allows imports of some
incorrectly-constructed archives. An example is the case of having
a __MACOSX directory next to a single directory with the actual files -
filtering out the former at ZipArchiveReader allows the fallback added
in #6170 to work.
2019-10-10 23:54:23 +02:00
6268bbcfc8 Merge branch 'master' into beatmap-parsing-fallback-v2 2019-10-03 15:12:21 +08:00
d0a4e1e3c2 Force a checksum check before skipping FileStore copy op 2019-09-20 15:00:27 +09:00
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
7b1ff38df7 Implement line-buffered reader
Add a line-buffered reader decorator operating on StreamReader
instances. The decorator has two main operations - PeekLine(), which
allows to see the next line in the stream without consuming it,
ReadLine(), which consumes and returns the next line in the stream, and
ReadToEnd() which reads all the remaining text in the stream (including
the unconsumed peeked line). Peeking line-per-line uses an internal
queue of lines that have been read ahead from the underlying stream.

The addition of the line-buffered reader is a workaround solution to
a problem with decoding. At current selecting a decoder works by
irreversibly reading the first line from the stream and looking for
a magic string that indicates the type of decoder to use.

It might however be possible for a file to be valid in format, just
missing a header. In such a case a lack of a line-buffered reader makes
it impossible to reparse the content of that first line. Introducing it
will however allow to peek the first line for magic first.

 - If magic is found in the first line, GetDecoder() will peek it and
   use it to return the correct Decoder instance. Note that in the case
   of JsonBeatmapDecoder the magic is the opening JSON object brace,
   and therefore must not be consumed.

 - If magic is not found, the fallback decoder will be able to consume
   it using ReadLine() in Decode().

This commit additionally contains basic unit tests for the reader.

Suggested-by: Aergwyn <aergwyn@t-online.de>
2019-09-15 01:26:15 +02:00
5b75060b94 Add test for rollback logic correctly dereferencing files 2019-06-10 16:45:45 +09:00
80d65f9a3b Update resource stores with GetAvailableResources 2019-05-31 14:33:18 +09:00
612db31c38 Apply newline additions 2019-04-01 12:16:32 +09:00
26d53d06a9 Fix remaining issues 2019-02-28 13:31:40 +09:00
a580c17949 Fix codefactor issue 2019-01-24 17:46:09 +09:00