日期:2014-05-18 浏览次数:21046 次
//类定义 public class Classxxoo { private const int MAX_CLIPENUM_IN_BLOCK = 254; private const int BLOCK_INDEX_NUM = (8 * 1024); //[StructLayout(LayoutKind.Sequential)] private struct Block_File { public uint frameNum; public uint clipStime; public uint clipEtime; public uint clip_size; public uint index_num; } //[StructLayout(LayoutKind.Sequential)] private struct clipIdx_info_t { public byte channel; public byte status; public ushort fileInfoIdx; public Block_File blkfile; //注意,这一行注释掉就正常工作了 public uint index_off; public uint clip_off; } //[StructLayout(LayoutKind.Sequential)] private struct KeyIndex { public uint cKeyOffset; public uint TimeStampSec; } //[StructLayout(LayoutKind.Sequential)] private struct blockIdx_info_t { public uint block_inf; public uint block_size; public uint block_no; public byte channel; public byte block_status; public byte block_type; public byte clip_num; public uint recover_num; public uint write_Size; public uint blockStime; public uint blockEtime; public uint index_num; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 28)] public byte[] rev; [MarshalAs(UnmanagedType.ByValArray, SizeConst = 8)] public clipIdx_info_t[] clip_info; } private blockIdx_info_t m_FileIndex; public Classxxoo( ) { m_FileIndex = new blockIdx_info_t(); } } //------------------运行代码------------------------ class Program { static void Main(string[] args) { Classxxoo xxoo = new Classxxoo( ); Console.WriteLine(xxoo.ToString()); Console.Read(); } }