src/Misc/EFTools/DesignXmlCore/Common/RdtManager.cs
/// <summary>
///     Gets the DocCookie from the RDT for the specified fullPath FileName
///     Returns 0 if the file is not in the RDT
/// </summary>
/// <param name="fullPathFileName">the fullpath filename whose docCookie is wanted</param>
/// <returns>the DocCookie of the specified file</returns>
Gets the DocCookie from the RDT for the specified fullPath FileName
Returns 0 if the file is not in the RDT
Gets the DocCookie from the RDT for the specified fullPath FileName 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@)"
            )]
        internal static uint GetRdtCookie(string fullPathFileName)
        {
            uint result = 0;
            var rdt = Instance.GetRunningDocumentTable();
            if (rdt != null)
            {
                VsShell.IVsHierarchy ppHier;
                uint pItemId;
                var ppunkDocData = IntPtr.Zero;
                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)
                    {
                        Marshal.Release(ppunkDocData);
                    }
                }
            }
            return result;
        }
[ SuppressMessage ( " " , " " , MessageId = " " ) ] internal static uint GetRdtCookie ( string fullPathFileName ) { uint result = 0 ; var rdt = Instance . GetRunningDocumentTable ( ) ; if ( rdt != null ) { VsShell . IVsHierarchy ppHier ; uint pItemId ; var ppunkDocData = IntPtr . Zero ; 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 ) { Marshal . Release ( ppunkDocData ) ; } } } return result ; }
Gets the DocCookie from the RDT for the specified fullPath FileName
Returns 0 if the file is not in the RDT
Gets the DocCookie from the RDT for the specified fullPath FileName 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 // Contains invalid path characters - for instance a file-less moniker
the DocCookie of the specified file
the DocCookie of the specified file
fullPathFileName
string
the fullpath filename whose docCookie is wanted
the fullpath filename whose docCookie is wanted