Esempio n. 1
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);
            }
        }
Esempio n. 2
0
        private void OnDeleteFile(CcdRecordModel model)
        {
            var result = MessageBox.Show("你确定要删除当前记录吗?", "删除提醒", MessageBoxButton.OKCancel, MessageBoxImage.Warning);

            if (result == MessageBoxResult.OK)
            {
                int ret = SDKApi.EagleData_DeleteRecord(model.record_id, model.id);
                if (ret != 0)
                {
                    _eventAggregator.GetEvent <InfoEventArgs>().Publish("删除存储记录失败!\n");
                    MessageBox.Show("删除记录失败!");
                }
                else
                {
                    Get_Record_List();
                }
            }
        }