當前位置: 首頁>>代碼示例>>C#>>正文


C# Agent.FindMember方法代碼示例

本文整理匯總了C#中Agent.FindMember方法的典型用法代碼示例。如果您正苦於以下問題:C# Agent.FindMember方法的具體用法?C# Agent.FindMember怎麽用?C# Agent.FindMember使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Agent的用法示例。


在下文中一共展示了Agent.FindMember方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: LogVarValue

        public  void LogVarValue(Agent pAgent, string name, object value)
        {
#if !BEHAVIAC_RELEASE

            if (Config.IsLoggingOrSocketing)
            {
                string valueStr = StringUtils.ToString(value);
                string typeName = "";

                if (!Object.ReferenceEquals(value, null))
                {
                    typeName = Utils.GetNativeTypeName(value.GetType());
                }
                else
                {
                    typeName = "Agent";
                }

                string full_name = name;

                if (!Object.ReferenceEquals(pAgent, null))
                {
                    CMemberBase pMember = pAgent.FindMember(name);

                    if (pMember != null)
                    {
                        string classFullName = pMember.GetClassNameString().Replace(".", "::");
                        full_name = string.Format("{0}::{1}", classFullName, name);
                    }
                }

                LogManager.Instance.Log(pAgent, typeName, full_name, valueStr);
            }
#endif
        }
開發者ID:Just4F,項目名稱:behaviac,代碼行數:35,代碼來源:LogManager.cs

示例2: Log

        public void Log(Agent pAgent)
        {
            //BEHAVIAC_ASSERT(this.m_changed);

            string valueStr = StringUtils.ToString(this.m_value);
			string typeName = "";
			if (!Object.ReferenceEquals (this.m_value, null)) {
								typeName = Utils.GetNativeTypeName (this.m_value.GetType ());
						} else {
								typeName = "Agent";
						}

            string full_name = this.m_name;
            if (!Object.ReferenceEquals(pAgent, null))
            {
                CMemberBase pMember = pAgent.FindMember(this.m_name);
                if (pMember != null)
                {
                    string classFullName = pMember.GetClassNameString().Replace(".", "::");
                    full_name = string.Format("{0}::{1}", classFullName, this.m_name);
                }
            }

            LogManager.Log(pAgent, typeName, full_name, valueStr);
#if !BEHAVIAC_RELEASE
            this.m_changed = false;
#endif
        }
開發者ID:KeyleXiao,項目名稱:behaviac,代碼行數:28,代碼來源:Properties.cs

示例3: Set

		public void Set(Agent pAgent, CMemberBase pMember, string variableName, object value, uint varId)
        {
            Debug.Check(!string.IsNullOrEmpty(variableName));

			if (varId == 0) 
			{
				varId = Utils.MakeVariableId(variableName);			
			}

            IVariable pVar = null;

            if (!this.m_variables.ContainsKey(varId))
            {
				if (pMember == null)
				{
					if (pAgent != null)
					{
						pMember = pAgent.FindMember(variableName); 
					}
					else
					{
						pMember = Agent.FindMemberBase(variableName);
					}
				}

                pVar = new IVariable(pMember, variableName, varId);
				behaviac.Debug.Check(pVar != null);
                m_variables[varId] = pVar;
            }
            else
            {
                pVar = this.m_variables[varId];
            }

			pVar.SetValue(value, pAgent);
        }
開發者ID:KeyleXiao,項目名稱:behaviac,代碼行數:36,代碼來源:Properties.cs

示例4: Get

		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;
        }
開發者ID:KeyleXiao,項目名稱:behaviac,代碼行數:38,代碼來源:Properties.cs

示例5: SetFromString

        public void SetFromString(Agent pAgent, string variableName, string valueStr)
        {
            Debug.Check(!string.IsNullOrEmpty(variableName));

            //to skip class name
            string variableNameOnly = Utils.GetNameWithoutClassName(variableName);

            CMemberBase pMember = pAgent.FindMember(variableNameOnly);

            uint varId = Utils.MakeVariableId(variableNameOnly);

            if (this.m_variables.ContainsKey(varId))
            {
                IVariable pVar = this.m_variables[varId];

                pVar.SetFromString(pAgent, pMember, valueStr);
            }
        }
開發者ID:KeyleXiao,項目名稱:behaviac,代碼行數:18,代碼來源:Properties.cs


注:本文中的Agent.FindMember方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。