Esempio n. 1
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);
        }
Esempio n. 2
0
        /// <summary>
        /// Get the profile data size
        /// </summary>
        /// <returns>Data size of one profile (in units of bytes)</returns>
        private uint GetOneProfileDataSize()
        {
            // Buffer size (in units of bytes)
            uint retBuffSize = 0;

            // Basic size
            int basicSize = (int)_cmbMeasureX.SelectedValue / (int)_cmbReceivedBinning.SelectedValue;
            basicSize /= (int)_cmbCompressX.SelectedValue;

            // Number of headers
            retBuffSize += (uint)basicSize * (_rdbtnOneHead.Checked ? 1U : 2U);

            // Envelope setting
            retBuffSize *= (_chkboxEnvelope.Checked ? 2U : 1U);

            //in units of bytes
            retBuffSize *= (uint)Marshal.SizeOf(typeof(uint));

            // Sizes of the header and footer structures
            LJV7IF_PROFILE_HEADER profileHeader = new LJV7IF_PROFILE_HEADER();
            retBuffSize += (uint)Marshal.SizeOf(profileHeader);
            LJV7IF_PROFILE_FOOTER profileFooter = new LJV7IF_PROFILE_FOOTER();
            retBuffSize += (uint)Marshal.SizeOf(profileFooter);

            return retBuffSize;
        }
Esempio n. 3
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;
        }