Exemple #1
0
        protected void ParseMessage(string argument, bool selfCalled = false)
        {
            if (argument == null)
            {
                return;
            }

            var pm = communicationSystems.ParseMessage(argument);

            if (ParsedMessage.MaxNumBounces < pm.NumBounces && !selfCalled && pm.MessageType != MessageCode.PingEntity)
            {
                pm.NumBounces++;
                //LOG.Debug("Bounced Message");
                communicationSystems.SendMessage(pm.ToString());
            }

            if (pm.IsAwakeningSignal)
            {
                ForceStartup();
            }
            else
            {
                switch (pm.MessageType)
                {
                case MessageCode.PingEntity:
                    if (pm.Type.Trim().ToLower().Contains("planet"))
                    {
                        trackingSystems.UpdatePlanetData(pm, selfCalled);
                    }
                    else
                    {
                        trackingSystems.UpdateTrackedEntity(pm, selfCalled);
                    }

                    break;
                }
            }
        }
        protected void ParseMessage(string argument, bool selfCalled = false)
        {
            try
            {
                if (argument == null)
                {
                    return;
                }

                var pm = communicationSystems.ParseMessage(argument);

                if (ParsedMessage.MaxNumBounces < pm.NumBounces && !selfCalled && pm.MessageType != MessageCode.PingEntity)
                {
                    pm.NumBounces++;
                    //LOG.Debug("Bounced Message");
                    communicationSystems.SendMessage(pm.ToString());
                }

                //switch (pm.MessageType)
                //{
                //   // case MessageCode.PingEntity:
                //        //if its a new point of intrest, sync the position with all ships.

                //    //    if (!pm.Type.Trim().ToLower().Contains("planet"))// && trackingSystems.UpdatePlanetData(pm, selfCalled))
                //    //    {
                //    //        var ent = new TrackedEntity(pm, log);
                //    //        trackingSystems.UpdateTrackedEntity(pm, selfCalled);
                //    //    }
                //        //communicationSystems.SendMessage(pm.ToString());


                //            break;
                //}
            }
            catch (Exception e) { log.Error(e.Message); }
        }