Ejemplo n.º 1
0
 private void tox_OnFriendLosslessPacketReceived(object sender, ToxEventArgs.FriendPacketEventArgs e)
 {
     lock (friendMessageLock)
     {
         friendMessageQueue.Enqueue(e.Data);
     }
 }
Ejemplo n.º 2
0
        void tox_OnFriendLosslessPacketReceived(object sender, ToxEventArgs.FriendPacketEventArgs e)
        {
            //get the name associated with the friendnumber
            byte[] receivedData = new byte[e.Data.Length - 1];
            for (int i = 0; i < receivedData.Length; i++)
            {
                receivedData [i] = e.Data [i + 1];
            }
            Package receivedPackage = Package.fromBytesStatic(receivedData);

            Utils.Utils.LogUtils("Event: Received package, PackageId:" + receivedPackage.uuid);
            if (receivedPackage.currentCount == 0)
            {
                if (receivedPackage.totalCount == 1)
                {
                    lock (reqQueueLock) {
                        reqQueue.Enqueue(Package.fromBytes(receivedData));
                    }
                    return;
                }
                byte[] fullSizeContent = new byte[receivedPackage.totalSize];
                receivedPackage.content.CopyTo(fullSizeContent, 0);
                mPackageCache.Add(receivedPackage.uuid, fullSizeContent);
            }
            else if (receivedPackage.currentCount != receivedPackage.totalCount - 1)
            {
                receivedPackage.content.CopyTo(mPackageCache [receivedPackage.uuid], receivedPackage.startIndex);
            }
            else if (receivedPackage.currentCount == receivedPackage.totalCount - 1)
            {
                lock (reqQueueLock) {
                    reqQueue.Enqueue(Package.fromBytes(receivedData));
                }
            }
        }
Ejemplo n.º 3
0
 private void OnToxFriendLosslessPacketReceived(object sender, ToxEventArgs.FriendPacketEventArgs e)
 {
     Logger.Log(LogLevel.Warning, "ToxFriendLosslessPacketReceived mot supported, canceled");
 }