public static Imaging.ImageFile GetIcon(IO.PackCollection pack, Language language, int nr) { var type = language.GetCode(); if (type.Length > 0) { type = type + "/"; } return(GetIcon(pack, type, nr)); }
public static Imaging.ImageFile GetIcon(IO.PackCollection pack, string type, int nr) { type = type ?? string.Empty; if (type.Length > 0 && !type.EndsWith("/")) { type = type + "/"; } var filePath = string.Format(IconFileFormat, nr / 1000, type, nr); if (!pack.TryGetFile(filePath, out var file) && type.Length > 0) { // Couldn't get specific type, try for generic version. filePath = string.Format(IconFileFormat, nr / 1000, string.Empty, nr); if (!pack.TryGetFile(filePath, out file)) { // Couldn't get generic version either, that's a shame. file = null; } } return(file as Imaging.ImageFile); }
public static Imaging.ImageFile GetIcon(IO.PackCollection pack, int nr) { return(GetIcon(pack, string.Empty, nr)); }