From fa4680e33b023299c4ae8cf933da4d6bda88e5de Mon Sep 17 00:00:00 2001 From: andy840119 Date: Sat, 12 Dec 2020 11:36:12 +0900 Subject: [PATCH] Make property has it's name. --- .../IO/Serialization/Converters/RomajiTagConverter.cs | 8 ++++---- .../IO/Serialization/Converters/RubyTagConverter.cs | 8 ++++---- osu.Game.Rulesets.Karaoke/Objects/Lyric.cs | 2 -- 3 files changed, 8 insertions(+), 10 deletions(-) diff --git a/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/RomajiTagConverter.cs b/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/RomajiTagConverter.cs index 5c56a1155..ded067fe5 100644 --- a/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/RomajiTagConverter.cs +++ b/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/RomajiTagConverter.cs @@ -19,14 +19,14 @@ public override RomajiTag ReadJson(JsonReader reader, Type objectType, RomajiTag if (value == null || value == "") return new RomajiTag(); - var regux = new Regex("([-0-9]+),([-0-9]+)]:(.*$)"); + var regux = new Regex("(?[-0-9]+),(?[-0-9]+)]:(?.*$)"); var result = regux.Match(value); if (!result.Success) return new RomajiTag(); - var startIndex = int.Parse(result.Groups[1].Value); - var endIndex = int.Parse(result.Groups[2].Value); - var text = result.Groups[3].Value; + var startIndex = int.Parse(result.Groups["start"]?.Value); + var endIndex = int.Parse(result.Groups["end"]?.Value); + var text = result.Groups["romaji"]?.Value; return new RomajiTag { diff --git a/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/RubyTagConverter.cs b/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/RubyTagConverter.cs index 22379cff9..a6fa381b6 100644 --- a/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/RubyTagConverter.cs +++ b/osu.Game.Rulesets.Karaoke/IO/Serialization/Converters/RubyTagConverter.cs @@ -19,14 +19,14 @@ public override RubyTag ReadJson(JsonReader reader, Type objectType, RubyTag exi if (value == null || value == "") return new RubyTag(); - var regux = new Regex("([-0-9]+),([-0-9]+)]:(.*$)"); + var regux = new Regex("(?[-0-9]+),(?[-0-9]+)]:(?.*$)"); var result = regux.Match(value); if (!result.Success) return new RubyTag(); - var startIndex = int.Parse(result.Groups[1].Value); - var endIndex = int.Parse(result.Groups[2].Value); - var text = result.Groups[3].Value; + var startIndex = int.Parse(result.Groups["start"]?.Value); + var endIndex = int.Parse(result.Groups["end"]?.Value); + var text = result.Groups["ruby"]?.Value; return new RubyTag { diff --git a/osu.Game.Rulesets.Karaoke/Objects/Lyric.cs b/osu.Game.Rulesets.Karaoke/Objects/Lyric.cs index 0ccb8f6e9..261a12e85 100644 --- a/osu.Game.Rulesets.Karaoke/Objects/Lyric.cs +++ b/osu.Game.Rulesets.Karaoke/Objects/Lyric.cs @@ -1,14 +1,12 @@ // Copyright (c) andy840119 . Licensed under the GPL Licence. // See the LICENCE file in the repository root for full licence text. -using System; using System.Collections.Generic; using System.Globalization; using System.Linq; using Newtonsoft.Json; using osu.Framework.Bindables; using osu.Framework.Extensions.IEnumerableExtensions; -using osu.Framework.Graphics.Sprites; using osu.Game.Beatmaps; using osu.Game.Beatmaps.ControlPoints; using osu.Game.Rulesets.Judgements;