Example #1
0
        private static void processProperty(string msg)
        {
            // Par:   [property]a->10
            // World: [property]WorldTest::World WorldTest::Property3->10
            // Agent: [property]AgentTest::AgentTest_1 AgentTest::Property5::type::name->10

            string[] tokens = msg.Substring(10).Split(' ');
            Debug.Check(tokens.Length > 0);

            string agentType     = string.Empty;
            string agentName     = string.Empty;
            string agentFullname = string.Empty;

            // Par
            if (tokens.Length == 1)
            {
                agentType     = string.Empty;
                agentFullname = tokens[0];
            }

            // Global or Agent
            else
            {
                string[] types = tokens[0].Split(new char[] { '#' }, StringSplitOptions.RemoveEmptyEntries);
                Debug.Check(types.Length == 2);
                agentType     = types[0];
                agentName     = types[1];
                agentFullname = tokens[0];

                AgentInstancePool.AddInstance(agentType, agentName);
            }

            Debug.Check(!string.IsNullOrEmpty(agentFullname));

            string[] values = tokens[tokens.Length - 1].Split(new string[] { "->", "\n" }, StringSplitOptions.RemoveEmptyEntries);

            if (values.Length == 2)
            {
                string basicValueName = values[0];
                int    index          = basicValueName.LastIndexOf(":");
                basicValueName = basicValueName.Substring(index + 1);

                if (_ms_planning)
                {
                    FrameStatePool.PlanProperty(agentFullname, basicValueName, values[1]);
                }
                else
                {
                    if (AgentDataPool.TotalFrames > -1 && !string.IsNullOrEmpty(agentFullname))
                    {
                        AgentDataPool.AddValue(agentFullname, basicValueName, AgentDataPool.TotalFrames, values[1]);
                    }
                }
            }
        }