Example #1
0
 public void Console_Write(string aMsg)
 {
     Console.WriteLine($"Console_Write:{aMsg}");
     ToEmpyrion.SendMessage(new ClientHostComData()
     {
         Command = ClientHostCommand.Console_Write, Data = aMsg
     });
 }
Example #2
0
 public bool Game_Request(CmdId reqId, ushort seqNr, object data)
 {
     Console.WriteLine($"Game_Request:{reqId}#{seqNr} = {data}");
     ToEmpyrion.SendMessage(new EmpyrionGameEventData()
     {
         eventId = reqId, seqNr = seqNr, data = data
     });
     return(true);
 }
Example #3
0
        public bool Game_Request(CmdId reqId, ushort seqNr, object data)
        {
            //Console.WriteLine($"Game_Request:{reqId}#{seqNr} = {data}");
            var msg = new EmpyrionGameEventData()
            {
                eventId = reqId, seqNr = seqNr
            };

            msg.SetEmpyrionObject(data);
            ToEmpyrion.SendMessage(msg);
            return(true);
        }
Example #4
0
        public void UpdateEWA()
        {
            if (!CurrentSysteminfo.online.Contains('o'))
            {
                return;
            }

            ToEmpyrion.SendMessage(new ClientHostComData()
            {
                Command = ClientHostCommand.UpdateEWA,
                Data    = new ProcessInformation()
                {
                    Id = Process.GetCurrentProcess().Id
                }
            });
        }
Example #5
0
        private void UpdateEmpyrionInfos()
        {
            CurrentSysteminfo.online = SetState(CurrentSysteminfo.online, "oc", (DateTime.Now - LastProcessInformationUpdate).TotalSeconds <= 10);

            if (ToEmpyrion == null)
            {
                return;
            }

            ToEmpyrion.SendMessage(new ClientHostComData()
            {
                Command = ClientHostCommand.ProcessInformation
            });
            if (ProcessInformation == null)
            {
                return;
            }

            CurrentSysteminfo.activePlayers = PlayerManager.OnlinePlayersCount;
            var activePlayfields = Request_Playfield_List().Result.playfields;

            CurrentSysteminfo.activePlayfields = activePlayfields == null ? 0 : activePlayfields.Count;

            Process EGSProcess = null;

            try{ EGSProcess = Process.GetProcessById(ProcessInformation.Id); } catch {}
            CurrentSysteminfo.online = SetState(CurrentSysteminfo.online, "E", EGSProcess == null);
            var ESGChildProcesses = EGSProcess?.GetChildProcesses().Where(P => P.ProcessName == "EmpyrionPlayfieldServer").ToArray();

            if (ESGChildProcesses != null)
            {
                CurrentSysteminfo.totalPlayfieldserver      = ESGChildProcesses.Count();
                CurrentSysteminfo.totalPlayfieldserverRamMB = ESGChildProcesses.Aggregate(0L, (S, P) => S + P.PrivateMemorySize64);
            }

            SystemConfig.Current.ProcessInformation = ProcessInformation;
            SystemConfig.Save();
        }
Example #6
0
 public void ClientHostMessage(ClientHostComData aMessage)
 {
     switch (aMessage.Command)
     {
     case ClientHostCommand.ProcessInformation:
         LastProcessInformationUpdate = DateTime.Now;
         if (aMessage.Data == null)
         {
             ToEmpyrion.SendMessage(new ClientHostComData()
             {
                 Command = ClientHostCommand.ProcessInformation,
                 Data    = new ProcessInformation()
                 {
                     Id = Process.GetCurrentProcess().Id
                 }
             });
         }
         else
         {
             ProcessInformation = aMessage.Data as ProcessInformation;
         } break;
     }
 }
Example #7
0
 private void OnStopping()
 {
     ToEmpyrion?.Close();
     FromEmpyrion?.Close();
 }