/// <summary> /// Get the profile data size /// </summary> /// <returns>Data size of one profile (in units of bytes)</returns> private uint GetOneProfileDataSize() { try { // Buffer size (in units of bytes) uint retBuffSize = 0; _envelopeMode = true; // Basic size int basicSize = (int)Define.MEASURE_RANGE_FULL / (int)Define.RECEIVED_BINNING_OFF; basicSize /= (int)Define.COMPRESS_X_OFF; // Number of headers retBuffSize += (uint)basicSize * _probeSetup.ProbeCount; // Envelope setting retBuffSize *= (_envelopeMode ? 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); } catch (Exception) { throw; } }
/// <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))); }
/// <summary> /// Data size calculation /// </summary> /// <param name="profileInfo">Profile information</param> /// <returns>Profile data size</returns> public static 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)); }