public override void DeInit()
        {
            var pack = new TranslationProtocoll.Packet
            {
                method = TranslationProtocoll.PacketMethod.quit
            };

            TranslationProtocoll.SendPacket(pack, _stream);
            _connection.Close();
        }
        public override IEnumerator Translate(TranslationData data)
        {
            bool startCollecting = _openRequests == 0;

            _openRequests++;
            TranslationProtocoll.SendTranslationRequest(data, _stream);

            if (startCollecting)
            {
                Logger.Log("Starting collection coroutine");
                StartCoroutine(CollectPackets());
            }

            yield return(new WaitForTranslation(this, data.Id));

            Logger.Log("Translation arrived");

            var pack = _arrivedTranslations[data.Id];

            TranslationProtocoll.ParsePacketForTranslation(pack, data);
        }
        private IEnumerator CollectPackets()
        {
            while (_openRequests > 0)
            {
                var pack = new TranslationProtocoll.Packet();
                Logger.Log("Begin waiting for packet (collectPackets)");
                Logger.Log($"Have {_openRequests} open requests:");
                yield return(TranslationProtocoll.ReadPacket(_stream, pack));

                Logger.Log($"Got data! Packet #{pack.id}", 0);
                Logger.Log(pack.text, 0);
                if (pack.method == TranslationProtocoll.PacketMethod.translation)
                {
                    _openRequests--;
                }
                if (pack.id != null)
                {
                    _arrivedTranslations.Add(pack.id.Value, pack);
                }
            }
        }