From 93ce80144b934b34d7522ea974614f4ddb2d65bd Mon Sep 17 00:00:00 2001 From: AUnicornWithNoLife <55228370+AUnicornWithNoLife@users.noreply.github.com> Date: Mon, 13 Feb 2023 17:16:32 +0000 Subject: [PATCH] opt + bug fix --- Cupola/Cupola.cs | 2 +- Tranquility/MainWindow.xaml.cs | 47 ++++++++++++++++++++++++++-------- 2 files changed, 37 insertions(+), 12 deletions(-) diff --git a/Cupola/Cupola.cs b/Cupola/Cupola.cs index 28d3be7..fff2559 100644 --- a/Cupola/Cupola.cs +++ b/Cupola/Cupola.cs @@ -71,7 +71,7 @@ namespace Cupola ReadWriteTexture2D brightest = images[0]; ReadWriteTexture2D output = images[0]; - outputImages[0] = output; + outputImages[0] = images[0]; for (int i = 1; i < images.Length; i++) { diff --git a/Tranquility/MainWindow.xaml.cs b/Tranquility/MainWindow.xaml.cs index d2ca883..611633d 100644 --- a/Tranquility/MainWindow.xaml.cs +++ b/Tranquility/MainWindow.xaml.cs @@ -14,7 +14,6 @@ namespace Tranquility public partial class MainWindow : Window { string[]? files; - ReadWriteTexture2D? finalImage; public MainWindow() { @@ -55,27 +54,53 @@ namespace Tranquility if (files == null) throw new Exception("Please select files before running"); + int opt; // 0 - Picture, 1 - Video + + opt = Options.SelectedIndex; + Progress.Value = 10; ReadWriteTexture2D[] images = Cupola.Cupola.Load(files); Progress.Value = 30; - finalImage = Cupola.Cupola.RunSingle(images); + if (opt == 0) + { + ReadWriteTexture2D finalImage = Cupola.Cupola.RunSingle(images); - Progress.Value = 90; + Progress.Value = 90; - CommonSaveFileDialog saveFileDialog = new CommonSaveFileDialog(); - saveFileDialog.DefaultExtension = ".jpg"; - saveFileDialog.EnsurePathExists = true; - CommonFileDialogResult result = saveFileDialog.ShowDialog(); + CommonSaveFileDialog saveFileDialog = new CommonSaveFileDialog(); + saveFileDialog.DefaultExtension = ".jpg"; + saveFileDialog.EnsurePathExists = true; + CommonFileDialogResult result = saveFileDialog.ShowDialog(); - if (result != CommonFileDialogResult.Ok) - throw new Exception("please set location valid OKAY"); + if (result != CommonFileDialogResult.Ok) + throw new Exception("please set location valid OKAY"); - finalImage.Save(saveFileDialog.FileName); + finalImage.Save(saveFileDialog.FileName); - Progress.Value = 100; + Progress.Value = 100; + } + else if (opt == 1) + { + ReadWriteTexture2D[] finalImages = Cupola.Cupola.RunMulti(images); + + Progress.Value = 90; + + string save = OpenFolder(); + + for (int i = 0; i < finalImages.Length; i++) + { + finalImages[i].Save(save + "\\" + i.ToString() + ".jpg"); + } + } + else + { + throw new Exception("invalid option please die"); + } + + } } }