private void copyElementToolStripMenuItem_Click(object sender, EventArgs e) { TreeNode selectedNode = this.treeView.SelectedNode; TreeNode parent = selectedNode.Parent; this.copyelement = this.ListDDS[parent.Index].ListDDS_element[selectedNode.Index]; }
private void addElementToolStripMenuItem_Click(object sender, EventArgs e) { dds.dds_element dds_element = new dds.dds_element(); dds_element.colour = 0; dds_element.name = "New element"; dds_element.ownerid = 0; dds_element.x1 = 0; dds_element.x2 = 0; dds_element.y1 = 0; dds_element.y2 = 0; if (this.treeView.SelectedNode.Level == 1) { TreeNode selectedNode = this.treeView.SelectedNode; TreeNode treeNode = selectedNode.Parent; dds_element.ownerid = Convert.ToInt16(treeNode.Index); this.ListDDS[treeNode.Index].ListDDS_element.Add(dds_element); treeNode.Nodes.Add("New element"); } else if (this.treeView.SelectedNode.Level == 0) { TreeNode treeNode = this.treeView.SelectedNode; dds_element.ownerid = Convert.ToInt16(treeNode.Index); this.ListDDS[treeNode.Index].ListDDS_element.Add(dds_element); treeNode.Nodes.Add("New element"); } }
public void load_tsi(string path) { this.treeView.Nodes.Clear(); this.ListDDS.Clear(); BinaryReader binaryReader = new BinaryReader(File.Open(path, FileMode.Open)); this.dds_count = binaryReader.ReadInt16(); for (int num = 0; num != (int)this.dds_count; num++) { dds dds = new dds(); short count = binaryReader.ReadInt16(); dds.path = Encoding.UTF7.GetString(binaryReader.ReadBytes((int)count)); this.treeView.Nodes.Add("Dds : \"" + dds.path + "\""); dds.colour_key = binaryReader.ReadInt32(); this.ListDDS.Add(dds); } this.totalelement_count = binaryReader.ReadInt16(); for (int num = 0; num != (int)this.dds_count; num++) { this.ListDDS[num].ddselement_count = binaryReader.ReadInt16(); for (int num2 = 0; num2 != (int)this.ListDDS[num].ddselement_count; num2++) { dds.dds_element dds_element = new dds.dds_element(); dds_element.Load_element(ref binaryReader); this.ListDDS[num].ListDDS_element.Add(dds_element); this.treeView.Nodes[num].Nodes.Add(dds_element.name); } } this.propertyGrid.SelectedObject = this.ListDDS[0].ListDDS_element[0]; binaryReader.Close(); }
private void removeDdsToolStripMenuItem_Click(object sender, EventArgs e) { this.ListDDS.RemoveAt(this.treeView.SelectedNode.Index); for (int num = this.treeView.SelectedNode.Index; num != this.ListDDS.Count; num++) { for (int num2 = 0; num2 != this.ListDDS[num].ListDDS_element.Count; num2++) { dds.dds_element expr_4D = this.ListDDS[num].ListDDS_element[num2]; expr_4D.ownerid -= 1; } } this.treeView.Nodes.Remove(this.treeView.SelectedNode); }
private void propertyGrid_PropertyValueChanged(object s, PropertyValueChangedEventArgs e) { if (this.propertyGrid.SelectedObject.GetType() == typeof(dds)) { dds dds = (dds)this.propertyGrid.SelectedObject; this.treeView.SelectedNode.Text = "Dds : \"" + dds.path + "\""; } if (this.propertyGrid.SelectedObject.GetType() == typeof(dds.dds_element)) { dds.dds_element dds_element = (dds.dds_element) this.propertyGrid.SelectedObject; this.treeView.SelectedNode.Text = dds_element.name; TreeNode selectedNode = this.treeView.SelectedNode; TreeNode parent = selectedNode.Parent; if (this.preview) { this.loadRect(this.ListDDS[parent.Index].ListDDS_element[selectedNode.Index].x1, this.ListDDS[parent.Index].ListDDS_element[selectedNode.Index].y1, this.ListDDS[parent.Index].ListDDS_element[selectedNode.Index].x2, this.ListDDS[parent.Index].ListDDS_element[selectedNode.Index].y2); } } }