Ejemplo n.º 1
0
        public IFunctionData Clone()
        {
            ArgumentCollection parameterType = new ArgumentCollection();

            ModuleUtils.CloneCollection(ParameterType, parameterType);

            ParameterDataCollection parameters = null;

            if (Parameters != null)
            {
                parameters = new ParameterDataCollection();
                ModuleUtils.CloneCollection(Parameters, parameters);
            }



            FunctionData functionData = new FunctionData()
            {
                Type           = this.Type,
                MethodName     = this.MethodName,
                ClassType      = this.ClassType,
                ClassTypeIndex = this.ClassTypeIndex,
                ParameterType  = parameterType,
                Parameters     = parameters,
                Instance       = this.Instance,
                Return         = this.Return,
                ReturnType     = this.ReturnType?.Clone(),
                Description    = this.Description
            };

            return(functionData);
        }
Ejemplo n.º 2
0
        public void Initialize(IFuncInterfaceDescription funcInterface)
        {
            ArgumentCollection argumentsTypes = new ArgumentCollection();

            foreach (IArgumentDescription argumentDescription in funcInterface.Arguments)
            {
                Argument argumentData = new Argument();
                argumentData.Initialize(argumentDescription);
                argumentsTypes.Add(argumentData);
            }

            ParameterDataCollection parameters = new ParameterDataCollection();

            foreach (IArgumentDescription argumentDescription in funcInterface.Arguments)
            {
                parameters.Add(new ParameterData());
            }

            Argument returnType = new Argument();

            returnType.Initialize(funcInterface.Return);

            Type          = funcInterface.FuncType;
            MethodName    = funcInterface.Name;
            ClassType     = funcInterface.ClassType;
            Description   = funcInterface;
            Instance      = string.Empty;
            Parameters    = parameters;
            ParameterType = argumentsTypes;
            ReturnType    = returnType;
        }
Ejemplo n.º 3
0
        ISequenceFlowContainer ICloneableClass <ISequenceFlowContainer> .Clone()
        {
            AssemblyInfoCollection assemblies = new AssemblyInfoCollection();

            foreach (IAssemblyInfo assemblyInfo in this.Assemblies)
            {
                assemblies.Add(assemblyInfo);
            }

            TypeDataCollection typeDatas = new TypeDataCollection();

            foreach (ITypeData typeData in TypeDatas)
            {
                typeDatas.Add(typeData);
            }

            ArgumentCollection arguments = new ArgumentCollection();

            ModuleUtils.CloneCollection(this.Arguments, arguments);

            VariableCollection variables = new VariableCollection();

            ModuleUtils.CloneFlowCollection(this.Variables, variables);

            // SequenceGroupParameter只在序列化时使用
            // Parameters只有在序列化时才会生成,在加载完成后会被删除
            ISequenceGroupParameter parameters = (null == Parameters) ?
                                                 null : this.Parameters.Clone() as ISequenceGroupParameter;

            SequenceCollection sequenceCollection = new SequenceCollection();

            ModuleUtils.CloneFlowCollection(this.Sequences, sequenceCollection);

            SequenceGroup sequenceGroup = new SequenceGroup()
            {
                Name           = this.Name + Constants.CopyPostfix,
                Description    = this.Description,
                Parent         = this.Parent,
                Info           = this.Info.Clone(),
                Assemblies     = assemblies,
                TypeDatas      = typeDatas,
                Arguments      = arguments,
                Variables      = variables,
                Parameters     = parameters,
                ExecutionModel = this.ExecutionModel,
                SetUp          = this.SetUp.Clone() as ISequence,
                Sequences      = sequenceCollection,
                TearDown       = this.TearDown.Clone() as ISequence
            };

            sequenceGroup.SetUp.Index    = CommonConst.SetupIndex;
            sequenceGroup.TearDown.Index = CommonConst.TeardownIndex;
            sequenceGroup.RefreshSignature();
            return(sequenceGroup);
        }
Ejemplo n.º 4
0
        public void Initialize(IFuncInterfaceDescription funcInterface)
        {
            ArgumentCollection argumentsTypes = new ArgumentCollection();

            foreach (IArgumentDescription argumentDescription in funcInterface.Arguments)
            {
                Argument argumentData = new Argument();
                argumentData.Initialize(argumentDescription);
                argumentsTypes.Add(argumentData);
            }

            ParameterDataCollection parameters = new ParameterDataCollection();

            foreach (IArgumentDescription argumentDescription in funcInterface.Arguments)
            {
                ParameterData parameterData = new ParameterData();
                if (null != argumentDescription.DefaultValue)
                {
                    parameterData.Value         = argumentDescription.DefaultValue;
                    parameterData.ParameterType = Data.Sequence.ParameterType.Value;
                }
                parameters.Add(parameterData);
            }

            Type          = funcInterface.FuncType;
            MethodName    = funcInterface.Name;
            ClassType     = funcInterface.ClassType;
            Description   = funcInterface;
            Instance      = string.Empty;
            Parameters    = parameters;
            ParameterType = argumentsTypes;

            if (null != funcInterface.Return)
            {
                Argument returnType = new Argument();
                returnType.Initialize(funcInterface.Return);
                ReturnType = returnType;
            }
        }