Exemplo n.º 1
0
        /// <summary>
        /// Data size calculation
        /// </summary>
        /// <param name="profileInfo">Profile information</param>
        /// <returns>Profile data size</returns>
        static public int CalculateDataSize(LJV7IF_PROFILE_INFO profileInfo)
        {
            LJV7IF_PROFILE_HEADER header = new LJV7IF_PROFILE_HEADER();
            LJV7IF_PROFILE_FOOTER footer = new LJV7IF_PROFILE_FOOTER();

            return(profileInfo.wProfDataCnt * profileInfo.byProfileCnt * (profileInfo.byEnvelope + 1) +
                   (Marshal.SizeOf(header) + Marshal.SizeOf(footer)) / Marshal.SizeOf(typeof(int)));
        }
Exemplo n.º 2
0
        /// <summary>
        /// Get the byte size of the structure.
        /// </summary>
        /// <param name="profileHeader">Structure whose byte size you want to get.</param>
        /// <returns>Byte size</returns>
        public static int GetByteSize(TypeOfStruct type)
        {
            switch (type)
            {
            case TypeOfStruct.PROFILE_HEADER:
                LJV7IF_PROFILE_HEADER profileHeader = new LJV7IF_PROFILE_HEADER();
                return(Marshal.SizeOf(profileHeader));

            case TypeOfStruct.PROFILE_FOOTER:
                LJV7IF_PROFILE_FOOTER profileFooter = new LJV7IF_PROFILE_FOOTER();
                return(Marshal.SizeOf(profileFooter));

            case TypeOfStruct.MEASURE_DATA:
                LJV7IF_MEASURE_DATA measureData = new LJV7IF_MEASURE_DATA();
                return(Marshal.SizeOf(measureData));
            }

            return(0);
        }