Esempio n. 1
0
        private void openNewWindow_Click(object sender, EventArgs e)
        {
            if (captures.SelectedItems.Count == 1)
            {
                var log = captures.SelectedItems[0].Tag as CaptureLog;

                var temppath = m_Core.TempLogFilename(log.exe);

                if (!log.local)
                {
                    MessageBox.Show("Can't open log in new instance with remote server in use", "Cannot open new instance",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                try
                {
                    File.Copy(log.path, temppath);
                }
                catch (System.Exception ex)
                {
                    MessageBox.Show("Couldn't save log to temporary location" + Environment.NewLine + ex.ToString(), "Cannot save temporary log",
                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                var process = new System.Diagnostics.Process();
                process.StartInfo = new System.Diagnostics.ProcessStartInfo(Application.ExecutablePath, String.Format("--tempfile \"{0}\"", temppath));
                process.Start();
            }
        }
        /// <summary>
        /// This function is the callback used to execute a command when the a menu item is clicked.
        /// See the Initialize method to see how the menu item is associated to this function using
        /// the OleMenuCommandService service and the MenuCommand class.
        /// </summary>
        private void MenuItemCallback(object sender, EventArgs e)
        {
            var proj = DTE.ActiveDocument.ProjectItem.ContainingProject;

            DTE.Solution.SolutionBuild.BuildProject(DTE.Solution.SolutionBuild.ActiveConfiguration.Name,
                                                    proj.UniqueName, true);

            var outputPath = GetOutputPath(proj);

            if (!File.Exists(outputPath))
            {
                return;
            }
            var dir = Directory.GetParent(outputPath).ToString();

            if (processId.HasValue)
            {
                try
                {
                    var p = Process.GetProcessById(processId.Value);
                    p.CloseMainWindow();
                    p.WaitForExit(5000);
                }
                catch (Exception ex)
                {
                    Debug.WriteLine("Failed to kill previous powershell process.");
                    Debug.WriteLine(ex);
                }
            }

            try
            {
                var p = new System.Diagnostics.Process
                {
                    StartInfo = new ProcessStartInfo
                    {
                        FileName         = @"C:\Windows\system32\WindowsPowerShell\v1.0\powershell.exe",
                        WorkingDirectory = dir,
                        Arguments        = $"-NoExit -Command \"& {{Import-Module '{outputPath}'}}\""
                    }
                };
                p.Start();
                processId = p.Id;

                var dteProcess = DTE.Debugger.LocalProcesses.Cast <EnvDTE.Process>().FirstOrDefault(prop => prop.ProcessID == processId);

                if (dteProcess != null)
                {
                    dteProcess.Attach();
                    DTE.Debugger.CurrentProcess = dteProcess;
                }
            }
            catch (Exception ex)
            {
                ActivityLog.LogError("OpenForPSCmdlet", $@"Failed to launch powershell
{ex.Message}
{ex.StackTrace}");
            }
        }
Esempio n. 3
0
        void IbApplication_OnOpenFile(string fullPath)
        {
            var p = new System.Diagnostics.Process();

            p.StartInfo.UseShellExecute = true;
            p.StartInfo.FileName        = fullPath;
            p.Start();
        }
Esempio n. 4
0
 private void LaunchGame()
 {
     try {
         System.Diagnostics.Process createGameProcess = new System.Diagnostics.Process();
         createGameProcess.StartInfo.FileName  = UserSettings.PlayerConfig.HunterPie.Launch.GamePath;
         createGameProcess.StartInfo.Arguments = UserSettings.PlayerConfig.HunterPie.Launch.LaunchArgs;
         createGameProcess.Start();
     } catch {
         Debugger.Error("Failed to launch Monster Hunter World. Common reasons for this error are:\n- Wrong file path;");
     }
 }
Esempio n. 5
0
        private bool StartUpdateProcess()
        {
            if (!File.Exists("Update.exe"))
            {
                return(false);
            }

            System.Diagnostics.Process UpdateProcess = new System.Diagnostics.Process();
            UpdateProcess.StartInfo.FileName  = "Update.exe";
            UpdateProcess.StartInfo.Arguments = $"version={HUNTERPIE_VERSION} branch={UserSettings.PlayerConfig.HunterPie.Update.Branch}";
            UpdateProcess.Start();
            return(true);
        }
Esempio n. 6
0
        private void openNewWindow_Click(object sender, EventArgs e)
        {
            if (captures.SelectedItems.Count == 1)
            {
                var log = captures.SelectedItems[0].Tag as CaptureLog;

                var temppath = m_Core.TempLogFilename(log.exe);

                File.Copy(log.localpath, temppath);

                var process = new System.Diagnostics.Process();
                process.StartInfo = new System.Diagnostics.ProcessStartInfo(Application.ExecutablePath, String.Format("--tempfile \"{0}\"", temppath));
                process.Start();
            }
        }
Esempio n. 7
0
        public static void Start(string fileName, string arguments, System.EventHandler exitHandler)
        {
            System.Diagnostics.Process p = new System.Diagnostics.Process();
            p.StartInfo.FileName  = fileName;
            p.StartInfo.Arguments = arguments;
            //p.SynchronizingObject = this;
            p.EnableRaisingEvents = true;
            p.Exited += (sender, e) => {
                EditorApplication.delayCall += () => {
                    exitHandler(sender, e);
                };
            };

            p.Start();
        }
Esempio n. 8
0
        public System.Diagnostics.Process LaunchProcess(string app, string arguments)
        {
            var sb      = new StringBuilder();
            var process = new System.Diagnostics.Process();

            process.StartInfo.CreateNoWindow         = true;
            process.StartInfo.FileName               = app;
            process.StartInfo.Arguments              = arguments;
            process.StartInfo.UseShellExecute        = false;
            process.StartInfo.RedirectStandardOutput = true;
            process.OutputDataReceived              += (sender, args) => sb.Append(args.Data);
            process.Start();
            process.BeginOutputReadLine();
            return(process);
        }
Esempio n. 9
0
        private void openNewWindow_Click(object sender, EventArgs e)
        {
            if (captures.SelectedItems.Count == 1)
            {
                var log = captures.SelectedItems[0].Tag as CaptureLog;

                var temppath = m_Core.TempLogFilename(log.exe);

                if (!log.local)
                {
                    MessageBox.Show("Can't open log in new instance with remote server in use", "Cannot open new instance",
                                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                try
                {
                    File.Copy(log.path, temppath);
                }
                catch (System.Exception ex)
                {
                    MessageBox.Show("Couldn't save log to temporary location" + Environment.NewLine + ex.ToString(), "Cannot save temporary log",
                                                    MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return;
                }

                var process = new System.Diagnostics.Process();
                process.StartInfo = new System.Diagnostics.ProcessStartInfo(Application.ExecutablePath, String.Format("--tempfile \"{0}\"", temppath));
                process.Start();
            }
        }
Esempio n. 10
0
        private void openNewWindow_Click(object sender, EventArgs e)
        {
            if (captures.SelectedItems.Count == 1)
            {
                var log = captures.SelectedItems[0].Tag as CaptureLog;

                var temppath = m_Core.TempLogFilename(log.exe);

                File.Copy(log.localpath, temppath);

                var process = new System.Diagnostics.Process();
                process.StartInfo = new System.Diagnostics.ProcessStartInfo(Application.ExecutablePath, String.Format("--tempfile \"{0}\"", temppath));
                process.Start();
            }
        }