mirror of https://github.com/ppy/osu
Fix default legacy skin not being able to read from stored `skin.ini`
This commit is contained in:
parent
e5b73f25cd
commit
9cdc1ba592
|
@ -19,7 +19,14 @@ public DefaultLegacySkin(IStorageResourceProvider resources)
|
|||
|
||||
[UsedImplicitly(ImplicitUseKindFlags.InstantiatedWithFixedConstructorSignature)]
|
||||
public DefaultLegacySkin(SkinInfo skin, IStorageResourceProvider resources)
|
||||
: base(skin, new NamespacedResourceStore<byte[]>(resources.Resources, "Skins/Legacy"), resources, string.Empty)
|
||||
: base(
|
||||
skin,
|
||||
new NamespacedResourceStore<byte[]>(resources.Resources, "Skins/Legacy"),
|
||||
resources,
|
||||
// A default legacy skin may still have a skin.ini if it is modified by the user.
|
||||
// We must specify the stream directly as we are redirecting storage to the osu-resources location for other files.
|
||||
new LegacySkinResourceStore<SkinFileInfo>(skin, resources.Files).GetStream("skin.ini")
|
||||
)
|
||||
{
|
||||
Configuration.CustomColours["SliderBall"] = new Color4(2, 170, 255, 255);
|
||||
Configuration.CustomComboColours = new List<Color4>
|
||||
|
|
|
@ -69,18 +69,28 @@ public LegacySkin(SkinInfo skin, IStorageResourceProvider resources)
|
|||
/// <param name="resources">Access to raw game resources.</param>
|
||||
/// <param name="configurationFilename">The user-facing filename of the configuration file to be parsed. Can accept an .osu or skin.ini file.</param>
|
||||
protected LegacySkin(SkinInfo skin, [CanBeNull] IResourceStore<byte[]> storage, [CanBeNull] IStorageResourceProvider resources, string configurationFilename)
|
||||
: this(skin, storage, resources, storage?.GetStream(configurationFilename))
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Construct a new legacy skin instance.
|
||||
/// </summary>
|
||||
/// <param name="skin">The model for this skin.</param>
|
||||
/// <param name="storage">A storage for looking up files within this skin using user-facing filenames.</param>
|
||||
/// <param name="resources">Access to raw game resources.</param>
|
||||
/// <param name="configurationStream">An optional stream containing the contents of a skin.ini file.</param>
|
||||
protected LegacySkin(SkinInfo skin, [CanBeNull] IResourceStore<byte[]> storage, [CanBeNull] IStorageResourceProvider resources, [CanBeNull] Stream configurationStream)
|
||||
: base(skin, resources)
|
||||
{
|
||||
using (var stream = storage?.GetStream(configurationFilename))
|
||||
if (configurationStream != null)
|
||||
{
|
||||
if (stream != null)
|
||||
{
|
||||
using (LineBufferedReader reader = new LineBufferedReader(stream, true))
|
||||
using (LineBufferedReader reader = new LineBufferedReader(configurationStream, true))
|
||||
Configuration = new LegacySkinDecoder().Decode(reader);
|
||||
|
||||
stream.Seek(0, SeekOrigin.Begin);
|
||||
configurationStream.Seek(0, SeekOrigin.Begin);
|
||||
|
||||
using (LineBufferedReader reader = new LineBufferedReader(stream))
|
||||
using (LineBufferedReader reader = new LineBufferedReader(configurationStream))
|
||||
{
|
||||
var maniaList = new LegacyManiaSkinDecoder().Decode(reader);
|
||||
|
||||
|
@ -90,7 +100,6 @@ protected LegacySkin(SkinInfo skin, [CanBeNull] IResourceStore<byte[]> storage,
|
|||
}
|
||||
else
|
||||
Configuration = new LegacySkinConfiguration();
|
||||
}
|
||||
|
||||
if (storage != null)
|
||||
{
|
||||
|
|
Loading…
Reference in New Issue