src/T4Toolbox.VisualStudio/OutputFileManager.cs
/// <summary>
/// Determines whether two project items collections are the same.
/// </summary>
/// <param name="collection1">
/// First <see cref="ProjectItems" /> collection.
/// </param>
/// <param name="collection2">
/// Second <see cref="ProjectItems" /> collection.
/// </param>
/// <returns>True, if the two collections are the same.</returns>
/// <remarks>
/// This method is necessary for MPF-based project implementations, such as database projects, which can return different
/// ProjectItems instances ultimately pointing to the same folder.
/// </remarks>
Determines whether two project items collections are the same.
Determines whether two project items collections are the same .
private static bool Same(ProjectItems collection1, ProjectItems collection2)
        {
            if (collection1 == collection2)
            {
                return true;
            }
            var parentItem1 = collection1.Parent as ProjectItem;
            var parentItem2 = collection2.Parent as ProjectItem;
            if (parentItem1 != null && parentItem2 != null)
            {
                if (!string.Equals(parentItem1.Name, parentItem2.Name, StringComparison.OrdinalIgnoreCase))
                {
                    return false;
                }
                return Same(parentItem1.Collection, parentItem2.Collection);
            }
            var parentProject1 = collection1.Parent as Project;
            var parentProject2 = collection2.Parent as Project;
            if (parentProject1 != null && parentProject2 != null)
            {
                return string.Equals(parentProject1.FullName, parentProject2.FullName, StringComparison.OrdinalIgnoreCase);
            }
            return false;
        }
private static bool Same ( ProjectItems collection1 , ProjectItems collection2 ) { if ( collection1 == collection2 ) { return true ; } var parentItem1 = collection1 . Parent as ProjectItem ; var parentItem2 = collection2 . Parent as ProjectItem ; if ( parentItem1 != null && parentItem2 != null ) { if ( ! string . Equals ( parentItem1 . Name , parentItem2 . Name , StringComparison . OrdinalIgnoreCase ) ) { return false ; } return Same ( parentItem1 . Collection , parentItem2 . Collection ) ; } var parentProject1 = collection1 . Parent as Project ; var parentProject2 = collection2 . Parent as Project ; if ( parentProject1 != null && parentProject2 != null ) { return string . Equals ( parentProject1 . FullName , parentProject2 . FullName , StringComparison . OrdinalIgnoreCase ) ; } return false ; }
Determines whether two project items collections are the same.
Determines whether two project items collections are the same .
True, if the two collections are the same.
True if the two collections are the same .
collection1
ProjectItems
None
collection2
ProjectItems
None
remarks
This method is necessary for MPF-based project implementations, such as database projects, which can return different
ProjectItems instances ultimately pointing to the same folder.
This method is necessary for MPF - based project implementations such as database projects which can return different ProjectItems instances ultimately pointing to the same folder .