src/Misc/EFTools/DesignXmlCore/Common/RdtManager.cs
/// <summary>
///     Gets the DocData object from the RDT for the specified fullPath filename
///     You might want to try casting this to an IVsPersistDocData2, but that may not work for all filetypes
///     Returns 0 if the file is not in the RDT
/// </summary>
/// <param name="fullPathFileName">the fullpath filename whose docCookie is wanted</param>
/// <returns>the docData of the specified file</returns>
Gets the DocData object from the RDT for the specified fullPath filename
You might want to try casting this to an IVsPersistDocData2, but that may not work for all filetypes
Returns 0 if the file is not in the RDT
Gets the DocData object from the RDT for the specified fullPath filename You might want to try casting this to an IVsPersistDocData2 but that may not work for all filetypes Returns 0 if the file is not in the RDT
[SuppressMessage("Microsoft.Usage", "CA1806:DoNotIgnoreMethodResults",
            MessageId =
                "Microsoft.VisualStudio.Shell.Interop.IVsRunningDocumentTable.FindAndLockDocument(System.UInt32,System.String,Microsoft.VisualStudio.Shell.Interop.IVsHierarchy@,System.UInt32@,System.IntPtr@,System.UInt32@)"
            )]
        public static Object GetDocData(string fullPathFileName)
        {
            var ppunkDocData = IntPtr.Zero;
            Object returnObj = null;
            uint result;
            var rdt = Instance.GetRunningDocumentTable();
            if (rdt != null)
            {
                VsShell.IVsHierarchy ppHier;
                uint pItemId;
                try
                {
                    try
                    {
                        if (Path.IsPathRooted(fullPathFileName))
                        {
                            fullPathFileName = Path.GetFullPath(fullPathFileName);
                        }
                    }
                    catch (ArgumentException)
                    {
                    }
                    FindAndLockDocument(
                        (uint)(VsShell._VSRDTFLAGS.RDT_NoLock),
                        fullPathFileName,
                        out ppHier,
                        out pItemId,
                        out ppunkDocData,
                        out result);
                }
                finally
                {
                    if (ppunkDocData != IntPtr.Zero)
                    {
                        returnObj = Marshal.GetObjectForIUnknown(ppunkDocData);
                        Marshal.Release(ppunkDocData);
                    }
                }
            }
            return returnObj;
        }
[ SuppressMessage ( " " , " " , MessageId = " " ) ] public static Object GetDocData ( string fullPathFileName ) { var ppunkDocData = IntPtr . Zero ; Object returnObj = null ; uint result ; var rdt = Instance . GetRunningDocumentTable ( ) ; if ( rdt != null ) { VsShell . IVsHierarchy ppHier ; uint pItemId ; try { try { if ( Path . IsPathRooted ( fullPathFileName ) ) { fullPathFileName = Path . GetFullPath ( fullPathFileName ) ; } } catch ( ArgumentException ) { } FindAndLockDocument ( ( uint ) ( VsShell . _VSRDTFLAGS . RDT_NoLock ) , fullPathFileName , out ppHier , out pItemId , out ppunkDocData , out result ) ; } finally { if ( ppunkDocData != IntPtr . Zero ) { returnObj = Marshal . GetObjectForIUnknown ( ppunkDocData ) ; Marshal . Release ( ppunkDocData ) ; } } } return returnObj ; }
Gets the DocData object from the RDT for the specified fullPath filename
You might want to try casting this to an IVsPersistDocData2, but that may not work for all filetypes
Returns 0 if the file is not in the RDT
Gets the DocData object from the RDT for the specified fullPath filename You might want to try casting this to an IVsPersistDocData2 but that may not work for all filetypes Returns 0 if the file is not in the RDT
// Canonicalize the file path // Use to get rid of 8.3 filenames, otherwise this'll fail
the docData of the specified file
the docData of the specified file
fullPathFileName
string
the fullpath filename whose docCookie is wanted
the fullpath filename whose docCookie is wanted