UWUVCI-AIO-WPF/UWUVCI AIO WPF/App.xaml.cs

133 lines
3.4 KiB
C#
Raw Normal View History

2020-03-01 13:12:17 +00:00
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
2020-05-04 16:20:21 +00:00
using System.Diagnostics;
using System.IO;
2020-03-01 13:12:17 +00:00
using System.Linq;
using System.Threading.Tasks;
2020-05-04 16:20:21 +00:00
using System.Timers;
2020-03-01 13:12:17 +00:00
using System.Windows;
2020-04-25 06:40:38 +00:00
using UWUVCI_AIO_WPF.UI.Windows;
2020-03-01 13:12:17 +00:00
namespace UWUVCI_AIO_WPF
{
/// <summary>
/// Interaktionslogik für "App.xaml"
/// </summary>
public partial class App : Application
{
2020-05-04 16:20:21 +00:00
Timer t = new Timer(5000);
private void Application_Startup(object sender, StartupEventArgs e)
2020-07-31 19:03:12 +00:00
{
if (Directory.Exists(@"custom"))
{
if (File.Exists(@"custom\main.dol"))
{
if (File.Exists(@"bin\Tools\nintendont.dol"))
{
File.Delete(@"bin\Tools\nintendont.dol");
File.Copy(@"custom\main.dol", @"bin\Tools\nintendont.dol");
}
else
{
if(!Directory.Exists(@"bin"))
{
Directory.CreateDirectory(@"bin");
}
else if(!Directory.Exists(@"bin\Tools"))
{
Directory.CreateDirectory(@"bin\Tools");
}
File.Copy(@"custom\main.dol", @"bin\Tools\nintendont.dol");
}
if (File.Exists(@"bin\Tools\nintendont_force.dol"))
{
File.Delete(@"bin\Tools\nintendont_force.dol");
File.Copy(@"custom\main.dol", @"bin\Tools\nintendont_force.dol");
}
else
{
File.Copy(@"custom\main.dol", @"bin\Tools\nintendont_force.dol");
}
}
}
2020-06-09 09:43:17 +00:00
bool check = true;
2020-06-24 15:54:51 +00:00
bool bypass = false;
2020-06-09 09:43:17 +00:00
if (e.Args.Length >= 1)
{
foreach(var s in e.Args)
{
if(s == "--skip")
{
check = false;
}
2020-06-24 15:54:51 +00:00
if(s == "--spacebypass")
{
bypass = true;
}
2020-06-09 09:43:17 +00:00
}
}
2020-05-04 16:20:21 +00:00
Process[] pname = Process.GetProcessesByName("UWUVCI AIO");
2020-06-09 09:43:17 +00:00
if (pname.Length > 1 && check)
2020-04-25 06:40:38 +00:00
{
2020-05-04 16:20:21 +00:00
t.Elapsed += KillProg;
t.Start();
2020-06-24 15:54:51 +00:00
Custom_Message cm = new Custom_Message("Another Instance Running", " You already got another instance of UWUVCI AIO running. \n This instance will terminate in 5 seconds. ");
2020-05-22 14:12:05 +00:00
2020-04-25 06:40:38 +00:00
cm.ShowDialog();
2020-05-04 16:20:21 +00:00
KillProg(null, null);
2020-04-25 06:40:38 +00:00
}
2020-05-04 16:20:21 +00:00
else
{
2020-08-11 19:35:17 +00:00
MainWindow wnd = new MainWindow();
2020-05-04 16:20:21 +00:00
double height = System.Windows.SystemParameters.PrimaryScreenHeight;
double witdh = System.Windows.SystemParameters.PrimaryScreenWidth;
if (witdh < 1150 || height < 700)
{
t.Elapsed += KillProg;
2020-05-22 14:12:05 +00:00
t.Start();
Custom_Message cm = new Custom_Message("Resolution not supported", "Your screen resolution is not supported, please use a resolution of atleast 1152x864\nThis instance will terminate in 5 seconds.");
2020-05-04 16:20:21 +00:00
cm.ShowDialog();
KillProg(null, null);
}
if (Environment.Is64BitOperatingSystem)
{
}
else
{
//wnd.is32();
Custom_Message cm = new Custom_Message("Warning", "Some features may cause issues on a 32Bit System. Upgrading to 64Bit would be recommended. \nReport any issues in the UWUVCI Discord, or ping @NicoAICP in #wiiu-assistance in the Nintendo Homebrew discord. ");
2020-05-04 16:20:21 +00:00
cm.ShowDialog();
}
2020-08-11 19:35:17 +00:00
2020-06-24 15:54:51 +00:00
if (bypass) {
wnd.allowBypass();
}
2020-05-04 16:20:21 +00:00
// The OpenFile() method is just an example of what you could do with the
// parameter. The method should be declared on your MainWindow class, where
// you could use a range of methods to process the passed file path
2020-06-09 09:43:17 +00:00
if (e.Args.Length >= 1 && e.Args[0] == "--debug")
2020-05-04 16:20:21 +00:00
{
2020-06-27 17:15:57 +00:00
wnd.setDebug(bypass);
2020-05-04 16:20:21 +00:00
}
wnd.Show();
}
2020-05-04 16:20:21 +00:00
}
private void KillProg(object sender, ElapsedEventArgs e)
{
t.Stop();
Environment.Exit(1);
}
}
2020-03-01 13:12:17 +00:00
}