private void CopyAddOnly_Click(object sender, EventArgs e) { for (int i = 0; i < 0x4000; i++) { if (!SecondTexture.IsValidTexture(i)) { continue; } else if (!Textures.TestTexture(i)) { Bitmap copy = new Bitmap(SecondTexture.GetTexture(i)); Ultima.Textures.Replace(i, copy); FiddlerControls.Events.FireTextureChangeEvent(this, i); } } m_Compare.Clear(); listBoxOrg.BeginUpdate(); listBoxOrg.Items.Clear(); List <object> cache = new List <object>(); for (int i = 0; i < 0x4000; i++) { cache.Add(i); } listBoxOrg.Items.AddRange(cache.ToArray()); listBoxOrg.EndUpdate(); }
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()); listBoxOrg.SelectedIndex = listBoxOrg.Items.IndexOf(i); if (SecondTexture.IsValidTexture(i)) { Bitmap bmp = SecondTexture.GetTexture(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 (!SecondTexture.IsValidTexture(i)) { return; } Bitmap copy = new Bitmap(SecondTexture.GetTexture(i)); Ultima.Textures.Replace(i, copy); FiddlerControls.Options.ChangedUltimaClass["Texture"] = true; FiddlerControls.Events.FireTextureChangeEvent(this, i); m_Compare[i] = true; listBoxOrg.BeginUpdate(); bool done = false; for (int id = 0; id < 0x4000; 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 bool Compare(int index) { if (m_Compare.ContainsKey(index)) { return(m_Compare[index]); } Bitmap bitorg = Textures.GetTexture(index); Bitmap bitsec = SecondTexture.GetTexture(index); if ((bitorg == null) && (bitsec == null)) { m_Compare[index] = true; return(true); } if (((bitorg == null) || (bitsec == null)) || (bitorg.Size != bitsec.Size)) { m_Compare[index] = false; return(false); } byte[] btImage1 = new byte[1]; btImage1 = (byte[])ic.ConvertTo(bitorg, btImage1.GetType()); byte[] btImage2 = new byte[1]; btImage2 = (byte[])ic.ConvertTo(bitsec, btImage2.GetType()); string hash1string = BitConverter.ToString(shaM.ComputeHash(btImage1)); string hash2string = BitConverter.ToString(shaM.ComputeHash(btImage2)); bool res; if (hash1string != hash2string) { res = false; } else { res = true; } m_Compare[index] = res; return(res); }
private void ExportAsTiff(object sender, EventArgs e) { if (listBoxSec.SelectedIndex == -1) { return; } int i = int.Parse(listBoxSec.Items[listBoxSec.SelectedIndex].ToString()); if (!SecondTexture.IsValidTexture(i)) { return; } string path = FiddlerControls.Options.OutputPath; string FileName = Path.Combine(path, String.Format("Texture(Sec) 0x{0:X}.tiff", i)); SecondTexture.GetTexture(i).Save(FileName, ImageFormat.Tiff); MessageBox.Show( String.Format("Texture 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 (!SecondTexture.IsValidTexture(i)) { return; } string path = AppDomain.CurrentDomain.SetupInformation.ApplicationBase; string FileName = Path.Combine(path, String.Format("Texture(Sec) 0x{0:X}.bmp", i)); SecondTexture.GetTexture(i).Save(FileName, ImageFormat.Bmp); MessageBox.Show( String.Format("Texture saved to {0}", FileName), "Saved", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); }