Пример #1
0
        public override Widget GetVisualizerWidget(ObjectValue val)
        {
            var options = DebuggingService.DebuggerSession.EvaluationOptions.Clone();

            options.AllowTargetInvoke = true;
            options.ChunkRawStrings   = true;

            hexEditor = new Mono.MHex.HexEditorDebugger();
            RawValueString rawString;
            RawValueArray  rawArray;
            IBuffer        buffer = null;

            switch (val.TypeName)
            {
            case "MonoTouch.Foundation.NSData":
            case "MonoMac.Foundation.NSData":
            case "System.IO.MemoryStream":
            case "Foundation.NSData":
                var stream = (RawValue)val.GetRawValue(options);
                rawArray = (RawValueArray)stream.CallMethod("ToArray");
                buffer   = new RawByteArrayBuffer(rawArray);
                break;

            case "string":
                rawString = (RawValueString)val.GetRawValue(options);
                buffer    = new RawStringBuffer(rawString);
                break;

            default:
                rawArray = (RawValueArray)val.GetRawValue(options);

                switch (val.TypeName)
                {
                case "sbyte[]":
                    buffer = new RawSByteArrayBuffer(rawArray);
                    break;

                case "char[]":
                    buffer = new RawCharArrayBuffer(rawArray);
                    break;

                case "byte[]":
                    buffer = new RawByteArrayBuffer(rawArray);
                    break;
                }
                break;
            }

            hexEditor.HexEditorData.Buffer = buffer;
            hexEditor.Editor.Sensitive     = CanEdit(val);

            var xwtScrollView = new Xwt.ScrollView(hexEditor);
            var scrollWidget  = (Widget)Xwt.Toolkit.CurrentEngine.GetNativeWidget(xwtScrollView);

            SetHexEditorOptions();
            hexEditor.SetFocus();

            return(scrollWidget);
        }
Пример #2
0
        void PopulateTextView(ObjectValue value)
        {
            var session = DebuggingService.DebuggerSession;
            var ops     = session.EvaluationOptions.Clone();

            ops.AllowTargetInvoke = true;

            switch (value.TypeName)
            {
            case "MonoTouch.Foundation.NSData":
            case "MonoMac.Foundation.NSData":
            case "System.IO.MemoryStream":
            case "Foundation.NSData":
                var stream = value.GetRawValue(ops) as RawValue;
                rawArray = stream.CallMethod("ToArray") as RawValueArray;
                break;

            default:
                rawArray = value.GetRawValue(ops) as RawValueArray;
                break;
            }

            length = rawArray.Length;
            offset = 0;

            if (length > 0)
            {
                switch (value.TypeName)
                {
                case "sbyte[]":
                    idle_id = GLib.Idle.Add(GetNextSByteArrayChunk);
                    break;

                case "MonoTouch.Foundation.NSData":
                case "MonoMac.Foundation.NSData":
                case "System.IO.MemoryStream":
                case "Foundation.NSData":
                case "byte[]":
                    idle_id = GLib.Idle.Add(GetNextByteArrayChunk);
                    break;

                default:
                    return;
                }

                textView.Destroyed += delegate {
                    if (idle_id != 0)
                    {
                        GLib.Source.Remove(idle_id);
                        idle_id = 0;
                    }
                };
            }
        }
        public override Widget GetVisualizerWidget(ObjectValue val)
        {
            var options = DebuggingService.DebuggerSession.EvaluationOptions.Clone();

            options.AllowTargetInvoke = true;
            options.ChunkRawStrings   = true;

            IBuffer buffer = null;

            hexEditor = new Mono.MHex.HexEditorDebugger();

            if (val.TypeName != null && val.TypeName.EndsWith("Foundation.NSData"))
            {
                var raw = (RawValueArray)((RawValue)val.GetRawValue()).CallMethod("ToArray");
                buffer = new RawByteArrayBuffer(raw);
            }
            else if (val.TypeName != "string")
            {
                var raw = (RawValueArray)val.GetRawValue(options);

                switch (val.TypeName)
                {
                case "sbyte[]":
                    buffer = new RawSByteArrayBuffer(raw);
                    break;

                case "char[]":
                    buffer = new RawCharArrayBuffer(raw);
                    break;

                case "byte[]":
                    buffer = new RawByteArrayBuffer(raw);
                    break;
                }
            }
            else
            {
                buffer = new RawStringBuffer((RawValueString)val.GetRawValue(options));
            }

            hexEditor.HexEditorData.Buffer = buffer;
            hexEditor.Editor.Sensitive     = CanEdit(val);

            var xwtScrollView = new Xwt.ScrollView(hexEditor);
            var scrollWidget  = (Widget)Xwt.Toolkit.CurrentEngine.GetNativeWidget(xwtScrollView);

            SetHexEditorOptions();
            hexEditor.SetFocus();

            return(scrollWidget);
        }
Пример #4
0
        public override Widget GetVisualizerWidget(ObjectValue val)
        {
            hexEditor = new Mono.MHex.HexEditor();

            byte[] buf = null;

            if (val.TypeName != "string")
            {
                var     raw = val.GetRawValue() as RawValueArray;
                sbyte[] sbuf;

                switch (val.TypeName)
                {
                case "sbyte[]":
                    sbuf = raw.ToArray() as sbyte[];
                    buf  = new byte[sbuf.Length];
                    for (int i = 0; i < sbuf.Length; i++)
                    {
                        buf[i] = (byte)sbuf[i];
                    }
                    break;

                case "char[]":
                    buf = Encoding.Unicode.GetBytes(new string (raw.ToArray() as char[]));
                    break;

                case "byte[]":
                    buf = raw.ToArray() as byte[];
                    break;
                }
            }
            else
            {
                var ops = DebuggingService.DebuggerSession.EvaluationOptions.Clone();
                ops.ChunkRawStrings = true;

                var raw = val.GetRawValue(ops) as RawValueString;

                buf = Encoding.Unicode.GetBytes(raw.Value);
            }

            hexEditor.HexEditorData.Buffer = new ArrayBuffer(buf);
            hexEditor.Sensitive            = CanEdit(val);

            var xwtScrollView = new Xwt.ScrollView(hexEditor);
            var scrollWidget  = (Widget)Xwt.Toolkit.CurrentEngine.GetNativeWidget(xwtScrollView);

            SetHexEditorOptions();
            hexEditor.SetFocus();
            return(scrollWidget);
        }
Пример #5
0
        public override Gtk.Widget GetVisualizerWidget(ObjectValue val)
        {
            var    ops  = DebuggingService.DebuggerSession.EvaluationOptions.Clone();
            string file = Path.GetTempFileName();

            Gdk.Pixbuf pixbuf;

            ops.AllowTargetInvoke = true;

            try {
                var pix = (RawValue)val.GetRawValue(ops);
                pix.CallMethod("Save", file, "png");
                pixbuf = new Gdk.Pixbuf(file);
            } finally {
                File.Delete(file);
            }

            var sc = new Gtk.ScrolledWindow();

            sc.ShadowType       = Gtk.ShadowType.In;
            sc.HscrollbarPolicy = Gtk.PolicyType.Automatic;
            sc.VscrollbarPolicy = Gtk.PolicyType.Automatic;
            var image = new Gtk.Image(pixbuf);

            sc.AddWithViewport(image);
            sc.ShowAll();
            return(sc);
        }
Пример #6
0
        public Gtk.Widget GetVisualizerWidget(ObjectValue val)
        {
            VBox box = new VBox(false, 6);

            textView             = new TextView();
            textView.Buffer.Text = val.GetRawValue() as string;
            textView.WrapMode    = WrapMode.Char;
            Gtk.ScrolledWindow scrolled = new Gtk.ScrolledWindow();
            scrolled.HscrollbarPolicy = PolicyType.Automatic;
            scrolled.VscrollbarPolicy = PolicyType.Automatic;
            scrolled.ShadowType       = ShadowType.In;
            scrolled.Add(textView);
            box.PackStart(scrolled, true, true, 0);
            CheckButton cb = new CheckButton(GettextCatalog.GetString("Wrap text"));

            cb.Active   = true;
            cb.Toggled += delegate {
                if (cb.Active)
                {
                    textView.WrapMode = WrapMode.Char;
                }
                else
                {
                    textView.WrapMode = WrapMode.None;
                }
            };
            box.PackStart(cb, false, false, 0);
            box.ShowAll();
            return(box);
        }
Пример #7
0
        void PopulateTextView(ObjectValue value)
        {
            var ops = DebuggingService.DebuggerSession.EvaluationOptions.Clone();

            ops.AllowTargetInvoke = true;

            rawArray = value.GetRawValue(ops) as RawValueArray;
            length   = rawArray.Length;
            offset   = 0;

            if (length > 0)
            {
                switch (value.TypeName)
                {
                case "sbyte[]":
                    idle_id = GLib.Idle.Add(GetNextSByteArrayChunk);
                    break;

                case "byte[]":
                    idle_id = GLib.Idle.Add(GetNextByteArrayChunk);
                    break;

                default:
                    return;
                }

                textView.Destroyed += delegate {
                    if (idle_id != 0)
                    {
                        GLib.Source.Remove(idle_id);
                        idle_id = 0;
                    }
                };
            }
        }
Пример #8
0
        void PopulateTextView(ObjectValue value)
        {
            rawArray = value.GetRawValue() as RawValueArray;
            length   = rawArray.Length;
            offset   = 0;

            if (length > 0)
            {
                switch (value.TypeName)
                {
                case "sbyte[]":
                    idle_id = GLib.Idle.Add(GetNextSByteArrayChunk);
                    break;

                case "byte[]":
                    idle_id = GLib.Idle.Add(GetNextByteArrayChunk);
                    break;

                default:
                    return;
                }

                textView.Destroyed += delegate {
                    if (idle_id != 0)
                    {
                        GLib.Source.Remove(idle_id);
                        idle_id = 0;
                    }
                };
            }
        }
Пример #9
0
            // Token: 0x060001EB RID: 491 RVA: 0x00006CDC File Offset: 0x00004EDC
            public int SetValueAsString(string pszValue, uint dwRadix, uint dwTimeout)
            {
                if (this.Value == null)
                {
                    return(-2147467259);
                }
                EvaluationOptions evaluationOptions = this.Frame.Session.EvaluationOptions;

                if (evaluationOptions != null)
                {
                    dwTimeout = (uint)evaluationOptions.EvaluationTimeout;
                }
                EvaluationOptions defaultOptions = StackFrame.DefaultOptions;

                defaultOptions.EvaluationTimeout       = (int)dwTimeout;
                defaultOptions.MemberEvaluationTimeout = (int)dwTimeout;
                defaultOptions.AllowMethodEvaluation   = true;
                defaultOptions.AllowTargetInvoke       = true;
                if (dwRadix == 16U)
                {
                    defaultOptions.IntegerDisplayFormat = IntegerDisplayFormat.Hexadecimal;
                }
                else
                {
                    defaultOptions.IntegerDisplayFormat = IntegerDisplayFormat.Decimal;
                }
                ObjectValue expressionValue = this.Frame.Frame.GetExpressionValue(pszValue, defaultOptions);

                if (!expressionValue.WaitHandle.WaitOne((int)dwTimeout))
                {
                    return(-2147221455);
                }
                this.Value.SetRawValue(expressionValue.GetRawValue());
                return(0);
            }
Пример #10
0
        void PopulateTextView(ObjectValue value)
        {
            var ops = DebuggingService.DebuggerSession.EvaluationOptions.Clone();

            ops.AllowTargetInvoke = true;
            ops.ChunkRawStrings   = true;

            if (value.TypeName == "string")
            {
                rawString = value.GetRawValue(ops) as RawValueString;
                length    = rawString.Length;
                offset    = 0;

                if (length > 0)
                {
                    idle_id             = GLib.Idle.Add(GetNextStringChunk);
                    textView.Destroyed += delegate {
                        if (idle_id != 0)
                        {
                            GLib.Source.Remove(idle_id);
                            idle_id = 0;
                        }
                    };
                }
            }
            else if (value.TypeName == "char[]")
            {
                rawArray = value.GetRawValue(ops) as RawValueArray;
                length   = rawArray.Length;
                offset   = 0;

                if (length > 0)
                {
                    idle_id             = GLib.Idle.Add(GetNextCharArrayChunk);
                    textView.Destroyed += delegate {
                        if (idle_id != 0)
                        {
                            GLib.Source.Remove(idle_id);
                            idle_id = 0;
                        }
                    };
                }
            }
        }
Пример #11
0
        void PopulateTextView()
        {
            if (value.TypeName == "string")
            {
                var ops = DebuggingService.DebuggerSession.EvaluationOptions.Clone();
                ops.ChunkRawStrings = true;

                raw    = value.GetRawValue(ops) as RawValueString;
                length = raw.Length;
                offset = 0;

                if (length > 0)
                {
                    idle_id             = GLib.Idle.Add(GetNextStringChunk);
                    textView.Destroyed += delegate {
                        if (idle_id != 0)
                        {
                            GLib.Source.Remove(idle_id);
                            idle_id = 0;
                        }
                    };
                }
            }
            else
            {
                var    array = value.GetRawValue() as RawValueArray;
                var    iter  = textView.Buffer.EndIter;
                string text;

                switch (value.TypeName)
                {
                case "char[]":
                    text = new string (array.ToArray() as char[]);
                    break;

                default:
                    text = string.Empty;
                    break;
                }

                textView.Buffer.Insert(ref iter, text);
            }
        }
        public Gtk.Widget GetVisualizerWidget(ObjectValue val)
        {
            VBox box = new VBox(false, 6);

            textView = new TextView()
            {
                WrapMode = WrapMode.Char
            };
            Gtk.ScrolledWindow scrolled = new Gtk.ScrolledWindow();
            scrolled.HscrollbarPolicy = PolicyType.Automatic;
            scrolled.VscrollbarPolicy = PolicyType.Automatic;
            scrolled.ShadowType       = ShadowType.In;
            scrolled.Add(textView);
            box.PackStart(scrolled, true, true, 0);
            CheckButton cb = new CheckButton(GettextCatalog.GetString("Wrap text"));

            cb.Active   = true;
            cb.Toggled += delegate
            {
                if (cb.Active)
                {
                    textView.WrapMode = WrapMode.Char;
                }
                else
                {
                    textView.WrapMode = WrapMode.None;
                }
            };
            box.PackStart(cb, false, false, 0);
            box.ShowAll();

            EvaluationOptions ops = DebuggingService.DebuggerSession.EvaluationOptions.Clone();

            ops.ChunkRawStrings = true;

            this.raw    = val.GetRawValue(ops) as RawValueString;
            this.length = raw.Length;
            this.offset = 0;
            this.val    = val;

            if (this.length > 0)
            {
                idle_id             = GLib.Idle.Add(GetNextStringChunk);
                textView.Destroyed += delegate
                {
                    if (idle_id != 0)
                    {
                        GLib.Source.Remove(idle_id);
                        idle_id = 0;
                    }
                };
            }

            return(box);
        }
        string GetString(ObjectValue val)
        {
            var ops = DebuggingService.DebuggerSession.EvaluationOptions.Clone();

            ops.AllowTargetInvoke = true;
            ops.ChunkRawStrings   = true;
            if (val.TypeName == "string")
            {
                var rawString = val.GetRawValue(ops) as RawValueString;
                var length    = rawString.Length;
                if (length > 0)
                {
                    return(rawString.Substring(0, Math.Min(length, 4096)));
                }
                else
                {
                    return("");
                }
            }
            else if (val.TypeName == "char[]")
            {
                var rawArray = val.GetRawValue(ops) as RawValueArray;
                var length   = rawArray.Length;
                if (length > 0)
                {
                    return(new string (rawArray.GetValues(0, Math.Min(length, 4096)) as char[]));
                }
                else
                {
                    return("");
                }
            }
            else
            {
                throw new InvalidOperationException();
            }
        }
Пример #14
0
        public Gtk.Widget GetVisualizerWidget(ObjectValue val)
        {
            Gdk.Pixbuf pixbuf;
            string     file = Path.GetTempFileName();

            try {
                RawValue pix = (RawValue)val.GetRawValue();
                pix.CallMethod("Save", file, "png");
                pixbuf = new Gdk.Pixbuf(file);
            } finally {
                File.Delete(file);
            }
            Gtk.ScrolledWindow sc = new Gtk.ScrolledWindow();
            sc.ShadowType       = Gtk.ShadowType.In;
            sc.HscrollbarPolicy = Gtk.PolicyType.Automatic;
            sc.VscrollbarPolicy = Gtk.PolicyType.Automatic;
            Gtk.Image image = new Gtk.Image(pixbuf);
            sc.AddWithViewport(image);
            sc.ShowAll();
            return(sc);
        }
Пример #15
0
        void PopulateTextView(ObjectValue value)
        {
            var    array = value.GetRawValue() as RawValueArray;
            var    iter  = textView.Buffer.EndIter;
            string text;

            switch (value.TypeName)
            {
            case "sbyte[]":
                text = SByteArrayToCString(array.ToArray() as sbyte[]);
                break;

            case "byte[]":
                text = ByteArrayToCString(array.ToArray() as byte[]);
                break;

            default:
                text = string.Empty;
                break;
            }

            textView.Buffer.Insert(ref iter, text);
        }