From 9b6bafeb7f582f66be11b230abb0d56fae0286c2 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Sat, 5 Feb 2022 21:43:35 +0800 Subject: [PATCH 1/3] Assembly utils should compare by full name, not partial name. --- osu.Game.Rulesets.Karaoke/Utils/AssemblyUtils.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/osu.Game.Rulesets.Karaoke/Utils/AssemblyUtils.cs b/osu.Game.Rulesets.Karaoke/Utils/AssemblyUtils.cs index f39924539..369918d9f 100644 --- a/osu.Game.Rulesets.Karaoke/Utils/AssemblyUtils.cs +++ b/osu.Game.Rulesets.Karaoke/Utils/AssemblyUtils.cs @@ -9,9 +9,9 @@ namespace osu.Game.Rulesets.Karaoke.Utils { public static class AssemblyUtils { - public static Assembly GetAssemblyByName(string partialName) + public static Assembly GetAssemblyByName(string name) { - var defaultAssembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(x => x.FullName.Contains(partialName)); + var defaultAssembly = AppDomain.CurrentDomain.GetAssemblies().FirstOrDefault(x => x.GetName().Name == name); if (defaultAssembly != null) return defaultAssembly; From 23a99e313cf50f515d682324074837abf6f4c082 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Sat, 5 Feb 2022 21:44:21 +0800 Subject: [PATCH 2/3] should not use GetType().Assembly because release dll might change by ILRepack. --- .../Skinning/Legacy/KaraokeLegacySkinTransformer.cs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/osu.Game.Rulesets.Karaoke/Skinning/Legacy/KaraokeLegacySkinTransformer.cs b/osu.Game.Rulesets.Karaoke/Skinning/Legacy/KaraokeLegacySkinTransformer.cs index dc98ce410..ceed171c3 100644 --- a/osu.Game.Rulesets.Karaoke/Skinning/Legacy/KaraokeLegacySkinTransformer.cs +++ b/osu.Game.Rulesets.Karaoke/Skinning/Legacy/KaraokeLegacySkinTransformer.cs @@ -12,6 +12,7 @@ using osu.Game.Database; using osu.Game.IO; using osu.Game.Rulesets.Karaoke.UI.HUD; +using osu.Game.Rulesets.Karaoke.Utils; using osu.Game.Rulesets.Scoring; using osu.Game.Skinning; @@ -105,7 +106,8 @@ private class InternalSkinStorageResourceProvider : IStorageResourceProvider { public InternalSkinStorageResourceProvider(string skinName) { - Files = Resources = new NamespacedResourceStore(new DllResourceStore(GetType().Assembly), $"Resources/Skin/{skinName}"); + var assembly = AssemblyUtils.GetAssemblyByName("osu.Game.Rulesets.Karaoke"); + Files = Resources = new NamespacedResourceStore(new DllResourceStore(assembly), $"Resources/Skin/{skinName}"); } public IResourceStore CreateTextureLoaderStore(IResourceStore underlyingStore) From bf78415f20c9baace54a3f4d9dd8b938e0a714a0 Mon Sep 17 00:00:00 2001 From: andy840119 Date: Sat, 5 Feb 2022 21:58:05 +0800 Subject: [PATCH 3/3] get resource store from karaoke ruleset because it might be more easier. also utils seems not working. --- .../Skinning/Legacy/KaraokeLegacySkinTransformer.cs | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/osu.Game.Rulesets.Karaoke/Skinning/Legacy/KaraokeLegacySkinTransformer.cs b/osu.Game.Rulesets.Karaoke/Skinning/Legacy/KaraokeLegacySkinTransformer.cs index ceed171c3..aa9fb310a 100644 --- a/osu.Game.Rulesets.Karaoke/Skinning/Legacy/KaraokeLegacySkinTransformer.cs +++ b/osu.Game.Rulesets.Karaoke/Skinning/Legacy/KaraokeLegacySkinTransformer.cs @@ -12,7 +12,6 @@ using osu.Game.Database; using osu.Game.IO; using osu.Game.Rulesets.Karaoke.UI.HUD; -using osu.Game.Rulesets.Karaoke.Utils; using osu.Game.Rulesets.Scoring; using osu.Game.Skinning; @@ -106,8 +105,8 @@ private class InternalSkinStorageResourceProvider : IStorageResourceProvider { public InternalSkinStorageResourceProvider(string skinName) { - var assembly = AssemblyUtils.GetAssemblyByName("osu.Game.Rulesets.Karaoke"); - Files = Resources = new NamespacedResourceStore(new DllResourceStore(assembly), $"Resources/Skin/{skinName}"); + var store = new KaraokeRuleset().CreateResourceStore(); + Files = Resources = new NamespacedResourceStore(store, $"Skin/{skinName}"); } public IResourceStore CreateTextureLoaderStore(IResourceStore underlyingStore)