예제 #1
0
        private void OnApproved(Message packet)
        {
            try
            {
                using (var approval = Approval.Deserialize(packet.read))
                {
                    ConsoleSystem.LogWarning(
                        $"[VirtualServer]: Подключились к: {(approval.official ? "[Oficial] " : "")}" +
                        approval.hostname);

                    if (_quitAfterConnected)
                    {
                        BaseClient.Disconnect("", true);
                        Framework.Quit();
                    }

                    BaseClient.Connection.encryptionLevel = approval.encryption;
                    BaseClient.Connection.decryptIncoming = true;

                    if (BaseClient.write.Start())
                    {
                        BaseClient.write.PacketId(Message.Type.Ready);
                        BaseClient.write.Send(new SendInfo(BaseClient.Connection));
                    }

                    packet.connection.encryptOutgoing = true;
                }
            }
            catch (Exception ex)
            {
                ConsoleSystem.LogError("[VirtualServer]: Исключение в OnApproved(): " + ex.Message);
            }
        }
예제 #2
0
        private void OnApproved(Message packet)
        {
            try
            {
                using (Approval approval = Approval.Deserialize(packet.read))
                {
                    ConsoleSystem.LogWarning($"[VirtualServer]: Вы подключились к: {(approval.official ? "[Oficial] " : "")}" + approval.hostname);

                    BaseClient.Connection.encryptionLevel = approval.encryption;
                    BaseClient.Connection.decryptIncoming = true;

                    if (BaseServer.write.Start())
                    {
                        BaseServer.write.PacketID(Message.Type.Approved);
                        Approval.Serialize(BaseServer.write, approval);
                        BaseServer.Send();
                    }
                    BaseServer.SetEncryptionLevel(approval.encryption);
                }
            }
            catch (Exception ex)
            {
                ConsoleSystem.LogError("[VirtualServer]: Исключение в OnApproved(): " + ex.Message);
            }
        }