Decode() public static method

public static Decode ( DeOps.Implementation.Protocol.G2Header root ) : WebCache
root DeOps.Implementation.Protocol.G2Header
return WebCache
Beispiel #1
0
        public static InvitePackage OpenInvite(byte[] decrypted, G2Protocol protocol)
        {
            // if we get down here, opening invite was success

            MemoryStream mem    = new MemoryStream(decrypted);
            PacketStream stream = new PacketStream(mem, protocol, FileAccess.Read);

            InvitePackage package = new InvitePackage();

            G2Header root = null;

            while (stream.ReadPacket(ref root))
            {
                if (root.Name == InvitePacket.Info)
                {
                    package.Info = OneWayInvite.Decode(root);
                }

                if (root.Name == InvitePacket.Contact)
                {
                    package.Contacts.Add(DhtContact.ReadPacket(root));
                }

                if (root.Name == InvitePacket.WebCache)
                {
                    package.Caches.Add(WebCache.Decode(root));
                }
            }

            return(package);
        }