コード例 #1
0
        private bool LinksMatch(Guid link1MigrationSourceId, ILink link1, Guid link2MigrationSourceId, ILink link2, out WitDiffLink diffLink)
        {
            if (m_serverDiffEngine.DiffServiceContainer == null)
            {
                Debug.Fail("m_serverDiffEngine.DiffServiceContainer is null");
                throw new ArgumentNullException("m_serverDiffEngine.DiffServiceContainer");
            }

            ILinkTranslationService linkTranslationService = m_serverDiffEngine.DiffServiceContainer.GetService(typeof(ILinkTranslationService)) as ILinkTranslationService;

            if (linkTranslationService == null)
            {
                throw new ArgumentNullException("linkTranslationService");
            }
            if (linkTranslationService.LinkConfigurationLookupService == null)
            {
                throw new ArgumentNullException("linkTranslationService.LinkConfigurationLookupService");
            }

            string mappedSourceLinkType = linkTranslationService.LinkConfigurationLookupService.FindMappedLinkType(
                link1MigrationSourceId, link1.LinkType.SourceArtifactType.ContentTypeReferenceName);

            if (!string.Equals(mappedSourceLinkType, link2.LinkType.SourceArtifactType.ContentTypeReferenceName, StringComparison.Ordinal))
            {
                diffLink = new WitDiffLink("SourceArtifactContentType", link1.LinkType.SourceArtifactType.FriendlyName, link2.LinkType.SourceArtifactType.FriendlyName);
                return(false);
            }

            string mappedTargetLinkType = linkTranslationService.LinkConfigurationLookupService.FindMappedLinkType(
                link1MigrationSourceId, link1.LinkType.TargetArtifactType.ContentTypeReferenceName);

            if (!string.Equals(mappedTargetLinkType, link2.LinkType.TargetArtifactType.ContentTypeReferenceName, StringComparison.Ordinal))
            {
                diffLink = new WitDiffLink("TargetArtifactContentType", link1.LinkType.TargetArtifactType.FriendlyName, link2.LinkType.TargetArtifactType.FriendlyName);
                return(false);
            }

            /* TODO: Need to use a Translation method something like LinkEngine.TranslateChangeGroup() does to enable this
             * comparison to work
             * if (!string.Equals(link1.SourceArtifact.Uri.ToString(), link2.SourceArtifact.Uri.ToString(), StringComparison.Ordinal))
             * {
             *  diffLink = new WitDiffLink("SourceArtifactUri", link1.SourceArtifact.Uri.ToString(), link2.SourceArtifact.Uri.ToString());
             *  return false;
             * }
             * if (!string.Equals(link1.TargetArtifact.Uri.ToString(), link2.TargetArtifact.Uri.ToString(), StringComparison.Ordinal))
             * {
             *  diffLink = new WitDiffLink("TargetArtifactUri", link1.TargetArtifact.Uri.ToString(), link2.TargetArtifact.Uri.ToString());
             *  return false;
             * }
             */

            if (!string.Equals(link1.Comment, link2.Comment, StringComparison.Ordinal))
            {
                diffLink = new WitDiffLink("Comment", link1.Comment, link2.Comment);
                return(false);
            }

            diffLink = null;
            return(true);
        }
コード例 #2
0
 public void AddMistmatchedLink(WitDiffLink diffLink)
 {
     m_mismatchedLinks.Add(diffLink);
 }