private void SelectChange(object sender, RoutedPropertyChangedEventArgs <object> e) { checked { if (this.selectedItem.Tag is BinFileValue) { try { string arg_3C_1 = this.textBoxValue.Text; TreeViewItem treeViewItem; BinFileValue tag = (BinFileValue)(treeViewItem = this.selectedItem).Tag; this.method_3(arg_3C_1, ref tag); treeViewItem.Tag = tag; } catch (Exception expr_4C) { MessageBox.Show(expr_4C.Message); return; } TreeViewItem treeViewItem2 = this.selectedItem; StackPanel stackPanel = (StackPanel)treeViewItem2.Header; TextBlock textBlock = (TextBlock)stackPanel.Children[stackPanel.Children.Count - 1]; textBlock.Text = this.method_2(RuntimeHelpers.GetObjectValue(NewLateBinding.LateGet(this.selectedItem.Tag, null, "Value", new object[0], null, null, null))); } else { if (this.selectedItem.Tag is BinFileEntry) { BinFileEntry binFileEntry = (BinFileEntry)this.selectedItem.Tag; binFileEntry.Prop = binFileEntry.PropertiesTable.GetProp(Convert.ToUInt32(this.textBoxValue.Text)); TreeViewItem treeViewItem3 = this.selectedItem; StackPanel stackPanel2 = (StackPanel)treeViewItem3.Header; string str = Convert.ToString(binFileEntry.Prop.Hash); if (binFileEntry.Prop.Prop != null) { str = binFileEntry.Prop.Prop; } TextBlock textBlock2 = (TextBlock)stackPanel2.Children[stackPanel2.Children.Count - 1]; textBlock2.Text = "Entry " + str; } } this.buttonApply.IsEnabled = false; } }
private void BinWin_Loaded(object sender, RoutedEventArgs e) { checked { this.binFile = new BinFile(@"F:\Project\Code\LuMei\代码\LuMei.TestForm\Katarina.bin"); if (this.binFile != null) { BinWin BinWin = this; if (this.binFile == null) { base.Close(); } else { this.textBlockType.Visibility = Visibility.Hidden; TreeViewItem treeViewItem = new TreeViewItem { IsExpanded = true, Tag = this.binFile }; treeViewItem.Header = new TextBlock { Text = this.binFile.FilePath.Split(new char[] { '\\' }).Last <string>(), FontSize = 17.0, FontWeight = FontWeights.Bold }; this.treeViewProps.Items.Add(treeViewItem); int num = this.binFile.Entries.Count - 1; for (int i = 0; i <= num; i++) { BinFileEntry binFileEntry = this.binFile.Entries[i]; TreeViewItem treeViewItem2 = new TreeViewItem { IsExpanded = true, Tag = binFileEntry }; StackPanel stackPanel = new StackPanel { Orientation = Orientation.Horizontal }; if (binFileEntry.Prop != null) { string str = Convert.ToString(binFileEntry.Prop.Hash); if (binFileEntry.Prop.Prop != null) { str = binFileEntry.Prop.Prop; } stackPanel.Children.Add(new TextBlock { Text = "Entry " + str, FontSize = 16.0, FontWeight = FontWeights.Medium, Foreground = new SolidColorBrush(Colors.Gray) }); } treeViewItem2.Header = stackPanel; this.method_6(ref binFileEntry.Values, ref treeViewItem2); treeViewItem.Items.Add(treeViewItem2); } } } } }