public static IsValidStatic ( int index ) : bool | ||
index | int | |
return | bool |
private void DrawItemSec(object sender, DrawItemEventArgs e) { if (e.Index == -1) { return; } Brush fontBrush = Brushes.Gray; int i = int.Parse(listBoxSec.Items[e.Index].ToString()); if (listBoxSec.SelectedIndex == e.Index) { e.Graphics.FillRectangle(Brushes.LightSteelBlue, e.Bounds.X, e.Bounds.Y, e.Bounds.Width, e.Bounds.Height); } if (!SecondArt.IsValidStatic(i)) { fontBrush = Brushes.Red; } else if (!Compare(i)) { fontBrush = Brushes.Blue; } e.Graphics.DrawString(String.Format("0x{0:X}", i), Font, fontBrush, new PointF((float)5, e.Bounds.Y + ((e.Bounds.Height / 2) - (e.Graphics.MeasureString(String.Format("0x{0:X}", i), Font).Height / 2)))); }
private void OnIndexChangedSec(object sender, EventArgs e) { if ((listBoxSec.SelectedIndex == -1) || (listBoxSec.Items.Count < 1)) { return; } int i = int.Parse(listBoxSec.Items[listBoxSec.SelectedIndex].ToString()); int pos = listBoxOrg.Items.IndexOf(i); if (pos >= 0) { listBoxOrg.SelectedIndex = pos; } if (SecondArt.IsValidStatic(i)) { Bitmap bmp = SecondArt.GetStatic(i); if (bmp != null) { pictureBoxSec.BackgroundImage = bmp; } else { pictureBoxSec.BackgroundImage = null; } } else { pictureBoxSec.BackgroundImage = null; } listBoxSec.Invalidate(); }
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)); Ultima.Art.ReplaceStatic(i, copy); FiddlerControls.Options.ChangedUltimaClass["Art"] = true; FiddlerControls.Events.FireItemChangeEvent(this, i); m_Compare[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); }
private void ExportAsTiff(object sender, EventArgs e) { if (listBoxSec.SelectedIndex == -1) { return; } int i = int.Parse(listBoxSec.Items[listBoxSec.SelectedIndex].ToString()); if (!SecondArt.IsValidStatic(i)) { return; } string path = FiddlerControls.Options.OutputPath; string FileName = Path.Combine(path, String.Format("Item(Sec) 0x{0:X}.tiff", i)); SecondArt.GetStatic(i).Save(FileName, ImageFormat.Tiff); MessageBox.Show( String.Format("Item saved to {0}", FileName), "Saved", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); }
private void ExportAsBmp(object sender, EventArgs e) { if (listBoxSec.SelectedIndex == -1) { return; } int i = int.Parse(listBoxSec.Items[listBoxSec.SelectedIndex].ToString()); if (!SecondArt.IsValidStatic(i)) { return; } string path = AppDomain.CurrentDomain.SetupInformation.ApplicationBase; string FileName = Path.Combine(path, String.Format("Item(Sec) 0x{0:X}.bmp", i)); SecondArt.GetStatic(i).Save(FileName, ImageFormat.Bmp); MessageBox.Show( String.Format("Item saved to {0}", FileName), "Saved", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); }