src/Misc/EFTools/DesignXmlCore/Common/CommonVsUtilities.cs
/// <summary>
///     Returns the docdata for this cookie on the rdt
/// </summary>
Returns the docdata for this cookie on the rdt
Returns the docdata for this cookie on the rdt
internal static bool TryGetDocDataFromCookie(uint cookie, out object docData)
        {
            docData = null;
            var success = false;
            var rdt = Package.GetGlobalService(typeof(IVsRunningDocumentTable)) as IVsRunningDocumentTable;
            Debug.Assert(rdt != null);
            if (rdt != null)
            {
                IVsHierarchy hierarchy;
                uint rdtFlags;
                uint readLocks;
                uint editLocks;
                string itemName;
                uint itemId;
                var unknownDocData = IntPtr.Zero;
                try
                {
                    var hr = rdt.GetDocumentInfo(
                        cookie,
                        out rdtFlags,
                        out readLocks,
                        out editLocks,
                        out itemName,
                        out hierarchy,
                        out itemId,
                        out unknownDocData);
                    if (NativeMethods.Succeeded(hr))
                    {
                        docData = Marshal.GetObjectForIUnknown(unknownDocData);
                        success = true;
                    }
                }
                finally
                {
                    if (unknownDocData != IntPtr.Zero)
                    {
                        Marshal.Release(unknownDocData);
                    }
                }
            }
            return success;
        }
internal static bool TryGetDocDataFromCookie ( uint cookie , out object docData ) { docData = null ; var success = false ; var rdt = Package . GetGlobalService ( typeof ( IVsRunningDocumentTable ) ) as IVsRunningDocumentTable ; Debug . Assert ( rdt != null ) ; if ( rdt != null ) { IVsHierarchy hierarchy ; uint rdtFlags ; uint readLocks ; uint editLocks ; string itemName ; uint itemId ; var unknownDocData = IntPtr . Zero ; try { var hr = rdt . GetDocumentInfo ( cookie , out rdtFlags , out readLocks , out editLocks , out itemName , out hierarchy , out itemId , out unknownDocData ) ; if ( NativeMethods . Succeeded ( hr ) ) { docData = Marshal . GetObjectForIUnknown ( unknownDocData ) ; success = true ; } } finally { if ( unknownDocData != IntPtr . Zero ) { Marshal . Release ( unknownDocData ) ; } } } return success ; }
Returns the docdata for this cookie on the rdt
Returns the docdata for this cookie on the rdt
cookie
uint
object
out