예제 #1
0
 public CoCRemoteClient(CoCServer server, Socket connection)
 {
     Connection = connection;
     Server = server;
     NetworkManager = new NetworkManagerAsync(connection, HandlePacketReceived, HandleReceicedPacketFailed);
     PacketHandlers = new Dictionary<ushort, PacketHandler>();
 }
예제 #2
0
        private void ConnectAsyncCompleted(object sender, SocketAsyncEventArgs e)
        {
            if (e.SocketError != SocketError.Success)
                throw new SocketException((int)e.SocketError);

            NetworkManager = new NetworkManagerAsync(e.ConnectSocket);
            NetworkManager.PacketReceived += OnPacketReceived;
            NetworkManager.Seed = new Random().Next();
            SendPacket(new LoginRequestPacket()
            {
                UserID = Avatar.ID,
                UserToken = Avatar.Token,
                ClientMajorVersion = 7,
                ClientContentVersion = 12,
                ClientMinorVersion = 200,
                FingerprintHash = "8771aa1095195c4217bd625d66e120d91e8d15b0",
                OpenUDID = "563a6f060d8624db",
                MacAddress = null,
                DeviceModel = "GT-I9300",
                LocaleKey = 2000000,
                Language = "en",
                AdvertisingGUID = "",
                OSVersion = "4.0.4",
                IsAdvertisingTrackingEnabled = false,
                AndroidDeviceID = "563a6f060d8624db",
                FacebookDistributionID = "",
                VendorGUID = "",
                Seed = NetworkManager.Seed
            });
            KeepAliveManager.Start();
        }
예제 #3
0
 public CoCRemoteClient(CoCServer server, Socket connection, NetworkManagerAsyncSettings settings)
 {
     _server = server;
     Connection = connection;
     Avatar = new Avatar();
     NetworkManager = new NetworkManagerAsync(connection, settings);
     NetworkManager.MessageReceived += OnMessageReceived;
 }
예제 #4
0
 public CoCRemoteClient(CoCServer server, Socket connection)
 {
     Connection = connection;
     Server = server;
     NetworkManager = new NetworkManagerAsync(connection);
     NetworkManager.PacketReceived += OnPacketReceived;
     PacketHandlers = new Dictionary<ushort, PacketHandler>();
     Avatar = new Avatar();
     Home = new Village();
 }
예제 #5
0
        public CoCProxyClient(Socket client, Socket server, NetworkManagerAsyncSettings settings)
        {
            // client connection is initiated with standard keys because we are acting as the server
            ClientConnection = new NetworkManagerAsync(client, settings);
            ClientConnection.MessageReceived += ClientReceived;

            var publicKeyS = Utils.BytesToString(ClientConnection.Crypto.KeyPair.PublicKey);
            var privateKeyS = Utils.BytesToString(ClientConnection.Crypto.KeyPair.PrivateKey);
            Console.WriteLine("Acting as server with standard \n\tpublickey: {0} \n\tprivatekey: {1}", publicKeyS, privateKeyS);

            // server connection is initiated with generated keys because we are acting as the client
            ServerConnection = new NetworkManagerAsync(server, settings);
            ServerConnection.Crypto = new Crypto8(MessageDirection.Server);
            ServerConnection.Crypto.UpdateSharedKey(Crypto8.SupercellPublicKey); // use supercell's public key
            ServerConnection.MessageReceived += ServerReceived;

            var publicKeyC = Utils.BytesToString(ServerConnection.Crypto.KeyPair.PublicKey);
            var privateKeyC = Utils.BytesToString(ServerConnection.Crypto.KeyPair.PrivateKey);
            Console.WriteLine("Acting as client with generated \n\tpublickey: {0} \n\tprivatekey: {1}", publicKeyC, privateKeyC);
        }
예제 #6
0
        private void ConnectAsyncCompleted(object sender, SocketAsyncEventArgs e)
        {
            // 6c12b527e6810ff7301d972042ae3614f3d73acc
            // ae9b056807ac8bfa58a3e879b1f1601ff17d1df5
            if (e.SocketError != SocketError.Success)
                throw new SocketException((int)e.SocketError);

            NetworkManager = new NetworkManagerAsync(e.ConnectSocket, HandleReceivedPacket, HandleReceicedPacketFailed);
            NetworkManager.Seed = new Random().Next();
            QueuePacket(new LoginRequestPacket()
            {
                UserID = Avatar.ID,
                UserToken = Avatar.Token,
                ClientMajorVersion = 7,
                ClientContentVersion = 0,
                ClientMinorVersion = 156,
                FingerprintHash = "ae9b056807ac8bfa58a3e879b1f1601ff17d1df5",
                OpenUDID = "563a6f060d8624db",
                MacAddress = null,
                DeviceModel = "GT-I9300",
                LocaleKey = 2000000,
                Language = "en",
                AdvertisingGUID = "",
                OSVersion = "4.0.4",
                IsAdvertisingTrackingEnabled = false,
                AndroidDeviceID = "563a6f060d8624db",
                FacebookDistributionID = "",
                VendorGUID = "",
                Seed = NetworkManager.Seed
            });
            KeepAliveManager.Start();
        }