예제 #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);
        }
        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);
        }
예제 #3
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;
		}