public static void Switch(GstatsSession session, Dictionary <string, string> recv) { string command = recv.Keys.First(); try { switch (command) { case "auth": AuthHandler.SendSessionKey(session, recv); break; case "authp": AuthPHandler.AuthPlayer(session, recv); break; case "getpd": //get player data break; default: session.UnknownDataRecived(recv); break; } } catch (Exception e) { LogWriter.Log.WriteException(e); } }
public static void SendSessionKey(GstatsSession session, Dictionary <string, string> dict) { //we have to verify the challenge response from the game, the response challenge is computed as //len = sprintf(resp, "%d%s",g_crc32(challenge,(int)strlen(challenge)), gcd_secret_key); //MD5Digest((unsigned char *)resp, (unsigned int)len, md5val); //DOXCODE(respformat, sizeof(respformat) - 1, enc3); //len = sprintf(resp, respformat, gcd_gamename, md5val, gameport); string sendingBuffer = string.Format(@"\sesskey\{0}", dict["response"]); session.SendAsync(sendingBuffer); }
//request \authp\\pid\27\resp\16ae1e1f47c8ab646de7a52d615e3b06\lid\0\final\ public static void AuthPlayer(GstatsSession session, Dictionary <string, string> dict) { /* * process the playerauth result * first, check \resp\16ae1e1f47c8ab646de7a52d615e3b06 * then find the */ //session.SendAsync(@"\pauthr\26\lid\"+dict["lid"]); session.SendAsync(@"\getpidr\26\lid\" + dict["lid"]); //session.SendAsync(@"\pauthr\26\lid\" + dict["lid"]); //session.SendAsync(@" \getpdr\26\lid\"+dict["lid"]+@"\mod\1234\length\5\data\mydata"); //session.SendAsync(@"\setpdr\1\lid\"+dict["lid"]+@"\pid\26\mod\123"); }