mirror of
https://github.com/ppy/osu.git
synced 2025-01-15 12:42:54 +08:00
Merge pull request #12173 from frenzibyte/osk-ignore-case
This commit is contained in:
commit
e0b12abcc1
@ -113,6 +113,31 @@ namespace osu.Game.Tests.Skins.IO
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[Test]
|
||||||
|
public async Task TestImportUpperCasedOskArchive()
|
||||||
|
{
|
||||||
|
using (HeadlessGameHost host = new CleanRunHeadlessGameHost(nameof(ImportSkinTest)))
|
||||||
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
var osu = LoadOsuIntoHost(host);
|
||||||
|
|
||||||
|
var imported = await loadSkinIntoOsu(osu, new ZipArchiveReader(createOsk("name 1", "author 1"), "skin1.OsK"));
|
||||||
|
|
||||||
|
Assert.That(imported.Name, Is.EqualTo("name 1"));
|
||||||
|
Assert.That(imported.Creator, Is.EqualTo("author 1"));
|
||||||
|
|
||||||
|
var imported2 = await loadSkinIntoOsu(osu, new ZipArchiveReader(createOsk("name 1", "author 1"), "skin1.oSK"));
|
||||||
|
|
||||||
|
Assert.That(imported2.Hash, Is.EqualTo(imported.Hash));
|
||||||
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
host.Exit();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private MemoryStream createOsk(string name, string author)
|
private MemoryStream createOsk(string name, string author)
|
||||||
{
|
{
|
||||||
var zipStream = new MemoryStream();
|
var zipStream = new MemoryStream();
|
||||||
|
@ -104,7 +104,7 @@ namespace osu.Game.Skinning
|
|||||||
protected override string ComputeHash(SkinInfo item, ArchiveReader reader = null)
|
protected override string ComputeHash(SkinInfo item, ArchiveReader reader = null)
|
||||||
{
|
{
|
||||||
// we need to populate early to create a hash based off skin.ini contents
|
// we need to populate early to create a hash based off skin.ini contents
|
||||||
if (item.Name?.Contains(".osk") == true)
|
if (item.Name?.Contains(".osk", StringComparison.OrdinalIgnoreCase) == true)
|
||||||
populateMetadata(item);
|
populateMetadata(item);
|
||||||
|
|
||||||
if (item.Creator != null && item.Creator != unknown_creator_string)
|
if (item.Creator != null && item.Creator != unknown_creator_string)
|
||||||
@ -122,7 +122,7 @@ namespace osu.Game.Skinning
|
|||||||
{
|
{
|
||||||
await base.Populate(model, archive, cancellationToken).ConfigureAwait(false);
|
await base.Populate(model, archive, cancellationToken).ConfigureAwait(false);
|
||||||
|
|
||||||
if (model.Name?.Contains(".osk") == true)
|
if (model.Name?.Contains(".osk", StringComparison.OrdinalIgnoreCase) == true)
|
||||||
populateMetadata(model);
|
populateMetadata(model);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -137,7 +137,7 @@ namespace osu.Game.Skinning
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
item.Name = item.Name.Replace(".osk", "");
|
item.Name = item.Name.Replace(".osk", "", StringComparison.OrdinalIgnoreCase);
|
||||||
item.Creator ??= unknown_creator_string;
|
item.Creator ??= unknown_creator_string;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user