protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider provider)
        {
            using (Form form1 = new Form())
            {
                form1.Text = "FormCollection Visualizer";
                form1.StartPosition = FormStartPosition.WindowsDefaultLocation;
                form1.SizeGripStyle = SizeGripStyle.Auto;
                form1.ShowInTaskbar = false;
                form1.ShowIcon = false;

                DataTable dt;

                using (Stream stream = provider.GetData())
                {
                    BinaryFormatter bformatter = new BinaryFormatter();

                    dt = (DataTable)bformatter.Deserialize(stream);

                    stream.Close();
                }

                DataGridView gridView = new DataGridView();
                gridView.Dock = DockStyle.Fill;

                form1.Controls.Add(gridView);

                gridView.DataSource = dt;

                windowService.ShowDialog(form1);
            }
        }
示例#2
0
        private object TryGetVisualizingObject(IVisualizerObjectProvider objectProvider)
        {
            object obj = null;

            try
            {
                obj = objectProvider.GetObject();
            }
            catch (Exception ex1) //ex1 just for debugging purpose
            {
                try
                {
                    var memoryStream = objectProvider.GetData();

                    BinaryFormatter bf = new BinaryFormatter();
                    bf.Binder         = new CustomSerializationBinder();
                    bf.AssemblyFormat = System.Runtime.Serialization.Formatters.FormatterAssemblyStyle.Simple;
                    bf.FilterLevel    = System.Runtime.Serialization.Formatters.TypeFilterLevel.Low;
                    obj = bf.UnsafeDeserialize(memoryStream, _ => null);
                }
                catch (Exception ex2)
                {
                    MessageBox.Show($"Cannot show Allegro .NET Core Visualizer\n\n{ex2.Message}", "Allegro .NET Core Visualizer");
                }
            }
            return(obj);
        }
示例#3
0
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            // TODO: Get the object to display a visualizer for.
            //       Cast the result of objectProvider.GetObject()
            //       to the type of the object being visualized.
            //object data = (object)objectProvider.GetObject();
            var     s2         = new StreamReader(objectProvider.GetData()).ReadToEnd();
            JObject jsonObject = JObject.Parse(s2);
            // eval into an expando
            dynamic dynObject = ConvertJTokenToObject(jsonObject);

            // WeakReference wr = (WeakReference)data;


            // TODO: Display your view of the object.
            //       Replace displayForm with your own custom Form or Control.
            using (Form1 displayForm = new Form1())
            {
                //displayForm.Text = data.ToString();
                var lxw = LINQPad.Util.CreateXhtmlWriter(true);
                lxw.Write(dynObject.TrackedObject);
                displayForm.setHTML(lxw.ToString());
                windowService.ShowDialog(displayForm);
            }
        }
        override protected void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            try
            {
                string _str    = null;
                Stream _stream = objectProvider.GetData();

                if (_stream != null && _stream.Length > 0)
                {
                    object _obj = null;
                    _obj = JsonHelper.Deserialize(_stream);     // Here i get the object i want
                    // ^^^
                    // Now add ur code to visualize the object in your way.

                    /* This is only to verify the object data before visualizing.
                     * if (_obj != null)
                     * {
                     *  _str = JsonHelper.ObjectToString(_obj);
                     *  MessageBox.Show(_str, "Show");
                     * }
                     */
                }

                // Show the grid with the list
                windowService.ShowDialog();
            }
            catch (Exception exp) { MessageBox.Show(exp.Message, "Visualizer Error"); }
            finally
            {
            }
        }
        override protected void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            try
            {
                var obj       = objectProvider.GetData();
                var modelNode = new M2ModelDialogDebuggerVisualizerService().DeserializeDataFromStream <ModelNode>(obj);

                var form = new Form
                {
                    ClientSize      = new Size(800, 600),
                    FormBorderStyle = FormBorderStyle.FixedToolWindow,
                };

                var treeView = new TreeView();
                treeView.Parent = form;
                treeView.Dock   = DockStyle.Fill;

                InitNodes(treeView.Nodes, modelNode);
                treeView.ExpandAll();

                windowService.ShowDialog(form);
            }
            catch (Exception e)
            {
                // TODO
                throw;
            }
        }
示例#6
0
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            string text = new StreamReader(objectProvider.GetData()).ReadLine();

            if (!String.IsNullOrWhiteSpace(text))
            {
                // Get an instance of the currently running Visual Studio IDE.
                EnvDTE80.DTE2 dte;
#if WEBMAPVS2013
                dte = (EnvDTE80.DTE2)System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE.12.0");
#else
                dte = (EnvDTE80.DTE2)System.Runtime.InteropServices.Marshal.GetActiveObject("VisualStudio.DTE.14.0");
#endif

                var info = text.Split(',');
                if (info.Length == 3)
                {
                    var fileIndex = info[0].IndexOf("file") + 5;
                    var lineIndex = info[1].IndexOf("line") + 5;
                    var filename  = info[0].Substring(fileIndex);
                    var line      = info[1].Substring(lineIndex);
                    dte.ExecuteCommand("File.OpenFile", filename);
                    dte.ExecuteCommand("Edit.GoTo", line);
                }
            }
        }
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            var bmp   = Image.FromStream(objectProvider.GetData());
            var image = (bmp as Bitmap).ToBgr();

            image.ShowDialog();
        }
        protected override void Show(IDialogVisualizerService p_windowService, IVisualizerObjectProvider p_objectProvider)
        {
            try
            {
                // Get data from VisualizerBase as Stream
                using (Stream objStreamData = p_objectProvider.GetData())
                {
                    BinaryFormatter bf = new BinaryFormatter();

                    // Create instance from that stream
                    BaseTable objBaseVisualizer = (BaseTable)bf.Deserialize(objStreamData);

                    // We get the first table in list (since we only use this one in DataTable visualizer)
                    VisualizerBaseTable objTable = objBaseVisualizer.MyTableToVisualize[0];

                    // We create new Form
                    VisualizerForm frmVisualizerForm = new VisualizerForm(objTable);

                    // And walla
                    frmVisualizerForm.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                UiHelper.MyMessageBox("Error while opening " + UiHelper.APP_NAME + " - DataTable Visualizer", ex);
            }
        }
示例#9
0
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            try
            {
                using (var reader = new StreamReader(objectProvider.GetData()))
                {
                    var result = reader.ReadToEnd();



                    var person = JsonConvert.DeserializeObject <Person>(result, new JsonSerializerSettings
                    {
                        ConstructorHandling = ConstructorHandling.AllowNonPublicDefaultConstructor,
                        ContractResolver    = new PrivatePropertyResolver()
                    });

                    if (person == null)
                    {
                        MessageBox.Show("Cannot visualize this object, please use a different visualizer.", "Type Not Supported", MessageBoxButtons.OK, MessageBoxIcon.Information);

                        return;
                    }

                    var window = new MainWindow(person);

                    window.ShowDialog();
                }
            }
            catch (Exception ex)
            {
                Trace.Fail(ex.Message, ex.StackTrace);
            }
        }
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            try
            {
                var obj = objectProvider.GetData();
                var modelNode = new M2ModelDialogDebuggerVisualizerService().DeserializeDataFromStream<ModelNode>(obj);

                var form = new Form
                {
                    ClientSize = new Size(800, 600),
                    FormBorderStyle = FormBorderStyle.FixedToolWindow,
                };

                var treeView = new TreeView();
                treeView.Parent = form;
                treeView.Dock = DockStyle.Fill;

                InitNodes(treeView.Nodes, modelNode);
                treeView.ExpandAll();

                windowService.ShowDialog(form);
            }
            catch (Exception e)
            {
                // TODO
                throw;
            }
        }
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            Stream pixbuf_stream = objectProvider.GetData();
            BinaryReader reader = new BinaryReader (pixbuf_stream);

            bool has_alpha;
            int bits_per_sample, width, height, rowstride;
            Gdk.Pixbuf pixbuf;

            has_alpha = reader.ReadBoolean ();
            bits_per_sample = reader.ReadInt32 ();
            width = reader.ReadInt32 ();
            height = reader.ReadInt32 ();
            rowstride = reader.ReadInt32 ();

            int size = height * rowstride;

            byte[] pixbuf_data = new byte [size];

            reader.Read (pixbuf_data, 0, size);

            pixbuf = new Pixbuf (Gdk.Colorspace.Rgb, has_alpha, bits_per_sample, width, height);

            Marshal.Copy (pixbuf_data, 0, pixbuf.Pixels, size);

            PixbufWindow win = new PixbufWindow ("Pixbuf Visualizer", pixbuf);

            win.Show ();
        }
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            var data = (DataTable)VisualizerObjectSource.Deserialize(objectProvider.GetData());

            windowService.ShowDialog(new ListForm {
                Data = data
            });
        }
 private void GetObjectData()
 {
     using (Stream output = m_objectProvider.GetData())
     {
         BinaryFormatter formatter = new BinaryFormatter();
         m_mbi = (MethodBodyInfo)formatter.Deserialize(output, null);
     }
 }
示例#14
0
        /// <summary>
        /// The format of the query information and the desired UI will usually depend on the Linq to SQLq provider
        /// used by the query.
        /// Therefore in this general query visualizer we only read the assembly and class for the specific
        /// query visualizer from the Stream and call the method "Display" on this class, which in turn will
        /// read the query information and show the UI.
        /// </summary>
        /// <param name="windowService"> used to display the UI </param>
        /// <param name="objectProvider"> used to retrieve the data (as Stream) from the visualizer proxy</param>
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            Stream rawStream = objectProvider.GetData();

            //call visualizer to serialize query info
            Visualizer qv = new Visualizer();

            qv.Display(windowService, rawStream);
        }
示例#15
0
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            if (windowService == null)
            {
                throw new ArgumentNullException("windowService");
            }
            if (objectProvider == null)
            {
                throw new ArgumentNullException("objectProvider");
            }

            var reader = new BinaryReader(objectProvider.GetData());
            var width  = reader.ReadInt32(); // unchecked uint to int conversion
            var height = reader.ReadInt32(); // unchecked uint to int conversion
            var src    = reader.ReadBytes(reader.ReadInt32());

            using (var form = new Form())
                using (var pb = new PictureBox())
                {
                    var bmp    = new Bitmap(width, height);
                    var data   = bmp.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
                    var length = height * data.Stride;
                    var pixels = new byte[length];
                    for (int i = 0; i < length; i += 4)
                    {
                        pixels[i + 0] = src[i + 2];
                        pixels[i + 1] = src[i + 1];
                        pixels[i + 2] = src[i + 0];
                        pixels[i + 3] = src[i + 3];
                    }
                    System.Runtime.InteropServices.Marshal.Copy(pixels, 0, data.Scan0, length);
                    bmp.UnlockBits(data);

                    var transGrid = new Bitmap(16, 16); // Checkerboard pattern for transparent images.
                    using (var g = System.Drawing.Graphics.FromImage(transGrid))
                    {
                        g.Clear(Color.FromArgb(102, 102, 102));
                        var brush = new SolidBrush(Color.FromArgb(153, 153, 153));
                        g.FillRectangle(brush, 0, 0, 8, 8);
                        g.FillRectangle(brush, 8, 8, 8, 8);
                    }

                    form.Controls.Add(pb);
                    form.ClientSize            = bmp.Size;
                    form.Width                 = Math.Max(form.Width, 200);
                    form.Text                  = string.Format("Texture Visualizer ({0:#,##0} x {1:#,##0})", width, height);
                    form.BackgroundImage       = transGrid;
                    form.BackgroundImageLayout = ImageLayout.Tile;
                    pb.Anchor                  = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right | AnchorStyles.Left;
                    pb.Bounds                  = form.ClientRectangle;
                    pb.SizeMode                = PictureBoxSizeMode.Zoom;
                    pb.Image     = bmp;
                    pb.BackColor = Color.Transparent;

                    windowService.ShowDialog(form);
                }
        }
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            var msg = new StreamReader(objectProvider.GetData()).ReadToEnd();

            var form = new AsposeVisualizerForm();
            form.SetText(msg);

            windowService.ShowDialog(form);
        }
示例#17
0
 private XElement ReadData(IVisualizerObjectProvider objectProvider)
 {
     var data = new XElement("Result");
     using (var sr = new IO.StreamReader(objectProvider.GetData()))
     {
         data = XElement.Parse(sr.ReadToEnd());
     }
     return data;
 }
        /// <summary>
        /// The format of the query information and the desired UI will usually depend on the Linq to SQLq provider
        /// used by the query. 
        /// Therefore in this general query visualizer we only read the assembly and class for the specific
        /// query visualizer from the Stream and call the method "Display" on this class, which in turn will
        /// read the query information and show the UI.         
        /// </summary>
        /// <param name="windowService"> used to display the UI </param>
        /// <param name="objectProvider"> used to retrieve the data (as Stream) from the visualizer proxy</param>
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            Stream rawStream = objectProvider.GetData();

            //call visualizer to serialize query info
            Visualizer qv = new Visualizer();

            qv.Display(windowService, rawStream);
        }
示例#19
0
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            var stream = objectProvider.GetData();
            var reader = new StreamReader(stream);
            var text = reader.ReadToEnd();

            var viewer = new TextViewer(text, "IL");
            viewer.ShowDialog();
        }
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            var streamReader = new StreamReader(objectProvider.GetData());
            var stateMachineSource = streamReader.ReadToEnd();

            var pointer = (int)stateMachineSource[0];

            var form = new StateMachineVisualiserForm(pointer, stateMachineSource.Substring(1));
            windowService.ShowDialog(form);
        }
示例#21
0
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            var stream = objectProvider.GetData();
            var reader = new StreamReader(stream);
            var text   = reader.ReadToEnd();

            var viewer = new TextViewer(text, "IL");

            viewer.ShowDialog();
        }
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            var formatter = new BinaryFormatter();
            var data = formatter.Deserialize(objectProvider.GetData());

            if (data is InternalColorFrame)
            {
                windowService.ShowDialog(new Kinect2DFrameVisualizerForm(data as InternalColorFrame, true) { Text = Properties.Resources.ColorFrameImageDialogDebuggerVisualizer });
            }
        }
示例#23
0
        public void SetObjectProvider(IVisualizerObjectProvider objectProvider)
        {
            var bytes = new MemoryStream();

            using (var output = objectProvider.GetData())
                output.CopyTo(bytes);

            richTextBox.Text = MessagePackFormatter.ToJsonString(bytes.ToArray());

            ActiveControl = richTextBox;
        }
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            var streamReader       = new StreamReader(objectProvider.GetData());
            var stateMachineSource = streamReader.ReadToEnd();

            var pointer = (int)stateMachineSource[0];

            var form = new StateMachineVisualiserForm(pointer, stateMachineSource.Substring(1));

            windowService.ShowDialog(form);
        }
示例#25
0
 /// <summary>
 /// Shows the specified window service.
 /// </summary>
 /// <param name="windowService">The window service.</param>
 /// <param name="objectProvider">The object provider.</param>
 protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
 {
     using (ImageInfo imageInfo = SerializationHelper.DeserializeImageInfo(objectProvider.GetData()))
     {
         ImageReference replacementObject = DebuggerHelper.DebugBitmap(imageInfo, objectProvider.IsObjectReplaceable);
         if (objectProvider.IsObjectReplaceable && replacementObject != null)
         {
             objectProvider.ReplaceObject(replacementObject);
         }
     }
 }
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            var dynamicDebuggerVisualizer = new DynamicDebuggerVisualizer();
            var dataStream = objectProvider.GetData();

            if (dataStream.Length == 0) return;

            var formToShow = dynamicDebuggerVisualizer.ShowLINQPad(dataStream, VsReferencedVersion);

            if (!IsTest())
                windowService.ShowDialog(formToShow);
        }
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            if (windowService == null)
                throw new ArgumentNullException("windowService");
            if (objectProvider == null)
                throw new ArgumentNullException("objectProvider");

            var reader = new BinaryReader(objectProvider.GetData());
            var width  = reader.ReadInt32(); // unchecked uint to int conversion
            var height = reader.ReadInt32(); // unchecked uint to int conversion
            var src = reader.ReadBytes(reader.ReadInt32());
            
            using (var form = new Form())
            using (var pb = new PictureBox())
            {
                var bmp = new Bitmap(width, height);
                var data = bmp.LockBits(new Rectangle(0, 0, width, height), ImageLockMode.WriteOnly, PixelFormat.Format32bppArgb);
                var length = height * data.Stride;
                var pixels = new byte[length];
                for (int i = 0; i < length; i += 4)
                {
                    pixels[i + 0] = src[i + 2];
                    pixels[i + 1] = src[i + 1];
                    pixels[i + 2] = src[i + 0];
                    pixels[i + 3] = src[i + 3];
                }
                System.Runtime.InteropServices.Marshal.Copy(pixels, 0, data.Scan0, length);
                bmp.UnlockBits(data);

                var transGrid = new Bitmap(16, 16); // Checkerboard pattern for transparent images.
                using (var g = System.Drawing.Graphics.FromImage(transGrid))
                {
                    g.Clear(Color.FromArgb(102, 102, 102));
                    var brush = new SolidBrush(Color.FromArgb(153, 153, 153));
                    g.FillRectangle(brush, 0, 0, 8, 8);
                    g.FillRectangle(brush, 8, 8, 8, 8);
                }
                
                form.Controls.Add(pb);
                form.ClientSize = bmp.Size;
                form.Width = Math.Max(form.Width, 200);
                form.Text = string.Format("Texture Visualizer ({0:#,##0} x {1:#,##0})", width, height);
                form.BackgroundImage = transGrid;
                form.BackgroundImageLayout = ImageLayout.Tile;
                pb.Anchor = AnchorStyles.Top | AnchorStyles.Bottom | AnchorStyles.Right | AnchorStyles.Left;
                pb.Bounds = form.ClientRectangle;
                pb.SizeMode = PictureBoxSizeMode.Zoom;
                pb.Image = bmp;
                pb.BackColor = Color.Transparent;

                windowService.ShowDialog(form);
            }
        }
示例#28
0
 protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
 {
     Stream incomingData = objectProvider.GetData();
     BinaryFormatter formatter = new BinaryFormatter();
     string name = (string)formatter.Deserialize(incomingData);
     Bitmap pixeldata = (Bitmap)formatter.Deserialize(incomingData);
     using (BitmapForm form = new BitmapForm()) {
         form.Text = name;
         form.Bitmap = pixeldata;
         windowService.ShowDialog(form);
     }
 }
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            string contents = new StreamReader(objectProvider.GetData()).ReadToEnd();

            var pictureBox = new PictureBox()
            {
                Size = new Size(100, 100),
                BackColor = Color.FromArgb(int.Parse(contents)),
                Dock = DockStyle.Fill
            };

            windowService.ShowDialog(pictureBox);
        }
示例#30
0
        public void SetObjectProvider(IVisualizerObjectProvider objectProvider)
        {
            MethodBodyInfo mbi;

            using (var output = objectProvider.GetData())
                mbi = (MethodBodyInfo) new BinaryFormatter().Deserialize(output, null);

            lblMethodGetType.Text  = mbi.TypeName;
            lblMethodToString.Text = mbi.MethodToString;
            richTextBox.Lines      = mbi.Instructions.ToArray();

            ActiveControl = richTextBox;
        }
示例#31
0
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            var formatter = new BinaryFormatter();
            var data      = formatter.Deserialize(objectProvider.GetData());

            if (data is InternalDepthFrame)
            {
                windowService.ShowDialog(new Kinect2DFrameVisualizerForm(data as InternalDepthFrame)
                {
                    Text = Properties.Resources.DepthFrameDialogDebuggerVisualizer
                });
            }
        }
示例#32
0
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            Stream          incomingData = objectProvider.GetData();
            BinaryFormatter formatter    = new BinaryFormatter();
            string          name         = (string)formatter.Deserialize(incomingData);
            Bitmap          pixeldata    = (Bitmap)formatter.Deserialize(incomingData);

            using (BitmapForm form = new BitmapForm()) {
                form.Text   = name;
                form.Bitmap = pixeldata;
                windowService.ShowDialog(form);
            }
        }
    protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
    {
        string command;

        try
        {
            command = new StreamReader(objectProvider.GetData()).ReadLine();
            MessageBox.Show(command);
        }
        catch (Exception ex)
        {
            MessageBox.Show(ex.ToString());
        }
    }
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            string html;

            using (var s = new StreamReader(objectProvider.GetData(), Encoding.UTF8))
            {
                html = s.ReadToEnd();
            }
            var form = new MainForm();

            form.CloseOnEsc = true;
            form.LoadHtml(html);
            windowService.ShowDialog(form);
        }
示例#35
0
 override protected void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
 {
     try
     {
         var    provider   = (IVisualizerObjectProvider2)objectProvider;
         var    jsonStream = objectProvider.GetData();
         var    reader     = new StreamReader(jsonStream);
         string json       = reader.ReadToEnd();
         ShowVisualizer(json);
     }
     catch (Exception ex)
     {
         MessageBox.Show($"List Debugger Visualizer Exception while getting object data: {ex.Message}");
     }
 }
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            var xmlString = new StreamReader(objectProvider.GetData()).ReadToEnd();
            var doc       = XDocument.Parse(xmlString);

            var converter   = new XDocumentFamilyToFrameworkElementConverter();
            var viewPart    = converter.Convert(doc);
            var browserPart = converter.CreateWebBrowserPanel(xmlString);

            var dlg = new XmlWindow();

            dlg.VariableElement = viewPart;
            dlg.BrowserElement  = browserPart;
            dlg.ShowDialog();
        }
示例#37
0
        /// <summary>
        /// Retrieves the message data from the object provider
        /// </summary>
        /// <param name="objectProvider"></param>
        /// <returns></returns>
        private static Message GetMessage(IVisualizerObjectProvider objectProvider)
        {
            Stream dataStream = objectProvider.GetData();

            if (dataStream.Length == 0)
            {
                return(null);
            }

            BinaryFormatter f       = new BinaryFormatter();
            Message         message = (Message)f.Deserialize(dataStream);

            Log.Write($"Message content - \t {message}");

            return(message);
        }
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            var xmlString = new StreamReader(objectProvider.GetData()).ReadToEnd();
            var ds        = new DataSet();

            using (var reader = new StringReader(xmlString))
            {
                ds.ReadXml(reader, XmlReadMode.ReadSchema);
            }

            using (var dlg = new DataSetVisualizerForm())
            {
                dlg.Target = ds;
                windowService.ShowDialog(dlg);
            }
        }
示例#39
0
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            // Dictionary<object, ocbect>[]へのデシリアライズ
            var rawObject = Unpacking.UnpackObject(objectProvider.GetData());
            var entity    = rawObject
                            .AsList()
                            .Select(x => x.AsDictionary())
                            .Select(x => x.ToDictionary(y => y.Key.ToString(), y => y.Value.ToObject()))
                            .ToArray();

            using (var dialog = new EntityDialog(entity))
            {
                dialog.StartPosition = FormStartPosition.CenterParent;
                dialog.ShowDialog();
            }
        }
示例#40
0
        /// <summary>
        ///     Displays the user interface for the visualizer.
        /// </summary>
        /// <param name="windowService">
        ///     An object of type Microsoft.VisualStudio.DebuggerVisualizers.IDialogVisualizerService,
        ///     which provides methods that a visualizer can use to display Windows forms, controls, and dialogs.
        /// </param>
        /// <param name="objectProvider">
        ///     An object of type Microsoft.VisualStudio.DebuggerVisualizers.IVisualizerObjectProvider.
        ///     This object provides communication from the debugger side of the visualizer
        ///     to the object source (Microsoft.VisualStudio.DebuggerVisualizers.VisualizerObjectSource)
        ///     on the debuggee side.
        /// </param>
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            // Get the object to display a visualizer for.
            try
            {
                //TargetObject = (object)objectProvider.GetObject();
                //_targetObjectType = TargetObject.GetType();
                using (var streamReader = new StreamReader(objectProvider.GetData()))
                {
                    var targetObjectType = streamReader.ReadLine();
                    _targetObjectType = Type.GetType(targetObjectType);

                    TargetObject = Serializer.Deserialize(_targetObjectType, streamReader.ReadToEnd());
                }
            }
            catch (Exception exception)
            {
                MessageBox.Show(string.Format(Resources.DeserializationOfXmlFailed, exception.Message));
                return;
            }

            //Display the view of the object.
            using (var displayForm = new frmVisualizerDialog(this))
            {
                windowService.ShowDialog(displayForm);

                if (IsUpdateRequired)
                {
                    if (objectProvider.IsObjectReplaceable)
                    {
                        //objectProvider.ReplaceObject(TargetObject);
                        //If the object is replaceable and it has been updated then
                        //replace the target object with the updated version.
                        using (var outgoingData = new MemoryStream())
                        {
                            using (var writer = new StreamWriter(outgoingData))
                            {
                                writer.WriteLine(TargetObject.GetType().AssemblyQualifiedName);
                                writer.WriteLine(Serializer.Serialize(TargetObject));
                                writer.Flush();
                                objectProvider.ReplaceData(outgoingData);
                            }
                        }
                    }
                }
            }
        }
示例#41
0
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            // Deserialize the Stream returned by GetData() into a string
            String vars = null;
            using (Stream dataStream = objectProvider.GetData())
            {
                BinaryFormatter formatter = new BinaryFormatter();
                vars = formatter.Deserialize(dataStream) as String;
            }

            // Create the user interface form, passing in the NameValueCollection
            using (VisualizerForm displayForm = new VisualizerForm())
            {
                displayForm.Visualize(vars);
                windowService.ShowDialog(displayForm);
            }
        }
示例#42
0
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            var dynamicDebuggerVisualizer = new DynamicDebuggerVisualizer();
            var dataStream = objectProvider.GetData();

            if (dataStream.Length == 0)
            {
                return;
            }

            var formToShow = dynamicDebuggerVisualizer.ShowLINQPad(dataStream, VsReferencedVersion);

            if (!IsTest())
            {
                windowService.ShowDialog(formToShow);
            }
        }
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            string serialized = "";

            using (StreamReader reader = new StreamReader(objectProvider.GetData(), Encoding.UTF8))
            {
                serialized = reader.ReadToEnd();
            }

            serialized = serialized.Substring(2);

            EntityCollection ecoll = Serializer.Deserialize <EntityCollection>(serialized);

            EntityCollectionViewerForm form = new EntityCollectionViewerForm(ecoll);

            form.ShowDialog();
        }
示例#44
0
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            // Deserialize the Stream returned by GetData() into a string
            String vars = null;

            using (Stream dataStream = objectProvider.GetData())
            {
                BinaryFormatter formatter = new BinaryFormatter();
                vars = formatter.Deserialize(dataStream) as String;
            }

            // Create the user interface form, passing in the NameValueCollection
            using (VisualizerForm displayForm = new VisualizerForm())
            {
                displayForm.Visualize(vars);
                windowService.ShowDialog(displayForm);
            }
        }
示例#45
0
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            try
            {
                MethodBodyInfo mbi;
                using (var output = objectProvider.GetData())
                    mbi = (MethodBodyInfo) new BinaryFormatter().Deserialize(output, null);

                IXmlDataProvider <MethodBodyInfo> provider = new TcpClientDataProvider(port: 22017);
                provider.Dump(mbi);
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message,
                                "Send to IL Monitor",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Error);
            }
        }
示例#46
0
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            try
            {
                StreamReader reader = new StreamReader(objectProvider.GetData());
                JsonTextReader jsonReader = new JsonTextReader(reader);
                JsonSerializer ser = new JsonSerializer();
                var sourceObject = ser.Deserialize<dynamic>(jsonReader);

                //var sourceObject = objectProvider.GetObject();
                //MessageBox.Show(sourceObject.ToString());
                using (Form frm = new ListVisualizerForm(sourceObject))
                {
                    frm.WindowState = FormWindowState.Maximized;
                    windowService.ShowDialog(frm);
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.GetBaseException().Message + Environment.NewLine + ex.GetBaseException().StackTrace);
            }
        }
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            var bitmap = new Bitmap(objectProvider.GetData());

            var form = new Form
            {
                Text = String.Format("ImageView - W: {0}px  H: {1}px", bitmap.Width, bitmap.Height),
                ClientSize = new Size(480, 320),
                FormBorderStyle = FormBorderStyle.Sizable,
                ShowInTaskbar = false,
                ShowIcon = false
            };

            var pictureBox = new PictureBox
            {
                SizeMode = PictureBoxSizeMode.Zoom,
                Image = bitmap,
                Parent = form,
                Dock = DockStyle.Fill
            };

            form.ShowDialog();
        }
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            if (windowService != null && objectProvider != null)
            {
                // Get serialized object stream from debuggee side.
                Stream stream = objectProvider.GetData();

                if (stream != null && stream.Length > 0)
                {
                    // Deserialize the object stream.
                    var transporter = (SyntaxTransporter)SyntaxSerializer.Deserialize(stream);

                    if (transporter != null)
                    {
                        using (SyntaxDebuggerVisualizerForm form = new SyntaxDebuggerVisualizerForm())
                        {
                            // Display the deserialized object.
                            form.Display(transporter);
                            windowService.ShowDialog(form);
                        }
                    }
                }
            }
        }
 /// <summary>
 /// </summary>
 /// <param name="windowService">An object of type <see cref="T:Microsoft.VisualStudio.DebuggerVisualizers.IDialogVisualizerService"/>, which provides methods your visualizer can use to display Windows forms, controls, and dialogs.</param>
 /// <param name="objectProvider">An object of type <see cref="T:Microsoft.VisualStudio.DebuggerVisualizers.IVisualizerObjectProvider"/>. This object provides communication from the debugger side of the visualizer to the object source (<see cref="T:Microsoft.VisualStudio.DebuggerVisualizers.VisualizerObjectSource"/>) on the debuggee side.</param>
 protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
 {
     WindsorContainerData data = DeserializeDataIn(objectProvider.GetData());
     var containerViewForm = new ContainerViewForm(data);
     windowService.ShowDialog(containerViewForm);
 }
        /// <summary>
        /// The format of the query information and the desired UI will usually depend on the Linq to SQLq provider
        /// used by the query. 
        /// Therefore in this general query visualizer we only read the assembly and class for the specific
        /// query visualizer from the Stream and call the method "Display" on this class, which in turn will
        /// read the query information and show the UI.         
        /// </summary>
        /// <param name="windowService"> used to display the UI </param>
        /// <param name="objectProvider"> used to retrieve the data (as Stream) from the visualizer proxy</param>
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            Stream rawStream = objectProvider.GetData();

            Visualizer.Display(windowService, rawStream);
        }
        protected override void Show(IDialogVisualizerService windowService, IVisualizerObjectProvider objectProvider)
        {
            // TODO: Get the object to display a visualizer for.
            //       Cast the result of objectProvider.GetObject()
            //       to the type of the object being visualized.
            //object data = (object)objectProvider.GetObject();
            var s2 = new StreamReader(objectProvider.GetData()).ReadToEnd();
            JObject jsonObject = JObject.Parse(s2);
            // eval into an expando
            dynamic dynObject = ConvertJTokenToObject(jsonObject);
               // WeakReference wr = (WeakReference)data;

            // TODO: Display your view of the object.
            //       Replace displayForm with your own custom Form or Control.
            using (Form1 displayForm = new Form1())
            {
                //displayForm.Text = data.ToString();
                var lxw = LINQPad.Util.CreateXhtmlWriter(true);
                lxw.Write(dynObject.TrackedObject);
                displayForm.setHTML(lxw.ToString());
                windowService.ShowDialog(displayForm);
            }
        }