/// <summary> /// Constructor /// </summary> public Deployer(List <DeployRule> deployRules, ProEnvironment.ProEnvironmentObject proEnv) { _compileLocally = proEnv.CompileLocally; _deploymentDirectory = proEnv.BaseCompilationPath; ProlibPath = proEnv.ProlibPath; DeployRules = deployRules.ToNonNullList(); DeployVarList = DeployRules.OfType <DeployVariableRule>().ToNonNullList(); }
public ProExecutionHandleCompilation(ProEnvironment.ProEnvironmentObject proEnv) : base(proEnv) { // set some options CompileWithDebugList = Config.Instance.CompileWithDebugList; CompileWithListing = Config.Instance.CompileWithListing; CompileWithXref = Config.Instance.CompileWithXref; UseXmlXref = Config.Instance.CompileUseXmlXref; IsAnalysisMode = false; DistantTempDir = Path.Combine(ProEnv.BaseCompilationPath, "~3p-tmp-" + DateTime.Now.ToString("HHmmss") + "-" + Path.GetRandomFileName()); }
/// <summary> /// Constructor /// </summary> public Deployer(List <DeployRule> deployRules, ProEnvironment.ProEnvironmentObject proEnv) { _compileLocally = proEnv.CompileLocally; _deploymentDirectory = proEnv.BaseCompilationPath; _sourceDirectory = (string.IsNullOrEmpty(proEnv.BaseLocalPath) ? "" : Path.GetFullPath(proEnv.BaseLocalPath).TrimEnd('\\')); _compressionLevel = CompressionLevel.Normal; _compileUnmatchedProgressFilesToDeployDir = true; ProlibPath = proEnv.ProlibPath; DeployRules = deployRules.ToNonNullList(); DeployVarList = DeployRules.OfType <DeployVariableRule>().ToNonNullList(); }
private bool Save() { switch (_currentMode) { case ViewMode.Delete: ProEnvironment.DeleteCurrent(); break; case ViewMode.Add: case ViewMode.Edit: case ViewMode.Copy: // mandatory fields foreach (var box in new List<YamuiTextBox> {flName}.Where(box => string.IsNullOrWhiteSpace(box.Text))) { BlinkTextBox(box, ThemeManager.Current.GenericErrorColor); return false; } var newEnv = new ProEnvironment.ProEnvironmentObject { Name = flName.Text, Suffix = flSuffix.Text, Label = flLabel.Text, ExtraPf = flExtraPf.Text, DatabaseExtractCandoTblType = flCanDoTblType.Text, DatabaseExtractCandoTblName = flCanDoTblName.Text, DatabaseAliasList = flListAliases.Text, IniPath = textbox2.Text, ExtraProPath = flExtraProPath.Text, BaseLocalPath = textbox3.Text, BaseCompilationPath = textbox4.Text, ProwinPath = textbox5.Text, LogFilePath = textbox6.Text, PreExecutionProgram = textbox7.Text, PostExecutionProgram = textbox8.Text, CmdLineParameters = flCmdLine.Text, DbConnectionInfo = _currentMode == ViewMode.Add ? new Dictionary<string, string>() : new Dictionary<string, string>(ProEnvironment.Current.DbConnectionInfo), CompileLocally = tgCompLocally.Checked }; if (_currentMode != ViewMode.Edit && (ProEnvironment.GetList.Exists(env => env.Name.EqualsCi(newEnv.Name) && env.Suffix.EqualsCi(newEnv.Suffix)))) { // name + suffix must be unique! BlinkTextBox(flName, ThemeManager.Current.GenericErrorColor); BlinkTextBox(flSuffix, ThemeManager.Current.GenericErrorColor); return false; } ProEnvironment.Modify((_currentMode == ViewMode.Edit) ? ProEnvironment.Current : null, newEnv); break; } ProEnvironment.SaveList(); return true; }
/// <summary> /// Constructor /// </summary> public DeploymentHandler(ProEnvironment.ProEnvironmentObject proEnv, DeploymentProfile currentProfile) { _proEnv = new ProEnvironment.ProEnvironmentObject(proEnv); _currentProfile = new DeploymentProfile(currentProfile); StartingTime = DateTime.Now; }
/// <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(); } }); }
public MultiCompilation(ProEnvironment.ProEnvironmentObject proEnv) { ProEnv = proEnv == null ? new ProEnvironment.ProEnvironmentObject(ProEnvironment.Current) : proEnv; StartingTime = DateTime.Now; }
public DifferentialDeploymentHandler(ProEnvironment.ProEnvironmentObject proEnv, DeploymentProfile currentProfile) : base(proEnv, currentProfile) { ForceFullDeploy = true; }
public ProExecutionCompile(ProEnvironment.ProEnvironmentObject proEnv) : base(proEnv) { }
private void ToggleMode(ViewMode mode) { if (IsHandleCreated) { BeginInvoke((Action) delegate { _switchingMode = true; try { // mode var isAddOrEdit = (mode == ViewMode.Add || mode == ViewMode.Copy || mode == ViewMode.Edit); var isDbAddOrEdit = (mode == ViewMode.DbAdd || mode == ViewMode.DbEdit); var isSelect = (mode == ViewMode.Select); // selection flName.Visible = flSuffix.Visible = flLabel.Visible = isAddOrEdit; cbName.Visible = cbSuffix.Visible = !isAddOrEdit; cbName.Enabled = cbSuffix.Enabled = !isAddOrEdit && !isDbAddOrEdit; txLabel.Text = ProEnvironment.Current.Label; // Fill combo boxes if (isSelect) { var envList = ProEnvironment.GetList; // Fill combo box appli var appliList = envList.Select(environnement => environnement.Name).Distinct().ToList(); if (appliList.Count > 0) { cbName.DataSource = appliList; var selectedIdx = appliList.FindIndex(str => str.EqualsCi(ProEnvironment.Current.Name)); cbName.SelectedIndex = selectedIdx >= 0 ? selectedIdx : 0; // Combo box env letter var envLetterList = envList.Where(environnement => environnement.Name.EqualsCi(ProEnvironment.Current.Name)).Select(environnement => environnement.Suffix).ToList(); // empty database cb cbDatabase.DataSource = new List <string>(); if (envLetterList.Count > 0) { // hide the combo if there is only one item if (envLetterList.Count == 1) { cbSuffix.Hide(); } else { cbSuffix.Show(); cbSuffix.DataSource = envLetterList; selectedIdx = envLetterList.FindIndex(str => str.EqualsCi(ProEnvironment.Current.Suffix)); cbSuffix.SelectedIndex = selectedIdx >= 0 ? selectedIdx : 0; } // Combo box database var dic = envList.FirstOrDefault(environnement => environnement.Name.EqualsCi(ProEnvironment.Current.Name) && environnement.Suffix.EqualsCi(ProEnvironment.Current.Suffix)); if (dic != null) { var databaseList = dic.DbConnectionInfo.Keys.ToList().OrderBy(s => s).ToList(); if (databaseList.Count > 0) { cbDatabase.DataSource = databaseList; selectedIdx = databaseList.FindIndex(str => str.EqualsCi(Config.Instance.EnvDatabase)); cbDatabase.SelectedIndex = selectedIdx >= 0 ? selectedIdx : 0; } } } else { cbSuffix.Hide(); } } else { // the user needs to add a new one btAdd.UseCustomBackColor = true; btAdd.BackColor = ThemeManager.Current.AccentColor; } } // handle pf dictionnary flDatabase.Visible = isDbAddOrEdit; cbDatabase.Visible = !flDatabase.Visible; // entering or leaving DB add/edit mode if (isDbAddOrEdit || _currentMode == ViewMode.DbAdd || _currentMode == ViewMode.DbEdit) { flDatabase.Enabled = textbox1.Enabled = isDbAddOrEdit; areaEnv.SetPropertyOnArea("Visible", !isDbAddOrEdit); areaDb.SetPropertyOnArea("Visible", !isDbAddOrEdit); areaLeftButtons.SetPropertyOnArea("Enabled", isDbAddOrEdit); } // entering or leaving add/edit mode else if (isAddOrEdit || _currentMode == ViewMode.Add || _currentMode == ViewMode.Copy || _currentMode == ViewMode.Edit) { EnableAllTextBoxes(isAddOrEdit); areaPf.SetPropertyOnArea("Visible", !isAddOrEdit); areaDb.SetPropertyOnArea("Visible", !isAddOrEdit); areaLeftButtons.SetPropertyOnArea("Enabled", isAddOrEdit); } // update the download database button UpdateDownloadButton(); // buttons to handle pf files btDbAdd.Visible = btDbEdit.Visible = btDbDelete.Visible = isSelect; btDbSave.Visible = btDbCancel.Visible = isDbAddOrEdit; btDbDelete.Enabled = ProEnvironment.Current.DbConnectionInfo.Count >= 1; // buttons modify/new/duplicate/delete btEdit.Visible = btAdd.Visible = btDelete.Visible = btCopy.Visible = isSelect; btSave.Visible = btCancel.Visible = isAddOrEdit; btDelete.Enabled = ProEnvironment.GetList.Count > 1; // Compilation toggle tgCompWithLst.Enabled = tgCompLocally.Enabled = isSelect; if (mode == ViewMode.Add) { // reset fields when adding a new env foreach (var control in scrollPanel.ContentPanel.Controls) { if (control is YamuiTextBox) { ((YamuiTextBox)control).Text = string.Empty; } } cbDatabase.DataSource = new List <string>(); var defaultEnv = new ProEnvironment.ProEnvironmentObject(); tgCompLocally.Checked = defaultEnv.CompileLocally; tgCompWithLst.Checked = defaultEnv.CompileWithListing; } else if (mode == ViewMode.DbAdd) { // reset fields when adding a new pf flDatabase.Text = string.Empty; textbox1.Text = string.Empty; } else { // fill details flName.Text = ProEnvironment.Current.Name; flSuffix.Text = ProEnvironment.Current.Suffix; flLabel.Text = ProEnvironment.Current.Label; flExtraPf.Lines = ProEnvironment.Current.ExtraPf.Replace("\r\n", "\n").Split('\n'); flExtraProPath.Lines = ProEnvironment.Current.ExtraProPath.Replace("\r\n", "\n").Split('\n'); flCmdLine.Text = ProEnvironment.Current.CmdLineParameters; flDatabase.Text = Config.Instance.EnvDatabase; textbox1.Text = ProEnvironment.Current.GetPfPath(); textbox2.Text = ProEnvironment.Current.IniPath; textbox3.Text = ProEnvironment.Current.BaseLocalPath; textbox4.Text = ProEnvironment.Current.BaseCompilationPath; textbox5.Text = ProEnvironment.Current.ProwinPath; textbox6.Text = ProEnvironment.Current.LogFilePath; tgCompLocally.Checked = ProEnvironment.Current.CompileLocally; tgCompWithLst.Checked = ProEnvironment.Current.CompileWithListing; } // blink when changing mode if (mode != _currentMode && mode != ViewMode.Select) { if (isAddOrEdit) { BlinkButton(btSave, ThemeManager.Current.AccentColor); BlinkButton(btCancel, ThemeManager.Current.AccentColor); ActiveControl = btSave; } else { BlinkButton(btDbSave, ThemeManager.Current.AccentColor); BlinkButton(btDbCancel, ThemeManager.Current.AccentColor); ActiveControl = btDbSave; } } else if (mode != _currentMode && mode == ViewMode.Select) { ActiveControl = _currentMode == ViewMode.Edit ? btEdit : btDbEdit; } // save current mode _currentMode = mode; } finally { _switchingMode = false; } }); } }
private void ToggleMode(ViewMode mode) { if (IsHandleCreated) { BeginInvoke((Action) delegate { // mode var isAddOrEdit = (mode == ViewMode.Add || mode == ViewMode.Copy || mode == ViewMode.Edit); var isSelect = (mode == ViewMode.Select); // selection flName.Visible = flSuffix.Visible = flLabel.Visible = isAddOrEdit; cbName.Visible = cbSuffix.Visible = !isAddOrEdit; cbName.Enabled = cbSuffix.Enabled = !isAddOrEdit; txLabel.Text = ProEnvironment.Current.Label; // Fill combo boxes if (isSelect) { var envList = ProEnvironment.GetList; // Fill combo box appli var appliList = envList.Select(environnement => environnement.Name).Distinct().ToList(); if (appliList.Count > 0) { cbName.DataSource = appliList; var selectedIdx = appliList.FindIndex(str => str.EqualsCi(ProEnvironment.Current.Name)); cbName.SelectedIndex = selectedIdx >= 0 ? selectedIdx : 0; // Combo box env letter var envLetterList = envList.Where(environnement => environnement.Name.EqualsCi(ProEnvironment.Current.Name)).Select(environnement => environnement.Suffix).ToList(); if (envLetterList.Count > 0) { // hide the combo if there is only one item if (envLetterList.Count == 1) { cbSuffix.Hide(); } else { cbSuffix.Show(); cbSuffix.DataSource = envLetterList; selectedIdx = envLetterList.FindIndex(str => str.EqualsCi(ProEnvironment.Current.Suffix)); cbSuffix.SelectedIndex = selectedIdx >= 0 ? selectedIdx : 0; } } else { cbSuffix.Hide(); } } else { // the user needs to add a new one btAdd.UseCustomBackColor = true; btAdd.BackColor = ThemeManager.Current.AccentColor; } } EnableAllTextBoxes(isAddOrEdit); areaDb.SetPropertyOnArea("Visible", !isAddOrEdit); areaLeftButtons.SetPropertyOnArea("Enabled", isAddOrEdit); // update the download database button UpdateDownloadButton(); // buttons modify/new/duplicate/delete btEdit.Visible = btAdd.Visible = btDelete.Visible = btCopy.Visible = isSelect; btSave.Visible = btCancel.Visible = isAddOrEdit; btDelete.Enabled = ProEnvironment.GetList.Count > 1; if (mode == ViewMode.Add) { // reset fields when adding a new env foreach (var control in scrollPanel.ContentPanel.Controls) { if (control is YamuiTextBox) ((YamuiTextBox) control).Text = string.Empty; } var defaultEnv = new ProEnvironment.ProEnvironmentObject(); tgCompLocally.Checked = defaultEnv.CompileLocally; flCanDoTblType.Text = defaultEnv.DatabaseExtractCandoTblType; flCanDoTblName.Text = defaultEnv.DatabaseExtractCandoTblName; } else { // fill details flName.Text = ProEnvironment.Current.Name; flSuffix.Text = ProEnvironment.Current.Suffix; flLabel.Text = ProEnvironment.Current.Label; flExtraPf.Text = ProEnvironment.Current.ExtraPf; flCanDoTblType.Text = ProEnvironment.Current.DatabaseExtractCandoTblType; flCanDoTblName.Text = ProEnvironment.Current.DatabaseExtractCandoTblName; flListAliases.Text = ProEnvironment.Current.DatabaseAliasList; flExtraProPath.Text = ProEnvironment.Current.ExtraProPath; flCmdLine.Text = ProEnvironment.Current.CmdLineParameters; textbox2.Text = ProEnvironment.Current.IniPath; textbox3.Text = ProEnvironment.Current.BaseLocalPath; textbox4.Text = ProEnvironment.Current.BaseCompilationPath; textbox5.Text = ProEnvironment.Current.ProwinPath; textbox6.Text = ProEnvironment.Current.LogFilePath; textbox7.Text = ProEnvironment.Current.PreExecutionProgram; textbox8.Text = ProEnvironment.Current.PostExecutionProgram; tgCompLocally.Checked = ProEnvironment.Current.CompileLocally; } // blink when changing mode if (mode != _currentMode && mode != ViewMode.Select) { BlinkButton(btSave, ThemeManager.Current.AccentColor); BlinkButton(btCancel, ThemeManager.Current.AccentColor); ActiveControl = btSave; } else if (mode != _currentMode && mode == ViewMode.Select) ActiveControl = btEdit; // save current mode _currentMode = mode; }); } }
public ProExecution() { // create a copy of the current environment ProEnv = new ProEnvironment.ProEnvironmentObject(ProEnvironment.Current); DistantRootTempDir = Path.Combine(ProEnv.BaseCompilationPath, "~3pTempDirectory"); if (_lock.TryEnterWriteLock(-1)) { _proExecutionCounter++; _proExecutionOpenedNumber++; _lock.ExitWriteLock(); } else { throw new Exception("Couln't increase the execution counter..."); } }
/// <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(); } }); }