public override void DeInit() { var pack = new TranslationProtocoll.Packet { method = TranslationProtocoll.PacketMethod.quit }; TranslationProtocoll.SendPacket(pack, _stream); _connection.Close(); }
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); } } }