Beispiel #1
0
        private bool MergeComments(BaseConstruct userBC, BaseConstruct newgenBC, BaseConstruct prevgenBC)
        {
            bool userChange = false, templateChange = false;

            // Comments
            if (userBC.Comments.IsTheSame(prevgenBC.Comments) == false)
            {
                userChange = true;
            }
            if (newgenBC.Comments.IsTheSame(prevgenBC.Comments) == false)
            {
                templateChange = true;
            }

            if (userBC.Equals(newgenBC))
            {
                userChange     = true;
                templateChange = false;
            }

            if (templateChange && userChange)
            {
                return(false);
            }
            if (userChange)
            {
                Comments = userBC.Comments.Clone();
            }
            else if (templateChange)
            {
                Comments = newgenBC.Comments.Clone();
            }
            return(true);
        }
Beispiel #2
0
        protected override bool CustomMergeStepInternal(BaseConstruct user, BaseConstruct newgen, BaseConstruct prevgen)
        {
            Attribute userBC = (Attribute)user, newgenBC = (Attribute)newgen, prevgenBC = (Attribute)prevgen;

            // PositionalArguments
            if (!Utility.MergeStringCollections(PositionalArguments, userBC.PositionalArguments, newgenBC.PositionalArguments, prevgenBC.PositionalArguments))
            {
                return(false);
            }

            // NamedArguments
            bool userChange     = !prevgenBC.NamedArgumentCollectionsAreTheSame(userBC);
            bool templateChange = !prevgenBC.NamedArgumentCollectionsAreTheSame(newgenBC);

            NamedArguments.Clear();

            if (user.Equals(newgen))
            {
                userChange     = true;
                templateChange = false;
            }

            if (templateChange && userChange)
            {
                return(false);
            }

            if (userChange)
            {
                NamedArguments.AddRange(userBC.NamedArguments);
            }
            else if (templateChange)
            {
                NamedArguments.AddRange(newgenBC.NamedArguments);
            }

            return(true);
        }