public override void Import(bool direct, ref Dictionary <string, bool> changedClasses) { if (!Remove) { Bitmap import = new Bitmap(File); if (File.Contains(".bmp")) { import = Utils.ConvertBmp(import); } Ultima.Art.ReplaceStatic(Index, import); } else { Ultima.Art.RemoveStatic(Index); } if (!direct) { ControlEvents.FireItemChangeEvent(this, Index); Options.ChangedUltimaClass["Art"] = true; } changedClasses["Art"] = true; }
private void OnClickReplace(object sender, EventArgs e) { if (listView1.SelectedItems.Count == 1) { using (OpenFileDialog dialog = new OpenFileDialog()) { dialog.Multiselect = false; dialog.Title = "Choose image file to replace"; dialog.CheckFileExists = true; dialog.Filter = "Image files (*.tif;*.tiff;*.bmp)|*.tif;*.tiff;*.bmp"; if (dialog.ShowDialog() == DialogResult.OK) { Bitmap bmp = new Bitmap(dialog.FileName); if (dialog.FileName.Contains(".bmp")) { bmp = Utils.ConvertBmp(bmp); } int id = (int)listView1.SelectedItems[0].Tag; if (id == -1) { listView1.SelectedItems[0].Tag = id = listView1.SelectedItems[0].Index; } Art.ReplaceStatic(id, bmp); ControlEvents.FireItemChangeEvent(this, id); listView1.Invalidate(); UpdateDetail(id); Options.ChangedUltimaClass["Art"] = true; } } } }
private void OnClickCopy(object sender, EventArgs e) { if (listBoxSec.SelectedIndex == -1) { return; } int i = int.Parse(listBoxSec.Items[listBoxSec.SelectedIndex].ToString()); if (!SecondArt.IsValidStatic(i)) { return; } int staticLength = Art.GetMaxItemID() + 1; if (i >= staticLength) { return; } Bitmap copy = new Bitmap(SecondArt.GetStatic(i)); Art.ReplaceStatic(i, copy); Options.ChangedUltimaClass["Art"] = true; ControlEvents.FireItemChangeEvent(this, i); _mCompare[i] = true; listBoxOrg.BeginUpdate(); bool done = false; for (int id = 0; id < staticLength; id++) { if (id > i) { listBoxOrg.Items.Insert(id, i); done = true; break; } if (id == i) { done = true; break; } } if (!done) { listBoxOrg.Items.Add(i); } listBoxOrg.EndUpdate(); listBoxOrg.Invalidate(); listBoxSec.Invalidate(); OnIndexChangedOrg(this, null); }