mirror of
https://github.com/osukey/osukey.git
synced 2025-08-08 09:03:50 +09:00
Fix default metadata propagation when no files are present
This commit is contained in:
@ -18,12 +18,12 @@ namespace osu.Game.Skinning
|
|||||||
|
|
||||||
public int ID { get; set; }
|
public int ID { get; set; }
|
||||||
|
|
||||||
public string Name { get; set; }
|
public string Name { get; set; } = string.Empty;
|
||||||
|
|
||||||
|
public string Creator { get; set; } = string.Empty;
|
||||||
|
|
||||||
public string Hash { get; set; }
|
public string Hash { get; set; }
|
||||||
|
|
||||||
public string Creator { get; set; }
|
|
||||||
|
|
||||||
public string InstantiationInfo { get; set; }
|
public string InstantiationInfo { get; set; }
|
||||||
|
|
||||||
public virtual Skin CreateInstance(IStorageResourceProvider resources)
|
public virtual Skin CreateInstance(IStorageResourceProvider resources)
|
||||||
|
@ -149,7 +149,7 @@ namespace osu.Game.Skinning
|
|||||||
CurrentSkinInfo.Value = ModelStore.ConsumableItems.Single(i => i.ID == chosen.ID);
|
CurrentSkinInfo.Value = ModelStore.ConsumableItems.Single(i => i.ID == chosen.ID);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override SkinInfo CreateModel(ArchiveReader archive) => new SkinInfo { Name = archive.Name };
|
protected override SkinInfo CreateModel(ArchiveReader archive) => new SkinInfo { Name = archive.Name ?? "No name" };
|
||||||
|
|
||||||
private const string unknown_creator_string = "Unknown";
|
private const string unknown_creator_string = "Unknown";
|
||||||
|
|
||||||
@ -163,6 +163,7 @@ namespace osu.Game.Skinning
|
|||||||
|
|
||||||
// LegacySkin will parse the skin.ini and populate `Skin.Configuration` during construction above.
|
// LegacySkin will parse the skin.ini and populate `Skin.Configuration` during construction above.
|
||||||
string skinIniSourcedName = instance.Configuration.SkinInfo.Name;
|
string skinIniSourcedName = instance.Configuration.SkinInfo.Name;
|
||||||
|
string skinIniSourcedCreator = instance.Configuration.SkinInfo.Creator;
|
||||||
string archiveName = item.Name.Replace(".osk", "", StringComparison.OrdinalIgnoreCase);
|
string archiveName = item.Name.Replace(".osk", "", StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
bool isImport = reader != null;
|
bool isImport = reader != null;
|
||||||
@ -170,7 +171,7 @@ namespace osu.Game.Skinning
|
|||||||
if (isImport)
|
if (isImport)
|
||||||
{
|
{
|
||||||
item.Name = !string.IsNullOrEmpty(skinIniSourcedName) ? skinIniSourcedName : archiveName;
|
item.Name = !string.IsNullOrEmpty(skinIniSourcedName) ? skinIniSourcedName : archiveName;
|
||||||
item.Creator = instance.Configuration.SkinInfo.Creator ?? unknown_creator_string;
|
item.Creator = !string.IsNullOrEmpty(skinIniSourcedCreator) ? skinIniSourcedCreator : unknown_creator_string;
|
||||||
|
|
||||||
// For imports, we want to use the archive or folder name as part of the metadata, in addition to any existing skin.ini metadata.
|
// For imports, we want to use the archive or folder name as part of the metadata, in addition to any existing skin.ini metadata.
|
||||||
// In an ideal world, skin.ini would be the only source of metadata, but a lot of skin creators and users don't update it when making modifications.
|
// In an ideal world, skin.ini would be the only source of metadata, but a lot of skin creators and users don't update it when making modifications.
|
||||||
|
Reference in New Issue
Block a user