private string a(UnknownDR A_0) { try { VLTClass dq = A_0.dq1; string text = HashTracker.getValueForHash(A_0.c1.hash); if (A_0.c1.ui3 == 0u) { return(text); } return(this.a(dq.dqb1.a(A_0.c1.ui3)) + "/" + text); } catch { return(""); } }
public void a(ClassRecord A_0, UnknownB0 A_1) { this.b01 = A_1; this.classRecord = A_0; this.classHash = A_0.hash; UnknownA8 a81 = (A_1.a(VLTOtherValue.TABLE_END) as UnknownA8); int num = a81.genht1[A_0.position].i2; A_1.ms1.Seek(num, SeekOrigin.Begin); BinaryReader br = new BinaryReader(A_1.ms1); this.fields = new VLTClass.aclz1[this.classRecord.i2]; for (int i = 0; i < this.classRecord.i2; ++i) { VLTClass.aclz1 a = new VLTClass.aclz1(); a.read(br); HashTracker.getValueForHash(a.hash); this.fields[i] = a; } this.dqb1 = new VLTClass.bie(this); }
/* * private void i( object A_0, EventArgs A_1 ) * { * if( this.tv.SelectedNode != null ) * { * TreeNode selectedNode = this.tv.SelectedNode; * if( selectedNode.Tag is UnknownDE ) * { * // Right-clicked "Database", selected "Copy Node Path" * Clipboard.SetDataObject( "" ); * } * else if( selectedNode.Tag is VLTClass ) * { * VLTClass dq = selectedNode.Tag as VLTClass; * Clipboard.SetDataObject( HashTracker.getValueForHash( dq.hash ) ); * } * else * { * UnknownDR dr = selectedNode.Tag as UnknownDR; * VLTClass dq2 = dr.dq1; * Clipboard.SetDataObject( HashTracker.getValueForHash( dq2.hash ) + "/" + this.a( dr ) ); * } * } * } */ private void h(object A_0, EventArgs A_1) { if (this.tvFields.SelectedNode != null) { TreeNode selectedNode = this.tvFields.SelectedNode; VLTBaseType bb = selectedNode.Tag as VLTBaseType; if (selectedNode.Parent != null) { VLTBaseType bb2 = selectedNode.Parent.Tag as VLTArrayType; Clipboard.SetDataObject(string.Concat(new object[] { HashTracker.getValueForHash(bb2.ui3), "[", bb.arrayIndex, "]" })); return; } Clipboard.SetDataObject(HashTracker.getValueForHash(bb.ui3)); } }
private void j(object A_0, EventArgs A_1) { if (this.tv.SelectedNode != null) { TreeNode selectedNode = this.tv.SelectedNode; if (selectedNode.Tag is UnknownDE) { Clipboard.SetDataObject("Database"); } else if (selectedNode.Tag is VLTClass) { VLTClass dq = selectedNode.Tag as VLTClass; Clipboard.SetDataObject(HashTracker.getValueForHash(dq.classHash)); } else { UnknownDR dr = selectedNode.Tag as UnknownDR; Clipboard.SetDataObject(HashTracker.getValueForHash(dr.c1.hash)); } } }
/* * private void e( object A_0, EventArgs A_1 ) * { * if( this.tvFields.SelectedNode != null ) * { * TreeNode treeNode = this.tvFields.SelectedNode; * if( treeNode.Parent != null ) * { * treeNode = treeNode.Parent; * } * VLTBaseType bb = treeNode.Tag as VLTBaseType; * this.a( bb.dr1, bb.ui3 ); * } * } */ // TODO: opt private void tv_AfterSelect(object A_0, TreeViewEventArgs A_1) { object tag = A_1.Node.Tag; if (tag is VLTClass) { this.classGrid.Visible = true; this.pnlData.Visible = false; VLTClass dq = tag as VLTClass; DataSet dataSet = new DataSet("VLT"); DataTable dataTable = dataSet.Tables.Add("Fields"); dataTable.Columns.Add("Name", typeof(string)); dataTable.Columns.Add("Type", typeof(string)); dataTable.Columns.Add("Length", typeof(ushort)); dataTable.Columns.Add("Count", typeof(short)); foreach (VLTClass.aclz1 a in dq) { DataRow dataRow = dataTable.NewRow(); dataRow[0] = HashTracker.getValueForHash(a.hash); dataRow[1] = HashTracker.getValueForHash(a.ui2); dataRow[2] = a.len; dataRow[3] = a.count; dataTable.Rows.Add(dataRow); } this.classGrid.DataSource = dataSet; this.classGrid.DataMember = "Fields"; // This gets rid of the extra row in the table that appears when viewing a root node (e.x. junkman, pvehicle) CurrencyManager currencyManager = (CurrencyManager)this.BindingContext[dataSet, "Fields"]; ((DataView)currencyManager.List).AllowNew = false; ((DataView)currencyManager.List).AllowEdit = false; ((DataView)currencyManager.List).AllowDelete = false; UnknownA8 a2 = dq.b01.a(VLTOtherValue.TABLE_END) as UnknownA8; this.classGrid.Update(); } else if (tag is UnknownDR) { this.lblFieldType.Text = ""; this.lblFieldOffset.Text = ""; this.dataGrid.DataSource = null; this.dataGrid.Update(); this.classGrid.Visible = false; this.pnlData.Visible = true; string text = ""; string text2 = ""; TreeNode treeNode = null; if (this.tvFields.SelectedNode != null) { if (this.tvFields.SelectedNode.Parent != null && this.tvFields.SelectedNode.Parent.Tag == null) { text = this.tvFields.SelectedNode.Parent.Text; text2 = this.tvFields.SelectedNode.Text; } else { text = this.tvFields.SelectedNode.Text; } } UnknownDR dr = tag as UnknownDR; VLTClass dq2 = dr.dq1; this.tvFields.BeginUpdate(); this.tvFields.Nodes.Clear(); int num = 0; foreach (VLTClass.aclz1 a3 in dq2) { VLTBaseType bb = dr.bba1[num++]; if (!a3.c() || dr.booa1[num - 1]) { if (a3.isArray()) { VLTArrayType m = bb as VLTArrayType; string text3 = string.Concat(new object[] { HashTracker.getValueForHash(a3.hash), " [", m.getMaxEntryCount(), "/", m.getCurrentEntryCount(), "]" }); TreeNode treeNode2 = this.tvFields.Nodes.Add(text3); treeNode2.Tag = bb; for (int i = 0; i < m.getMaxEntryCount(); ++i) { TreeNode treeNode3 = treeNode2.Nodes.Add("[" + i + "]"); treeNode3.Tag = m.genlist[i]; if (treeNode2.Text == text && treeNode3.Text == text2) { treeNode = treeNode3; } } if (treeNode2.Text == text && treeNode == null) { treeNode = treeNode2; } } else { TreeNode treeNode4 = this.tvFields.Nodes.Add(HashTracker.getValueForHash(a3.hash)); treeNode4.Tag = bb; if (treeNode4.Text == text) { treeNode = treeNode4; } } } } if (this.tvFields.Nodes.Count > 0) { if (treeNode == null) { this.tvFields.SelectedNode = this.tvFields.Nodes[0]; } else { this.tvFields.SelectedNode = treeNode; } } this.tvFields.EndUpdate(); UnknownA8 a4 = dr.b01.a(VLTOtherValue.TABLE_END) as UnknownA8; } else { this.classGrid.Visible = false; this.pnlData.Visible = false; } }
private void classdump() { using (StreamWriter streamWriter = new StreamWriter((new FileInfo(Application.ExecutablePath)).Directory.FullName + "\\temp.cs", false, Encoding.ASCII)) { streamWriter.WriteLine("using System;"); streamWriter.WriteLine("using mwperf;"); streamWriter.WriteLine("namespace mwperf.VLTTables {"); foreach (VLTClass dq in this.av) { string text = this.bThree(HashTracker.getValueForHash(dq.classHash)); if (this.c(text)) { streamWriter.WriteLine("\tnamespace " + text + " {"); streamWriter.WriteLine("\t\tpublic abstract class " + this.bThree(text + "_base") + " {"); foreach (VLTClass.aclz1 a in dq) { string text2 = this.bThree(HashTracker.getValueForHash(a.hash)); if (this.c(text2)) { streamWriter.WriteLine(string.Concat(new string[] { "\t\t\tpublic static VLTOffsetData", a.isArray() ? "[]" : "", " ", text2, ";" })); } } streamWriter.WriteLine("\t\t}"); foreach (UnknownDR dr in dq.dqb1) { int num = 0; string text3 = this.bThree(HashTracker.getValueForHash(dr.c1.hash)); if (this.c(text3)) { streamWriter.WriteLine(string.Concat(new string[] { "\t\tpublic class ", text3, " : ", text, "_base {" })); streamWriter.WriteLine("\t\t\tstatic " + text3 + "() {"); foreach (VLTClass.aclz1 a2 in dq) { VLTBaseType bb = dr.bba1[num++]; if (!a2.c() || dr.booa1[num - 1]) { string text4 = this.bThree(HashTracker.getValueForHash(a2.hash)); if (this.c(text4)) { streamWriter.Write("\t\t\t\t" + text4 + " = "); if (a2.isArray()) { VLTArrayType m = bb as VLTArrayType; streamWriter.WriteLine("new VLTOffsetData[] {"); for (int i = 0; i < m.getMaxEntryCount(); ++i) { bb = m.genlist[i]; streamWriter.WriteLine(string.Concat(new string[] { "\t\t\t\t\tnew VLTOffsetData(VLTOffsetType.", bb.isVltOffset ? "Vlt" : "Bin", ", ", string.Format("0x{0:x}", bb.ui1), ")", (i != (int)(m.getMaxEntryCount() - 1)) ? "," : "" })); } streamWriter.WriteLine("\t\t\t\t};"); } else { streamWriter.WriteLine(string.Concat(new string[] { "new VLTOffsetData(VLTOffsetType.", bb.isVltOffset ? "Vlt" : "Bin", ", ", string.Format("0x{0:x}", bb.ui1), ");" })); } } } } streamWriter.WriteLine("\t\t\t}"); streamWriter.WriteLine("\t\t}"); } } streamWriter.WriteLine("\t}"); } } streamWriter.WriteLine("}"); } }
private void tvFields_AfterSelect(object A_0, TreeViewEventArgs A_1) { object tag = A_1.Node.Tag; if (tag is VLTBaseType && !(tag is VLTArrayType)) { VLTBaseType bb = tag as VLTBaseType; //bb.l(); // MW: TODO: What is l() supposed to be? DataSet dataSet = new DataSet("DataItem"); DataTable dataTable = dataSet.Tables.Add("Values"); dataTable.Columns.Add("Name", typeof(string)); dataTable.Columns.Add("Value", typeof(string)); Type type = bb.GetType(); FieldInfo[] fields = type.GetFields(); foreach (FieldInfo fieldInfo in fields) { object[] customAttributes = fieldInfo.GetCustomAttributes(typeof(DataValueAttribute), false); if (customAttributes != null && customAttributes.Length == 1 && customAttributes[0] is DataValueAttribute) { DataValueAttribute dataValueAttribute = customAttributes[0] as DataValueAttribute; DataRow dataRow = dataTable.NewRow(); dataRow[0] = dataValueAttribute.Name; object value = fieldInfo.GetValue(bb); if (value == null) { dataRow[1] = "(null)"; } else { if (dataValueAttribute.Hex) { dataRow[1] = string.Format("0x{0:x}", value); } else { dataRow[1] = value.ToString(); } } dataTable.Rows.Add(dataRow); } } this.dataGrid.DataSource = dataSet; this.dataGrid.DataMember = "Values"; // This gets rid of the extra row in the table that appears when viewing a sub-node (e.x. junkman --> default) CurrencyManager currencyManager = (CurrencyManager)this.BindingContext[dataSet, "Values"]; ((DataView)currencyManager.List).AllowNew = false; ((DataView)currencyManager.List).AllowEdit = false; ((DataView)currencyManager.List).AllowDelete = false; this.lblFieldType.Text = "Type: " + HashTracker.getValueForHash(bb.typeHash); if (BuildConfig.DEBUG) { this.writeToConsole("bb.GetType(): " + type.ToString()); // Here, we're getting the proper type! Great! this.writeToConsole("bb.j(): " + string.Format("0x{0:x}", bb.typeHash)); // Here, we're derping! OMG! } UnknownBA ba = bb.dr1.b01.a(VLTOtherValue.VLTMAGIC) as UnknownBA; string text = ba.sa1[0]; this.lblFieldOffset.Text = string.Format("Offset: {0}:0x{1:x} ({2})", bb.isVltOffset ? "vlt" : "bin", bb.ui1, text); this.dataGrid.Update(); } else { this.lblFieldType.Text = ""; this.lblFieldOffset.Text = ""; this.dataGrid.DataSource = null; this.dataGrid.Update(); } }
private void tvFields_AfterSelect(object sender, TreeViewEventArgs e) { object tag = e.Node.Tag; if (tag is VLTBaseType && !(tag is VLTArrayType)) { VLTBaseType bb = tag as VLTBaseType; //bb.l(); // MW: TODO: What is l() supposed to be? DataSet dataSet = new DataSet("DataItem"); DataTable dataTable = dataSet.Tables.Add("Values"); dataTable.Columns.Add("Name", typeof(string)); dataTable.Columns.Add("Value", typeof(string)); Type type = bb.GetType(); FieldInfo[] fields = type.GetFields(); foreach (FieldInfo fieldInfo in fields) { object[] customAttributes = fieldInfo.GetCustomAttributes(typeof(DataValueAttribute), false); if (customAttributes != null && customAttributes.Length == 1 && customAttributes[0] is DataValueAttribute) { DataValueAttribute dataValueAttribute = customAttributes[0] as DataValueAttribute; DataRow dataRow = dataTable.NewRow(); dataRow[0] = dataValueAttribute.Name; object value = fieldInfo.GetValue(bb); if (value == null) { dataRow[1] = "(null)"; } else { if (dataValueAttribute.Hex) { dataRow[1] = string.Format("0x{0:x}", value); } else { dataRow[1] = value.ToString(); } } dataTable.Rows.Add(dataRow); } } this.dataGrid.DataSource = dataSet; this.dataGrid.DataMember = "Values"; this.lblFieldType.Text = "Type: " + HashTracker.getValueForHash(bb.typeHash); /* * if( BuildConfig.DEBUG ) * { * this.writeToConsole( "bb.GetType(): " + type.ToString() ); // Here, we're getting the proper type! Great! * this.writeToConsole( "bb.j(): " + string.Format( "0x{0:x}", bb.ui2 ) ); // Here, we're derping! OMG! * }*/ UnknownBA ba = bb.dr1.b01.a(VLTOtherValue.VLTMAGIC) as UnknownBA; string text = ba.sa1[0]; this.lblFieldOffset.Text = string.Format("Offset: {0}:0x{1:x} ({2})", bb.isVltOffset ? "vlt" : "bin", bb.ui1, text); this.dataGrid.Update(); } else { this.lblFieldType.Text = ""; this.lblFieldOffset.Text = ""; this.dataGrid.DataSource = null; this.dataGrid.Update(); } }
private void tv_AfterSelect(object sender, TreeViewEventArgs e) { object tag = e.Node.Tag; if (tag is VLTClass) { this.classGrid.Visible = true; this.pnlData.Visible = false; VLTClass dq = tag as VLTClass; if (!this.classGridDataSet.Tables.Contains(dq.classHash.ToString())) { DataTable dataTable = this.classGridDataSet.Tables.Add(dq.classHash.ToString()); dataTable.Columns.Add("Name", typeof(string)); dataTable.Columns.Add("Type", typeof(string)); dataTable.Columns.Add("Length", typeof(ushort)); dataTable.Columns.Add("Count", typeof(short)); foreach (VLTClass.aclz1 a in dq) { /* * object[] rowData = * { * HashTracker.getValueForHash( a.hash ), * HashTracker.getValueForHash( a.ui2 ), * a.len, * a.count * }; * dataTable.Rows.Add( rowData );*/ dataTable.Rows.Add(new object[] { HashTracker.getValueForHash(a.hash), HashTracker.getValueForHash(a.ui2), a.len, a.count }); /* * DataRow dataRow = dataTable.NewRow(); * dataRow[0] = HashTracker.getValueForHash( a.hash ); * dataRow[1] = HashTracker.getValueForHash( a.ui2 ); * dataRow[2] = a.len; * dataRow[3] = a.count; * dataTable.Rows.Add( dataRow );*/ } } this.classGrid.DataMember = dq.classHash.ToString(); //this.classGrid.Columns["Name"].Width = 80; //this.classGrid.Columns["Type"].Width = 150; //this.classGrid.Columns["Length"].Width = 60; //this.classGrid.Columns["Count"].Width = 60; this.classGrid.Update(); } else if (tag is UnknownDR) // TODO { this.lblFieldType.Text = ""; this.lblFieldOffset.Text = ""; this.dataGrid.DataSource = null; this.dataGrid.Update(); this.classGrid.Visible = false; this.pnlData.Visible = true; string text = ""; string text2 = ""; TreeNode treeNode = null; if (this.tvFields.SelectedNode != null) { if (this.tvFields.SelectedNode.Parent != null && this.tvFields.SelectedNode.Parent.Tag == null) { text = this.tvFields.SelectedNode.Parent.Text; text2 = this.tvFields.SelectedNode.Text; } else { text = this.tvFields.SelectedNode.Text; } } UnknownDR dr = tag as UnknownDR; VLTClass dq2 = dr.dq1; this.tvFields.BeginUpdate(); this.tvFields.Nodes.Clear(); int num = 0; foreach (VLTClass.aclz1 a3 in dq2) { VLTBaseType bb = dr.bba1[num++]; if (!a3.c() || dr.booa1[num - 1]) { if (a3.isArray()) { VLTArrayType m = bb as VLTArrayType; string text3 = string.Concat(new object[] { HashTracker.getValueForHash(a3.hash), " [", m.getMaxEntryCount(), "/", m.getCurrentEntryCount(), "]" }); TreeNode treeNode2 = this.tvFields.Nodes.Add(text3); treeNode2.Tag = bb; for (int i = 0; i < m.getMaxEntryCount(); ++i) { TreeNode treeNode3 = treeNode2.Nodes.Add("[" + i + "]"); treeNode3.Tag = m.genlist[i]; if (treeNode2.Text == text && treeNode3.Text == text2) { treeNode = treeNode3; } } if (treeNode2.Text == text && treeNode == null) { treeNode = treeNode2; } } else { TreeNode treeNode4 = this.tvFields.Nodes.Add(HashTracker.getValueForHash(a3.hash)); treeNode4.Tag = bb; if (treeNode4.Text == text) { treeNode = treeNode4; } } } } if (this.tvFields.Nodes.Count > 0) { if (treeNode == null) { this.tvFields.SelectedNode = this.tvFields.Nodes[0]; } else { this.tvFields.SelectedNode = treeNode; } } this.tvFields.EndUpdate(); } else { this.classGrid.Visible = false; this.pnlData.Visible = false; } }
/** * Searches open files for the specified entry name/hash; stores results in the given List */ private void search(string A_0, ref List <string> A_1) { uint num; if (A_0.StartsWith("0x")) { num = uint.Parse(A_0.Substring(2), NumberStyles.AllowHexSpecifier | NumberStyles.AllowLeadingWhite | NumberStyles.AllowTrailingWhite); } else { num = JenkinsHash.getHash32(A_0); } foreach (VLTClass dq in this.av) { if (dq.classHash == num) { string text = A_0 + ": Found match for class: " + HashTracker.getValueForHash(dq.classHash); if (!A_1.Contains(text)) { A_1.Add(text); } } foreach (VLTClass.aclz1 a in dq) { if (a.hash == num) { string text = string.Concat(new string[] { A_0, ": Found match for field: ", HashTracker.getValueForHash(dq.classHash), "/", HashTracker.getValueForHash(a.hash) }); if (!A_1.Contains(text)) { A_1.Add(text); } } } foreach (UnknownDR dr in dq.dqb1) { if (dr.c1.hash == num) { string text = string.Concat(new string[] { A_0, ": Found match for row: ", HashTracker.getValueForHash(dq.classHash), "/", this.a(dr) }); if (!A_1.Contains(text)) { A_1.Add(text); } } } } }
private void tvRefresh() { bool flag = true; this.classGrid.Visible = false; // Clear out the class DataSet, just in case something in the cache changes somehow upon loading a file. this.classGridDataSet = new DataSet("VLT"); this.classGrid.DataSource = this.classGridDataSet; this.pnlData.Visible = false; this.tv.Nodes.Clear(); if (this.au.Count == 0) { return; } this.tv.BeginUpdate(); Dictionary <string, TreeNode> dict = new Dictionary <string, TreeNode>(); foreach (VLTClass dq in this.av) { string text = HashTracker.getValueForHash(dq.classHash); TreeNode treeNode2 = this.tv.Nodes.Add(text); treeNode2.Tag = dq; foreach (UnknownDR dr in dq.dqb1) { TreeNode treeNode3 = null; string text2; if (dr.c1.ui3 == 0u) { treeNode3 = treeNode2; } else { // This failure seems to be caused by our underlying problem with the VLTClass RowEntry failure. text2 = string.Format("{0:x},{1:x}", dq.classHash, dr.c1.ui3); if (dict.ContainsKey(text2)) { treeNode3 = dict[text2]; } } if (treeNode3 == null) { if (flag) { DialogResult dialogResult = MessageBox.Show("Could not find parent data row. Did you forget to load a dependency?\nThe hierarchy will be flattened.", "Warning", MessageBoxButtons.OK); // TODO: , 48); if (dialogResult == DialogResult.OK) { flag = false; } } treeNode3 = treeNode2; } text = string.Concat(new object[] { HashTracker.getValueForHash(dr.c1.hash), " [", dq.classRecord.i6, "+", dr.c1.i1, "]" }); treeNode3 = treeNode3.Nodes.Add(text); treeNode3.Tag = dr; text2 = string.Format("{0:x},{1:x}", dq.classHash, dr.c1.hash); dict[text2] = treeNode3; } } this.tv.Sort(); this.tv.EndUpdate(); }