Remove unused InstalledMods.Icons cache.

This commit is contained in:
Paul Chote
2020-02-15 11:51:49 +00:00
committed by abcdefg30
parent 84df61c672
commit e5309ee586

View File

@@ -26,16 +26,12 @@ namespace OpenRA
readonly Dictionary<string, Manifest> mods; readonly Dictionary<string, Manifest> mods;
readonly SheetBuilder sheetBuilder; readonly SheetBuilder sheetBuilder;
readonly Dictionary<string, Sprite> icons = new Dictionary<string, Sprite>();
public readonly IReadOnlyDictionary<string, Sprite> Icons;
/// <summary>Initializes the collection of locally installed mods.</summary> /// <summary>Initializes the collection of locally installed mods.</summary>
/// <param name="searchPaths">Filesystem paths to search for mod packages.</param> /// <param name="searchPaths">Filesystem paths to search for mod packages.</param>
/// <param name="explicitPaths">Filesystem paths to additional mod packages.</param> /// <param name="explicitPaths">Filesystem paths to additional mod packages.</param>
public InstalledMods(IEnumerable<string> searchPaths, IEnumerable<string> explicitPaths) public InstalledMods(IEnumerable<string> searchPaths, IEnumerable<string> explicitPaths)
{ {
sheetBuilder = new SheetBuilder(SheetType.BGRA, 256); sheetBuilder = new SheetBuilder(SheetType.BGRA, 256);
Icons = new ReadOnlyDictionary<string, Sprite>(icons);
mods = GetInstalledMods(searchPaths, explicitPaths); mods = GetInstalledMods(searchPaths, explicitPaths);
} }
@@ -76,20 +72,7 @@ namespace OpenRA
package = new Folder(path); package = new Folder(path);
if (package.Contains("mod.yaml")) if (package.Contains("mod.yaml"))
{ return new Manifest(id, package);
var manifest = new Manifest(id, package);
if (package.Contains("icon.png"))
{
using (var stream = package.GetStream("icon.png"))
if (stream != null)
icons[id] = sheetBuilder.Add(new Png(stream));
}
else if (!manifest.Metadata.Hidden)
Log.Write("debug", "Mod '{0}' is missing 'icon.png'.".F(path));
return manifest;
}
} }
catch (Exception e) catch (Exception e)
{ {