public void Approve(NetIncomingMessage msg, Server server) { if (msg.PeekString() != null) { switch (msg.ReadString()) { case "RELEASE_GAME_IOS": case "RELEASE_GAME_ANDROID": case "RELEASE_GAME_DESKTOP": case "RELEASE_GAME_WEB": if (HasCorrectVersion(msg)) { try { //proceed SecureMessageDecoder sed = new SecureMessageDecoder(msg); byte[][] contents = sed.ReadAndDecodeContents(); if (server.ecdhrsaProvider.IsVerified(contents[0], contents[1], contents[2])) { msg.SenderConnection.Approve(); Console.WriteLine("APPROVAL: uniqueId " + NetUtility.ToHexString(msg.SenderConnection.RemoteUniqueIdentifier)); return; } } catch (Exception e) { Console.WriteLine(e); msg.SenderConnection.Deny(); } } else { //send msg forcing to update. msg.SenderConnection.Deny(Convert.ToChar(DisconnectResponse.RECONNECT).ToString()); return; } break; default: msg.SenderConnection.Deny(); return; } } msg.SenderConnection.Deny(); }
public static void Data(NetIncomingMessage msg, Client client) { try { Console.WriteLine("msg.Length :" + msg.LengthBytes); SecureMessageDecoder sed = new SecureMessageDecoder(msg); byte[][] contents = sed.ReadAndDecodeContents(); if (client.ecdhrsaProvider.IsVerified(contents[0], contents[1], contents[2])) { Console.WriteLine("IS VERIFIED AND READY TO GOOOOOOOOOOOOOOO"); } else { Console.WriteLine("NOT VERIFIED"); } } catch (Exception e) { Console.WriteLine(e); } }