private void Folder_Click(object sender, RoutedEventArgs e) { try { if (File.Exists(path)) { path = new FileInfo(path).DirectoryName; } Process.Start(path); Close(); } catch (Exception) { Custom_Message cm = new Custom_Message("An Error occured", "An error occured opening the folder. Please make sure the Output Path exists."); try { cm.Owner = (FindResource("mvm") as MainViewModel).mw; }catch (Exception) { //left empty on purpose } cm.ShowDialog(); dontChecked(); Close(); } }
private void FileSelect_Click(object sender, RoutedEventArgs e) { string file = ""; MainViewModel mvm = FindResource("mvm") as MainViewModel; file = mvm.GetFilePath(false, false); if (!string.IsNullOrEmpty(file)) { string copy = ""; if (new FileInfo(file).Extension.Contains("tga")) { using (Process conv = new Process()) { conv.StartInfo.UseShellExecute = false; conv.StartInfo.CreateNoWindow = true; if (Directory.Exists(Path.Combine(tempPath, "image"))) { Directory.Delete(Path.Combine(tempPath, "image"), true); } Directory.CreateDirectory(Path.Combine(tempPath, "image")); conv.StartInfo.FileName = Path.Combine(toolsPath, "tga2png.exe"); conv.StartInfo.Arguments = $"-i \"{file}\" -o \"{Path.Combine(tempPath, "image")}\""; conv.Start(); conv.WaitForExit(); foreach (string sFile in Directory.GetFiles(Path.Combine(tempPath, "image"), "*.png")) { copy = sFile; } } } else { copy = file; } try { bi.TitleScreen = new Bitmap(copy); b = bi.Create(console); Image.Source = BitmapToImageSource(b); } catch { Custom_Message cm = new Custom_Message("Image Issue", "The image you're trying to use will not work, please try a different image."); try { cm.Owner = mvm.mw; } catch (Exception) { //left empty on purpose } cm.ShowDialog(); } } }
private void setup_Click(object sender, RoutedEventArgs e) { if (!(FindResource("mvm") as MainViewModel).saveworkaround) { long injctSize = GetDirectorySize(Path.Combine(path, (FindResource("mvm") as MainViewModel).foldername), true); if (injctSize >= new DriveInfo(driveletter).AvailableFreeSpace) { long div = injctSize - new DriveInfo(driveletter).AvailableFreeSpace + 1048576; Custom_Message cm = new Custom_Message("Insufficient Space", $" You do not have enough space on the selected drive. \n Please make sure you have at least {FormatBytes(div)} free! "); try { cm.Owner = (FindResource("mvm") as MainViewModel).mw; } catch (Exception) { //left empty on purpose } cm.ShowDialog(); } else { dp.Tick += Dp_Tick; dp.Interval = TimeSpan.FromSeconds(1); dp.Start(); Task.Run(() => { if (gc) { SetupNintendont(); } CopyInject(); }); setup.IsEnabled = false; } } else { dp.Tick += Dp_Tick; dp.Interval = TimeSpan.FromSeconds(1); dp.Start(); Task.Run(() => { if (gc) { SetupNintendont(); } CopyInject(); }); setup.IsEnabled = false; } }
public TitleKeys(string url) { MainViewModel mvm = FindResource("mvm") as MainViewModel; try { if (Owner?.GetType() != typeof(MainWindow)) { WindowStartupLocation = WindowStartupLocation.CenterScreen; } } catch (Exception) { WindowStartupLocation = WindowStartupLocation.CenterScreen; } string fullurl = ""; try { fullurl = mvm.GetURL(url); if (fullurl == "" || fullurl == null) { throw new Exception(); } } catch (Exception) { Custom_Message cm = new Custom_Message("Not Implemented", $"The Helppage for {url.ToUpper()} is not implemented yet"); try { cm.Owner = mvm.mw; } catch (Exception) { // left empty on purpose } cm.ShowDialog(); Close(); mvm.mw.Show(); } wb.Source = new Uri(fullurl, UriKind.Absolute); wb.Refresh(true); clsWebbrowser_Errors.SuppressscriptErrors(wb, true); InitializeComponent(); this.url = url; }
private void Folder_Click(object sender, RoutedEventArgs e) { try { if (File.Exists(path)) { path = new FileInfo(path).DirectoryName; } Process.Start(path); this.Close(); } catch (Exception) { Custom_Message cm = new Custom_Message("An Error occured", "An error occured opening the folder. Please make sure the Output Path exists."); try { cm.Owner = (FindResource("mvm") as MainViewModel).mw; }catch (Exception) { } cm.ShowDialog(); if (dont.IsChecked == true) { if (Message.Content.ToString().ToLower().Contains("gcz")) { Properties.Settings.Default.gczw = true; } else if (Message.Content.ToString().ToLower().Contains("dsi")) { Properties.Settings.Default.ndsw = true; } else if (Message.Content.ToString().ToLower().Contains("co-processor")) { Properties.Settings.Default.snesw = true; } else if (Message.Content.ToString().ToLower().Contains("images")) { Properties.Settings.Default.dont = true; } Properties.Settings.Default.Save(); } this.Close(); } }
private void Button_Click_1(object sender, RoutedEventArgs e) { if (tbKey.Text.Length > 32 || tbKey.Text.Length < 32) { if (tbKey.Text.Length > 32) { cm = new Custom_Message("Wrong Key", "The entered Key is too long"); cm.Owner = this; cm.ShowDialog(); } else { cm = new Custom_Message("Wrong Key", "The entered Key is too short"); cm.Owner = this; cm.ShowDialog(); } } else { if (ckey) { MainViewModel mvm = (MainViewModel)FindResource("mvm"); if (mvm.checkcKey(tbKey.Text)) { this.Visibility = Visibility.Hidden; cm = new Custom_Message("Correct Key", "The entered CommonKey is correct!"); cm.Owner = this.Owner; (this.Owner as MainWindow).move = false; cm.ShowDialog(); (this.Owner as MainWindow).move = true; this.Close(); mvm.ArePathsSet(); } else { cm = new Custom_Message("Incorrect Key", "The entered CommonKey is incorrect!"); cm.Owner = this; cm.ShowDialog(); } } else { MainViewModel mvm = (MainViewModel)FindResource("mvm"); if (mvm.checkKey(tbKey.Text)) { this.Visibility = Visibility.Hidden; cm = new Custom_Message("Correct Key", "The entered TitleKey is correct!"); cm.Owner = this.Owner; (this.Owner as MainWindow).move = false; cm.ShowDialog(); (this.Owner as MainWindow).move = true; this.Close(); } else { cm = new Custom_Message("Incorrect Key", "The entered TitleKey is incorrect!"); cm.Owner = this; cm.ShowDialog(); } } } }
public void checkForAdditionalFiles(GameConsoles console, string repoid) { if (!Directory.Exists(System.IO.Path.Combine(Directory.GetCurrentDirectory(), "bin", "repo"))) { Directory.CreateDirectory(System.IO.Path.Combine(Directory.GetCurrentDirectory(), "bin", "repo")); } bool ini = false; bool btsnd = false; string inip = ""; string btsndp = ""; string exten = ""; string linkbase = "https://raw.githubusercontent.com/Flumpster/UWUVCI-Images/master/"; if (console == GameConsoles.N64) { if (RemoteFileExists(linkbase + repoid + "/game.ini")) { ini = true; inip = linkbase + repoid + "/game.ini"; } } string[] ext = { "wav", "mp3", "btsnd" }; foreach (var e in ext) { if (RemoteFileExists(linkbase + repoid + "/BootSound." + e)) { btsnd = true; btsndp = linkbase + repoid + "/BootSound." + e; exten = e; break; } } if (ini || btsnd) { string extra = "There are more additional files found. Do you want to download those?"; if (ini && !btsnd) { extra = "There is an additional INI file available for Dowload. Do you want to dowload it?"; } if (!ini && btsnd) { extra = "There is an additional BootSound file available for Dowload. Do you want to dowload it?"; } if (ini && btsnd) { extra = "There is an adittional INI and BootSound file available for Dowload. Do you want to download those?"; } MainViewModel mvm = FindResource("mvm") as MainViewModel; Custom_Message cm = new Custom_Message("Found additional Files", extra); try { cm.Owner = mvm.mw; } catch (Exception) { } cm.ShowDialog(); if (mvm.addi) { var client = new WebClient(); if (ini) { client.DownloadFile(inip, System.IO.Path.Combine(Directory.GetCurrentDirectory(), "bin", "repo", "game.ini")); (mvm.Thing as N64Config).ini.Text = System.IO.Path.Combine(Directory.GetCurrentDirectory(), "bin", "repo", "game.ini"); mvm.GameConfiguration.N64Stuff.INIPath = System.IO.Path.Combine(Directory.GetCurrentDirectory(), "bin", "repo", "game.ini"); } if (btsnd) { client.DownloadFile(btsndp, System.IO.Path.Combine(Directory.GetCurrentDirectory(), "bin", "repo", $"bootSound.{exten}")); mvm.BootSound = System.IO.Path.Combine(Directory.GetCurrentDirectory(), "bin", "repo", $"bootSound.{exten}"); switch (console) { case GameConsoles.NDS: (mvm.Thing as OtherConfigs).sound.Text = System.IO.Path.Combine(Directory.GetCurrentDirectory(), "bin", "repo", $"bootSound.{exten}"); break; case GameConsoles.GBA: (mvm.Thing as GBA).sound.Text = System.IO.Path.Combine(Directory.GetCurrentDirectory(), "bin", "repo", $"bootSound.{exten}"); break; case GameConsoles.N64: (mvm.Thing as N64Config).sound.Text = System.IO.Path.Combine(Directory.GetCurrentDirectory(), "bin", "repo", $"bootSound.{exten}"); break; case GameConsoles.WII: if (mvm.test == GameConsoles.GCN) { (mvm.Thing as GCConfig).sound.Text = System.IO.Path.Combine(Directory.GetCurrentDirectory(), "bin", "repo", $"bootSound.{exten}"); } else { (mvm.Thing as WiiConfig).sound.Text = System.IO.Path.Combine(Directory.GetCurrentDirectory(), "bin", "repo", $"bootSound.{exten}"); } break; } } mvm.addi = false; } } }