DataDictionary.Functions.Procedure.CreateProcedureUpdate C# (CSharp) Method

CreateProcedureUpdate() public method

Creates a copy of the procedure in the designated dictionary. The namespace structure is copied over. The new procedure is set to update this one.
public CreateProcedureUpdate ( Dictionary dictionary ) : Procedure
dictionary Dictionary The target dictionary of the copy
return Procedure
        public Procedure CreateProcedureUpdate(Dictionary dictionary)
        {
            Procedure retVal = (Procedure) Duplicate();
            retVal.SetUpdateInformation(this);
            retVal.ClearAllRequirements();

            String[] names = FullName.Split('.');
            names = names.Take(names.Count() - 1).ToArray();

            if (Enclosing is NameSpace)
            {
                NameSpace nameSpace = dictionary.GetNameSpaceUpdate(names, Dictionary);
                nameSpace.appendProcedures(retVal);
            }
            else
            {
                String[] nameSpaceRef = names.Take(names.Count() - 1).ToArray();

                if (Enclosing is Structure)
                {
                    NameSpace nameSpace = dictionary.GetNameSpaceUpdate(nameSpaceRef, Dictionary);
                    Structure structure = nameSpace.GetStructureUpdate(names.Last(), (NameSpace) nameSpace.Updates);
                    structure.appendProcedures(retVal);
                }
            }

            return retVal;
        }