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); File file; if (!pack.TryGetFile(filePath, out 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; }