示例#1
0
        private IStream SaveDocumentWindowPositions(IVsUIShellDocumentWindowMgr windowsMgr)
        {
            if (windowsMgr == null)
            {
                Debug.Assert(false, "IVsUIShellDocumentWindowMgr", String.Empty, 0);
                return(null);
            }

            IStream stream;

            NativeMethods.CreateStreamOnHGlobal(IntPtr.Zero, true, out stream);
            if (stream == null)
            {
                Debug.Assert(false, "CreateStreamOnHGlobal", String.Empty, 0);
                return(null);
            }
            int hr = windowsMgr.SaveDocumentWindowPositions(0, stream);

            if (hr != VSConstants.S_OK)
            {
                Debug.Assert(false, "SaveDocumentWindowPositions", String.Empty, hr);
                return(null);
            }

            // Move to the beginning of the stream
            // In preparation for reading
            LARGE_INTEGER l = new LARGE_INTEGER();

            ULARGE_INTEGER[] ul = new ULARGE_INTEGER[1];
            ul[0]      = new ULARGE_INTEGER();
            l.QuadPart = 0;
            //Seek to the beginning of the stream
            stream.Seek(l, 0, ul);
            return(stream);
        }
示例#2
0
        public async Task <string> GetDocumentWindowPositionsAsync()
        {
            using (var stream = new VsOleStream())
            {
                await _package.JoinableTaskFactory.SwitchToMainThreadAsync();

                var result = _vsDocumentWindowMgr.SaveDocumentWindowPositions(0, stream);
                if (result != VSConstants.S_OK)
                {
                    return(null);
                }

                stream.Seek(0, SeekOrigin.Begin);

                return(Convert.ToBase64String(stream.ToArray()));
            }
        }
示例#3
0
        private (List <WorkspaceBreakpoint>, string) GetWorkspaceItem()
        {
            var breakpoints = new List <WorkspaceBreakpoint>();

            foreach (Breakpoint breakpoint in _dte.Debugger.Breakpoints)
            {
                breakpoints.Add(new WorkspaceBreakpoint()
                {
                    Filename = breakpoint.File,
                    Line     = breakpoint.FileLine,
                    Enabled  = breakpoint.Enabled
                });
            }

            IStream stream;

            NativeHelpers.CreateStreamOnHGlobal(IntPtr.Zero, true, out stream);
            ErrorHandler.ThrowOnFailure(_documentWindowMgr.SaveDocumentWindowPositions(0U, stream));
            stream.Rewind();
            var windowsBase64 = System.Convert.ToBase64String(stream.ToByteArray());

            return(breakpoints, windowsBase64);
        }
        private IStream SaveDocumentWindowPositions(IVsUIShellDocumentWindowMgr windowsMgr)
        {
            if (windowsMgr == null)
            {
                Debug.Assert(false, "IVsUIShellDocumentWindowMgr", String.Empty, 0);
                return null;
            }
            IStream stream;
            NativeMethods.CreateStreamOnHGlobal(IntPtr.Zero, true, out stream);
            if (stream == null)
            {
                Debug.Assert(false, "CreateStreamOnHGlobal", String.Empty, 0);
                return null;
            }
            int hr = windowsMgr.SaveDocumentWindowPositions(0, stream);
            if (hr != VSConstants.S_OK)
            {
                Debug.Assert(false, "SaveDocumentWindowPositions", String.Empty, hr);
                return null;
            }

            // Move to the beginning of the stream
            // In preparation for reading
            LARGE_INTEGER l = new LARGE_INTEGER();
            ULARGE_INTEGER[] ul = new ULARGE_INTEGER[1];
            ul[0] = new ULARGE_INTEGER();
            l.QuadPart = 0;
            //Seek to the beginning of the stream
            stream.Seek(l, 0, ul);
            return stream;
        }