The BinaryArray_r structure is an array of Binary_r data structures.
예제 #1
0
        /// <summary>
        /// Parse BinaryArray_r structure.
        /// </summary>
        /// <param name="ptr">A pointer points to memory allocated.</param>
        /// <returns>Instance of BinaryArray_r structure.</returns>
        public static BinaryArray_r ParseBinaryArray_r(IntPtr ptr)
        {
            BinaryArray_r binaryArray = new BinaryArray_r
            {
                Values = (uint)Marshal.ReadInt32(ptr)
            };

            if (binaryArray.Values == 0)
            {
                binaryArray.Lpbin = null;
            }
            else
            {
                binaryArray.Lpbin = new Binary_r[binaryArray.Values];
                IntPtr baaddr = new IntPtr(Marshal.ReadInt32(ptr, sizeof(uint)));
                for (uint i = 0; i < binaryArray.Values; i++)
                {
                    binaryArray.Lpbin[i] = ParseBinary_r(baaddr);
                    baaddr = new IntPtr(baaddr.ToInt32() + 8);
                }
            }

            return(binaryArray);
        }
        /// <summary>
        /// Parse BinaryArray_r structure.
        /// </summary>
        /// <param name="ptr">A pointer points to the allocated memory.</param>
        /// <returns>Instance of BinaryArray_r structure.</returns>
        public static BinaryArray_r ParseBinaryArray_r(IntPtr ptr)
        {
            BinaryArray_r binaryArray = new BinaryArray_r
            {
                CValues = (uint)Marshal.ReadInt32(ptr)
            };

            if (binaryArray.CValues == 0)
            {
                binaryArray.Lpbin = null;
            }
            else
            {
                if (AdapterHelper.Transport.ToLower(System.Globalization.CultureInfo.CurrentCulture) != "mapi_http")
                {
                    IntPtr baaddr = new IntPtr(Marshal.ReadInt32(ptr, sizeof(uint)));
                    binaryArray.Lpbin = new Binary_r[binaryArray.CValues];
                    for (uint i = 0; i < binaryArray.CValues; i++)
                    {
                        binaryArray.Lpbin[i] = ParseBinary_r(baaddr);
                        baaddr = new IntPtr(baaddr.ToInt32() + 8);
                    }
                }
                else
                {
                    binaryArray.Lpbin = new Binary_r[binaryArray.CValues];
                    for (uint i = 0; i < binaryArray.CValues; i++)
                    {
                        binaryArray.Lpbin[i] = ParseBinary_r(ptr);
                    }
                }
            }

            return binaryArray;
        }