Exemple #1
0
        private bool RunLoadSam(Run.RunOptions options)
        {
            string exeFileName = Path.Combine(Path.Combine(_appSettings.ExeDirs.FirstOrDefault(), "uattools"), "loadsam.exe");

            if (!File.Exists(exeFileName))
            {
                return(false);
            }

            string args = string.Format("/Nloadsam {0}", options.LoadSamTime);

            using (Process proc = new Process())
            {
                ProcessStartInfo info = new ProcessStartInfo(exeFileName, args);
                info.UseShellExecute        = false;
                info.RedirectStandardOutput = false;
                info.RedirectStandardError  = false;
                info.CreateNoWindow         = false;
                info.WorkingDirectory       = Path.GetDirectoryName(exeFileName);
                proc.StartInfo = info;
                if (!proc.Start())
                {
                    return(false);
                }
            }

            return(true);
        }
Exemple #2
0
        private bool RunSam(Run.RunOptions options)
        {
            if (options.SetDbDate)
            {
                using (var pr = new ProcessRunner())
                {
                    int exitCode = pr.ExecuteProcess("setdbdat", "today force", _appSettings.TempDir, true);
                    if (exitCode != 0)
                    {
                        this.ShowError(string.Format("\"setdbdat today force\" returned exit code {0}.\n\n" +
                                                     "(The SAM will still start, but the dbdate may be incorrect)", exitCode));
                    }
                }
            }

            var args = options.CreateSamArgsString();

            using (Process proc = new Process())
            {
                var platformPath = _appSettings.PlatformPath;
                if (string.IsNullOrEmpty(platformPath))
                {
                    this.ShowError(Res.Err_DkPlatformDirUnknown);
                    return(false);
                }

                var exePathName = Path.Combine(platformPath, "SAM.exe");
                if (!File.Exists(exePathName))
                {
                    this.ShowError("SAM.exe not found in path.");
                    return(false);
                }

                ProcessStartInfo info = new ProcessStartInfo(exePathName, args);
                info.UseShellExecute        = false;
                info.RedirectStandardOutput = false;
                info.RedirectStandardError  = false;
                info.CreateNoWindow         = false;
                info.WorkingDirectory       = _appSettings.ExeDirs.FirstOrDefault();
                proc.StartInfo = info;
                if (!proc.Start())
                {
                    this.ShowError("Unable to start the SAM.");
                    return(false);
                }
            }

            if (options.LoadSam && !options.Diags)
            {
                RunLoadSam(options);
            }

            return(true);
        }
Exemple #3
0
        private bool RunCam(Run.RunOptions options)
        {
            var args = options.CreateCamArgsString();

            using (Process proc = new Process())
            {
                var platformPath = _appSettings.PlatformPath;
                if (string.IsNullOrEmpty(platformPath))
                {
                    this.ShowError(Res.Err_DkPlatformDirUnknown);
                    return(false);
                }

                var exePathName = Path.Combine(platformPath, "..\\CAMNet\\CAMNet.exe");
                if (!File.Exists(exePathName))
                {
                    this.ShowError("CAMNet.exe not found in path.");
                    return(false);
                }

                ProcessStartInfo info = new ProcessStartInfo(exePathName, args);
                info.UseShellExecute        = false;
                info.RedirectStandardOutput = false;
                info.RedirectStandardError  = false;
                info.CreateNoWindow         = false;
                info.WorkingDirectory       = _appSettings.ExeDirs.FirstOrDefault();
                proc.StartInfo = info;
                if (!proc.Start())
                {
                    this.ShowError("Unable to start the CAM.");
                    return(false);
                }
            }

            return(true);
        }