test/Misc/EFTools/TestInfrastructure/VS/DteExtensions.cs
/// <summary>
///     Determines if the document is dirty by querying the doc data directly
/// </summary>
Determines if the document is dirty by querying the doc data directly
Determines if the document is dirty by querying the doc data directly
public static bool IsDocumentDirty(this DTE dte, string documentPath)
        {
            Debug.Assert(dte != null, "dte must not be null.");
            Debug.Assert(!string.IsNullOrWhiteSpace(documentPath), "!string.IsNullOrWhiteSpace(documentPath)");
            var serviceProvider = new ServiceProvider((IServiceProvider)dte);
            IVsHierarchy vsHierarchy;
            uint itemId, docCookie;
            IVsPersistDocData vsPersistDocData;
            VsShellUtilities.GetRDTDocumentInfo(
                serviceProvider, documentPath, out vsHierarchy, out itemId, out vsPersistDocData, out docCookie);
            if (vsPersistDocData != null)
            {
                int isDirty;
                vsPersistDocData.IsDocDataDirty(out isDirty);
                return isDirty == 1;
            }
            throw new InvalidOperationException("Could not find the doc data in IsDocumentDirty");
        }
public static bool IsDocumentDirty ( this DTE dte , string documentPath ) { Debug . Assert ( dte != null , " " ) ; Debug . Assert ( ! string . IsNullOrWhiteSpace ( documentPath ) , " " ) ; var serviceProvider = new ServiceProvider ( ( IServiceProvider ) dte ) ; IVsHierarchy vsHierarchy ; uint itemId , docCookie ; IVsPersistDocData vsPersistDocData ; VsShellUtilities . GetRDTDocumentInfo ( serviceProvider , documentPath , out vsHierarchy , out itemId , out vsPersistDocData , out docCookie ) ; if ( vsPersistDocData != null ) { int isDirty ; vsPersistDocData . IsDocDataDirty ( out isDirty ) ; return isDirty == 1 ; } throw new InvalidOperationException ( " " ) ; }
Determines if the document is dirty by querying the doc data directly
Determines if the document is dirty by querying the doc data directly
DTE
this
documentPath
string