private static string[] GetZippedFiles(string prefix) { return(ZippedIcon.GetFiles(prefix, "/sitecore/shell/themes/standard/" + prefix + ".zip")); }
private static void DrawIcons(string prefix, string img, string area) { var files = GetFiles(prefix); var num1 = files.Length; if (num1 == 0) { num1 = 1; } var height = (num1 / 24 + (num1 % 24 == 0 ? 0 : 1)) * 40; using (var bitmap1 = new Bitmap(960, height, PixelFormat.Format32bppArgb)) { if (prefix == "OfficeWhite") { Graphics.FromImage(bitmap1).FillRectangle(Brushes.DarkGray, 0, 0, 960, height); } var htmlTextWriter = new HtmlTextWriter(new StringWriter()); htmlTextWriter.WriteLine("<map name=\"" + prefix + "\">"); var relativeIconPath = prefix + "/32x32/"; var num2 = 0; using (Graphics graphics = Graphics.FromImage(bitmap1)) { foreach (string path in files) { int num3 = num2 % 24; int num4 = num2 / 24; string themedImageSource = Images.GetThemedImageSource(relativeIconPath + path, ImageDimension.id32x32); try { using (Bitmap bitmap2 = Settings.Icons.UseZippedIcons ? new Bitmap(ZippedIcon.GetStream(relativeIconPath + path, ZippedIcon.GetZipFile(relativeIconPath))) : new Bitmap(FileUtil.MapPath(themedImageSource))) { graphics.DrawImage(bitmap2, num3 * 40 + 4, num4 * 40 + 4, 32, 32); } string str1 = $"{ (num3 * 40 + 4)},{ (num4 * 40 + 4)},{ (num3 * 40 + 36)},{ (num4 * 40 + 36)}"; string str2 = StringUtil.Capitalize(Path.GetFileNameWithoutExtension(path)?.Replace("_", " ")); htmlTextWriter.WriteLine("<area shape=\"rect\" coords=\"{0}\" href=\"#\" alt=\"{1}\" sc_path=\"{2}\"/>", str1, str2, (relativeIconPath + path)); ++num2; } catch (Exception ex) { Log.Warn("Unable to open icon " + themedImageSource, ex, typeof(SetIconForm)); } } } htmlTextWriter.WriteLine("</map>"); FileUtil.WriteToFile(area, htmlTextWriter.InnerWriter.ToString()); bitmap1.Save(img, ImageFormat.Png); } }