/// <summary> /// Import all the files given in the array. /// This will open the file. Read in all the data /// and pass the data to the codec. It will then /// close the file and move to the next file. /// </summary> /// <param name="filenames">Array of file names.</param> /// <returns>List of all the ensembles found in the file.</returns> public List <FilePlayback.EnsembleData> ImportFiles(string[] filenames) { try { // Read in all the information from the file using (FilePlayback playback = new FilePlayback()) { Task.Run(() => playback.FindEnsembles(filenames)); // Send an event when complete PublishCompleteEvent(); // Return all the ensemble data found return(playback.GetEnsembleDataList()); } } catch (Exception e) { log.Error(string.Format("Error Importing the files: {0}", filenames), e); return(new List <FilePlayback.EnsembleData>()); } }
/// <summary> /// Import all the files given in the array. /// This will open the file. Read in all the data /// and pass the data to the codec. It will then /// close the file and move to the next file. /// </summary> /// <param name="filenames">Array of file names.</param> /// <returns>List of all the ensembles found in the file.</returns> public List<FilePlayback.EnsembleData> ImportFiles(string[] filenames) { try { // Read in all the information from the file using (FilePlayback playback = new FilePlayback()) { Task.Run(() => playback.FindEnsembles(filenames)); // Send an event when complete PublishCompleteEvent(); // Return all the ensemble data found return playback.GetEnsembleDataList(); } } catch (Exception e) { log.Error(string.Format("Error Importing the files: {0}", filenames), e); return new List<FilePlayback.EnsembleData>(); } }
/// <summary> /// Import the RoweTech binary files. /// This is optimized for RoweTech Binary files. /// </summary> /// <param name="files">Files to import to a project.</param> private async void ImportRTB(string[] files) { // If the project does not exist in the list, create it now if (!IsProjectExist(_importProjectName)) { // Create the new project based off // the project name and project directory Project prj = new Project(_importProjectName, RTI.Pulse.Commons.GetProjectDefaultFolderPath(), null); // Create the new project based off // the project name and project directory //System.Windows.Application.Current.Dispatcher.BeginInvoke(new System.Action(() => AddProject(prj))); await AddProject(prj); prj.Dispose(); } //// Create the importer and an eventhandler to handle the imported data //AdcpImportBinaryFile importer = new AdcpImportBinaryFile(); ////importer.ReceiveBinaryDataEvent += new AdcpImportBinaryFile.ReceiveBinaryDataEventHandler(importer_ReceiveBinaryDataEvent); //importer.CompleteEvent += new AdcpImportBinaryFile.CompleteEventHandler(importer_CompleteEvent); // Set flag to turn on recording and importing // This will tell the recorder to record but since we // are importing, do not update all the playback displays IsProjectLoading = true; _adcpConnection.IsRecording = true; _adcpConnection.IsImporting = true; IoC.Get <PlaybackViewModel>().IsRecordEnabled = true; // Call this to update the display // Create the file playback based off the selected file List <RTI.FilePlayback.EnsembleData> ensList = new List <FilePlayback.EnsembleData>(); using (FilePlayback fp = new FilePlayback()) { fp.FindRtbEnsembles(files); ensList = fp.GetEnsembleDataList(); } // Publish all the ensembles found from the importer //foreach(var ens in list) foreach (var ens in ensList) { //_adcpConnection.PublishEnsembleData(ens.RawData, ens.Ensemble); // Check if the serial number is set for the project if (_pm.SelectedProject.SerialNumber.IsEmpty()) { if (ens.Ensemble.IsEnsembleAvail) { _pm.SelectedProject.SerialNumber = ens.Ensemble.EnsembleData.SysSerialNumber; } } // Record the data _pm.SelectedProject.RecordBinaryEnsemble(ens.RawData); _pm.SelectedProject.RecordDbEnsemble(ens.Ensemble, AdcpCodec.CodecEnum.Binary); } // Set the Project Image if (_SelectedProjectVM != null) { await System.Windows.Application.Current.Dispatcher.BeginInvoke(new System.Action(() => { _SelectedProjectVM.RefreshDisplay(); this.NotifyOfPropertyChange(() => this.ProjectList); })); } // Turn off recording and importing _adcpConnection.IsRecording = false; _adcpConnection.IsImporting = false; IoC.Get <PlaybackViewModel>().IsRecordEnabled = false; // Call this to update the display IsProjectLoading = false; }