コード例 #1
0
 protected void CloneParameters(ParameterBase iiToCopyFrom)
 {
     foreach (Parameter p in iiToCopyFrom.Parameters)
     {
         var clone = (Parameter)p.Clone();
         clone.ParentObject = this;
         Parameters.Add(clone);
     }
 }
コード例 #2
0
        protected internal bool ParametersAreTheSame(ParameterBase comparisonFunction, ComparisonDepth depth)
        {
            if (Parameters.Count != comparisonFunction.Parameters.Count)
            {
                return(false);
            }

            for (int i = 0; i < Parameters.Count; i++)
            {
                if (depth != ComparisonDepth.Signature && Parameters[i].Name != comparisonFunction.Parameters[i].Name)
                {
                    return(false);
                }

                if (Parameters[i].DataType != comparisonFunction.Parameters[i].DataType)
                {
                    return(false);
                }
            }
            return(true);
        }
コード例 #3
0
        protected internal bool ParametersAreTheSame(ParameterBase comparisonFunction, ComparisonDepth depth)
        {
            if (Parameters.Count != comparisonFunction.Parameters.Count) return false;

            for (int i = 0; i < Parameters.Count; i++)
            {
                if (depth != ComparisonDepth.Signature && Parameters[i].Name != comparisonFunction.Parameters[i].Name)
                    return false;

                if (Parameters[i].DataType != comparisonFunction.Parameters[i].DataType)
                {
                    return false;
                }
            }
            return true;
        }
コード例 #4
0
 protected void CloneParameters(ParameterBase iiToCopyFrom)
 {
     foreach (Parameter p in iiToCopyFrom.Parameters)
     {
         var clone = (Parameter)p.Clone();
         clone.ParentObject = this;
         Parameters.Add(clone);
     }
 }
コード例 #5
0
        protected override bool CustomMergeStepInternal(BaseConstruct user, BaseConstruct newgen, BaseConstruct prevgen)
        {
            // Handle Parameters in here, leave other customisations to CustomMergeStepParameterInternal
            ParameterBase userBC = (ParameterBase)user, newgenBC = (ParameterBase)newgen, prevgenBC = (ParameterBase)prevgen;

            if (userBC.Parameters.Count != prevgenBC.Parameters.Count &&
                newgenBC.Parameters.Count != prevgenBC.Parameters.Count)
            {
                // We can't merge if there are additional parameters in user and newgen.
                return(false);
            }
            if (userBC.Parameters.Count != prevgenBC.Parameters.Count)
            {
                // the user has a different number of parameters. Check to see if the
                // newgen has changed, if it has then we can't merge.
                if (prevgenBC.ParametersAreTheSame(newgenBC, ComparisonDepth.Complete) == false)
                {
                    return(false);
                }

                // User has changed, newgen hasn't.
                CloneParameters(userBC);
                return(true);
            }
            if (newgenBC.Parameters.Count != prevgenBC.Parameters.Count)
            {
                // the newgen has a different number of parameters. Check to see if the
                // user has changed, if it has then we can't merge.
                if (prevgenBC.ParametersAreTheSame(userBC, ComparisonDepth.Complete) == false)
                {
                    return(false);
                }
                // Template has changed, newgen hasn't.
                CloneParameters(newgenBC);
                return(true);
            }

            Parameters.Clear();
            // Check each parameter individually
            for (int i = 0; i < prevgenBC.Parameters.Count; i++)
            {
                bool userChange     = prevgenBC.Parameters[i].IsTheSame(userBC.Parameters[i], ComparisonDepth.Complete) == false;
                bool templateChange = prevgenBC.Parameters[i].IsTheSame(newgenBC.Parameters[i], ComparisonDepth.Complete) == false;

                if (userBC.Parameters[i].IsTheSame(newgenBC.Parameters[i], ComparisonDepth.Complete))
                {
                    userChange     = true;
                    templateChange = false;
                }
                Parameter clone;
                if (templateChange && userChange)
                {
                    return(false);
                }
                if (userChange)
                {
                    clone = (Parameter)userBC.Parameters[i].Clone();
                }
                else if (templateChange)
                {
                    clone = (Parameter)newgenBC.Parameters[i].Clone();
                }
                else
                {
                    clone = (Parameter)userBC.Parameters[i].Clone();
                }
                clone.ParentObject = this;
                Parameters.Add(clone);
            }

            return(CustomMergeStepParameterInternal(user, newgen, prevgen));
        }