예제 #1
0
        public object Get(Agent pAgent, uint varId)
        {
            IVariable variable = null;

            if (this.m_variables.TryGetValue(varId, out variable))
            {
                Property property = variable.GetProperty();
                if (property != null)
                {
                    string refName = property.GetRefName();
                    if (!string.IsNullOrEmpty(refName))
                    {
                        return(this.Get(pAgent, property.GetRefNameId()));
                    }
                }
                return(variable.GetValue(pAgent));
            }
            CMemberBase cMemberBase = pAgent.FindMember(varId);

            if (cMemberBase != null)
            {
                return(cMemberBase.Get(pAgent));
            }
            return(null);
        }
        public object run(Agent parent, Agent parHolder)
        {
            if (this.m_params != null)
            {
                for (int i = 0; i < this.m_params.Length; i++)
                {
                    Property paramProperty = this.m_params[i].paramProperty;
                    if (paramProperty != null)
                    {
                        this.m_param_values[i] = paramProperty.GetValue(parent, parHolder);
                    }
                    if (this.m_params[i].paramStructMembers != null)
                    {
                        Type type = this.m_param_values[i].GetType();
                        Agent.CTagObjectDescriptor descriptorByName = Agent.GetDescriptorByName(type.get_FullName());
                        foreach (KeyValuePair <string, Property> current in this.m_params[i].paramStructMembers)
                        {
                            CMemberBase member = descriptorByName.GetMember(current.get_Key());
                            if (member != null)
                            {
                                object value = current.get_Value().GetValue(parent, parHolder);
                                member.Set(this.m_param_values[i], value);
                            }
                        }
                    }
                }
            }
            object result = this.method_.Invoke(parent, this.m_param_values);

            if (this.m_params != null)
            {
                for (int j = 0; j < this.m_params.Length; j++)
                {
                    Property paramProperty2 = this.m_params[j].paramProperty;
                    if (paramProperty2 != null)
                    {
                        object v = this.m_param_values[j];
                        paramProperty2.SetValue(parHolder, v);
                    }
                    if (this.m_params[j].paramStructMembers != null)
                    {
                        Type type2 = this.m_param_values[j].GetType();
                        Agent.CTagObjectDescriptor descriptorByName2 = Agent.GetDescriptorByName(type2.get_FullName());
                        foreach (KeyValuePair <string, Property> current2 in this.m_params[j].paramStructMembers)
                        {
                            CMemberBase member2 = descriptorByName2.GetMember(current2.get_Key());
                            if (member2 != null)
                            {
                                object v2 = member2.Get(this.m_param_values[j]);
                                current2.get_Value().SetValue(parHolder, v2);
                            }
                        }
                    }
                }
            }
            return(result);
        }
예제 #3
0
        public object run(Agent parent, Agent parHolder)
        {
            if (this.m_params != null)
            {
                for (int i = 0; i < this.m_params.Length; i++)
                {
                    Property paramProperty = this.m_params[i].paramProperty;
                    if (paramProperty != null)
                    {
                        this.m_param_values[i] = paramProperty.GetValue(parent, parHolder);
                    }
                    if (this.m_params[i].paramStructMembers != null)
                    {
                        Agent.CTagObjectDescriptor descriptorByName = Agent.GetDescriptorByName(this.m_param_values[i].GetType().FullName);
                        foreach (KeyValuePair <string, Property> pair in this.m_params[i].paramStructMembers)
                        {
                            CMemberBase member = descriptorByName.GetMember(pair.Key);
                            if (member != null)
                            {
                                object v = pair.Value.GetValue(parent, parHolder);
                                member.Set(this.m_param_values[i], v);
                            }
                        }
                    }
                }
            }
            object obj3 = this.method_.Invoke(parent, this.m_param_values);

            if (this.m_params != null)
            {
                for (int j = 0; j < this.m_params.Length; j++)
                {
                    Property property2 = this.m_params[j].paramProperty;
                    if (property2 != null)
                    {
                        object obj4 = this.m_param_values[j];
                        property2.SetValue(parHolder, obj4);
                    }
                    if (this.m_params[j].paramStructMembers != null)
                    {
                        Agent.CTagObjectDescriptor descriptor2 = Agent.GetDescriptorByName(this.m_param_values[j].GetType().FullName);
                        foreach (KeyValuePair <string, Property> pair2 in this.m_params[j].paramStructMembers)
                        {
                            CMemberBase base3 = descriptor2.GetMember(pair2.Key);
                            if (base3 != null)
                            {
                                object obj5 = base3.Get(this.m_param_values[j]);
                                pair2.Value.SetValue(parHolder, obj5);
                            }
                        }
                    }
                }
            }
            return(obj3);
        }
예제 #4
0
파일: Properties.cs 프로젝트: i17c/behaviac
        public object Get(Agent pAgent, uint varId)
        {
            if (!this.m_variables.ContainsKey(varId))
            {
                //possible static property
                CMemberBase pMember = pAgent.FindMember(varId);

                if (pMember != null)
                {
                    object pAddr = pMember.Get(pAgent);

                    return(pAddr);
                }

                Debug.Check(false, "a compatible property is not found");
            }
            else
            {
                //par
                IVariable pVar = this.m_variables[varId];

                {
                    Property refPropety = pVar.GetProperty();
                    if (refPropety != null)
                    {
                        string refName = refPropety.GetRefName();
                        if (!string.IsNullOrEmpty(refName))
                        {
                            return(this.Get(pAgent, refPropety.GetRefNameId()));
                        }
                    }

                    return(pVar.GetValue(pAgent));
                }
            }

            return(null);
        }
예제 #5
0
        public object Get(Agent pAgent, uint varId)
        {
            IVariable variable = null;

            if (!this.m_variables.TryGetValue(varId, out variable))
            {
                CMemberBase base2 = pAgent.FindMember(varId);
                if (base2 != null)
                {
                    return(base2.Get(pAgent));
                }
            }
            else
            {
                Property property = variable.GetProperty();
                if ((property != null) && !string.IsNullOrEmpty(property.GetRefName()))
                {
                    return(this.Get(pAgent, property.GetRefNameId()));
                }
                return(variable.GetValue(pAgent));
            }
            return(null);
        }