Microsoft.Protocols.TestSuites.MS_OXCFXICS.REPLGUID_IDSET.Deserialize C# (CSharp) Method

Deserialize() public method

Deserialize from a stream.
public Deserialize ( Stream stream, int size ) : int
stream Stream A stream contains serialize.
size int Must be -1.
return int
        public override int Deserialize(Stream stream, int size)
        {
            int usedBytes = 0;
            AdapterHelper.Site.Assert.AreEqual(-1, size, "The size value MUST be -1, the actual value is {0}.", size);

            this.idsetList = new List<REPLGUID_IDSETElement>();
            this.IsAllGLOBCNTInGLOBSET = true;
            this.IsAllGLOBCNTRanged = true;
            this.IsDisjointGLOBCNTMadeIntoSingleton = true;
            this.HasAllDuplicateGLOBCNTRemoved = true;
            this.HasGLOBCNTGroupedIntoRanges = true;
            while (stream.Position < stream.Length)
            {
                REPLGUID_IDSETElement ele = new REPLGUID_IDSETElement();
                usedBytes += ele.Deserialize(stream, -1);
                this.IsAllGLOBCNTInGLOBSET = IsAllGLOBCNTInGLOBSET
                    && ele.GLOBSET.IsAllGLOBCNTInGLOBSET;
                this.IsAllGLOBCNTRanged = IsAllGLOBCNTRanged
                    && ele.GLOBSET.IsAllGLOBCNTRanged;
                this.IsDisjointGLOBCNTMadeIntoSingleton = IsDisjointGLOBCNTMadeIntoSingleton
                    && ele.GLOBSET.IsDisjointGLOBCNTMadeIntoSingleton;
                this.HasAllDuplicateGLOBCNTRemoved = HasAllDuplicateGLOBCNTRemoved
                    && ele.GLOBSET.HasAllDuplicateGLOBCNTRemoved;
                this.HasGLOBCNTGroupedIntoRanges = HasGLOBCNTGroupedIntoRanges
                    && ele.GLOBSET.HasGLOBCNTGroupedIntoRanges;
                this.idsetList.Add(ele);
            }

            return usedBytes;
        }
    }

Usage Example

Exemplo n.º 1
0
        /// <summary>
        /// Gets the REPLGUID_IDSET.
        /// </summary>
        /// <param name="id">The id to be calculated.</param>
        /// <param name="type">The type to be calculated.</param>
        /// <returns>A REPLGUID_IDSET.</returns>
        public REPLGUID_IDSET GetIdset(ushort id, ushort type)
        {
            if (this.PropList != null)
            {
                byte[] buffer = this.PropList.GetPropValue(id, type) as byte[];
                if (buffer != null && buffer.Length > 0)
                {
                    using (MemoryStream ms = new MemoryStream(buffer, false))
                    {
                        REPLGUID_IDSET idset = null;
                        idset = new REPLGUID_IDSET();
                        idset.Deserialize(ms, -1);
                        return(idset);
                    }
                }
            }

            return(null);
        }
All Usage Examples Of Microsoft.Protocols.TestSuites.MS_OXCFXICS.REPLGUID_IDSET::Deserialize