mirror of
https://github.com/stuff-by-3-random-dudes/UWUVCI-AIO-WPF
synced 2024-11-22 19:13:11 +00:00
Creation of sd setup window
This commit is contained in:
parent
7c95435696
commit
61d902b38f
8 changed files with 318 additions and 1 deletions
|
@ -1270,13 +1270,15 @@ namespace UWUVCI_AIO_WPF
|
|||
Regex reg = new Regex("[^a-zA-Z0-9 é -]");
|
||||
//string outputPath = Path.Combine(Properties.Settings.Default.InjectionPath, gameName);
|
||||
string outputPath = Path.Combine(Properties.Settings.Default.OutPath, $"[LOADIINE]{reg.Replace(gameName,"")} [{mvvm.prodcode}]");
|
||||
mvvm.foldername = $"[LOADIINE]{reg.Replace(gameName, "")} [{mvvm.prodcode}]";
|
||||
int i = 0;
|
||||
while (Directory.Exists(outputPath))
|
||||
{
|
||||
outputPath = Path.Combine(Properties.Settings.Default.OutPath, $"[LOADIINE]{reg.Replace(gameName, "")} [{mvvm.prodcode}]_{i}");
|
||||
mvvm.foldername = $"[LOADIINE]{reg.Replace(gameName, "")} [{mvvm.prodcode}]_{i}";
|
||||
i++;
|
||||
}
|
||||
|
||||
|
||||
DirectoryCopy(baseRomPath,outputPath, true);
|
||||
|
||||
Custom_Message cm = new Custom_Message("Injection Complete", $"Config will stay filled, choose a Console again to clear it.\nTo Open the Location of the Inject press Open Folder.", Settings.Default.OutPath);
|
||||
|
@ -1301,12 +1303,15 @@ namespace UWUVCI_AIO_WPF
|
|||
if (gameName == null || gameName == string.Empty) gameName = "NoName";
|
||||
//string outputPath = Path.Combine(Properties.Settings.Default.InjectionPath, gameName);
|
||||
string outputPath = Path.Combine(Properties.Settings.Default.OutPath, $"[WUP]{reg.Replace(gameName,"")}");
|
||||
mvvm.foldername = $"[WUP]{reg.Replace(gameName, "")}";
|
||||
int i = 0;
|
||||
while (Directory.Exists(outputPath))
|
||||
{
|
||||
outputPath = Path.Combine(Properties.Settings.Default.OutPath, $"[WUP]{reg.Replace(gameName,"")}_{i}");
|
||||
mvvm.foldername = $"[WUP]{reg.Replace(gameName, "")}_{i}";
|
||||
i++;
|
||||
}
|
||||
|
||||
mvm.Progress = 40;
|
||||
mvm.msg = "Packing...";
|
||||
using (Process cnuspacker = new Process())
|
||||
|
|
|
@ -328,6 +328,7 @@ namespace UWUVCI_AIO_WPF
|
|||
}
|
||||
}
|
||||
|
||||
public string foldername = "";
|
||||
|
||||
public string msg
|
||||
{
|
||||
|
@ -867,6 +868,7 @@ namespace UWUVCI_AIO_WPF
|
|||
CBasePath = null;
|
||||
prodcode = "";
|
||||
if(Directory.Exists(Path.Combine(Directory.GetCurrentDirectory(), "bin", "repo"))) Directory.Delete(Path.Combine(Directory.GetCurrentDirectory(), "bin", "repo"), true);
|
||||
foldername = "";
|
||||
}
|
||||
|
||||
DownloadWait Injectwait;
|
||||
|
|
|
@ -27,6 +27,7 @@
|
|||
<Button Content="Reset TitleKeys" HorizontalAlignment="Left" Margin="325,254,0,0" VerticalAlignment="Top" Width="153" RenderTransformOrigin="-0.099,0.116" Click="Button_Click_8"/>
|
||||
<Button Content="Start Nintendont Config Tool" HorizontalAlignment="Left" Margin="325,342,0,0" VerticalAlignment="Top" Width="267" RenderTransformOrigin="-0.099,0.116" Click="Button_Click_9"/>
|
||||
<Button Content="Reset Don't show this again Option" HorizontalAlignment="Left" Margin="410,387,0,0" VerticalAlignment="Top" Width="266" RenderTransformOrigin="-0.099,0.116" Click="Button_Click_10"/>
|
||||
<Button Content="Button" HorizontalAlignment="Left" Margin="325,451,0,0" VerticalAlignment="Top" Width="75" Click="Button_Click_11"/>
|
||||
|
||||
</Grid>
|
||||
</Page>
|
||||
|
|
|
@ -118,5 +118,10 @@ namespace UWUVCI_AIO_WPF.UI.Frames
|
|||
Properties.Settings.Default.gczw = false;
|
||||
Properties.Settings.Default.Save();
|
||||
}
|
||||
|
||||
private void Button_Click_11(object sender, RoutedEventArgs e)
|
||||
{
|
||||
new SDSetup().Show();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
33
UWUVCI AIO WPF/UI/Windows/DownloadWait - Kopieren.xaml
Normal file
33
UWUVCI AIO WPF/UI/Windows/DownloadWait - Kopieren.xaml
Normal file
|
@ -0,0 +1,33 @@
|
|||
<Window x:Class="UWUVCI_AIO_WPF.UI.Windows.SDSetup"
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:local="clr-namespace:UWUVCI_AIO_WPF"
|
||||
xmlns:materialDesign="http://materialdesigninxaml.net/winfx/xaml/themes"
|
||||
mc:Ignorable="d"
|
||||
Title="MAIN" Height="175.197" Width="337.333" WindowStyle="None" WindowStartupLocation="CenterScreen" Foreground="White" Background="LightGray" ResizeMode="NoResize" Icon="/UWUVCI AIO WPF;component/b.ico" Closing="wind_Closing" Closed="wind_Closed">
|
||||
<Grid Margin="0,0,-120,0">
|
||||
<Grid Height="52" VerticalAlignment="Top" Margin="0,0,-111,0" MouseDown="MoveWindow">
|
||||
<Grid.Background>
|
||||
|
||||
<VisualBrush TileMode="Tile" Viewport="0,0,0.0965,1">
|
||||
<VisualBrush.Visual>
|
||||
<Image Source="/UI/Images/bg maybe wpf.png"></Image>
|
||||
</VisualBrush.Visual>
|
||||
</VisualBrush>
|
||||
|
||||
|
||||
</Grid.Background>
|
||||
<TextBlock Name="tbTitleBar" HorizontalAlignment="Left" Margin="0,8,0,0" TextWrapping="Wrap" Text="SD Setup" VerticalAlignment="Top" FontSize="25" Width="332" TextAlignment="Center"/>
|
||||
</Grid>
|
||||
<Button Content="Button" HorizontalAlignment="Left" Margin="311,6,0,0" VerticalAlignment="Top" Width="18" Background="{x:Null}" BorderBrush="{x:Null}" Height="25" Click="Window_Close" Name="close" MouseEnter="close_MouseEnter" MouseLeave="close_MouseLeave"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="315,7,0,0" TextWrapping="Wrap" Text="X" VerticalAlignment="Top" Foreground="White" FontSize="16" IsHitTestVisible="False"/>
|
||||
<ComboBox HorizontalAlignment="Left" Margin="10,85,0,0" VerticalAlignment="Top" Width="313" Name="sd" Foreground="Black" SelectionChanged="sd_SelectionChanged"/>
|
||||
<TextBlock HorizontalAlignment="Left" Margin="10,61,0,0" TextWrapping="Wrap" Text="Choose your SD Card:" VerticalAlignment="Top" Foreground="Black" />
|
||||
<Button Content="Setup SD Card" HorizontalAlignment="Left" Margin="199,129,0,0" VerticalAlignment="Top" Width="124" Height="28" IsEnabled="False" Name="setup" Click="setup_Click"/>
|
||||
<Border BorderThickness="1.5,1.5,1.5,1.5" BorderBrush="#FF2196F3" HorizontalAlignment="Left" Height="175" VerticalAlignment="Top" Width="337"/>
|
||||
|
||||
</Grid>
|
||||
</Window>
|
||||
|
262
UWUVCI AIO WPF/UI/Windows/DownloadWait - Kopieren.xaml.cs
Normal file
262
UWUVCI AIO WPF/UI/Windows/DownloadWait - Kopieren.xaml.cs
Normal file
|
@ -0,0 +1,262 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Management;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using System.Windows;
|
||||
using System.Windows.Controls;
|
||||
using System.Windows.Data;
|
||||
using System.Windows.Documents;
|
||||
using System.Windows.Input;
|
||||
using System.Windows.Media;
|
||||
using System.Windows.Media.Imaging;
|
||||
using System.Windows.Shapes;
|
||||
using System.Windows.Threading;
|
||||
|
||||
namespace UWUVCI_AIO_WPF.UI.Windows
|
||||
{
|
||||
/// <summary>
|
||||
/// Interaktionslogik für DownloadWait.xaml
|
||||
/// </summary>
|
||||
|
||||
partial class SDSetup : Window, IDisposable
|
||||
{
|
||||
bool gc = false;
|
||||
string path = "";
|
||||
ManagementEventWatcher watcher = new ManagementEventWatcher();
|
||||
ManagementEventWatcher watcher2 = new ManagementEventWatcher();
|
||||
string driveletter = "";
|
||||
public SDSetup()
|
||||
{
|
||||
|
||||
InitializeComponent();
|
||||
Task.Run(() => checkfornewinput());
|
||||
Task.Run(() => checkfornewoutput());
|
||||
GetDrives();
|
||||
|
||||
}
|
||||
public void SpecifyDrive()
|
||||
{
|
||||
if (sd.SelectedValue != null)
|
||||
{
|
||||
driveletter = sd.SelectedValue.ToString().Substring(0, 3);
|
||||
}
|
||||
else
|
||||
{
|
||||
driveletter = "";
|
||||
|
||||
}
|
||||
}
|
||||
public SDSetup(bool gamecube, string injectlocation)
|
||||
{
|
||||
InitializeComponent();
|
||||
gc = gamecube;
|
||||
path = injectlocation;
|
||||
|
||||
|
||||
Task.Run(() => checkfornewinput());
|
||||
Task.Run(() => checkfornewoutput());
|
||||
|
||||
GetDrives();
|
||||
}
|
||||
private void checkfornewinput()
|
||||
{
|
||||
|
||||
WqlEventQuery query = new WqlEventQuery("SELECT * FROM Win32_VolumeChangeEvent WHERE EventType = 2");
|
||||
watcher.EventArrived += new EventArrivedEventHandler(watcher_EventArrived);
|
||||
watcher.Query = query;
|
||||
watcher.Start();
|
||||
watcher.WaitForNextEvent();
|
||||
}
|
||||
private void checkfornewoutput()
|
||||
{
|
||||
WqlEventQuery query = new WqlEventQuery("SELECT * FROM Win32_VolumeChangeEvent WHERE EventType = 3");
|
||||
watcher2.EventArrived += new EventArrivedEventHandler(watcher_EventArrived);
|
||||
watcher2.Query = query;
|
||||
watcher2.Start();
|
||||
watcher2.WaitForNextEvent();
|
||||
}
|
||||
|
||||
private void watcher_EventArrived(object sender, EventArrivedEventArgs e)
|
||||
{
|
||||
|
||||
this.Dispatcher.Invoke(() => { GetDrives(); });
|
||||
|
||||
|
||||
}
|
||||
|
||||
private void GetDrives()
|
||||
{
|
||||
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)
|
||||
{
|
||||
|
||||
}
|
||||
private void Window_Minimize(object sender, RoutedEventArgs e)
|
||||
{
|
||||
this.WindowState = WindowState.Minimized;
|
||||
}
|
||||
|
||||
public void changeOwner(MainWindow ow)
|
||||
{
|
||||
this.Owner = ow;
|
||||
try
|
||||
{
|
||||
if (this.Owner.GetType() == typeof(MainWindow))
|
||||
{
|
||||
this.WindowStartupLocation = WindowStartupLocation.CenterOwner;
|
||||
this.ShowInTaskbar = false;
|
||||
}
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
this.WindowStartupLocation = WindowStartupLocation.CenterScreen;
|
||||
}
|
||||
}
|
||||
private void wind_Closing(object sender, System.ComponentModel.CancelEventArgs e)
|
||||
{
|
||||
|
||||
|
||||
|
||||
}
|
||||
private void MoveWindow(object sender, MouseButtonEventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if (e.ChangedButton == MouseButton.Left)
|
||||
this.DragMove();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
private async void Window_Close(object sender, RoutedEventArgs e)
|
||||
{
|
||||
/*Task t = new Task(() => watcher.Stop());
|
||||
t.Start();
|
||||
t.Wait();
|
||||
t = new Task(() => watcher2.Stop());
|
||||
t.Start();
|
||||
t.Wait();*/
|
||||
|
||||
watcher.Stop();
|
||||
watcher2.Stop();
|
||||
|
||||
this.Close();
|
||||
}
|
||||
private void close_MouseLeave(object sender, MouseEventArgs e)
|
||||
{
|
||||
close.Background = new SolidColorBrush(Color.FromArgb(0, 250, 250, 250));
|
||||
}
|
||||
|
||||
private void close_MouseEnter(object sender, MouseEventArgs e)
|
||||
{
|
||||
close.Background = new SolidColorBrush(Color.FromArgb(150, 255, 100, 100));
|
||||
}
|
||||
private void wind_Closed(object sender, EventArgs e)
|
||||
{
|
||||
try
|
||||
{
|
||||
if ((FindResource("mvm") as MainViewModel).mw != null)
|
||||
{
|
||||
(FindResource("mvm") as MainViewModel).mw.Topmost = false;
|
||||
}
|
||||
}
|
||||
catch (Exception s)
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
private void setup_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
if (gc)
|
||||
{
|
||||
SetupNintendont();
|
||||
}
|
||||
CopyInject();
|
||||
}
|
||||
|
||||
private void SetupNintendont()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
private void CopyInject()
|
||||
{
|
||||
MainViewModel mvm = FindResource("mvm") as MainViewModel;
|
||||
if(path.Contains("[LOADIINE]") && !path.Contains("[WUP]"))
|
||||
{
|
||||
DirectoryCopy(path, driveletter + "\\wiiu\\games\\" + mvm.foldername, true);
|
||||
}
|
||||
else
|
||||
{
|
||||
DirectoryCopy(path, driveletter + "\\install\\" + mvm.foldername, true);
|
||||
}
|
||||
|
||||
mvm.foldername = "";
|
||||
}
|
||||
|
||||
public static void DirectoryCopy(string sourceDirName, string destDirName, bool copySubDirs)
|
||||
{
|
||||
// Get the subdirectories for the specified directory.
|
||||
DirectoryInfo dir = new DirectoryInfo(sourceDirName);
|
||||
|
||||
if (!dir.Exists)
|
||||
{
|
||||
throw new DirectoryNotFoundException($"Source directory does not exist or could not be found: {sourceDirName}");
|
||||
}
|
||||
|
||||
// If the destination directory doesn't exist, create it.
|
||||
if (!Directory.Exists(destDirName))
|
||||
{
|
||||
Directory.CreateDirectory(destDirName);
|
||||
}
|
||||
|
||||
// Get the files in the directory and copy them to the new location.
|
||||
foreach (FileInfo file in dir.EnumerateFiles())
|
||||
{
|
||||
file.CopyTo(System.IO.Path.Combine(destDirName, file.Name), false);
|
||||
}
|
||||
|
||||
// If copying subdirectories, copy them and their contents to new location.
|
||||
if (copySubDirs)
|
||||
{
|
||||
foreach (DirectoryInfo subdir in dir.EnumerateDirectories())
|
||||
{
|
||||
DirectoryCopy(subdir.FullName, System.IO.Path.Combine(destDirName, subdir.Name), copySubDirs);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private void sd_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
if(sd.SelectedIndex > -1 && sd.SelectedItem != null)
|
||||
{
|
||||
setup.IsEnabled = true;
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
setup.IsEnabled = false;
|
||||
|
||||
}
|
||||
SpecifyDrive();
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
|
@ -93,6 +93,7 @@ namespace UWUVCI_AIO_WPF
|
|||
mvm.donttrim = false;
|
||||
mvm.NKITFLAG = false;
|
||||
mvm.prodcode = "";
|
||||
mvm.foldername = "";
|
||||
mvm.isDoneMW();
|
||||
|
||||
switch ((sender as ListView).SelectedIndex)
|
||||
|
|
|
@ -88,6 +88,7 @@
|
|||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.IO.Compression" />
|
||||
<Reference Include="System.IO.Compression.FileSystem" />
|
||||
<Reference Include="System.Management" />
|
||||
<Reference Include="System.Windows.Forms" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
|
@ -137,6 +138,9 @@
|
|||
<Compile Include="UI\Windows\Custom Message.xaml.cs">
|
||||
<DependentUpon>Custom Message.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UI\Windows\DownloadWait - Kopieren.xaml.cs">
|
||||
<DependentUpon>DownloadWait - Kopieren.xaml</DependentUpon>
|
||||
</Compile>
|
||||
<Compile Include="UI\Windows\DownloadWait.xaml.cs">
|
||||
<DependentUpon>DownloadWait.xaml</DependentUpon>
|
||||
</Compile>
|
||||
|
@ -229,6 +233,10 @@
|
|||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
</Page>
|
||||
<Page Include="UI\Windows\DownloadWait - Kopieren.xaml">
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
<SubType>Designer</SubType>
|
||||
</Page>
|
||||
<Page Include="UI\Windows\DownloadWait.xaml">
|
||||
<SubType>Designer</SubType>
|
||||
<Generator>MSBuild:Compile</Generator>
|
||||
|
|
Loading…
Reference in a new issue