Exemplo n.º 1
0
        private void ReceiveWfc29900(NetState ns, byte[] buffer, int length)
        {
            try {
                int offset = 0;
                while (offset < length && !ns.IsDisposing)
                {
                    GsTcpReader reader = new GsTcpReader(buffer, offset, length);
                    switch (reader.RecordType)
                    {
                    case "login":
                        OnReceive_Login(ns, reader);
                        break;

                    case "logout":
                        OnReceive_Logout(ns, reader);
                        break;

                    case "getprofile":
                        OnReceive_GetProfile(ns, reader);
                        break;

                    case "updatepro":
                        OnReceive_UpdateProfile(ns, reader);
                        break;

                    case "status":
                        OnReceive_Status(ns, reader);
                        break;

                    default:
                        Kernel.WriteLine(TypeName, $"{ns} sent unhandled Wfc29900 message.");
                        Console.WriteLine(BufferFormat.AsString(buffer, length));
                        break;
                    }
                    offset = reader.Position;
                }
            }
            catch (Exception e) {
                Console.Write($"{TypeName}: {e.Message}");
                ns.DisposeAfterNextFlush();
            }
        }
Exemplo n.º 2
0
 /// <summary>
 /// Throws an exception with message format ns message<br/>buffer.
 /// </summary>
 public NetStateMsgException(INetState ns, string message, byte[] buffer, int length)
     : base($"{(ns?.ToString() ?? "unknown")} {message}{Environment.NewLine}{BufferFormat.AsString(buffer, length)}")
 {
 }
Exemplo n.º 3
0
 /// <summary>
 /// Throws an exception with message format ns message<br/>buffer.
 /// </summary>
 public NetStateMsgException(INetState ns, string message, PacketReader reader)
     : base($"{(ns?.ToString() ?? "unknown")} {message}{Environment.NewLine}{BufferFormat.AsString(reader.Buffer, reader.Length)}")
 {
 }
Exemplo n.º 4
0
 private void ReceiveWfc29901(NetState ns, byte[] buffer, int length)
 {
     Console.WriteLine($"{TypeName}: {ns} sent unhandled Wfc29901 message");
     Console.WriteLine(BufferFormat.AsString(buffer, length));
 }