diff --git a/h-encore-auto/AutoMode.xaml.cs b/h-encore-auto/AutoMode.xaml.cs index 04a82ab..88cd6ab 100644 --- a/h-encore-auto/AutoMode.xaml.cs +++ b/h-encore-auto/AutoMode.xaml.cs @@ -50,6 +50,16 @@ namespace h_encore_auto private void buttonStart_Click(object sender, RoutedEventArgs e) { + Process[] pname = Process.GetProcessesByName("qcma"); + if (pname.Length != 0) + { + foreach (var proc in pname) + { + proc.Kill(); + } + MessageBox.Show("QCMA was closed, since this application has to interact with it."); + } + // 7ZIP Download and extraction Util.dlFile(Ref.url7zr, "7zr.exe"); Util.dlFile(Ref.url7za, "7z-extra.7z"); @@ -157,12 +167,33 @@ namespace h_encore_auto process.Start(); process.WaitForExit(); - startInfo.Arguments = @" / C reg import " + pathImportReg; + startInfo.Arguments = @" /C reg import " + pathImportReg; process.StartInfo = startInfo; process.Start(); process.WaitForExit(); } + startInfo.Arguments = @"/C " + pathQcmaExtracted + "qcma.exe"; + process.StartInfo = startInfo; + process.Start(); + + for (; ; ) + { + var guide = new VitaGuide(); + guide.ShowDialog(); + + if (Util.IsDirectoryEmpty(pathQcmaRes + "PSVita\\APP\\")) + { + MessageBox.Show("Required folder not found. \nMake sure you did everything correctly and follow the steps again."); + } + else + { + break; + } + } + + shortAID = Directory.GetDirectories(pathQcmaRes + "PSVita\\APP\\")[0]; + } } diff --git a/h-encore-auto/Util.cs b/h-encore-auto/Util.cs index 1de82c2..b90c5c5 100644 --- a/h-encore-auto/Util.cs +++ b/h-encore-auto/Util.cs @@ -4,6 +4,7 @@ using System.Net.Http; using System.IO; using System.Windows.Markup; using System.Windows; +using System.Collections.Generic; namespace h_encore_auto { @@ -60,5 +61,13 @@ namespace h_encore_auto Util.DeleteDirectory(Ref.tempDir); System.Environment.Exit(0); } + public static bool IsDirectoryEmpty(string path) + { + IEnumerable items = Directory.EnumerateFileSystemEntries(path); + using (IEnumerator en = items.GetEnumerator()) + { + return !en.MoveNext(); + } + } } } \ No newline at end of file diff --git a/h-encore-auto/VitaGuide.xaml b/h-encore-auto/VitaGuide.xaml new file mode 100644 index 0000000..d0e2b4f --- /dev/null +++ b/h-encore-auto/VitaGuide.xaml @@ -0,0 +1,17 @@ + + + + +