From 40837e499925430cabc474d4fd5d2b25e1fee911 Mon Sep 17 00:00:00 2001 From: NicoAICP Date: Sun, 14 Jun 2020 14:58:40 +0200 Subject: [PATCH] i hope this reverts the second last commit if nto fuck this tool --- .../Windows/ImageCreator - Kopieren.xaml.cs | 87 ++++++--------- .../UI/Windows/ImageCreator.xaml.cs | 101 +++++++----------- 2 files changed, 73 insertions(+), 115 deletions(-) diff --git a/UWUVCI AIO WPF/UI/Windows/ImageCreator - Kopieren.xaml.cs b/UWUVCI AIO WPF/UI/Windows/ImageCreator - Kopieren.xaml.cs index b9621cc..6697827 100644 --- a/UWUVCI AIO WPF/UI/Windows/ImageCreator - Kopieren.xaml.cs +++ b/UWUVCI AIO WPF/UI/Windows/ImageCreator - Kopieren.xaml.cs @@ -27,14 +27,13 @@ namespace UWUVCI_AIO_WPF.UI.Windows /// /// Interaktionslogik für ImageCreator.xaml /// - + public partial class IconCreator : Window, IDisposable { private static readonly string tempPath = System.IO.Path.Combine(Directory.GetCurrentDirectory(), "bin", "temp"); private static readonly string toolsPath = System.IO.Path.Combine(Directory.GetCurrentDirectory(), "bin", "Tools"); MenuIconImage bi = new MenuIconImage(); Bitmap b; - Bitmap framecopy; string console = "other"; string othercons = ""; bool drc = false; @@ -45,7 +44,7 @@ namespace UWUVCI_AIO_WPF.UI.Windows imageName.Content = "iconTex"; SetTemplate(); } - public IconCreator(string name) + public IconCreator(string name) { InitializeComponent(); console = name; @@ -62,9 +61,8 @@ namespace UWUVCI_AIO_WPF.UI.Windows } private void SetTemplate() { - if(othercons == "GB") + if (othercons == "GB") { - bi.Frame = new Bitmap(Properties.Resources.Icon); wii.IsChecked = true; ww.Content = "Alt 1"; @@ -75,7 +73,7 @@ namespace UWUVCI_AIO_WPF.UI.Windows hb.Visibility = Visibility.Visible; wii.Visibility = Visibility.Visible; } - if(othercons == "GBC") + if (othercons == "GBC") { bi.Frame = new Bitmap(Properties.Resources.Icon); wii.IsChecked = true; @@ -87,7 +85,7 @@ namespace UWUVCI_AIO_WPF.UI.Windows hb.Visibility = Visibility.Visible; wii.Visibility = Visibility.Visible; } - if(console == "WII" && (FindResource("mvm") as MainViewModel).test != GameConsoles.GCN) + if (console == "WII" && (FindResource("mvm") as MainViewModel).test != GameConsoles.GCN) { bi.Frame = new Bitmap(Properties.Resources.Wii2); ww.Visibility = Visibility.Visible; @@ -107,7 +105,7 @@ namespace UWUVCI_AIO_WPF.UI.Windows hb.Visibility = Visibility.Visible; wii.Visibility = Visibility.Visible; } - else if((FindResource("mvm") as MainViewModel).GameConfiguration.Console == GameConsoles.NDS) + else if ((FindResource("mvm") as MainViewModel).GameConfiguration.Console == GameConsoles.NDS) { bi.Frame = new Bitmap(Properties.Resources.Icon); wii.IsChecked = true; @@ -195,7 +193,7 @@ namespace UWUVCI_AIO_WPF.UI.Windows { bi.Frame = new Bitmap(Properties.Resources.Icon); } - framecopy = bi.Frame.Clone() as Bitmap; + } private void Button_Click(object sender, RoutedEventArgs e) @@ -207,10 +205,10 @@ namespace UWUVCI_AIO_WPF.UI.Windows { string file = ""; MainViewModel mvm = FindResource("mvm") as MainViewModel; - file = mvm.GetFilePath(false, false); - if(!string.IsNullOrEmpty(file)) + file = mvm.GetFilePath(false, false); + if (!string.IsNullOrEmpty(file)) { - + string copy = ""; if (new FileInfo(file).Extension.Contains("tga")) { @@ -240,23 +238,9 @@ namespace UWUVCI_AIO_WPF.UI.Windows { copy = file; } - - if(enOv.IsChecked == false) - { - - //bi.TitleScreen = new Bitmap(copy); - bi.Frame = new Bitmap(copy); - b = bi.Create(console); - Image.Source = BitmapToImageSource(b); - } - else - { - bi.TitleScreen = new Bitmap(copy); - b = bi.Create(console); - Image.Source = BitmapToImageSource(b); - } - - + bi.TitleScreen = new Bitmap(copy); + b = bi.Create(console); + Image.Source = BitmapToImageSource(b); } } @@ -266,7 +250,7 @@ namespace UWUVCI_AIO_WPF.UI.Windows { Directory.CreateDirectory(@"bin\createdIMG"); } - if(File.Exists(System.IO.Path.Combine(@"bin\createdIMG", imageName.Content + ".png"))) + if (File.Exists(System.IO.Path.Combine(@"bin\createdIMG", imageName.Content + ".png"))) { File.Delete(System.IO.Path.Combine(@"bin\createdIMG", imageName.Content + ".png")); } @@ -275,10 +259,10 @@ namespace UWUVCI_AIO_WPF.UI.Windows b = ResizeImage(b, 854, 480); } - - b.Save(System.IO.Path.Combine(@"bin\createdIMG", imageName.Content + ".png")); - - + + b.Save(System.IO.Path.Combine(@"bin\createdIMG", imageName.Content + ".png")); + + this.Close(); } @@ -334,17 +318,13 @@ namespace UWUVCI_AIO_WPF.UI.Windows } } - + private void enOv_Click(object sender, RoutedEventArgs e) { - if(enOv.IsChecked == true) + if (enOv.IsChecked == true) { - if(bi.Frame != framecopy) - { - bi.TitleScreen = bi.Frame.Clone() as Bitmap; - bi.Frame = framecopy; - } + b = bi.Create(console); Image.Source = BitmapToImageSource(b); ww.IsEnabled = true; @@ -358,13 +338,10 @@ namespace UWUVCI_AIO_WPF.UI.Windows wii.IsEnabled = false; hb.IsEnabled = false; ws.IsEnabled = false; - - if(bi.TitleScreen != null) + + if (bi.TitleScreen != null) { - //b = ResizeImage(bi.TitleScreen, 128, 128); - bi.Frame = bi.TitleScreen; - b = bi.Create(console); - Image.Source = BitmapToImageSource(b); + b = ResizeImage(bi.TitleScreen, 128, 128); Image.Source = BitmapToImageSource(b); } else { @@ -411,7 +388,7 @@ namespace UWUVCI_AIO_WPF.UI.Windows private void Players_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) { - + } private void Players_TextChanged(object sender, TextChangedEventArgs e) @@ -421,7 +398,7 @@ namespace UWUVCI_AIO_WPF.UI.Windows public void Dispose() { - + } private void combo_SelectionChanged(object sender, SelectionChangedEventArgs e) @@ -431,7 +408,7 @@ namespace UWUVCI_AIO_WPF.UI.Windows bi.Frame = Properties.Resources.SNES_PAL; } - else if(combo.SelectedIndex == 1) + else if (combo.SelectedIndex == 1) { bi.Frame = Properties.Resources.SNES_USA; } @@ -445,7 +422,7 @@ namespace UWUVCI_AIO_WPF.UI.Windows private void pal_Click(object sender, RoutedEventArgs e) { - if(pal.IsChecked == true) + if (pal.IsChecked == true) { bi.Frame = Properties.Resources.SNES_PAL; @@ -473,13 +450,13 @@ namespace UWUVCI_AIO_WPF.UI.Windows private void RLEn_Click(object sender, RoutedEventArgs e) { - + DrawImage(); } private void ww_Click(object sender, RoutedEventArgs e) { - if(othercons == "GB") + if (othercons == "GB") { if (ww.IsChecked == true) { @@ -497,7 +474,7 @@ namespace UWUVCI_AIO_WPF.UI.Windows console = "WII"; } } - else if(othercons == "GBC") + else if (othercons == "GBC") { if (ww.IsChecked == true) @@ -675,7 +652,7 @@ namespace UWUVCI_AIO_WPF.UI.Windows console = "WII"; } } - framecopy = bi.Frame.Clone() as Bitmap; + DrawImage(); } } diff --git a/UWUVCI AIO WPF/UI/Windows/ImageCreator.xaml.cs b/UWUVCI AIO WPF/UI/Windows/ImageCreator.xaml.cs index 944e8a7..4a888c7 100644 --- a/UWUVCI AIO WPF/UI/Windows/ImageCreator.xaml.cs +++ b/UWUVCI AIO WPF/UI/Windows/ImageCreator.xaml.cs @@ -27,14 +27,13 @@ namespace UWUVCI_AIO_WPF.UI.Windows /// /// Interaktionslogik für ImageCreator.xaml /// - + public partial class ImageCreator : Window, IDisposable { private static readonly string tempPath = System.IO.Path.Combine(Directory.GetCurrentDirectory(), "bin", "temp"); private static readonly string toolsPath = System.IO.Path.Combine(Directory.GetCurrentDirectory(), "bin", "Tools"); BootImage bi = new BootImage(); Bitmap b; - Bitmap framecopy; string console = "other"; bool drc = false; private string backupcons; @@ -57,7 +56,7 @@ namespace UWUVCI_AIO_WPF.UI.Windows { InitializeComponent(); Bitmap bit; - if(consoles == GameConsoles.TG16) + if (consoles == GameConsoles.TG16) { if (other) { @@ -87,15 +86,16 @@ namespace UWUVCI_AIO_WPF.UI.Windows private void SetTemplate(GameConsoles console) { Bitmap bit; - switch (console){ + switch (console) + { case GameConsoles.NDS: bit = new Bitmap(Properties.Resources.NDS); - + this.console = "NDS"; break; case GameConsoles.N64: bit = new Bitmap(Properties.Resources.N64); - + break; case GameConsoles.NES: bit = new Bitmap(Properties.Resources.NES); @@ -114,7 +114,7 @@ namespace UWUVCI_AIO_WPF.UI.Windows RLDi.Visibility = Visibility.Hidden; RLEn.Visibility = Visibility.Hidden; ReleaseYear.Visibility = Visibility.Hidden; - + PLDi.Visibility = Visibility.Hidden; PLEn.Visibility = Visibility.Hidden; Players.Visibility = Visibility.Hidden; @@ -149,7 +149,6 @@ namespace UWUVCI_AIO_WPF.UI.Windows break; } bi.Frame = bit; - framecopy = bit.Clone() as Bitmap; } private void Button_Click(object sender, RoutedEventArgs e) @@ -161,10 +160,10 @@ namespace UWUVCI_AIO_WPF.UI.Windows { string file = ""; MainViewModel mvm = FindResource("mvm") as MainViewModel; - file = mvm.GetFilePath(false, false); - if(!string.IsNullOrEmpty(file)) + file = mvm.GetFilePath(false, false); + if (!string.IsNullOrEmpty(file)) { - + string copy = ""; if (new FileInfo(file).Extension.Contains("tga")) { @@ -194,19 +193,9 @@ namespace UWUVCI_AIO_WPF.UI.Windows { copy = file; } - if(enOv.IsChecked == false) - { - bi.Frame = new Bitmap(copy); - b = bi.Create(console); - Image.Source = BitmapToImageSource(b); - } - else - { - bi.TitleScreen = new Bitmap(copy); - b = bi.Create(console); - Image.Source = BitmapToImageSource(b); - } - + bi.TitleScreen = new Bitmap(copy); + b = bi.Create(console); + Image.Source = BitmapToImageSource(b); } } @@ -216,7 +205,7 @@ namespace UWUVCI_AIO_WPF.UI.Windows { Directory.CreateDirectory(@"bin\createdIMG"); } - if(File.Exists(System.IO.Path.Combine(@"bin\createdIMG", imageName.Content + ".png"))) + if (File.Exists(System.IO.Path.Combine(@"bin\createdIMG", imageName.Content + ".png"))) { File.Delete(System.IO.Path.Combine(@"bin\createdIMG", imageName.Content + ".png")); } @@ -225,10 +214,10 @@ namespace UWUVCI_AIO_WPF.UI.Windows b = ResizeImage(b, 854, 480); } - - b.Save(System.IO.Path.Combine(@"bin\createdIMG", imageName.Content + ".png")); - - + + b.Save(System.IO.Path.Combine(@"bin\createdIMG", imageName.Content + ".png")); + + this.Close(); } @@ -292,7 +281,7 @@ namespace UWUVCI_AIO_WPF.UI.Windows RLDi.IsEnabled = en; RLEn.IsEnabled = en; ReleaseYear.IsEnabled = en; - if(en && RLDi.IsChecked == true) + if (en && RLDi.IsChecked == true) { ReleaseYear.IsEnabled = false; } @@ -304,7 +293,7 @@ namespace UWUVCI_AIO_WPF.UI.Windows Players.IsEnabled = false; } PlayerLabel.IsEnabled = en; - if(snesonly.IsVisible == true) + if (snesonly.IsVisible == true) { snesonly.IsEnabled = en; } @@ -312,13 +301,8 @@ namespace UWUVCI_AIO_WPF.UI.Windows private void enOv_Click(object sender, RoutedEventArgs e) { - if((ovl.IsVisible == true && enOv.IsChecked == true)) + if ((ovl.IsVisible == true && enOv.IsChecked == true)) { - if (bi.Frame != framecopy) - { - bi.TitleScreen = bi.Frame.Clone() as Bitmap; - bi.Frame = framecopy; - } EnableOrDisbale(true); b = bi.Create(console); Image.Source = BitmapToImageSource(b); @@ -326,12 +310,9 @@ namespace UWUVCI_AIO_WPF.UI.Windows else { EnableOrDisbale(false); - if(bi.TitleScreen != null) + if (bi.TitleScreen != null) { - //b = ResizeImage(bi.TitleScreen, 1280, 720); - bi.Frame = bi.TitleScreen; - b = bi.Create(console); - Image.Source = BitmapToImageSource(b); + b = ResizeImage(bi.TitleScreen, 1280, 720); Image.Source = BitmapToImageSource(b); } else { @@ -373,8 +354,8 @@ namespace UWUVCI_AIO_WPF.UI.Windows void DrawImage() { - - + + bi.NameLine1 = GameName1.Text; bi.NameLine2 = GameName2.Text; if (!string.IsNullOrWhiteSpace(GameName2.Text)) @@ -385,8 +366,8 @@ namespace UWUVCI_AIO_WPF.UI.Windows { bi.Longname = false; } - - if(PLEn.IsChecked == true && !String.IsNullOrWhiteSpace(Players.Text)) + + if (PLEn.IsChecked == true && !String.IsNullOrWhiteSpace(Players.Text)) { bi.Players = Convert.ToInt32(Players.Text); } @@ -409,7 +390,7 @@ namespace UWUVCI_AIO_WPF.UI.Windows private void Players_KeyDown(object sender, System.Windows.Input.KeyEventArgs e) { - + } private void Players_TextChanged(object sender, TextChangedEventArgs e) @@ -419,7 +400,7 @@ namespace UWUVCI_AIO_WPF.UI.Windows public void Dispose() { - + } private void combo_SelectionChanged(object sender, SelectionChangedEventArgs e) @@ -429,7 +410,7 @@ namespace UWUVCI_AIO_WPF.UI.Windows bi.Frame = Properties.Resources.SNES_PAL; } - else if(combo.SelectedIndex == 1) + else if (combo.SelectedIndex == 1) { bi.Frame = Properties.Resources.SNES_USA; } @@ -443,7 +424,7 @@ namespace UWUVCI_AIO_WPF.UI.Windows private void pal_Click(object sender, RoutedEventArgs e) { - if(console != "WII" && backupcons != "WII") + if (console != "WII" && backupcons != "WII") { if (pal.IsChecked == true) { @@ -470,14 +451,14 @@ namespace UWUVCI_AIO_WPF.UI.Windows bi.Frame = Properties.Resources.WIIWARE; } } - framecopy = bi.Frame.Clone() as Bitmap; + b = bi.Create(console); Image.Source = BitmapToImageSource(b); } private void RadioButton_Click(object sender, RoutedEventArgs e) { - if(console != "WII" && backupcons != "WII") + if (console != "WII" && backupcons != "WII") { backupcons = console; bi.Frame = Properties.Resources.SFAM; @@ -485,7 +466,7 @@ namespace UWUVCI_AIO_WPF.UI.Windows else { backupcons = "WII"; - if(altwii.IsChecked == false) + if (altwii.IsChecked == false) { console = "WII"; switchs(Visibility.Hidden); @@ -497,9 +478,9 @@ namespace UWUVCI_AIO_WPF.UI.Windows console = "other"; bi.Frame = Properties.Resources.wii3New; } - + } - framecopy = bi.Frame.Clone() as Bitmap; + b = bi.Create(console); Image.Source = BitmapToImageSource(b); } @@ -532,7 +513,7 @@ namespace UWUVCI_AIO_WPF.UI.Windows private void CheckBox_Click(object sender, RoutedEventArgs e) { - if(alt.IsChecked == true) + if (alt.IsChecked == true) { bi.changefont(true); } @@ -552,8 +533,8 @@ namespace UWUVCI_AIO_WPF.UI.Windows Players.Visibility = v; - - if(v == Visibility.Hidden) + + if (v == Visibility.Hidden) { bi.NameLine1 = ""; bi.NameLine2 = ""; @@ -572,9 +553,9 @@ namespace UWUVCI_AIO_WPF.UI.Windows { bi.Players = Convert.ToInt32(Players.Text); } - + } - + } } }