public void AddSelected(ClrtDisplayableType dispItem) { if (!_selected.Contains(dispItem)) { _selected.Add(dispItem); } }
public void RemoveSelected(ClrtDisplayableType dispItem) { if (_selected.Contains(dispItem)) { _selected.Remove(dispItem); } }
private void UpdateTypeValueSetupGrid(ClrtDisplayableType dispType, TreeViewItem root) { bool realRoot = false; if (root == null) { realRoot = true; root = GuiUtils.GetTypeValueSetupTreeViewItem(dispType); } else { root.Tag = dispType; } if (dispType.HasFields) { DisplayNodes(root, dispType.Fields); } else if (dispType.HasAlternatives) { DisplayNodes(root, dispType.Alternatives); } if (realRoot) { TypeValueReportTreeView.Items.Clear(); TypeValueReportTreeView.Items.Add(root); } root.ExpandSubtree(); }
private void OpenClicked(object sender, RoutedEventArgs e) { string error = null; string path = GuiUtils.SelectFile(string.Format("*.{0}", "tvr"), string.Format("Type values setups (*.tvr)|*.tvr|All files (*.*)|*.*"), _indexProxy.FileMoniker.OutputFolder); if (path == null) { return; } try { ClrtDisplayableType[] queryItems = ClrtDisplayableType.DeserializeArray(path, out error); _typeInfo = ClrtDisplayableType.ClrtDisplayableTypeAryFixup(queryItems); TypeValueReportTreeView.Items.Clear(); TypeValueReportTopTextBox.Text = _typeInfo.GetDescription(); UpdateTypeValueSetupGrid(_typeInfo, null); UpdateSelections(_typeInfo); } catch (Exception ex) { error = Utils.GetExceptionErrorString(ex); GuiUtils.ShowError(error, this); } }
private void RunClicked(object sender, RoutedEventArgs e) { _query = GetQuery(); if (TypeValueSaveReportCheckBox.IsChecked.Value) { string error; ClrtDisplayableType[] tosave = GetOrderedSelectionForSaving(out error); if (error != null) { GuiUtils.ShowError(error, this); return; } var tpName = Utils.BaseTypeName(tosave[0].TypeName); tpName = DumpFileMoniker.GetValidFileName(tpName); string spath = _indexProxy.FileMoniker.OutputFolder + Path.DirectorySeparatorChar + "TypeValuesSetup." + tpName + ".tvr"; int pathNdx = 1; while (File.Exists(spath)) { var newTpName = tpName + "(" + pathNdx.ToString() + ")"; ++pathNdx; spath = _indexProxy.FileMoniker.OutputFolder + Path.DirectorySeparatorChar + "TypeValuesSetup." + newTpName + ".tvr"; } bool r = ClrtDisplayableType.SerializeArray(spath, tosave, out error); if (error != null) { GuiUtils.ShowError(error, this); return; } } DialogResult = _selection.Count > 0; }
public static void UpdateTypeValueSetupTreeViewItem(TreeViewItem node, ClrtDisplayableType dispType) { var txtBlk = GetClrtDisplayableTypeStackPanel(dispType); node.Header = txtBlk; node.Tag = dispType; txtBlk.Tag = node; }
public TypeValuesReportSetup(IndexProxy proxy, ClrtDisplayableType typeInfo) { Debug.Assert(typeInfo.HasAddresses); _indexProxy = proxy; _typeInfo = typeInfo; _selection = new HashSet <ClrtDisplayableType>(new ClrtDisplayableIdComparer()); InitializeComponent(); TypeValueReportTopTextBox.Text = typeInfo.GetDescription(); UpdateTypeValueSetupGrid(typeInfo, null); TypeValueReportSelectedList.Items.Add("SELECTED VALUES " + Constants.DownwardsBlackArrow); TypeValueReportFilterList.Items.Add("FILTERS " + Constants.DownwardsBlackArrow); }
private void GetQueryHelper(ClrtDisplayableType disp, TypeValueQuery qry, Dictionary <long, List <ClrtDisplayableType> > dct) { var items = dct[disp.Id]; // has to be there for (int i = 0, icnt = items.Count; i < icnt; ++i) { var item = items[i]; TypeValueQuery q = new TypeValueQuery(item.Id, qry, item.TypeName, item.TypeId, item.FieldName, item.FieldIndex, item.IsAlternative, item.Filter, item.GetValue); qry.AddChild(q); GetQueryHelper(item, q, dct); } }
public static TreeViewItem GetTypeValueSetupTreeViewItem(ClrtDisplayableType dispType) { var txtBlk = GetClrtDisplayableTypeStackPanel(dispType); var node = new TreeViewItem { Header = txtBlk, Tag = dispType, }; txtBlk.Tag = node; return(node); }
public TypeValueFilterDlg(ClrtDisplayableType dispType) { InitializeComponent(); LbTypeName.Content = dispType.TypeName; _dispType = dispType; if (_dispType.HasFilter) { TbTypeValue.Text = _dispType.Filter.FilterString; } Init(); InitFilterDescription(); }
private void UpdateSelection(ClrtDisplayableType dispType) { Debug.Assert(dispType != null); if (dispType.GetValue || dispType.HasFilter) { if (dispType.GetValue) { } _selection.Add(dispType); } else { _selection.Remove(dispType); } UpdateSelectionListBox(dispType, TypeValueReportSelectedList, dispType.GetValue); UpdateSelectionListBox(dispType, TypeValueReportFilterList, dispType.HasFilter); }
private void UpdateSelectionListBox(ClrtDisplayableType dispType, ListBox lb, bool include) { bool contains = lb.Items.Contains(dispType); if (include) { if (contains) { return; } lb.Items.Add(dispType); } else { if (contains) { lb.Items.Remove(dispType); } } }
private void InsertClrtDisplayableType(LinkedList <ClrtDisplayableType> lst, ClrtDisplayableType cdt) { long myParentId = cdt.Parent.Id; var node = lst.Last; while (true) { var val = node.Value; if (val.Id == myParentId) { lst.AddAfter(node, cdt); break; } if (node.Previous == null) { throw new ArgumentException("[" + this.GetType().Name + "][InsertClrtDisplayableType] ClrtDisplayableType list is corrupted."); } node = node.Previous; } }
public static TextBlock GetClrtDisplayableTypeTextBlock(ClrtDisplayableType val) { var txtBlk = new TextBlock(); txtBlk.Inlines.Add(" "); if (val.IsDummy) { txtBlk.Inlines.Add(new Italic(new Run(val.FieldName + " ") { Foreground = Brushes.DarkBlue })); txtBlk.Inlines.Add(new Run(" " + val.TypeName)); return(txtBlk); } var selection = val.SelectionStr(); if (!string.IsNullOrEmpty(selection)) { txtBlk.Inlines.Add(new Bold(new Run(selection + " ")) { Foreground = Brushes.DarkGreen }); } if (!string.IsNullOrEmpty(val.FieldName)) { txtBlk.Inlines.Add(new Italic(new Run(val.FieldName + " ") { Foreground = Brushes.DarkRed })); } txtBlk.Inlines.Add(new Run(" " + val.TypeName)); if (val.HasAddresses) { txtBlk.Inlines.Add(new Italic(new Run(" [" + Utils.CountString(val.Addresses.Length) + "]")) { Foreground = Brushes.DarkGreen }); } return(txtBlk); }
/// <summary> /// Update selections/filters for type display loaded form a file. /// </summary> /// <param name="dispType">Information loaded from a file.</param> private void UpdateSelections(ClrtDisplayableType dispType) { if (dispType.GetValue || dispType.HasFilter) { UpdateSelection(dispType); } if (dispType.HasFields) { for (int i = 0, icnt = dispType.Fields.Length; i < icnt; ++i) { UpdateSelections(dispType.Fields[i]); } } if (dispType.HasAlternatives) { for (int i = 0, icnt = dispType.Alternatives.Length; i < icnt; ++i) { UpdateSelections(dispType.Alternatives[i]); } } }
/// <summary> /// Get type display panel. /// </summary> /// <param name="dispType">Type information.</param> /// <returns>Adorned panel.</returns> public static StackPanel GetClrtDisplayableTypeStackPanel(ClrtDisplayableType dispType) { var stackPanel = new StackPanel() { Orientation = Orientation.Horizontal }; Image image = new Image(); if (dispType.IsDummy) { image.Source = ((Image)Application.Current.FindResource("GroupPng")).Source; stackPanel.Children.Add(image); stackPanel.Children.Add(GetClrtDisplayableTypeTextBlock(dispType)); return(stackPanel); } var kind = dispType.Kind; var specKind = TypeExtractor.GetSpecialKind(kind); if (specKind != ClrElementKind.Unknown) { switch (specKind) { case ClrElementKind.Free: case ClrElementKind.Guid: case ClrElementKind.DateTime: case ClrElementKind.TimeSpan: case ClrElementKind.Decimal: image.Source = ((Image)Application.Current.FindResource("PrimitivePng")).Source; break; case ClrElementKind.Interface: image.Source = ((Image)Application.Current.FindResource("InterfacePng")).Source; break; case ClrElementKind.Enum: image.Source = ((Image)Application.Current.FindResource("EnumPng")).Source; break; case ClrElementKind.SystemObject: case ClrElementKind.System__Canon: case ClrElementKind.Exception: case ClrElementKind.Abstract: image.Source = ((Image)Application.Current.FindResource("ClassPng")).Source; break; case ClrElementKind.SystemNullable: image.Source = ((Image)Application.Current.FindResource("StructPng")).Source; break; } } else { switch (TypeExtractor.GetStandardKind(kind)) { case ClrElementKind.String: image.Source = ((Image)Application.Current.FindResource("PrimitivePng")).Source; break; case ClrElementKind.SZArray: case ClrElementKind.Array: image.Source = ((Image)Application.Current.FindResource("ArrayPng")).Source; break; case ClrElementKind.Object: case ClrElementKind.Class: image.Source = ((Image)Application.Current.FindResource("ClassPng")).Source; break; case ClrElementKind.Struct: image.Source = ((Image)Application.Current.FindResource("StructPng")).Source; break; case ClrElementKind.Unknown: image.Source = ((Image)Application.Current.FindResource("QuestionPng")).Source; break; default: image.Source = ((Image)Application.Current.FindResource("PrimitivePng")).Source; break; } } stackPanel.Children.Add(image); stackPanel.Children.Add(GetClrtDisplayableTypeTextBlock(dispType)); return(stackPanel); }
public void AddFilter(ClrtDisplayableType dispItem, string filter) { }