Beispiel #1
0
        private void button_EditvLuxSettings_Click(object sender, System.EventArgs e)
        {
            try
            {
                //add/edit lighting cfg (either custom or default name "lighting.cfg") to RCS:
                string lightingCfgFile = VLuxLightingTool.GetLightingCfgFile(_settings);

                ManagedBase.RCS.GetProvider().EditFile(lightingCfgFile);

                Process vLux = FileHelper.RunExternalTool("vLux", VLuxLightingDlg.vLuxEXEPath, VLuxArgumentString, true);

                if (vLux == null)
                {
                    return;
                }

                // ReadToEnd will block so we do so in another thread.
                Thread StandardOutputThread = new Thread(() => { Console.WriteLine(vLux.StandardOutput.ReadToEnd()); });

                using (WaitForProcessDlg waitDlg = new WaitForProcessDlg("vLux", vLux))
                {
                    waitDlg.ShowDialog(this);
                }

                // In case the user somehow succeeds in closing WaitForProcessDlg it will block here until the process in done.
                vLux.WaitForExit();
                int iExitCode = vLux.ExitCode;

                //add lighting cfg file to RCS
                ManagedBase.RCS.GetProvider().AddFile(lightingCfgFile, false /* Text file */);
            }
            catch (Exception ex)
            {
                EditorManager.DumpException(ex);
                EditorManager.ShowMessageBox("Could not start vLux (\"" + VLuxLightingDlg.vLuxEXEPath + "\").\n\nDetailed message:\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
        private void button_EditvLuxSettings_Click(object sender, System.EventArgs e)
        {
            try
              {
            //add/edit lighting cfg (either custom or default name "lighting.cfg") to RCS:
            string lightingCfgFile = VLuxLightingTool.GetLightingCfgFile(_settings);

            ManagedBase.RCS.GetProvider().EditFile(lightingCfgFile);

            Process vLux = FileHelper.RunExternalTool("vLux", VLuxLightingDlg.vLuxEXEPath, VLuxArgumentString, true);

            if (vLux == null)
              return;

            // ReadToEnd will block so we do so in another thread.
            Thread StandardOutputThread = new Thread(() => { Console.WriteLine(vLux.StandardOutput.ReadToEnd()); });

            using (WaitForProcessDlg waitDlg = new WaitForProcessDlg("vLux", vLux))
            {
              waitDlg.ShowDialog(this);
            }

            // In case the user somehow succeeds in closing WaitForProcessDlg it will block here until the process in done.
            vLux.WaitForExit();
            int iExitCode = vLux.ExitCode;

            //add lighting cfg file to RCS
            ManagedBase.RCS.GetProvider().AddFile(lightingCfgFile, false /* Text file */);

              }
              catch (Exception ex)
              {
            EditorManager.DumpException(ex);
            EditorManager.ShowMessageBox("Could not start vLux (\"" + VLuxLightingDlg.vLuxEXEPath + "\").\n\nDetailed message:\n" + ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
              }
        }