From 0b3e8e8523121c1af620f01aedcf6b6f1bee7c59 Mon Sep 17 00:00:00 2001 From: Jakob Date: Fri, 6 Jul 2018 02:04:14 +0200 Subject: [PATCH] still working on auto-mode --- h-encore-auto/AutoMode.xaml.cs | 33 ++++++++++++++- h-encore-auto/Util.cs | 9 ++++ h-encore-auto/VitaGuide.xaml | 17 ++++++++ h-encore-auto/VitaGuide.xaml.cs | 65 +++++++++++++++++++++++++++++ h-encore-auto/h-encore-auto.csproj | 24 +++++++++++ h-encore-auto/img/1.png | Bin 0 -> 367002 bytes h-encore-auto/img/10.png | Bin 0 -> 54396 bytes h-encore-auto/img/11.png | Bin 0 -> 31184 bytes h-encore-auto/img/12.png | Bin 0 -> 14061 bytes h-encore-auto/img/13.png | Bin 0 -> 87088 bytes h-encore-auto/img/14.png | Bin 0 -> 93657 bytes h-encore-auto/img/2.png | Bin 0 -> 72616 bytes h-encore-auto/img/3.png | Bin 0 -> 25528 bytes h-encore-auto/img/4.png | Bin 0 -> 47558 bytes h-encore-auto/img/5.png | Bin 0 -> 43670 bytes h-encore-auto/img/6.png | Bin 0 -> 42176 bytes h-encore-auto/img/7.png | Bin 0 -> 57162 bytes h-encore-auto/img/8.png | Bin 0 -> 66834 bytes h-encore-auto/img/9.PNG | Bin 0 -> 10008 bytes h-encore-auto/ref.cs | 6 ++- 20 files changed, 151 insertions(+), 3 deletions(-) create mode 100644 h-encore-auto/VitaGuide.xaml create mode 100644 h-encore-auto/VitaGuide.xaml.cs create mode 100644 h-encore-auto/img/1.png create mode 100644 h-encore-auto/img/10.png create mode 100644 h-encore-auto/img/11.png create mode 100644 h-encore-auto/img/12.png create mode 100644 h-encore-auto/img/13.png create mode 100644 h-encore-auto/img/14.png create mode 100644 h-encore-auto/img/2.png create mode 100644 h-encore-auto/img/3.png create mode 100644 h-encore-auto/img/4.png create mode 100644 h-encore-auto/img/5.png create mode 100644 h-encore-auto/img/6.png create mode 100644 h-encore-auto/img/7.png create mode 100644 h-encore-auto/img/8.png create mode 100644 h-encore-auto/img/9.PNG 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 @@ + + + + +