Example #1
0
        public static void OnReceive(NetState state, PacketReader pvSrc)
        {
            byte cmd = pvSrc.ReadByte();

            if (cmd == 0x02)
            {
                Authenticate(state, pvSrc);
            }
            else if (cmd == 0xFE)
            {
                state.Send(new CompactServerInfo());
                state.Dispose();
            }
            else if (cmd == 0xFF)
            {
                string statStr = String.Format(", Name={0}, Age={1}, Clients={2}, Items={3}, Chars={4}, Mem={5}K, Ver={6}", Server.Misc.ServerList.ServerName, (int)(DateTime.Now - Server.Items.Clock.ServerStart).TotalHours, NetState.Instances.Count, World.Items.Count, World.Mobiles.Count, (int)(System.GC.GetTotalMemory(false) / 1024), ProtocolVersion);
                state.Send(new UOGInfo(statStr));
                state.Dispose();
            }
            else if (!IsAuth(state))
            {
                Console.WriteLine("ADMIN: Unauthorized packet from {0}, disconnecting", state);
                Disconnect(state);
            }
            else
            {
                if (!RemoteAdminHandlers.Handle(cmd, state, pvSrc))
                {
                    Disconnect(state);
                }
            }
        }
Example #2
0
        public static void OnReceive(NetState state, PacketReader pvSrc)
        {
            byte cmd = pvSrc.ReadByte();

            if (cmd == 0x02)
            {
                Authenticate(state, pvSrc);
            }
            else if (cmd == 0xFD)
            {
                state.Send(new UOGInfo(Statistics.GetReceiveData()));
                state.Dispose();
            }
            else if (cmd == 0xFE)
            {
                state.Send(new CompactServerInfo());
                state.Dispose();
            }
            else if (cmd == 0xFF)
            {
                string statStr = $", Name={Misc.ServerList.ServerName}, Age={(int) (DateTime.UtcNow - Items.Clock.ServerStart).TotalHours}, Clients={NetState.Instances.Count}, Items={World.Items.Count}, Chars={World.Mobiles.Count}, Mem={(int) (GC.GetTotalMemory(false) / 1024)}K, Ver={ProtocolVersion}";

                state.Send(new UOGInfo(statStr));
                state.Dispose();
            }
            else if (!IsAuth(state))
            {
                Console.WriteLine("ADMIN: Unauthorized packet from {0}, disconnecting", state);
                Disconnect(state);
            }
            else
            {
                if (!RemoteAdminHandlers.Handle(cmd, state, pvSrc))
                {
                    Disconnect(state);
                }
            }
        }
Example #3
0
 public static void Configure()
 {
     RemoteAdminHandlers.Register(0x41, new OnPacketReceive(Save));
     RemoteAdminHandlers.Register(0x42, new OnPacketReceive(Shutdown));
     RemoteAdminHandlers.Register(0x46, new OnPacketReceive(WorldBroadcast));
 }