示例#1
0
        public ActionAssignInstance(ClassPointer owner)
        {
            _class               = owner;
            _actMethod           = new MethodCreateValue(this);
            _parameters          = new ParameterValueCollection();
            _valType             = new ParameterValue(this);
            _valType.Name        = Instance_Type;
            _valType.ParameterID = IntanceTypeId;
            ConstObjectPointer cop = new ConstObjectPointer(Instance_Type, typeof(Type));

            _valType.ConstantValue = cop;
            _valType.ConstantValue.SetOnValueChanged(onInstanceTypeChanged);
            _val             = new ParameterValue(this);
            _val.ParameterID = IntanceValueId;
            _val.Name        = Instance_Value;
            _parameters.Add(_valType);
            _parameters.Add(_val);
        }
示例#2
0
        public object Clone(IActionContext act)
        {
            ParameterValueCollection obj = new ParameterValueCollection();

            foreach (ParameterValue pv in this)
            {
                obj.Add(pv.Clone(act));
            }
            return(obj);
        }
示例#3
0
        public virtual IAction CreateNewCopy()
        {
            ActionExecMath a = (ActionExecMath)Activator.CreateInstance(this.GetType(), _class);

            a._actId   = (UInt32)(Guid.NewGuid().GetHashCode());
            a._asLocal = _asLocal;
            a._desc    = _desc;
            if (_mathExp != null)
            {
                a._mathExp = (MathExpMethod)_mathExp.Clone();
            }
            if (string.IsNullOrEmpty(_name))
            {
                a._name = "Action" + Guid.NewGuid().GetHashCode().ToString("x");
            }
            else
            {
                if (_name.Length > 30)
                {
                    a._name = _name.Substring(0, 30) + Guid.NewGuid().GetHashCode().ToString("x");
                }
                else
                {
                    a._name = _name + "_" + Guid.NewGuid().GetHashCode().ToString("x");
                }
            }
            a.ScopeMethodId = ScopeMethodId;
            a.SubScopeId    = SubScopeId;
            if (_parameters != null)
            {
                ParameterValueCollection ps = new ParameterValueCollection();
                foreach (ParameterValue pv in _parameters)
                {
                    pv.SetCloneOwner(a);
                    ps.Add((ParameterValue)pv.Clone());
                }
                a._parameters = ps;
            }
            return(a);
        }