public FileInfo CppJniReflectionJavaP(string file, string currDir, string directory = "") { lock (this) { JavaCppReflectionOutput = ""; CurrentCppReflectionFile = Path.Combine(currDir, file); if (!CurrentCppReflectionFile.Contains(".class")) { CurrentCppReflectionFile += ".class"; } else if (CurrentCppReflectionFile == "") { CurrentCppReflectionFile = file; } JavaCppReflectionProcess = new Process(); JavaCppReflectionMessageBox = new MessageScreenScrollable(); JavaCppReflectionMessageBox.Text = "javap Output"; JavaCppReflectionMessageBox.AddOnCloseDelegate(JavaCppReflectionProcess_Exit); JavaCppReflectionProcess.Exited += new EventHandler(JavaCppReflectionProcess_Exited); JavaCppReflectionProcess.OutputDataReceived += new DataReceivedEventHandler(JavaCppReflectionProcess_OutputDataReceived); JavaCppReflectionProcess.ErrorDataReceived += new DataReceivedEventHandler(JavaCppReflectionProcess_ErrorDataReceived); try { JavaCppReflectionMessageBox.Show(); JavaCppReflectionMessageBox.AppendText("Processing 1 File\n"); JavaCppReflectionMessageBox.AppendText("Calling argument:\n" + MainWindow.Instance.SelectedJdkEnvironment.JavaPLocation + " -s " + file + "\nWorking Directory:\t" + currDir + "\n\n----------------\n"); JavaCppReflectionProcess.StartInfo = new ProcessStartInfo(MainWindow.Instance.SelectedJdkEnvironment.JavaPLocation); JavaCppReflectionProcess.StartInfo.WindowStyle = ProcessWindowStyle.Minimized; JavaCppReflectionProcess.StartInfo.WorkingDirectory = currDir; JavaCppReflectionProcess.StartInfo.Arguments = "-s " + file; JavaCppReflectionProcess.StartInfo.UseShellExecute = false; JavaCppReflectionProcess.StartInfo.CreateNoWindow = true; JavaCppReflectionProcess.StartInfo.RedirectStandardOutput = true; JavaCppReflectionProcess.StartInfo.RedirectStandardError = true; JavaCppReflectionProcess.Start(); JavaCppReflectionProcess.BeginOutputReadLine(); JavaCppReflectionProcess.BeginErrorReadLine(); } catch (Exception e) { } } return null; }
private void RunReadElfButton_Click(object sender, EventArgs e) { ReadElfProcess = new Process(); string args = CheckBoxes(); ReadElfMessageBox = new MessageScreenScrollable(); ReadElfMessageBox.Text = "readelf Utility Output (" + args + " )"; ReadElfMessageBox.ColorFormatting = false; ReadElfMessageBox.AddOnCloseDelegate(StringsProcess_Exit); ReadElfProcess.Exited += new EventHandler(StringsProcess_Exited); ReadElfProcess.OutputDataReceived += new DataReceivedEventHandler(StringsProcess_OutputDataReceived); ReadElfProcess.ErrorDataReceived += new DataReceivedEventHandler(StringsProcess_ErrorDataReceived); string readElfExec = NdkEnvironment.GetBinUtilsPrefixForArchitcture(SelectedArch); if (NUtilityGlobalContext.OSType == (int)NUtilityGlobalContext.OS.Windows) { readElfExec += "readelf.exe"; } else { readElfExec += "readelf"; } ReadElfMessageBox.Show(); ReadElfProcess.StartInfo = new ProcessStartInfo(readElfExec); ReadElfProcess.StartInfo.WindowStyle = ProcessWindowStyle.Minimized; ReadElfProcess.StartInfo.WorkingDirectory = BinaryFile.Directory.FullName; ReadElfProcess.StartInfo.Arguments = args + " " + BinaryFile.FullName; ReadElfProcess.StartInfo.UseShellExecute = false; ReadElfProcess.StartInfo.CreateNoWindow = true; ReadElfProcess.StartInfo.RedirectStandardOutput = true; ReadElfProcess.StartInfo.RedirectStandardError = true; ReadElfProcess.Start(); ReadElfProcess.BeginOutputReadLine(); ReadElfProcess.BeginErrorReadLine(); }
public void CreateCppReflection() { if (JavaPOutput == null) { MainWindow.PrintMessageInMessageBoxInst("Tried to Generate C++ JNI Reflection code from file without Javap output!", context: MESSAGE_CONTEXT, severity: (int)nUtility.MainWindow.TextSeverity.ERROR); return; } else { JavaPToCppMessageWindow = new MessageScreenScrollable(); JavaPToCppMessageWindow.Text = "C++ JNI Reflection for \"" + ReadableClassName + "\""; JavaPToCppMessageWindow.Show(); JavaPToCppMessageWindow.AddOnCloseDelegate(JavaPToCppMessageWindow_OnClose); BackgroundRegexThread = new Thread(new ThreadStart(CppReflectionProcessing)); // Do processing on background thread in order to not freeze up UI BackgroundRegexThread.Start(); } }
private void NdkStack() { ProjectEnvironment.ProjectModule theModule = ((ProjectEnvironment.ProjectModule)AndroidStudioModuleComboBox.SelectedItem); NdkStackProcess = new Process(); NdkStackWindow = new MessageScreenScrollable(); NdkStackWindow.ColorFormatting = false; NdkStackWindow.AddOnCloseDelegate(NdkStackProcess_Exit); NdkStackWindow.Text = "(NDK) Stack Output"; NdkStackWindow.Show(); string ndk_stack = ""; if (NUtilityGlobalContext.OSType == (int)NUtilityGlobalContext.OS.Windows) { ndk_stack = Path.Combine(SelectedNdkEnvironment.RootDirectory, "ndk-stack.exe"); } else { ndk_stack = Path.Combine(SelectedNdkEnvironment.RootDirectory, "ndk-stack"); } try { NdkStackProcess.Exited += new EventHandler(NdkStackProcess_Exited); NdkStackProcess.OutputDataReceived += new DataReceivedEventHandler(NdkStackProcess_OutputDataReceived); NdkStackProcess.ErrorDataReceived += new DataReceivedEventHandler(NdkStackProcess_ErrorDataReceived); NdkStackProcess.StartInfo = new ProcessStartInfo(ndk_stack); NdkStackProcess.StartInfo.WindowStyle = ProcessWindowStyle.Minimized; NdkStackProcess.StartInfo.WorkingDirectory = theModule.ModuleRootDirectory; NdkStackProcess.StartInfo.Arguments = "-sym " + theModule.BinDirectory + Path.DirectorySeparatorChar + "local" + Path.DirectorySeparatorChar + ArchBinaryList.SelectedText; NdkStackProcess.StartInfo.UseShellExecute = false; NdkStackProcess.StartInfo.CreateNoWindow = true; NdkStackProcess.StartInfo.RedirectStandardInput = true; NdkStackProcess.StartInfo.RedirectStandardOutput = true; NdkStackProcess.StartInfo.RedirectStandardError = true; NdkStackProcess.Start(); NdkStackProcess.BeginOutputReadLine(); NdkStackProcess.BeginErrorReadLine(); } catch (Exception e) { } }
// Returns StdOut from javap for the given argumenbt in the current directory private void Javap(string arg, string currDir, int numFiles) { JavaPProcess = new Process(); JavaPMessageBox = new MessageScreenScrollable(); JavaPMessageBox.Text = "javap Output"; JavaPMessageBox.AddOnCloseDelegate(JavaPProcess_Exit); JavaPProcess.Exited += new EventHandler(JavaPProcess_Exited); JavaPProcess.OutputDataReceived += new DataReceivedEventHandler(JavaPProcess_OutputDataReceived); JavaPProcess.ErrorDataReceived += new DataReceivedEventHandler(JavaPProcess_ErrorDataReceived); try { JavaPMessageBox.Show(); if (numFiles == 1) { JavaPMessageBox.AppendText("Processing 1 File\n"); } else { JavaPMessageBox.AppendText("Processing " + numFiles + " Files\n"); } JavaPMessageBox.AppendText("Calling argument:\n" + MainWindow.Instance.SelectedJdkEnvironment.JavaPLocation + " -s " + arg + "\nWorking Directory:\t" + currDir + "\n\n----------------\n"); JavaPProcess.StartInfo = new ProcessStartInfo(MainWindow.Instance.SelectedJdkEnvironment.JavaPLocation); JavaPProcess.StartInfo.WindowStyle = ProcessWindowStyle.Minimized; JavaPProcess.StartInfo.WorkingDirectory = currDir; JavaPProcess.StartInfo.Arguments = "-s " + arg; JavaPProcess.StartInfo.UseShellExecute = false; JavaPProcess.StartInfo.CreateNoWindow = true; JavaPProcess.StartInfo.RedirectStandardOutput = true; JavaPProcess.StartInfo.RedirectStandardError = true; JavaPProcess.Start(); JavaPProcess.BeginOutputReadLine(); JavaPProcess.BeginErrorReadLine(); } catch (Exception e) {} }