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

120 lines
3.2 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)
{
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;
if (e.Args.Length >= 1)
{
foreach(var s in e.Args)
{
if(s == "--skip")
{
check = false;
}
}
}
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-05-22 14:12:05 +00:00
Custom_Message cm = new Custom_Message("Another Instance Running", "You already got another instance of UWUVCI AIO running.\nThis instance will terminate in 5 seconds.");
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-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
{
Custom_Message cm = new Custom_Message("Incompatible Operating System", "Your Operating System is not a 64Bit OS.\nThe Injector will run, but most likley many (if not all) features will not work.");
cm.ShowDialog();
}
MainWindow wnd = new MainWindow();
// 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
{
wnd.setDebug();
}
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
}