Beispiel #1
0
        public override string ToString()
        {
            if (!string.IsNullOrEmpty(Description))
            {
                return(Description);
            }

            return(ExternalId.ToString());
        }
Beispiel #2
0
        public override string ToString()
        {
            string str = ExternalId.ToString();

            if (!string.IsNullOrEmpty(Description))
            {
                str += $" ({Description})";
            }

            return(str);
        }
Beispiel #3
0
 public override void Print()
 {
     Console.WriteLine(formatter.Format("External Number", ExternalId.ToString()));
     Console.WriteLine(formatter.Format("Member", Member));
     foreach (var item in Procedures)
     {
         Console.WriteLine(formatter.Format("Code", item.Key));
         Console.WriteLine(formatter.Format("Name", item.Value));
     }
     Console.WriteLine();
 }
Beispiel #4
0
        public PortalHandler(WorldHandler worldHandler, EngineConnection engineConnection, MessageEventArgs eventArgs)
        {
            m_SendCommand  = engineConnection.SendCommand;
            m_WorldHandler = worldHandler;

            m_SendCommand += SentCommandToEngine;

            AgentId = eventArgs.AgentId;

            switch (eventArgs.Type)
            {
            case MessegeType.Portal_New:
                //Assumes the DS engine's ints are at least 16 bits.
                //  Still gives low odds of id collisions.
                ExternalId = RandomHelper.Rand.Next(Int16.MaxValue);
                m_SendCommand(AgentId, CommandType.Portal_SetId, ExternalId.ToString());
                break;

            case MessegeType.Portal_WorldLoaded:
                if (!eventArgs.Parameters.Any())
                {
                    Debug.Fail("No parameters found.");
                }
                int id;
                if (Int32.TryParse(eventArgs.Parameters.First(), out id))
                {
                    ExternalId = id;
                }
                else
                {
                    throw new OrchestrationException($"Parameter should have been an int.");
                }
                break;

            default:
                throw new Exceptions.OrchestrationException($"Type invalid: {eventArgs.Type}", new ArgumentException());
            }
        }