public void Write(BinaryWriter writer) { _signature.Write(writer); _width.Write(writer); _height.Write(writer); _depth.Write(writer); _type.Write(writer); _format.Write(writer); _flags.Write(writer); _registrationPoint.Write(writer); _mipmapCount.Write(writer); __unnamed.Write(writer); _pixelsOffset.Write(writer); __unnamed2.Write(writer); __unnamed3.Write(writer); __unnamed4.Write(writer); __unnamed5.Write(writer); _baseAddress.Write(writer); }
public void Save() { //// Double Check Path //if (!File.Exists(path)) //{ // SaveFileDialog sfd = new SaveFileDialog(); // sfd.Filter = "Halo 2 Tags (*." + TagClass + "|*." + TagClass; // if (sfd.ShowDialog() == DialogResult.OK) // { // path = sfd.FileName; // Globals.Tags.Add(path); // } //} // Get new values //int Field = 0; //for (int i = 0; i < this.Controls[0].Controls.Count; i++) //{ // if (this.Controls[0].Controls[i].GetType() == typeof(Value)) // { // Field = ((Value)this.Controls[0].Controls[i]).Index; // plugin[Field].SetValue(((Value)this.Controls[0].Controls[i]).Save()); // } // else if (this.Controls[0].Controls[i].GetType() == typeof(Enum)) // { // Field = ((Enum)this.Controls[0].Controls[i]).Index; // plugin[Field].SetValue(((Enum)this.Controls[0].Controls[i]).Save()); // } // else if (this.Controls[0].Controls[i].GetType() == typeof(Bitmask)) // { // Field = ((Bitmask)this.Controls[0].Controls[i]).Index; // plugin[Field].SetValue(((Bitmask)this.Controls[0].Controls[i]).Save()); // } // else if (this.Controls[0].Controls[i].GetType() == typeof(HaloControls.String)) // { // Field = ((HaloControls.String)this.Controls[0].Controls[i]).Index; // plugin[Field].SetValue(((HaloControls.String)this.Controls[0].Controls[i]).Save()); // } // else if (this.Controls[0].Controls[i].GetType() == typeof(TagReference)) // { // Field = ((HaloControls.TagReference)this.Controls[0].Controls[i]).Index; // plugin[Field].SetValue(((HaloControls.TagReference)this.Controls[0].Controls[i]).Save()); // } // else if (this.Controls[0].Controls[i].GetType() == typeof(TagBlock)) // { // Field = ((TagBlock)this.Controls[0].Controls[i]).Index; // ((TagBlock)this.Controls[0].Controls[i]).Save(); // } //} // Delete the file File.Delete(Path); // Reopen stream EndianWriter bw = new EndianWriter(Endianness.Little, new FileStream(Path, FileMode.Create, FileAccess.ReadWrite, FileShare.ReadWrite)); // Write to tag plugin.Write(bw); // Close bw.Close(); // Done MessageBox.Show("Done!"); }