public static void LoadEnhancements() { I9Gfx.Enhancements = new Bitmap[DatabaseAPI.Database.Enhancements.Length]; for (int index = 0; index <= DatabaseAPI.Database.Enhancements.Length - 1; ++index) { if (DatabaseAPI.Database.Enhancements[index].Image != string.Empty) { try { I9Gfx.Enhancements[index] = new Bitmap(I9Gfx.GetEnhancementsPath() + DatabaseAPI.Database.Enhancements[index].Image); } catch (Exception ex) { I9Gfx.Enhancements[index] = new Bitmap(30, 30, PixelFormat.Format32bppArgb); } DatabaseAPI.Database.Enhancements[index].ImageIdx = index; } else { I9Gfx.Enhancements[index] = new Bitmap(30, 30, PixelFormat.Format32bppArgb); DatabaseAPI.Database.Enhancements[index].ImageIdx = -1; } if (index % 5 == 0) { Application.DoEvents(); } } }
public static void LoadSets() { I9Gfx.Sets = new ExtendedBitmap(DatabaseAPI.Database.EnhancementSets.Count * 30, 30); for (int index = 0; index <= DatabaseAPI.Database.EnhancementSets.Count - 1; ++index) { if (!string.IsNullOrEmpty(DatabaseAPI.Database.EnhancementSets[index].Image)) { int x = index * 30; using (ExtendedBitmap extendedBitmap = new ExtendedBitmap(I9Gfx.GetEnhancementsPath() + DatabaseAPI.Database.EnhancementSets[index].Image)) { DatabaseAPI.Database.EnhancementSets[index].ImageIdx = index; Size size = extendedBitmap.Size; int num; if (size.Height <= 30) { size = extendedBitmap.Size; num = size.Width <= 30 ? 1 : 0; } else { num = 0; } if (num == 0) { I9Gfx.Sets.Graphics.DrawImage((Image)extendedBitmap.Bitmap, x, 0, 30, 30); } else { I9Gfx.Sets.Graphics.DrawImage((Image)extendedBitmap.Bitmap, x, 0); } } } else { goto label_16; } label_13: if (index % 5 == 0) { Application.DoEvents(); continue; } continue; label_16: DatabaseAPI.Database.EnhancementSets[index].ImageIdx = -1; goto label_13; } }
void DisplayIcon() { if (mySet.Image != "") { ExtendedBitmap extendedBitmap1 = new ExtendedBitmap(I9Gfx.GetEnhancementsPath() + mySet.Image); ExtendedBitmap extendedBitmap2 = new ExtendedBitmap(30, 30); extendedBitmap2.Graphics.DrawImage((Image)I9Gfx.Borders.Bitmap, extendedBitmap2.ClipRect, I9Gfx.GetOverlayRect(Origin.Grade.SetO), System.Drawing.GraphicsUnit.Pixel); extendedBitmap2.Graphics.DrawImage((Image)extendedBitmap1.Bitmap, extendedBitmap2.ClipRect, extendedBitmap2.ClipRect, System.Drawing.GraphicsUnit.Pixel); btnImage.Image = (Image) new Bitmap((Image)extendedBitmap2.Bitmap); btnImage.Text = mySet.Image; } else { ExtendedBitmap extendedBitmap = new ExtendedBitmap(30, 30); extendedBitmap.Graphics.DrawImage((Image)I9Gfx.Borders.Bitmap, extendedBitmap.ClipRect, I9Gfx.GetOverlayRect(Origin.Grade.SetO), System.Drawing.GraphicsUnit.Pixel); btnImage.Image = (Image) new Bitmap((Image)extendedBitmap.Bitmap); btnImage.Text = "Select Image"; } }
void DisplayIcon() { if (this.mySet.Image != "") { ExtendedBitmap extendedBitmap = new ExtendedBitmap(I9Gfx.GetEnhancementsPath() + this.mySet.Image); ExtendedBitmap extendedBitmap2 = new ExtendedBitmap(30, 30); extendedBitmap2.Graphics.DrawImage(I9Gfx.Borders.Bitmap, extendedBitmap2.ClipRect, I9Gfx.GetOverlayRect(Origin.Grade.SetO), GraphicsUnit.Pixel); extendedBitmap2.Graphics.DrawImage(extendedBitmap.Bitmap, extendedBitmap2.ClipRect, extendedBitmap2.ClipRect, GraphicsUnit.Pixel); this.btnImage.Image = new Bitmap(extendedBitmap2.Bitmap); this.btnImage.Text = this.mySet.Image; } else { ExtendedBitmap extendedBitmap3 = new ExtendedBitmap(30, 30); extendedBitmap3.Graphics.DrawImage(I9Gfx.Borders.Bitmap, extendedBitmap3.ClipRect, I9Gfx.GetOverlayRect(Origin.Grade.SetO), GraphicsUnit.Pixel); this.btnImage.Image = new Bitmap(extendedBitmap3.Bitmap); this.btnImage.Text = "Select Image"; } }
void btnImage_Click(object sender, EventArgs e) { if (!this.Loading) { this.ImagePicker.InitialDirectory = I9Gfx.GetEnhancementsPath(); this.ImagePicker.FileName = this.mySet.Image; if (this.ImagePicker.ShowDialog() == DialogResult.OK) { string str = FileIO.StripPath(this.ImagePicker.FileName); if (!File.Exists(FileIO.AddSlash(this.ImagePicker.InitialDirectory) + str)) { Interaction.MsgBox("You must select an image from the " + I9Gfx.GetEnhancementsPath() + " folder!\r\n\r\nIf you are adding a new image, you should copy it to the folder and then select it.", MsgBoxStyle.Information, "Ah..."); } else { this.mySet.Image = str; this.DisplayIcon(); } } } }
private void DisplayIcon() { if (!string.IsNullOrWhiteSpace(mySet.Image)) { using var extendedBitmap1 = new ExtendedBitmap($"{I9Gfx.GetEnhancementsPath()}{mySet.Image}"); using var extendedBitmap2 = new ExtendedBitmap(30, 30); extendedBitmap2.Graphics.DrawImage(I9Gfx.Borders.Bitmap, extendedBitmap2.ClipRect, I9Gfx.GetOverlayRect(Origin.Grade.SetO), GraphicsUnit.Pixel); extendedBitmap2.Graphics.DrawImage(extendedBitmap1.Bitmap, extendedBitmap2.ClipRect, extendedBitmap2.ClipRect, GraphicsUnit.Pixel); btnImage.Image = new Bitmap(extendedBitmap2.Bitmap); btnImage.Text = mySet.Image; } else { using var extendedBitmap = new ExtendedBitmap(30, 30); extendedBitmap.Graphics.DrawImage(I9Gfx.Borders.Bitmap, extendedBitmap.ClipRect, I9Gfx.GetOverlayRect(Origin.Grade.SetO), GraphicsUnit.Pixel); btnImage.Image = new Bitmap(extendedBitmap.Bitmap); btnImage.Text = @"Select Image"; } }
public static void LoadSets() { I9Gfx.Sets = new ExtendedBitmap(DatabaseAPI.Database.EnhancementSets.Count * 30, 30); int index = 0; while (index <= DatabaseAPI.Database.EnhancementSets.Count - 1) { if (!string.IsNullOrEmpty(DatabaseAPI.Database.EnhancementSets[index].Image)) { int x = index * 30; using (ExtendedBitmap extendedBitmap = new ExtendedBitmap(I9Gfx.GetEnhancementsPath() + DatabaseAPI.Database.EnhancementSets[index].Image)) { DatabaseAPI.Database.EnhancementSets[index].ImageIdx = index; if (extendedBitmap.Size.Height > 30 || extendedBitmap.Size.Width > 30) { I9Gfx.Sets.Graphics.DrawImage(extendedBitmap.Bitmap, x, 0, 30, 30); } else { I9Gfx.Sets.Graphics.DrawImage(extendedBitmap.Bitmap, x, 0); } goto IL_109; } goto IL_107; } goto IL_107; IL_109: if (index % 5 == 0) { Application.DoEvents(); } index++; continue; IL_107: DatabaseAPI.Database.EnhancementSets[index].ImageIdx = -1; goto IL_109; } }
private void btnImage_Click(object sender, EventArgs e) { if (Loading) { return; } ImagePicker.InitialDirectory = I9Gfx.GetEnhancementsPath(); ImagePicker.FileName = mySet.Image; if (ImagePicker.ShowDialog() == DialogResult.OK) { var str = FileIO.StripPath(ImagePicker.FileName); if (!File.Exists(FileIO.AddSlash(ImagePicker.InitialDirectory) + str)) { MessageBox.Show( $"You must select an image from the {I9Gfx.GetEnhancementsPath()} folder!\r\n\r\nIf you are adding a new image, you should copy it to the folder and then select it.", @"Select Image", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { mySet.Image = str; DisplayIcon(); } } }