Example #1
0
        //constructor
        public PlainText()
        {
            ScrollBox = new Xwt.ScrollView(RTV);
            Layout.Add(ScrollBox, 0, 1, 1, 3, true, true);

            Layout.Add(lblFileName, 0, 0);
            Layout.Add(mbMode, 1, 0);
            Layout.Add(mbCodepage, 2, 0);

            foreach (EncodingInfo cp in Encoding.GetEncodings())
            {
                Xwt.MenuItem mi = new Xwt.MenuItem();
                mi.Tag = cp.CodePage;
                mi.Label = "CP" + cp.CodePage + " - " + cp.DisplayName;
                mi.Clicked += new EventHandler(Codepage_Clicked);
                mnuFormat.Items.Add(mi);
            }
            mbCodepage.Menu = mnuFormat;
        }
		public override Widget GetVisualizerWidget (ObjectValue val)
		{
			hexEditor = new Mono.MHex.HexEditor ();

			IBuffer buffer = null;

			if (val.TypeName != "string") {
				var raw = (RawValueArray) val.GetRawValue ();

				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 {
				var ops = DebuggingService.DebuggerSession.EvaluationOptions.Clone ();
				ops.ChunkRawStrings = true;

				buffer = new RawStringBuffer ((RawValueString) val.GetRawValue (ops));
			}

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

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

			return scrollWidget;
		}
Example #3
0
        void ShowDebugInfo(object sender, EventArgs e)
        {
            System.Configuration.Configuration confLR = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.PerUserRoamingAndLocal);
            System.Configuration.Configuration confR = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.PerUserRoaming);
            System.Configuration.Configuration confEXE = System.Configuration.ConfigurationManager.OpenExeConfiguration(System.Configuration.ConfigurationUserLevel.None);

            Xwt.Dialog Fcdbg = new Xwt.Dialog();
            Fcdbg.Buttons.Add(Xwt.Command.Close);
            Fcdbg.Buttons[0].Clicked += (o, ea) => {Fcdbg.Hide();};
            Fcdbg.Title="FC debug output";
            string txt = ""+
                "===THE FILE COMMANDER, VERSION " + Winforms.Application.ProductVersion + (Environment.Is64BitProcess ? " 64-BIT" : " 32-BIT") + "===\n"+
                Environment.CommandLine + " @ .NET fw " + Environment.Version + (Environment.Is64BitOperatingSystem ? " 64-bit" : " 32-bit") + " on " + Environment.MachineName + "-" + Environment.OSVersion + " (" + Environment.OSVersion.Platform + " v" + Environment.OSVersion.Version.Major + "." + Environment.OSVersion.Version.Minor + ")\n" +
                "The current drawing toolkit is " + Xwt.Toolkit.CurrentEngine.GetSafeBackend (this) + "\n" +
                "\nCONFIGuration files:\n---------\n"+
                "Local: "+confLR.FilePath + " (exists? " + b2s(confLR.HasFile) +")\n"+
                "Roaming: " + confR.FilePath + " (exists? " + b2s(confR.HasFile) + ")\n" +
                "Overall: " + confEXE.FilePath + " (exists? " + b2s(confEXE.HasFile) + ")\n" +
                "\nPanel debug:\n---------\n"+
                "The active panel is: " + ((ActivePanel == p1) ? "LEFT\n" : "RIGHT\n") +
                "The passive panel is: " + ((ActivePanel == p2) ? "LEFT\n" : "RIGHT\n")+
                "They are different? "+ b2s(ActivePanel != PassivePanel) + " (should be yes)\n"+
                "The LEFT filesystem: " + p1.FS.ToString() + " at \"" + p1.FS.CurrentDirectory + "\"\n"+
                "The RIGHT filesystem: " + p2.FS.ToString() + " at \"" + p2.FS.CurrentDirectory + "\"\n"+
                "Filesystems are same by type? " + b2s(p1.FS.GetType()==p2.FS.GetType()) + ".\n"+
                "Filesystems are identically? " + b2s(p1.FS==p2.FS) + " (should be no).\n"+
                "\nTheme debug:\n---------\n"+
                "Using external theme? " + b2s(!(fcmd.Properties.Settings.Default.UserTheme == null || fcmd.Properties.Settings.Default.UserTheme == ""))+"\n"+
                "Theme's cascade style sheet file: \"" + fcmd.Properties.Settings.Default.UserTheme + "\"\n\nIf you having some troubles, please report this to https://github.com/atauenis/fcmd bug tracker or http://atauenis.ru/phpBB3/viewtopic.php?f=4&t=211 topic. \nThe End.";
            Xwt.RichTextView rtv = new Xwt.RichTextView();
            rtv.LoadText(txt, new Xwt.Formats.PlainTextFormat());
            Xwt.ScrollView sv = new Xwt.ScrollView(rtv);
            Fcdbg.Content = sv;
            Fcdbg.Width = 500;
            Fcdbg.Run();
        }
		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)
		{
			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;
		}