Esempio n. 1
0
            public Thumbnail Deserialize(Omnix.Serialization.RocketPack.RocketPackReader r, int rank)
            {
                if (rank > 256)
                {
                    throw new System.FormatException();
                }

                // Read property count
                uint propertyCount = r.GetUInt32();

                System.Buffers.IMemoryOwner <byte> p_value = Omnix.Base.SimpleMemoryOwner <byte> .Empty;

                for (; propertyCount > 0; propertyCount--)
                {
                    uint id = r.GetUInt32();
                    switch (id)
                    {
                    case 0:     // Value
                    {
                        p_value = r.GetRecyclableMemory(33554432);
                        break;
                    }
                    }
                }

                return(new Thumbnail(p_value));
            }
Esempio n. 2
0
            public SessionDataMessage Deserialize(Omnix.Serialization.RocketPack.RocketPackReader r, int rank)
            {
                if (rank > 256)
                {
                    throw new System.FormatException();
                }

                // Read property count
                uint propertyCount = r.GetUInt32();

                ulong p_sessionId   = 0;
                bool  p_isCompleted = false;

                System.Buffers.IMemoryOwner <byte> p_data = Omnix.Base.SimpleMemoryOwner <byte> .Empty;

                for (; propertyCount > 0; propertyCount--)
                {
                    uint id = r.GetUInt32();
                    switch (id)
                    {
                    case 0:     // SessionId
                    {
                        p_sessionId = r.GetUInt64();
                        break;
                    }

                    case 1:     // IsCompleted
                    {
                        p_isCompleted = r.GetBoolean();
                        break;
                    }

                    case 2:     // Data
                    {
                        p_data = r.GetRecyclableMemory(262144);
                        break;
                    }
                    }
                }

                return(new SessionDataMessage(p_sessionId, p_isCompleted, p_data));
            }