This class represents a set of PropertyRows
상속: Node
        /// <summary>
        /// Deserialize the ROP response buffer.
        /// </summary>
        /// <param name="ropBytes">ROPs bytes in response.</param>
        /// <param name="startIndex">The start index of this ROP.</param>
        /// <returns>The size of response buffer structure.</returns>
        public int Deserialize(byte[] ropBytes, int startIndex)
        {
            int index = startIndex;

            this.RopId            = ropBytes[index++];
            this.InputHandleIndex = ropBytes[index++];
            this.ReturnValue      = (uint)BitConverter.ToInt32(ropBytes, index);
            index += sizeof(uint);

            // Only success response has below fields
            if (this.ReturnValue == 0)
            {
                this.RowCount = (uint)BitConverter.ToUInt32(ropBytes, index);
                index        += sizeof(uint);

                List <Property> properties     = new List <Property>();
                Property        pidTagFolderId = new Property(PropertyType.PtypInteger64)
                {
                    Name = "PidTagFolderId"
                };
                properties.Add(pidTagFolderId);

                Property pidTagMessageClass = new Property(PropertyType.PtypString8)
                {
                    Name = "PidTagMessageClass"
                };
                properties.Add(pidTagMessageClass);

                Property pidTagLastModificationTime = new Property(PropertyType.PtypTime)
                {
                    Name = "PidTagLastModificationTime"
                };
                properties.Add(pidTagLastModificationTime);

                Context.Instance.Properties    = properties;
                Context.Instance.PropertyBytes = ropBytes;
                Context.Instance.CurIndex      = index;
                this.Rows = new PropertyRowSet
                {
                    Count = (int)this.RowCount
                };

                // Set row count
                this.Rows.Parse(Context.Instance);

                // Context.Instance.CurIndex indicates the already deserialized bytes' index
                index = Context.Instance.CurIndex;
            }

            return(index - startIndex);
        }
예제 #2
0
        /// <summary>
        /// Deserialize the ROP response buffer.
        /// </summary>
        /// <param name="ropBytes">ROPs bytes in response.</param>
        /// <param name="startIndex">The start index of this ROP.</param>
        /// <returns>The size of response buffer structure.</returns>
        public int Deserialize(byte[] ropBytes, int startIndex)
        {
            int index = startIndex;

            this.RopId            = ropBytes[index++];
            this.InputHandleIndex = ropBytes[index++];
            this.ReturnValue      = BitConverter.ToUInt32(ropBytes, index);
            index += sizeof(uint);

            // Only success response has below fields
            if (this.ReturnValue == 0)
            {
                this.Origin   = ropBytes[index++];
                this.RowCount = BitConverter.ToUInt16(ropBytes, index);
                index        += sizeof(ushort);

                // Parse RowData
                // Add RowData bytes into Context
                Context.Instance.PropertyBytes = ropBytes;
                Context.Instance.CurIndex      = index;

                // Allocate PropretyRowSetNode to parse RowData
                this.RowData = new PropertyRowSet
                {
                    // Set row count
                    Count = this.RowCount
                };

                this.RowData.Parse(Context.Instance);

                // Context.Instance.CurIndex indicates the already deserialized bytes' index
                index = Context.Instance.CurIndex;
            }
            else
            {
                this.Origin   = 0;
                this.RowCount = 0;
                this.RowData  = null;
            }

            return(index - startIndex);
        }
        /// <summary>
        /// Deserialize the ROP response buffer.
        /// </summary>
        /// <param name="ropBytes">ROPs bytes in response.</param>
        /// <param name="startIndex">The start index of this ROP.</param>
        /// <returns>The size of response buffer structure.</returns>
        public int Deserialize(byte[] ropBytes, int startIndex)
        {
            int index = startIndex;
            this.RopId = ropBytes[index++];
            this.InputHandleIndex = ropBytes[index++];
            this.ReturnValue = BitConverter.ToUInt32(ropBytes, index);
            index += sizeof(uint);

            // Only success response has below fields
            if (this.ReturnValue == 0)
            {
                this.Origin = ropBytes[index++];
                this.RowCount = BitConverter.ToUInt16(ropBytes, index);
                index += sizeof(ushort);

                // Parse RowData
                // Add RowData bytes into Context
                Context.Instance.PropertyBytes = ropBytes;
                Context.Instance.CurIndex = index;

                // Allocate PropretyRowSetNode to parse RowData
                this.RowData = new PropertyRowSet
                {
                    // Set row count
                    Count = this.RowCount
                };
                
                this.RowData.Parse(Context.Instance);

                // Context.Instance.CurIndex indicates the already deserialized bytes' index
                index = Context.Instance.CurIndex;
            }
            else
            {
                this.Origin = 0;
                this.RowCount = 0;
                this.RowData = null;
            }

            return index - startIndex;
        }
        /// <summary>
        /// Deserialize the ROP response buffer.
        /// </summary>
        /// <param name="ropBytes">ROPs bytes in response.</param>
        /// <param name="startIndex">The start index of this ROP.</param>
        /// <returns>The size of response buffer structure.</returns>
        public int Deserialize(byte[] ropBytes, int startIndex)
        {
            int index = startIndex;
            this.RopId = ropBytes[index++];
            this.InputHandleIndex = ropBytes[index++];
            this.ReturnValue = (uint)BitConverter.ToInt32(ropBytes, index);
            index += sizeof(uint);

            // Only success response has below fields
            if (this.ReturnValue == 0)
            {
                this.RowCount = (uint)BitConverter.ToUInt32(ropBytes, index);
                index += sizeof(uint);
             
                List<Property> properties = new List<Property>();
                Property pidTagFolderId = new Property(PropertyType.PtypInteger64)
                {
                    Name = "PidTagFolderId"
                };
                properties.Add(pidTagFolderId);

                Property pidTagMessageClass = new Property(PropertyType.PtypString8)
                {
                    Name = "PidTagMessageClass"
                };
                properties.Add(pidTagMessageClass);

                Property pidTagLastModificationTime = new Property(PropertyType.PtypTime)
                {
                    Name = "PidTagLastModificationTime"
                };
                properties.Add(pidTagLastModificationTime);

                Context.Instance.Properties = properties;
                Context.Instance.PropertyBytes = ropBytes;
                Context.Instance.CurIndex = index;
                this.Rows = new PropertyRowSet
                {
                    Count = (int)this.RowCount
                };

                // Set row count
                this.Rows.Parse(Context.Instance);

                // Context.Instance.CurIndex indicates the already deserialized bytes' index
                index = Context.Instance.CurIndex;
            }

            return index - startIndex;
        }