Esempio n. 1
0
        private void ItemListDoubleClicked(object sender, MouseButtonEventArgs e)
        {
            if (CollectionValues.SelectedIndex < 0)
            {
                return;
            }
            DisplayableString item = (DisplayableString)CollectionValues.SelectedItem;

            if (_instanceValue.Fields != null && _instanceValue.Fields.Length == 1 && _instanceValue.Fields[0].Kind == ClrElementKind.String)
            {
                if (!item.IsLong())
                {
                    return;
                }
                var fld  = _instanceValue.Fields[0];
                var inst = new InstanceValue(fld.TypeId, fld.Address, fld.TypeName, string.Empty, item.FullContent);
                Dispatcher.CurrentDispatcher.InvokeAsync(() => ValueWindows.ShowContentWindow(fld.GetDescription(), inst, ValueWindows.WndType.Content));
                return;
            }
            ulong addr = GetAddressFromEntry(item.FullContent);

            if (addr != Constants.InvalidAddress)
            {
                Dispatcher.CurrentDispatcher.InvokeAsync(() => ((MainWindow)Owner).ExecuteInstanceValueQuery("Getting object value at: " + Utils.RealAddressString(addr), addr));
            }
        }
Esempio n. 2
0
        private void GetInstValueClicked(bool forKey)
        {
            string value = GetSelectionString(forKey); // true for key

            if (value == null)
            {
                return;
            }
            ulong addr = GetAddressFromEntry(value);

            if (addr != Constants.InvalidAddress)
            {
                System.Windows.Threading.Dispatcher.CurrentDispatcher.InvokeAsync(() => ((MainWindow)Owner).ExecuteInstanceValueQuery("Getting object value at: " + Utils.RealAddressString(addr), addr));
            }
            if (DisplayableString.IsLargeString(value))
            {
                var inst = new InstanceValue(Constants.InvalidIndex, ClrElementKind.Unknown, Constants.InvalidAddress, "FROM: " + _instValue.TypeName, null, value);
                ValueWindows.ShowContentWindow("A collection item " + (forKey ? "key." : "value."), inst, ValueWindows.WndType.Content);
                return;
            }
            ((MainWindow)Owner).MainStatusShowMessage("The value requested cannot be elaborated more. The values is what you see.");
        }
Esempio n. 3
0
        private async void GetInstanceValue(TreeViewItem selTreeItem, InstanceValue selInstValue, bool rawValue = false)
        {
            if (TypeExtractor.IsString(selInstValue.Kind))
            {
                if (selInstValue.Value.IsLong())
                {
                    ValueWindows.ShowContentWindow(selInstValue.GetDescription(), selInstValue, ValueWindows.WndType.Content);
                }
                return;
            }

            if (selInstValue.HaveFields())
            {
                return;                            // already has values
            }
            ulong addr = _mainWindow.GetAddressFromEntry(selInstValue.Value.FullContent);

            if (selInstValue.Address != Constants.InvalidAddress && addr != Constants.InvalidAddress && addr == selInstValue.Address)
            {
                if (!rawValue) // if known collection show it in a collection window
                {
                    if (TypeExtractor.IsKnownType(selInstValue.TypeName))
                    {
                        var msg = "Getting object value at: " + Utils.RealAddressString(selInstValue.Address);
                        _mainWindow.ExecuteInstanceValueQuery(msg, selInstValue.Address);
                        return;
                    }
                }
                var index = MainWindow.CurrentIndex;

                StatusText.Text      = "Getting value at address: " + selInstValue.Address + ", please wait...";
                Mouse.OverrideCursor = Cursors.Wait;

                (string error, InstanceValue[] fields) = await Task.Factory.StartNew(() =>
                {
                    return(index.GetInstanceValueFields(selInstValue.Address, selInstValue.Parent));
                }, _mainWindow.DumpSTAScheduler);

                if (Utils.IsInformation(error))
                {
                    StatusText.Text = error;
                }
                else
                {
                    StatusText.Text = "Getting fields at address: " + selInstValue.Address + (fields != null ? ", done." : ", failed.");
                }
                Mouse.OverrideCursor = null;

                if (error != null && !Utils.IsInformation(error))
                {
                    GuiUtils.ShowError(error, this);
                    return;
                }

                if (fields.Length < 1)
                {
                    return;
                }

                if (fields.Length == 1 && fields[0].IsArray())
                {
                    ValueWindows.ShowContentWindow(fields[0].GetDescription(), fields[0], ValueWindows.WndType.List);
                    return;
                }

                if (fields.Length > 0)
                {
                    selInstValue.SetFields(fields);
                    for (int i = 0, icount = fields.Length; i < icount; ++i)
                    {
                        var fld    = fields[i];
                        var tvNode = new TreeViewItem
                        {
                            Header = GuiUtils.GetInstanceValueStackPanel(fld),
                            Tag    = fld
                        };
                        selTreeItem.Items.Add(tvNode);
                    }
                }
                selTreeItem.ExpandSubtree();
            }
            else
            {
                StatusText.Text = "Value for " + selInstValue.TypeName + " cannot be expanded.";
                return;
            }
        }