Removed unnecessary code

This commit is contained in:
ZestyTS 2020-10-01 17:39:56 -07:00
parent 25b43a09a8
commit 0786fdc317

View file

@ -5,16 +5,11 @@ using System.IO.Compression;
using System.Linq; using System.Linq;
using System.Management; using System.Management;
using System.Net; using System.Net;
using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Windows; using System.Windows;
using System.Windows.Controls; using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input; using System.Windows.Input;
using System.Windows.Media; using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using System.Windows.Threading; using System.Windows.Threading;
namespace UWUVCI_AIO_WPF.UI.Windows namespace UWUVCI_AIO_WPF.UI.Windows
@ -22,7 +17,7 @@ namespace UWUVCI_AIO_WPF.UI.Windows
/// <summary> /// <summary>
/// Interaktionslogik für DownloadWait.xaml /// Interaktionslogik für DownloadWait.xaml
/// </summary> /// </summary>
partial class SDSetup : Window, IDisposable partial class SDSetup : Window, IDisposable
{ {
bool gc = false; bool gc = false;
@ -55,7 +50,7 @@ namespace UWUVCI_AIO_WPF.UI.Windows
{ {
InitializeComponent(); InitializeComponent();
gc = gamecube; gc = gamecube;
path = injectlocation; path = injectlocation;
if (!gamecube) if (!gamecube)
{ {
setup.Content = "Copy to SD"; setup.Content = "Copy to SD";
@ -69,7 +64,6 @@ namespace UWUVCI_AIO_WPF.UI.Windows
} }
private void checkfornewinput() private void checkfornewinput()
{ {
WqlEventQuery query = new WqlEventQuery("SELECT * FROM Win32_VolumeChangeEvent WHERE EventType = 2"); WqlEventQuery query = new WqlEventQuery("SELECT * FROM Win32_VolumeChangeEvent WHERE EventType = 2");
watcher.EventArrived += new EventArrivedEventHandler(watcher_EventArrived); watcher.EventArrived += new EventArrivedEventHandler(watcher_EventArrived);
watcher.Query = query; watcher.Query = query;
@ -81,7 +75,7 @@ namespace UWUVCI_AIO_WPF.UI.Windows
} }
catch (Exception) catch (Exception)
{ {
//left empty on purpose
} }
} }
@ -98,17 +92,14 @@ namespace UWUVCI_AIO_WPF.UI.Windows
} }
catch (Exception) catch (Exception)
{ {
//left empty on purpose
} }
} }
private void watcher_EventArrived(object sender, EventArrivedEventArgs e) private void watcher_EventArrived(object sender, EventArrivedEventArgs e)
{ {
Dispatcher.Invoke(() => { GetDrives(); });
this.Dispatcher.Invoke(() => { GetDrives(); });
} }
private void GetDrives() private void GetDrives()
@ -116,15 +107,6 @@ namespace UWUVCI_AIO_WPF.UI.Windows
sd.ItemsSource = DriveInfo.GetDrives().Where(d => d.IsReady && d.DriveType == DriveType.Removable).Select(d => d.Name + " " + d.VolumeLabel + "").ToList(); sd.ItemsSource = DriveInfo.GetDrives().Where(d => d.IsReady && d.DriveType == DriveType.Removable).Select(d => d.Name + " " + d.VolumeLabel + "").ToList();
} }
private void Button_MouseEnter(object sender, MouseEventArgs e)
{
}
private void min_MouseLeave(object sender, MouseEventArgs e)
{
}
public static long GetDirectorySize(string p) public static long GetDirectorySize(string p)
{ {
string[] a = Directory.GetFiles(p, "*.*"); string[] a = Directory.GetFiles(p, "*.*");
@ -138,8 +120,6 @@ namespace UWUVCI_AIO_WPF.UI.Windows
} }
public static long GetDirectorySize(string b, bool t) public static long GetDirectorySize(string b, bool t)
{ {
long result = 0; long result = 0;
Stack<string> stack = new Stack<string>(); Stack<string> stack = new Stack<string>();
stack.Push(b); stack.Push(b);
@ -161,41 +141,35 @@ namespace UWUVCI_AIO_WPF.UI.Windows
} }
private void Window_Minimize(object sender, RoutedEventArgs e) private void Window_Minimize(object sender, RoutedEventArgs e)
{ {
this.WindowState = WindowState.Minimized; WindowState = WindowState.Minimized;
} }
public void changeOwner(MainWindow ow) public void changeOwner(MainWindow ow)
{ {
this.Owner = ow; Owner = ow;
try try
{ {
if (this.Owner?.GetType() == typeof(MainWindow)) if (Owner?.GetType() == typeof(MainWindow))
{ {
this.WindowStartupLocation = WindowStartupLocation.CenterOwner; WindowStartupLocation = WindowStartupLocation.CenterOwner;
this.ShowInTaskbar = false; ShowInTaskbar = false;
} }
} }
catch (Exception) catch (Exception)
{ {
this.WindowStartupLocation = WindowStartupLocation.CenterScreen; WindowStartupLocation = WindowStartupLocation.CenterScreen;
} }
}
private void wind_Closing(object sender, System.ComponentModel.CancelEventArgs e)
{
} }
private void MoveWindow(object sender, MouseButtonEventArgs e) private void MoveWindow(object sender, MouseButtonEventArgs e)
{ {
try try
{ {
if (e.ChangedButton == MouseButton.Left) if (e.ChangedButton == MouseButton.Left)
this.DragMove(); DragMove();
} }
catch (Exception) catch (Exception)
{ {
//left empty on purpose
} }
} }
private void Window_Close(object sender, RoutedEventArgs e) private void Window_Close(object sender, RoutedEventArgs e)
@ -211,7 +185,7 @@ namespace UWUVCI_AIO_WPF.UI.Windows
watcher2.Stop(); watcher2.Stop();
watcher.Dispose(); watcher.Dispose();
watcher2.Dispose(); watcher2.Dispose();
this.Close(); Close();
} }
private void close_MouseLeave(object sender, MouseEventArgs e) private void close_MouseLeave(object sender, MouseEventArgs e)
{ {
@ -233,7 +207,7 @@ namespace UWUVCI_AIO_WPF.UI.Windows
} }
catch (Exception ) catch (Exception )
{ {
//left empty on purpose
} }
} }
DispatcherTimer dp = new DispatcherTimer(); DispatcherTimer dp = new DispatcherTimer();
@ -247,12 +221,12 @@ namespace UWUVCI_AIO_WPF.UI.Windows
dblSByte = bytes / 1024.0; dblSByte = bytes / 1024.0;
} }
return String.Format("{0:0.##} {1}", dblSByte, Suffix[i]); return string.Format("{0:0.##} {1}", dblSByte, Suffix[i]);
} }
private void setup_Click(object sender, RoutedEventArgs e) private void setup_Click(object sender, RoutedEventArgs e)
{if(!(FindResource("mvm") as MainViewModel).saveworkaround) {if(!(FindResource("mvm") as MainViewModel).saveworkaround)
{ {
long injctSize = GetDirectorySize(System.IO.Path.Combine(path, (FindResource("mvm") as MainViewModel).foldername), true); long injctSize = GetDirectorySize(Path.Combine(path, (FindResource("mvm") as MainViewModel).foldername), true);
if (injctSize >= new DriveInfo(driveletter).AvailableFreeSpace) if (injctSize >= new DriveInfo(driveletter).AvailableFreeSpace)
{ {
long div = injctSize - new DriveInfo(driveletter).AvailableFreeSpace + 1048576; long div = injctSize - new DriveInfo(driveletter).AvailableFreeSpace + 1048576;
@ -263,7 +237,7 @@ namespace UWUVCI_AIO_WPF.UI.Windows
} }
catch (Exception) catch (Exception)
{ {
//left empty on purpose
} }
cm.ShowDialog(); cm.ShowDialog();
} }
@ -301,14 +275,7 @@ namespace UWUVCI_AIO_WPF.UI.Windows
}); });
setup.IsEnabled = false; setup.IsEnabled = false;
} }
} }
private void Dp_Tick(object sender, EventArgs e) private void Dp_Tick(object sender, EventArgs e)
@ -370,13 +337,13 @@ namespace UWUVCI_AIO_WPF.UI.Windows
{ {
MainViewModel mvm = FindResource("mvm") as MainViewModel; MainViewModel mvm = FindResource("mvm") as MainViewModel;
mvm.msg = "Copying Injected Game..."; mvm.msg = "Copying Injected Game...";
if(!System.IO.Path.Combine(path, mvm.foldername).Contains("[WUP]")) if(!Path.Combine(path, mvm.foldername).Contains("[WUP]"))
{ {
DirectoryCopy(System.IO.Path.Combine(path, mvm.foldername), driveletter + "\\wiiu\\games\\" + mvm.foldername, true); DirectoryCopy(Path.Combine(path, mvm.foldername), driveletter + "\\wiiu\\games\\" + mvm.foldername, true);
} }
else else
{ {
DirectoryCopy(System.IO.Path.Combine(path,mvm.foldername), driveletter + "\\install\\" + mvm.foldername, true); DirectoryCopy(Path.Combine(path,mvm.foldername), driveletter + "\\install\\" + mvm.foldername, true);
} }
mvm.foldername = ""; mvm.foldername = "";
@ -403,7 +370,7 @@ namespace UWUVCI_AIO_WPF.UI.Windows
// Get the files in the directory and copy them to the new location. // Get the files in the directory and copy them to the new location.
foreach (FileInfo file in dir.EnumerateFiles()) foreach (FileInfo file in dir.EnumerateFiles())
{ {
file.CopyTo(System.IO.Path.Combine(destDirName, file.Name), true); file.CopyTo(Path.Combine(destDirName, file.Name), true);
} }
// If copying subdirectories, copy them and their contents to new location. // If copying subdirectories, copy them and their contents to new location.
@ -411,7 +378,7 @@ namespace UWUVCI_AIO_WPF.UI.Windows
{ {
foreach (DirectoryInfo subdir in dir.EnumerateDirectories()) foreach (DirectoryInfo subdir in dir.EnumerateDirectories())
{ {
DirectoryCopy(subdir.FullName, System.IO.Path.Combine(destDirName, subdir.Name), copySubDirs); DirectoryCopy(subdir.FullName, Path.Combine(destDirName, subdir.Name), copySubDirs);
} }
} }
} }