diff --git a/osu.Desktop/Beatmaps/IO/LegacyFilesystemReader.cs b/osu.Desktop/Beatmaps/IO/LegacyFilesystemReader.cs index bb26d2d63b..a6367ebfab 100644 --- a/osu.Desktop/Beatmaps/IO/LegacyFilesystemReader.cs +++ b/osu.Desktop/Beatmaps/IO/LegacyFilesystemReader.cs @@ -25,9 +25,9 @@ namespace osu.Desktop.Beatmaps.IO public LegacyFilesystemReader(string path) { basePath = path; - beatmaps = Directory.GetFiles(basePath, "*.osu").Select(f => Path.GetFileName(f)).ToArray(); + beatmaps = Directory.GetFiles(basePath, @"*.osu").Select(f => Path.GetFileName(f)).ToArray(); if (beatmaps.Length == 0) - throw new FileNotFoundException("This directory contains no beatmaps"); + throw new FileNotFoundException(@"This directory contains no beatmaps"); using (var stream = new StreamReader(ReadFile(beatmaps[0]))) { var decoder = BeatmapDecoder.GetDecoder(stream); diff --git a/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs b/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs index 91e647964a..7302e2a4c5 100644 --- a/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs +++ b/osu.Game/Beatmaps/Formats/BeatmapDecoder.cs @@ -12,7 +12,7 @@ namespace osu.Game.Beatmaps.Formats { var line = stream.ReadLine().Trim(); if (!decoders.ContainsKey(line)) - throw new IOException("Unknown file format"); + throw new IOException(@"Unknown file format"); return (BeatmapDecoder)Activator.CreateInstance(decoders[line]); } protected static void AddDecoder(string magic) where T : BeatmapDecoder diff --git a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs index eeda4e46f8..89451c1233 100644 --- a/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs +++ b/osu.Game/Beatmaps/Formats/OsuLegacyDecoder.cs @@ -15,11 +15,11 @@ namespace osu.Game.Beatmaps.Formats { public static void Register() { - AddDecoder("osu file format v14"); - AddDecoder("osu file format v13"); - AddDecoder("osu file format v12"); - AddDecoder("osu file format v11"); - AddDecoder("osu file format v10"); + AddDecoder(@"osu file format v14"); + AddDecoder(@"osu file format v13"); + AddDecoder(@"osu file format v12"); + AddDecoder(@"osu file format v11"); + AddDecoder(@"osu file format v10"); // TODO: Not sure how far back to go, or differences between versions } @@ -40,34 +40,34 @@ namespace osu.Game.Beatmaps.Formats { switch (key) { - case "AudioFilename": + case @"AudioFilename": beatmap.Metadata.AudioFile = val; break; - case "AudioLeadIn": + case @"AudioLeadIn": beatmap.AudioLeadIn = int.Parse(val); break; - case "PreviewTime": + case @"PreviewTime": beatmap.Metadata.PreviewTime = int.Parse(val); break; - case "Countdown": + case @"Countdown": beatmap.Countdown = int.Parse(val) == 1; break; - case "SampleSet": + case @"SampleSet": beatmap.SampleSet = (SampleSet)Enum.Parse(typeof(SampleSet), val); break; - case "StackLeniency": + case @"StackLeniency": beatmap.StackLeniency = float.Parse(val, NumberFormatInfo.InvariantInfo); break; - case "Mode": + case @"Mode": beatmap.Mode = (PlayMode)int.Parse(val); break; - case "LetterboxInBreaks": + case @"LetterboxInBreaks": beatmap.LetterboxInBreaks = int.Parse(val) == 1; break; - case "SpecialStyle": + case @"SpecialStyle": beatmap.SpecialStyle = int.Parse(val) == 1; break; - case "WidescreenStoryboard": + case @"WidescreenStoryboard": beatmap.WidescreenStoryboard = int.Parse(val) == 1; break; } @@ -77,19 +77,19 @@ namespace osu.Game.Beatmaps.Formats { switch (key) { - case "Bookmarks": + case @"Bookmarks": beatmap.StoredBookmarks = val; break; - case "DistanceSpacing": + case @"DistanceSpacing": beatmap.DistanceSpacing = double.Parse(val, NumberFormatInfo.InvariantInfo); break; - case "BeatDivisor": + case @"BeatDivisor": beatmap.BeatDivisor = int.Parse(val); break; - case "GridSize": + case @"GridSize": beatmap.GridSize = int.Parse(val); break; - case "TimelineZoom": + case @"TimelineZoom": beatmap.TimelineZoom = double.Parse(val, NumberFormatInfo.InvariantInfo); break; } @@ -99,34 +99,34 @@ namespace osu.Game.Beatmaps.Formats { switch (key) { - case "Title": + case @"Title": beatmap.Metadata.Title = val; break; - case "TitleUnicode": + case @"TitleUnicode": beatmap.Metadata.TitleUnicode = val; break; - case "Artist": + case @"Artist": beatmap.Metadata.Artist = val; break; - case "ArtistUnicode": + case @"ArtistUnicode": beatmap.Metadata.ArtistUnicode = val; break; - case "Creator": + case @"Creator": beatmap.Metadata.Author = val; break; - case "Version": + case @"Version": beatmap.Version = val; break; - case "Source": + case @"Source": beatmap.Metadata.Source = val; break; - case "Tags": + case @"Tags": beatmap.Metadata.Tags = val; break; - case "BeatmapID": + case @"BeatmapID": beatmap.BeatmapID = int.Parse(val); break; - case "BeatmapSetID": + case @"BeatmapSetID": beatmap.BeatmapSetID = int.Parse(val); beatmap.Metadata.BeatmapSetID = int.Parse(val); break; @@ -137,22 +137,22 @@ namespace osu.Game.Beatmaps.Formats { switch (key) { - case "HPDrainRate": + case @"HPDrainRate": beatmap.BaseDifficulty.DrainRate = float.Parse(val, NumberFormatInfo.InvariantInfo); break; - case "CircleSize": + case @"CircleSize": beatmap.BaseDifficulty.CircleSize = float.Parse(val, NumberFormatInfo.InvariantInfo); break; - case "OverallDifficulty": + case @"OverallDifficulty": beatmap.BaseDifficulty.OverallDifficulty = float.Parse(val, NumberFormatInfo.InvariantInfo); break; - case "ApproachRate": + case @"ApproachRate": beatmap.BaseDifficulty.ApproachRate = float.Parse(val, NumberFormatInfo.InvariantInfo); break; - case "SliderMultiplier": + case @"SliderMultiplier": beatmap.BaseDifficulty.SliderMultiplier = float.Parse(val, NumberFormatInfo.InvariantInfo); break; - case "SliderTickRate": + case @"SliderTickRate": beatmap.BaseDifficulty.SliderTickRate = float.Parse(val, NumberFormatInfo.InvariantInfo); break; } @@ -160,9 +160,9 @@ namespace osu.Game.Beatmaps.Formats private void handleEvents(Beatmap beatmap, string val) { - if (val.StartsWith("//")) + if (val.StartsWith(@"//")) return; - if (val.StartsWith(" ")) + if (val.StartsWith(@" ")) return; // TODO string[] split = val.Split(','); EventType type; @@ -222,10 +222,10 @@ namespace osu.Game.Beatmaps.Formats line = line.Trim(); if (string.IsNullOrEmpty(line)) continue; - if (line.StartsWith("osu file format v")) + if (line.StartsWith(@"osu file format v")) continue; - if (line.StartsWith("[") && line.EndsWith("]")) + if (line.StartsWith(@"[") && line.EndsWith(@"]")) { if (!Enum.TryParse(line.Substring(1, line.Length - 2), out section)) throw new InvalidDataException($@"Unknown osu section {line}"); diff --git a/osu.Game/Beatmaps/IO/ArchiveReader.cs b/osu.Game/Beatmaps/IO/ArchiveReader.cs index d9b4295704..77315d4a21 100644 --- a/osu.Game/Beatmaps/IO/ArchiveReader.cs +++ b/osu.Game/Beatmaps/IO/ArchiveReader.cs @@ -22,7 +22,7 @@ namespace osu.Game.Beatmaps.IO if (reader.Test(storage, path)) return (ArchiveReader)Activator.CreateInstance(reader.Type, storage.GetStream(path)); } - throw new IOException("Unknown file format"); + throw new IOException(@"Unknown file format"); } protected static void AddReader(Func test) where T : ArchiveReader diff --git a/osu.Game/Beatmaps/IO/OszArchiveReader.cs b/osu.Game/Beatmaps/IO/OszArchiveReader.cs index d7241d17a1..b70bee076c 100644 --- a/osu.Game/Beatmaps/IO/OszArchiveReader.cs +++ b/osu.Game/Beatmaps/IO/OszArchiveReader.cs @@ -25,10 +25,10 @@ namespace osu.Game.Beatmaps.IO public OszArchiveReader(Stream archiveStream) { archive = ZipFile.Read(archiveStream); - beatmaps = archive.Entries.Where(e => e.FileName.EndsWith(".osu")) + beatmaps = archive.Entries.Where(e => e.FileName.EndsWith(@".osu")) .Select(e => e.FileName).ToArray(); if (beatmaps.Length == 0) - throw new FileNotFoundException("This directory contains no beatmaps"); + throw new FileNotFoundException(@"This directory contains no beatmaps"); using (var stream = new StreamReader(ReadFile(beatmaps[0]))) { var decoder = BeatmapDecoder.GetDecoder(stream);