private string GetJavaVersion() { ProcessRun java = new ProcessRun(javaExe); List <string> result = null; try { result = java.Run("-version"); } catch (Exception exc) { ToLog(new ProcessRun.OutData(ProcessRun.StreamType.Error, DateTime.Now, exc.Message)); return(null); } MatchCollection matches = null; foreach (string line in result) { matches = Regex.Matches(line, "^java version\\s\"(.+)\"$"); if (matches.Count > 0) { return(matches[0].Groups[1].Value); } } return(null); }
private void InitializeProcessRun() { zipAlign = new ProcessRun(Application.StartupPath + @"\tools\zipalign.exe"); zipAlign.OutputDataReceived += new MyDataReceivedEventHandler(processRun_OutputDataReceived); zipAlign.ErrorDataReceived += new MyDataReceivedEventHandler(processRun_ErrorDataReceived); zipAlign.Exception += new ExceptionEventHandler(processRun_Exception); zipAlign.Exited += new EventHandler(processRun_Exited); }
private void ZipAlignF(Object inputFilePath) { if (inputFilePath is string) { string filePath = (string)inputFilePath; string outputFile = Path.GetDirectoryName(filePath) + @"\" + Path.GetFileNameWithoutExtension(filePath) + "_zipaligned.apk"; ProcessRun zipalign = new ProcessRun(Application.StartupPath + @"\tools\zipalign.exe"); List <string> result = zipalign.Run(" -f 4 \"" + filePath + "\" " + "\"" + outputFile + "\""); foreach (string line in result) { ToLog(new ProcessRun.OutData(ProcessRun.StreamType.Error, DateTime.Now, line)); //ToLog(line); } BeginInvoke(new MethodInvoker(delegate { toolStripProgressBar1.Value++; })); } }