コード例 #1
0
        public void Init()
        {
            SecSession = new Session();
            Initialized = false;

            ServerPackets = new PacketStream("S");
            ClientPackets = new PacketList("C");

            Packets = new List<Packet_old>();
        }
コード例 #2
0
 private static Session CreateSession(byte[] clientKey1, byte[] clientKey2, byte[] serverKey1, byte[] serverKey2)
 {
     var session = new Session
     {
         ClientKey1 = clientKey1,
         ClientKey2 = clientKey2,
         ServerKey1 = serverKey1,
         ServerKey2 = serverKey2
     };
     session.Init();
     Console.WriteLine("Success");
     return session;
 }
コード例 #3
0
        private void TryInitialize()
        {
            if (Initialized)
                throw new InvalidOperationException("Already initalized");
            if (_client.Length < 256 || _server.Length < 256 + 4)
                return;

            _server.Position = 0;
            _client.Position = 0;

            var magicBytes = _server.ReadBytes(4);
            if (!magicBytes.SequenceEqual(new byte[] {1, 0, 0, 0}))
                throw new FormatException("Not a Tera connection");

            var clientKey1 = _client.ReadBytes(128);
            var clientKey2 = _client.ReadBytes(128);
            var serverKey1 = _server.ReadBytes(128);
            var serverKey2 = _server.ReadBytes(128);
            _session = CreateSession(clientKey1, clientKey2, serverKey1, serverKey2);

            ClientToServer(_client.ReadBytes((int) (_client.Length - _client.Position)));
            ServerToClient(_server.ReadBytes((int) (_server.Length - _server.Position)));
            _client = null;
            _server = null;
        }
コード例 #4
0
 private static Session CreateSession(byte[] clientKey1, byte[] clientKey2, byte[] serverKey1, byte[] serverKey2)
 {
     var session = new Session();
     session.ClientKey1 = clientKey1;
     session.ClientKey2 = clientKey2;
     session.ServerKey1 = serverKey1;
     session.ServerKey2 = serverKey2;
     session.Init();
     return session;
 }