private void disasmTree_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e) { if ((sender as TreeView).SelectedItem != null) { // scroll to member logic TreeViewItem si = ((sender as TreeView).SelectedItem as TreeViewItem); List <string> tp = new List <string> { "TypeDefinition", "MethodDefinition", "PropertyDefinition", "FieldDefinition", "EventDefinition" }; if (tp.Contains(si.Tag.GetType().Name)) { AshFile af = (disasmFile.Child as AshFile); string g = string.Empty; string[] td = nd.Decompile(si.Tag).Text.Split('\r'); if (si.Tag.GetType().Name == tp[0]) { g = td[2].Trim(); } else { if (!td[0].Contains("[CompilerGenerated]")) { g = td[0].Trim(); if (g.Contains(";")) { g = g.Substring(0, g.IndexOf(';')); } } else { MessageBox.Show("This member is compiler generated."); } } LocateInCode(g); } else if (si.Tag.GetType().Name == "EmbeddedResource" && si.Items.Count == 0) { //if (NeedsSave && MessageBoxResult.Yes == MessageBox.Show("Save current changes?", "Save changes", MessageBoxButton.YesNo)) Save(); XapEditor.decompiler.ResourceDecompiler rdec = new decompiler.ResourceDecompiler(si.Tag as Mono.Cecil.EmbeddedResource); string tmp = Path.GetTempFileName(); //AshFile af = new AshFile(this.pwner, tmp, EditorType.Resource); foreach (KeyValuePair <string, string> kv in rdec.Entries) { //af.reEntries.Items.Add(new ComboBoxItem() { Content = kv.Key, Tag = kv.Value }); si.Items.Add(nd.GetTreeItem(XapEntry.GetIconForExtension(Path.GetExtension(kv.Key)), kv.Key, kv.Key, kv.Key, string.Format("{0} bytes", new FileInfo(kv.Value).Length))); bool iF = kv.Key.Replace('\\', '/').Contains("/"); } //disasmFile.Child = af; } } }
private void disasmTree_MouseDoubleClick(object sender, System.Windows.Input.MouseButtonEventArgs e) { if ((sender as TreeView).SelectedItem != null) { // scroll to member logic TreeViewItem si = ((sender as TreeView).SelectedItem as TreeViewItem); List<string> tp = new List<string> { "TypeDefinition", "MethodDefinition", "PropertyDefinition", "FieldDefinition", "EventDefinition" }; if (tp.Contains(si.Tag.GetType().Name)) { AshFile af = (disasmFile.Child as AshFile); string g = string.Empty; string[] td = nd.Decompile(si.Tag).Text.Split('\r'); if (si.Tag.GetType().Name == tp[0]) { g = td[2].Trim(); } else { if (!td[0].Contains("[CompilerGenerated]")) { g = td[0].Trim(); if (g.Contains(";")) g = g.Substring(0, g.IndexOf(';')); } else MessageBox.Show("This member is compiler generated."); } LocateInCode(g); } else if (si.Tag.GetType().Name == "EmbeddedResource" && si.Items.Count == 0) { //if (NeedsSave && MessageBoxResult.Yes == MessageBox.Show("Save current changes?", "Save changes", MessageBoxButton.YesNo)) Save(); XapEditor.decompiler.ResourceDecompiler rdec = new decompiler.ResourceDecompiler(si.Tag as Mono.Cecil.EmbeddedResource); string tmp = Path.GetTempFileName(); //AshFile af = new AshFile(this.pwner, tmp, EditorType.Resource); foreach (KeyValuePair<string, string> kv in rdec.Entries) { //af.reEntries.Items.Add(new ComboBoxItem() { Content = kv.Key, Tag = kv.Value }); si.Items.Add(nd.GetTreeItem(XapEntry.GetIconForExtension(Path.GetExtension(kv.Key)), kv.Key, kv.Key, kv.Key, string.Format("{0} bytes", new FileInfo(kv.Value).Length))); bool iF = kv.Key.Replace('\\', '/').Contains("/"); } //disasmFile.Child = af; } } }