/// <summary> /// Allows to do a hard copy /// </summary> public DeployProfile(DeployProfile profile) { Name = profile.Name; SourceDirectory = profile.SourceDirectory; ExploreRecursively = profile.ExploreRecursively; AutoUpdateSourceDir = profile.AutoUpdateSourceDir; ForceSingleProcess = profile.ForceSingleProcess; OnlyGenerateRcode = profile.OnlyGenerateRcode; NumberProcessPerCore = profile.NumberProcessPerCore; }
/// <summary> /// Start the deployment! /// </summary> private void BtStartOnButtonPressed(object sender, EventArgs eventArgs) { SetDataFromFields(); SaveProfilesList(); if (string.IsNullOrEmpty(DeployProfile.Current.SourceDirectory) || !Directory.Exists(DeployProfile.Current.SourceDirectory)) { BlinkTextBox(fl_directory, ThemeManager.Current.GenericErrorColor); return; } // init screen btStart.Visible = false; btReset.Visible = false; progressBar.Visible = true; progressBar.Progress = 0; progressBar.Text = @"Please wait, the deployment is starting..."; btReport.Visible = false; lbl_report.Visible = false; _reportExportPath = null; Application.DoEvents(); // start the deployment Task.Factory.StartNew(() => { _proEnv = new ProEnvironment.ProEnvironmentObject(ProEnvironment.Current); _currentProfile = new DeployProfile(DeployProfile.Current); // new mass compilation _currentCompil = new ProCompilation { // check if we need to force the compiler to only use 1 process // (either because the user want to, or because we have a single user mode database) MonoProcess = _currentProfile.ForceSingleProcess || _proEnv.IsDatabaseSingleUser(), NumberOfProcessesPerCore = _currentProfile.NumberProcessPerCore, RFilesOnly = _currentProfile.OnlyGenerateRcode }; _currentCompil.OnCompilationEnd += OnCompilationEnd; var filesToCompile = _proEnv.Deployer.GetFilesList(new List<string> { _currentProfile.SourceDirectory }, _currentProfile.ExploreRecursively ? SearchOption.AllDirectories : SearchOption.TopDirectoryOnly, 0); _deploymentPercentage = 0; _currentStep = 0; _totalSteps = _proEnv.Deployer.DeployTransferRules.Count > 0 ? _proEnv.Deployer.DeployTransferRules.Max(rule => rule.Step) : 0; _filesToDeployPerStep.Clear(); _hookProcedureErrors.Clear(); if (filesToCompile.Count > 0 && _currentCompil.CompileFiles(filesToCompile)) { UpdateReport(""); UpdateProgressBar(); btCancel.SafeInvoke(button => button.Visible = true); this.SafeInvoke(page => { // start a recurrent event (every second) to update the progression of the compilation _progressTimer = new Timer(); _progressTimer.Interval = 500; _progressTimer.Tick += (o, args) => UpdateProgressBar(); _progressTimer.Start(); }); } else { if (filesToCompile.Count == 0) { UserCommunication.Notify("No compilable files found in the input directories,<br>the valid extensions for compilable Progress files are : " + Config.Instance.CompileKnownExtension, MessageImg.MsgInfo, "Multiple compilation", "No files found", 10); } // nothing started ResetScreen(); } }); }