private void Application(Socket socket, Subheader sh, PacketReader pr) { ServerUserInformation sentUser = FindUser(pr.ReadObject <SessionInformation>()); switch (sh) { case Subheader.ADDUSR: if (DatabaseQuery.AddFriend(sentUser, pr.ReadObject <UserInformation>()) != Subheader.NULL) { SendError(socket, sh, null); } break; case Subheader.REMOVEUSR: case Subheader.DEC_REQ: if (DatabaseQuery.RemoveFriend(sentUser, pr.ReadObject <FriendInformation>()) != Subheader.NULL) { SendError(socket, sh, null); } break; case Subheader.BLOCKUSR: case Subheader.ACC_REQ: if (DatabaseQuery.UpdateFriendRequest(sentUser, pr.ReadObject <FriendInformation>()) != Subheader.NULL) { SendError(socket, sh, null); } break; case Subheader.VIEWFRIENDS: if (DatabaseQuery.ViewFriends(sentUser) != Subheader.NULL) { SendError(socket, sh, null); } break; case Subheader.PING: SendHeaders(socket, Header.Application, sh); break; default: // Invalid Subheader Dispose(socket); Console.WriteLine("Application disposal: " + (int)sh); //SendError(socket, Subheader.INVALIDREQ, null); break; } }