AppMetrics.AgentService.AgentServiceClass.EnsurePluginStarted C# (CSharp) Method

EnsurePluginStarted() private method

private EnsurePluginStarted ( PluginInfo plugin ) : void
plugin PluginInfo
return void
        private void EnsurePluginStarted(PluginInfo plugin)
        {
            try
            {
                if (plugin.IsStarted)
                    return;

                ReportEvent("Start plugin: " + plugin.Name);

                var exePath = Const.GetPluginExePath(plugin.Name);
                var version = FileVersionInfo.GetVersionInfo(exePath).FileVersion;

                ReportEvent(string.Format("Plugin version: {0} {1}", plugin.Name, version));

                var startInfo = new ProcessStartInfo(exePath)
                    {
                        UseShellExecute = false,
                        RedirectStandardOutput = true,
                        CreateNoWindow = true,
                        RedirectStandardInput = true,
                    };
                var process = Process.Start(startInfo);
                plugin.Process = process;
            }
            catch (Exception exc)
            {
                Report(exc);
            }
        }