private async void ReadToBytesTime_Tapped(object sender, TappedRoutedEventArgs e) { long readToBytes_Time; var picker = new Windows.Storage.Pickers.FileOpenPicker { ViewMode = Windows.Storage.Pickers.PickerViewMode.Thumbnail, SuggestedStartLocation = Windows.Storage.Pickers.PickerLocationId.PicturesLibrary }; picker.FileTypeFilter.Add(".AEDAT"); var file = await picker.PickSingleFileAsync(); if (file == null) { return; } Stopwatch sw = new Stopwatch(); sw.Start(); byte[] result = await AedatUtilities.ReadToBytes(file); // All of the bytes in the AEDAT file loaded into an array sw.Stop(); readToBytes_Time = sw.ElapsedMilliseconds; ContentDialog readTimeDialog = new ContentDialog() { Title = "Testing", Content = "Read to bytes time: " + readToBytes_Time + " ms", CloseButtonText = "Close" }; await readTimeDialog.ShowAsync(); }
private async void SearchTest_Tapped(object sender, TappedRoutedEventArgs e) { var picker = new FileOpenPicker { ViewMode = PickerViewMode.Thumbnail, SuggestedStartLocation = PickerLocationId.PicturesLibrary }; picker.FileTypeFilter.Add(".AEDAT"); var file = await picker.PickSingleFileAsync(); if (file == null) { return; } byte[] aedatFile = await AedatUtilities.ReadToBytes(file); string result = AedatUtilities.FindLineInHeader(AedatUtilities.hardwareInterfaceCheck, ref aedatFile); CameraParameters cameraParam = AedatUtilities.ParseCameraModel(result); if (cameraParam == null) { ContentDialog AEEE = new ContentDialog() { Title = "EEE", Content = "AEEEE", CloseButtonText = "Close" }; await AEEE.ShowAsync(); } ContentDialog invaldInputDialogue = new ContentDialog() { Title = "Testing...", Content = cameraParam.cameraName, CloseButtonText = "Close" }; await invaldInputDialogue.ShowAsync(); }
private async void SelectFile_Tapped(object sender, TappedRoutedEventArgs e) { int frameTime; int maxFrames; try { // Grab video reconstruction settings from GUI // Will throw a FormatException if input is invalid (negative numbers or input has letters) (frameTime, maxFrames) = ParseVideoSettings(); } catch (FormatException) { await invaldVideoSettingsDialog.ShowAsync(); return; } // Select AEDAT file to be converted to video var picker = new FileOpenPicker { ViewMode = PickerViewMode.Thumbnail, SuggestedStartLocation = PickerLocationId.PicturesLibrary }; picker.FileTypeFilter.Add(".AEDAT"); // Select AEDAT file to be converted IReadOnlyList <StorageFile> files = await picker.PickMultipleFilesAsync(); if (files == null) { showLoading.IsActive = false; backgroundTint.Visibility = Windows.UI.Xaml.Visibility.Collapsed; return; } var picker2 = new FolderPicker { ViewMode = PickerViewMode.Thumbnail, SuggestedStartLocation = PickerLocationId.PicturesLibrary }; picker2.FileTypeFilter.Add("*"); // Select AEDAT file to be converted StorageFolder folder = await picker2.PickSingleFolderAsync(); if (folder == null) { showLoading.IsActive = false; backgroundTint.Visibility = Windows.UI.Xaml.Visibility.Collapsed; return; } foreach (StorageFile file in files) { byte[] aedatFile = await AedatUtilities.ReadToBytes(file); // Determine camera type from AEDAT header string cameraTypeSearch = AedatUtilities.FindLineInHeader(AedatUtilities.hardwareInterfaceCheck, ref aedatFile); CameraParameters cam = AedatUtilities.ParseCameraModel(cameraTypeSearch); if (cam == null) { await invalidCameraDataDialog.ShowAsync(); return; } showLoading.IsActive = true; backgroundTint.Visibility = Windows.UI.Xaml.Visibility.Visible; StorageFolder folder2 = await folder.CreateFolderAsync(file.Name.Replace(".aedat", "") + " Event Chunks"); if (playbackType.IsOn) { await TimeBasedReconstruction(aedatFile, cam, frameTime, maxFrames, folder2, file.Name.Replace(".aedat", "")); } else { int numOfEvents = Int32.Parse(numOfEventInput.Text); await EventBasedReconstruction(aedatFile, cam, numOfEvents, maxFrames, folder2, file.Name.Replace(".aedat", "")); } } showLoading.IsActive = false; backgroundTint.Visibility = Windows.UI.Xaml.Visibility.Collapsed; }