コード例 #1
0
ファイル: Executor.cs プロジェクト: ycherkes/VS-Macros
        /// <summary>
        /// Initializes the engine.
        /// </summary>
        ///
        public void InitializeEngine()
        {
            this.RegisterCmdNameMappinginROT();
            this.RegisterCommandDispatcherinROT();

            Server.InitializeServer();
            Server.serverWait = new Thread(new ThreadStart(Server.WaitForMessage));
            Server.serverWait.Start();

            EnvDTE.DTE dte     = ((IServiceProvider)VSMacrosPackage.Current).GetService(typeof(SDTE)) as EnvDTE.DTE;
            string     version = dte.Version;

            Executor.executionEngine = new Process();
            string exeFileName = version.StartsWith("14.") ? "VS2015\\VisualStudio2015.Macros.ExecutionEngine.exe" : "VisualStudio.Macros.ExecutionEngine.exe";
            string processName = Path.Combine(Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location), exeFileName);

            Executor.executionEngine.StartInfo.FileName        = processName;
            Executor.executionEngine.StartInfo.UseShellExecute = false;
            Executor.executionEngine.StartInfo.Arguments       = ProvidePipeArguments(Server.Guid, version);
            Executor.executionEngine.Start();

            Executor.Job = JobHandle.CreateNewJob();
            Executor.Job.AddProcess(Executor.executionEngine);
        }