static void UpdateList( List<RunParameters> list, RunParameters p ) { list.Insert(0, p); for( int i = 1; i < list.Count; i++ ) if (list[i].Equals(p)) { list.RemoveAt(i); return; } if (list.Count > maxItems) list.RemoveRange(maxItems, list.Count - maxItems); }
public Run Execute(RunParameters p) { Run run = new Run(); ProcessStartInfo info = new ProcessStartInfo(p.exePath); info.WorkingDirectory = p.workingDirectory; info.UseShellExecute = false; info.EnvironmentVariables["JAVA_TOOL_OPTIONS"] = "\"-agentpath:" + Application.StartupPath + "\\PJvmImpl.dll\""; info.EnvironmentVariables["ijwprof_txt"] = run.txtFile; info.EnvironmentVariables["ijwprof_bin"] = run.binFile; info.Arguments = p.parameters; Process.Start(info).WaitForExit(); return run; }
public NewRunDialog( RunParameters initialParameters, AgentLoader loader ) { InitializeComponent(); agentBox.DisplayMember = "Name"; foreach (IAgent agent in loader.Agents) agentBox.Items.Add(agent); agentBox.SelectedItem = loader.Default; if (initialParameters != null) { applicationBox.Text = initialParameters.exePath; workingDirectoryBox.Text = initialParameters.workingDirectory; argumentsBox.Text = initialParameters.parameters; agentBox.SelectedItem = initialParameters.agent; } }
public Run Execute(RunParameters p) { using (new ComServerRegistration(Application.StartupPath + "/pcomimpl.dll")) { Run run = new Run(); ProcessStartInfo info = new ProcessStartInfo(p.exePath); info.WorkingDirectory = p.workingDirectory; info.UseShellExecute = false; info.EnvironmentVariables["Cor_Enable_Profiling"] = "1"; info.EnvironmentVariables["COR_PROFILER"] = "{C1E9FE1F-F517-45c0-BB0E-EFAECC9401FC}"; info.EnvironmentVariables["ijwprof_txt"] = run.txtFile; info.EnvironmentVariables["ijwprof_bin"] = run.binFile; info.Arguments = p.parameters; Process.Start(info).WaitForExit(); return run; } }
public static void AddRun(RunParameters p, AgentLoader loader) { List<RunParameters> l = new List<RunParameters>(); XmlDocument doc = new XmlDocument(); doc.Load(Application.StartupPath + "/mru.xml"); foreach (XmlElement e in doc.SelectNodes("/mru/run")) l.Add(new RunParameters(e, loader.GetAgent)); UpdateList(l, p); XmlWriterSettings settings = new XmlWriterSettings(); settings.Indent = true; settings.IndentChars = " "; using (XmlWriter writer = XmlWriter.Create(Application.StartupPath + "/mru.xml", settings)) { writer.WriteProcessingInstruction("xml-stylesheet", "href=\"mru.xslt\" type=\"text/xsl\""); writer.WriteStartElement("mru"); foreach (RunParameters r in l) r.WriteTo(writer); writer.WriteEndElement(); } }