src/Misc/EFTools/DesignXmlCore/Common/RdtManager.cs
/// <summary>
///     This routine returns the document from the RDT.  We wrote this routine because
///     sometimes 8.3 filenames are used and other times long filenames, so this routine
///     tries and, if it fails, canonicalizes the path and tries again.
/// </summary>
This routine returns the document from the RDT.  We wrote this routine because
sometimes 8.3 filenames are used and other times long filenames, so this routine
tries and, if it fails, canonicalizes the path and tries again.
This routine returns the document from the RDT . We wrote this routine because sometimes 8 . 3 filenames are used and other times long filenames so this routine tries and if it fails canonicalizes the path and tries again .
private static int FindAndLockDocument(
            uint rdtLockType,
            string fullPathFileName,
            out VsShell.IVsHierarchy ppHier,
            out uint pitemid,
            out IntPtr ppunkDocData,
            out uint pdwCookie)
        {
            var hr = VSConstants.S_FALSE;
            var rdt = Instance.GetRunningDocumentTable();
            ppHier = null;
            pitemid = 0;
            ppunkDocData = IntPtr.Zero;
            pdwCookie = 0;
            if (rdt != null)
            {
                hr = rdt.FindAndLockDocument(
                    rdtLockType,
                    fullPathFileName,
                    out ppHier,
                    out pitemid,
                    out ppunkDocData,
                    out pdwCookie);
                if (NativeMethods.Failed(hr))
                {
                    try
                    {
                        if (Path.IsPathRooted(fullPathFileName) == false)
                        {
                            fullPathFileName = Path.GetFullPath(fullPathFileName);
                            hr = rdt.FindAndLockDocument(
                                rdtLockType,
                                fullPathFileName,
                                out ppHier,
                                out pitemid,
                                out ppunkDocData,
                                out pdwCookie);
                        }
                    }
                    catch (ArgumentException)
                    {
                    }
                    catch (IOException)
                    {
                    }
                }
            }
            return hr;
        }
private static int FindAndLockDocument ( uint rdtLockType , string fullPathFileName , out VsShell . IVsHierarchy ppHier , out uint pitemid , out IntPtr ppunkDocData , out uint pdwCookie ) { var hr = VSConstants . S_FALSE ; var rdt = Instance . GetRunningDocumentTable ( ) ; ppHier = null ; pitemid = 0 ; ppunkDocData = IntPtr . Zero ; pdwCookie = 0 ; if ( rdt != null ) { hr = rdt . FindAndLockDocument ( rdtLockType , fullPathFileName , out ppHier , out pitemid , out ppunkDocData , out pdwCookie ) ; if ( NativeMethods . Failed ( hr ) ) { try { if ( Path . IsPathRooted ( fullPathFileName ) == false ) { fullPathFileName = Path . GetFullPath ( fullPathFileName ) ; hr = rdt . FindAndLockDocument ( rdtLockType , fullPathFileName , out ppHier , out pitemid , out ppunkDocData , out pdwCookie ) ; } } catch ( ArgumentException ) { } catch ( IOException ) { } } } return hr ; }
This routine returns the document from the RDT.
This routine returns the document from the RDT .
// Canonicalize the file path // Use to get rid of 8.3 filenames, otherwise this'll fail
rdtLockType
uint
fullPathFileName
string
VsShell.IVsHierarchy
out
uint
out
IntPtr
out