Exemplo n.º 1
0
        string HactoolInfo(string fname)
        {
            NCALogTb.AppendText("Checking file " + fname + "\r\n");
            string cmdline = $"/C \"\"{HactoolExe}\" -k \"{KeyFile}\" \"{fname}\"\"";

            Console.WriteLine(cmdline);
            var start = new ProcessStartInfo()
            {
                FileName               = "cmd.exe",
                Arguments              = cmdline,
                CreateNoWindow         = true,
                UseShellExecute        = false,
                RedirectStandardOutput = true,
            };

            using (var p = Process.Start(start))
            {
                string output = p.StandardOutput.ReadToEnd();
                p.WaitForExit(5000);
                if (!p.HasExited)
                {
                    p.Kill();
                    MessageBox.Show("The hactool process timed out and has been killed");
                    Console.WriteLine(output);
                    NCALogTb.AppendText("PROCESS TIMED OUT.\r\n" + output);
                    return(null);
                }
                NCALogTb.AppendText(output + "\r\n\r\n");
                return(output);
            }
        }
Exemplo n.º 2
0
        bool HactoolExtract(string fname, string target)
        {
            NCALogTb.AppendText("Extracting file " + fname + " target " + target + "\r\n");
            string cmdline = $"/C \"\"{HactoolExe}\" -k \"{KeyFile}\" --romfsdir=\"{OutputPathTb.Text}\\{target}RomFS\" \"{fname}\"\"";

            Console.WriteLine(cmdline);
            var start = new ProcessStartInfo()
            {
                FileName               = "cmd.exe",
                Arguments              = cmdline,
                CreateNoWindow         = true,
                UseShellExecute        = false,
                RedirectStandardOutput = true,
            };

            using (var p = Process.Start(start))
            {
                string output = p.StandardOutput.ReadToEnd();
                p.WaitForExit(10000);
                if (!p.HasExited)
                {
                    p.Kill();
                    MessageBox.Show("The hactool process timed out and has been killed");
                    Console.WriteLine(output);
                    NCALogTb.AppendText("PROCESS TIMED OUT.\r\n" + output);
                    return(false);
                }
                NCALogTb.AppendText(output + "\r\n\r\n");
                if (!Directory.Exists(path(OutputPathTb.Text, target + "RomFS\\lyt")))
                {
                    MessageBox.Show("Couldn't find lyt dir, check the log");
                    return(false);
                }
                return(true);
            }
        }