コード例 #1
0
        private static void Call()
        {
            SMPInterface.Reader.ReadByte();
            SMPInterface.Debug("Got handshake\n");

            string ConnectionHash = SMPInterface.Reader.ReadString();

            SMPInterface.Debug("Got connection hash, length: " + ConnectionHash.Length.ToString() + "\n");
            if (ConnectionHash != "-")
            {
                if (!SMPInterface.AuthConnect(SMPInterface.CaseUsername, ConnectionHash))
                {
                    SMPInterface.Disconnect();
                    SMPInterface.Debug("Failed to auth connect.\n");
                    return;
                }
            }
            else
            {
                SMPInterface.Debug("Server is not authing\n");
            }
            SMPInterface.Debug("Sending Login Request\n");

            SMPInterface.Handler.SetOperationCode(SMPInterface.PacketTypes.LoginReq);
            SMPInterface.Handler.Write((int)ProtoclVersion);
            SMPInterface.Handler.Write(SMPInterface.Username);

            if (SMPInterface.SrvPassword.Length > 0)
            {
                SMPInterface.Handler.Write(SMPInterface.SrvPassword);
            }
            else
            {
                SMPInterface.Handler.Write("Password");
            }

            SMPInterface.Handler._Write(new byte[9]); // stuff we don't need
            SMPInterface.Handler.Flush();
        }