diff --git a/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Misc/StringExtensions.cs b/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Misc/StringExtensions.cs index 29f3e8f..9acc459 100644 --- a/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Misc/StringExtensions.cs +++ b/osu.Game.Rulesets.IGPlayer/Feature/Player/Plugins/Bundle/CloudMusic/Misc/StringExtensions.cs @@ -13,18 +13,30 @@ public static int ToMilliseconds(this string src) int result; string[] spilt = src.Split("."); - if (spilt.Length < 3) + string formatString = ""; + + for (int i = 0; i < spilt.Length; i++) { - // ??? - Logging.Log($"给定的时间不正确:{src}"); - return int.MaxValue; - } + int length = spilt[i].Length; + + switch (i) + { + case 0: + formatString += new string('m', length); + break; - string formatString = "".PadRight(spilt[0].Length, 'm') - + @"\." - + "".PadRight(spilt[1].Length, 's') - + @"\." - + "".PadRight(spilt[2].Length, 'f'); + case 1: + formatString += new string('s', length); + break; + + case 2: + formatString += new string('f', length); + break; + } + + if (i < spilt.Length - 1) + formatString += @"\."; + } try {