Example #1
0
        /// <summary>
        /// 获取记录列表
        /// </summary>
        public void Get_Record_List()
        {
            CcdRecordModels.Clear();
            SDKApi.EagleData_RefetchRecList();
            int record_num = SDKApi.EagleData_GetRecordNumber();

            if (record_num > 0)
            {
                IntPtr intPtr        = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(EagleData_Record_Id)) * record_num);
                int    nStructLength = Marshal.SizeOf(typeof(EagleData_Record));

                int actual_num = SDKApi.EagleData_GetRecordList(intPtr, record_num);

                _recordIds = new EagleData_Record_Id[actual_num];

                for (int i = 0; i < actual_num; i++)
                {
                    _recordIds[i] = (EagleData_Record_Id)Marshal.PtrToStructure(intPtr + Marshal.SizeOf(typeof(EagleData_Record_Id)) * i, typeof(EagleData_Record_Id));
                    // EagleData_Record ccd = new EagleData_Record();
                    var record = SDKApi.EagleData_GetRecordAndAllocMemory(_recordIds[i]);
                    var ccd    = (EagleData_Record)Marshal.PtrToStructure(record, typeof(EagleData_Record));

                    //得到数据项
                    var item  = (EagleData_CcdRecord)Marshal.PtrToStructure(ccd.ccd_record_list, typeof(EagleData_CcdRecord));
                    var model = new CcdRecordModel()
                    {
                        data_size        = item.data_size,
                        data_source_type = item.data_source_type,
                        disk_bitmap      = item.disk_bitmap,
                        end_time         = item.end_time,
                        frame_number     = item.frame_number,//镇数
                        head_size        = item.head_size,
                        id = item.id,
                        pixel_sampling_type = item.pixel_sampling_type,
                        record_id           = item.record_id,
                        record_index        = item.record_index,
                        start_time          = item.start_time,
                        task_index          = item.task_index,
                        TaskName            = item.record_id.task_name,
                        RecordName          = item.record_id.task_name + item.record_id.start_time,
                    };
                    long totalsize = 0;
                    if (item.frame_number < 2)
                    {
                        totalsize = 0;
                    }
                    else
                    {
                        totalsize = (long)(item.frame_number + 1) * item.data_size;
                    }
                    model.TotalSize = String.Format("{0:F2}GB", totalsize / (1024.0 * 1024.0 * 1024.0));
                    CcdRecordModels.Add(model);
                    SDKApi.EagleData_FreeRecordMemory(record);
                    //  var r1 = SDKApi.EagleData_DeleteRecord(list.record_id, list.id);
                }
                Marshal.FreeHGlobal(intPtr);
            }
        }
Example #2
0
        private unsafe void get_record_list()
        {
            SDKApi.EagleData_RefetchRecList();
            int record_num = SDKApi.EagleData_GetRecordNumber();

            if (record_num > 0)
            {
                //var ids =IntPtr.Zero ;// new EagleData_Record_Id();
                //  List<EagleData_Record_Id> list = new List<EagleData_Record_Id>();
                //  var ids = new IntPtr[record_num];//EagleData_Record_Id[record_num];
                //  for (int i = 0; i < record_num; i++)
                //  {
                //     // ids[i].task_name = new  string('\0',64);
                //     // list.Add(new EagleData_Record_Id() { task_name=new string ('\0',64),start_time=0 });
                //  }

                //// var intptr = Marshal.AllocHGlobal(Marshal.SizeOf(64));
                //  IntPtr[] ptArr = new IntPtr[1];
                //  ptArr[0] = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(EagleData_Record_Id)));
                IntPtr pt            = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(EagleData_Record_Id)) * record_num);
                int    nStructLength = Marshal.SizeOf(typeof(EagleData_Record));
                //  Marshal.Copy(ptArr, 0, pt, 1);

                int actual_num = SDKApi.EagleData_GetRecordList(pt, record_num);

                EagleData_Record_Id[] ids = new EagleData_Record_Id[actual_num];

                for (int i = 0; i < actual_num; i++)
                {
                    ids[i] = (EagleData_Record_Id)Marshal.PtrToStructure(pt + Marshal.SizeOf(typeof(EagleData_Record_Id)) * i, typeof(EagleData_Record_Id));
                    EagleData_Record ccd = new EagleData_Record();
                    var record           = SDKApi.EagleData_GetRecordAndAllocMemory(ids[i]);
                    ccd = (EagleData_Record)Marshal.PtrToStructure(record, typeof(EagleData_Record));
                    int s    = 0;
                    var list = (EagleData_CcdRecord)Marshal.PtrToStructure(ccd.ccd_record_list, typeof(EagleData_CcdRecord));

                    var r1  = SDKApi.EagleData_DeleteRecord(list.record_id, list.id);
                    int ss1 = 0;
                    //var ret = SDKApi.EagleData_CheckAndRemountFileSystem(0, DISK_MOUNT_TYPE.DISK_MOUNT_FROM_AOE);
                    //var databuffer = new byte[list.data_size];
                    //var headerbuffer = new byte[list.head_size];

                    //// if (record!= null)
                    //for (int index = 0; index < list.frame_number; i++)
                    //{
                    //    var flag = SDKApi.EagleData_ReadOneStoredFrame(list.record_id, list.id, index, databuffer, (int)list.data_size, headerbuffer, (int)list.head_size);
                    //   //保存数据  databuffer
                    //}
                    //ret = SDKApi.EagleData_RemoveFileSystem(0, DISK_MOUNT_TYPE.DISK_MOUNT_FROM_AOE);
                    //_print_record_detail(&record->id, i + 1);


                    // EagleData_FreeRecordMemory(record);
                }
                Marshal.FreeHGlobal(pt);
            }
        }