1
0
mirror of https://github.com/ppy/osu.git synced 2024-09-21 20:07:25 +08:00
osu-lazer/osu.Game/Skinning/LegacySkinDecoder.cs

56 lines
1.8 KiB
C#
Raw Normal View History

2019-05-12 21:53:12 +08:00
// Copyright (c) ppy Pty Ltd <contact@ppy.sh>. Licensed under the MIT Licence.
// See the LICENCE file in the repository root for full licence text.
2018-04-13 17:19:50 +08:00
using osu.Game.Beatmaps.Formats;
namespace osu.Game.Skinning
{
public class LegacySkinDecoder : LegacyDecoder<LegacySkinConfiguration>
2018-04-13 17:19:50 +08:00
{
public LegacySkinDecoder()
: base(1)
{
}
protected override void ParseLine(LegacySkinConfiguration skin, Section section, string line)
2018-04-13 17:19:50 +08:00
{
if (section != Section.Colours)
{
line = StripComments(line);
var pair = SplitKeyVal(line);
switch (section)
{
case Section.General:
switch (pair.Key)
{
case @"Name":
skin.SkinInfo.Name = pair.Value;
return;
case @"Author":
skin.SkinInfo.Creator = pair.Value;
return;
case @"Version":
if (pair.Value == "latest" || pair.Value == "User")
skin.LegacyVersion = LegacySkinConfiguration.LATEST_VERSION;
2019-10-10 04:33:25 +08:00
else if (decimal.TryParse(pair.Value, out var version))
skin.LegacyVersion = version;
return;
}
break;
}
if (!string.IsNullOrEmpty(pair.Key))
2019-09-03 17:56:01 +08:00
skin.ConfigDictionary[pair.Key] = pair.Value;
2018-04-13 17:19:50 +08:00
}
base.ParseLine(skin, section, line);
2018-04-13 17:19:50 +08:00
}
}
}