public Parameters( Solution solution, string zipDirectory, SolutionPackagerCaller.Parameters solutionPackagerParameters, bool[] managed, bool exportAutoNumberingSettings, bool exportCalendarSettings, bool exportCustomizationSettings, bool exportEmailTrackingSettings, bool exportExternalApplications, bool exportGeneralSettings, bool exportIsvConfig, bool exportMarketingSettings, bool exportOutlookSynchronizationSettings, bool exportRelationshipRoles, bool exportSales ) { Solution = solution ?? throw new ArgumentNullException(nameof(solution)); ZipDirectory = zipDirectory ?? throw new ArgumentNullException(nameof(zipDirectory)); SolutionPackagerParameters = solutionPackagerParameters ?? throw new ArgumentNullException(nameof(solutionPackagerParameters)); Managed = managed; ExportAutoNumberingSettings = exportAutoNumberingSettings; ExportCalendarSettings = exportCalendarSettings; ExportCustomizationSettings = exportCustomizationSettings; ExportEmailTrackingSettings = exportEmailTrackingSettings; ExportExternalApplications = exportExternalApplications; ExportGeneralSettings = exportGeneralSettings; ExportIsvConfig = exportIsvConfig; ExportMarketingSettings = exportMarketingSettings; ExportOutlookSynchronizationSettings = exportOutlookSynchronizationSettings; ExportRelationshipRoles = exportRelationshipRoles; ExportSales = exportSales; }
private void BtnPack_Click(object sender, EventArgs e) { errorProvider.Clear(); int nrErrors = 0; if (txtInputPack.Text.Length == 0) { errorProvider.SetError(txtInputPack, Resources.INPUT_FOLDER_NOT_SPECIFIED); nrErrors += 1; } if (CoreToolsDownloader.GetSolutionPackagerVersion() == null) { errorProvider.SetError(chkImportSolution, Resources.SOLUTIONPACKAGER_MISSING); nrErrors += 1; } if (txtOutputPack.Text.Length == 0) { errorProvider.SetError(txtOutputPack, Resources.ZIP_FILE_NOT_SPECIFIED); nrErrors += 1; } if (nrErrors > 0) { errorProvider.SetError(btnPack, nrErrors == 1 ? Resources.EXPORT_ERROR : string.Format(CultureInfo.InvariantCulture, Resources.EXPORT_ERRORS, nrErrors)); return; } var parameters = new SolutionPackagerCaller.Parameters() { Action = "Pack", ZipFile = txtOutputPack.Text, OutputFolder = txtInputPack.Text, PackageType = packageTypes[cmbPackageTypePack.SelectedIndex], ErrorLevel = errorLevels[cmbErrorLevelPack.SelectedIndex], MapFile = txtMapPack.Text, NoLogo = chkNoLogoPack.Checked, LogFile = txtLogPack.Text, Arguments = txtArgumentsPack.Text }; if (chkImportSolution.Checked) { parameters.ImportSolutionParams = new CrmSolutionImporter.Parameters() { ImportDependencies = chkImportDependencies.Checked, ImportManaged = chkImportManaged.Checked, ImportOverwrite = chkImportOverwrite.Checked, ImportPublishWorkflows = chkImportPublishWorkflows.Checked, HoldingSolution = chkImportHoldingSolution.Checked, PreferManaged = cmbPackageTypePack.SelectedIndex == 3 && radPreferManaged.Checked }; } solutionPackagerCaller.ManageSolution(parameters); }
private void DownloadSolutionCompleted(Parameters args, SolutionPackagerCaller.Parameters value, Exception exception) { if (exception is FaultException <OrganizationServiceFault> crmError) { solutionPackagerControl.WriteErrorLog("The following error occurred while downloading the solution:\r\n{0}", crmError); MessageBox.Show(crmError.Message, Resources.MBOX_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error); } else if (exception != null) { solutionPackagerControl.WriteErrorLog("The following error occurred while downloading the solution:\r\n{0}", exception); MessageBox.Show(exception.Message, Resources.MBOX_ERROR, MessageBoxButtons.OK, MessageBoxIcon.Error); } else { solutionPackagerCaller.ManageSolution(value); } }
private void btnPack_Click(object sender, EventArgs e) { int nrErrors = 0; if (txtInputPack.Text.Length == 0) { errorProvider.SetError(txtInputPack, Resources.INPUT_FOLDER_NOT_SPECIFIED); nrErrors += 1; } if (CoreToolsDownloader.GetSolutionPackagerVersion() == null) { errorProvider.SetError(localOrCrm, Resources.SOLUTIONPACKAGER_MISSING); nrErrors += 1; } if (txtOutputPack.Text.Length == 0) { errorProvider.SetError(txtOutputPack, Resources.ZIP_FILE_NOT_SPECIFIED); nrErrors += 1; } if (nrErrors > 0) { errorProvider.SetError(btnPack, nrErrors == 1 ? Resources.EXPORT_ERROR : string.Format(CultureInfo.InvariantCulture, Resources.EXPORT_ERRORS, nrErrors)); return; } var parameters = new SolutionPackagerCaller.Parameters() { Action = "Pack", ZipFile = txtOutputPack.Text, OutputFolder = txtInputPack.Text, PackageType = packageTypes[cmbPackageTypePack.SelectedIndex], ErrorLevel = errorLevels[cmbErrorLevelPack.SelectedIndex], MapFile = txtMapPack.Text, NoLogo = chkNoLogoPack.Checked, LogFile = txtLogPack.Text, Arguments = txtArgumentsPack.Text }; solutionPackagerCaller.ManageSolution(parameters); }
private void BtnExtract_Click(object sender, EventArgs e) { int nrErrors = 0; if (txtOutputFolder.Text.Length == 0) { errorProvider.SetError(txtOutputFolder, Resources.OUTPUT_FOLDER_NOT_SPECIFIED); nrErrors += 1; } if (localOrCrm.Checked) { if (cmbCrmSolutions.SelectedIndex < 0) { errorProvider.SetError(cmbCrmSolutions, Resources.NO_SOLUTION_SELECTED); nrErrors += 1; } } else { if (!File.Exists(txtZipPath.Text)) { errorProvider.SetError(txtZipPath, Resources.ZIP_FILE_DOES_NOT_EXIST); nrErrors += 1; } } if (nrErrors > 0) { errorProvider.SetError(btnExtract, nrErrors == 1 ? Resources.EXPORT_ERROR : string.Format(CultureInfo.InvariantCulture, Resources.EXPORT_ERRORS, nrErrors)); return; } var parameters = new SolutionPackagerCaller.Parameters() { ZipFile = txtZipPath.Text, OutputFolder = txtOutputFolder.Text, AllowWrite = chkAllowWrite.Checked, AllowDelete = radAllowDeleteYes.Checked ? true : (radAllowDeleteNo.Checked ? false : default(bool?)) }; if (localOrCrm.Checked) { crmSolutionManager.DownloadSolution( new CrmSolutionManager.DownloadSolutionParams( cmbCrmSolutions.SelectedItem as Models.Solution, zipDirectory: txtZipPath.Text, solutionPackagerParameters: parameters, managed: radManaged.Checked, exportAutoNumberingSettings: chkExportAutoNumbering.Checked, exportCalendarSettings: chkExportCalendar.Checked, exportCustomizationSettings: chkExportCustomization.Checked, exportEmailTrackingSettings: chkExportEmailTracking.Checked, exportExternalApplications: chkExportExternalApplications.Checked, exportGeneralSettings: chkExportGeneralSettings.Checked, exportIsvConfig: chkExportISVConfig.Checked, exportMarketingSettings: chkExportMarketing.Checked, exportOutlookSynchronizationSettings: chkExportOutlookSynchronization.Checked, exportRelationshipRoles: chkExportRelationshipRoles.Checked, exportSales: chkExportSales.Checked)); } else { solutionPackagerCaller.ExtractSolution(parameters); } }
private void BtnExtract_Click(object sender, EventArgs e) { int nrErrors = 0; if (txtOutputExtract.Text.Length == 0) { errorProvider.SetError(txtOutputExtract, Resources.OUTPUT_FOLDER_NOT_SPECIFIED); nrErrors += 1; } if (CoreToolsDownloader.GetSolutionPackagerVersion() == null) { errorProvider.SetError(localOrCrm, Resources.SOLUTIONPACKAGER_MISSING); nrErrors += 1; } if (localOrCrm.Checked) { if (cmbCrmSolutions.SelectedIndex < 0) { errorProvider.SetError(cmbCrmSolutions, Resources.NO_SOLUTION_SELECTED); nrErrors += 1; } } else { if (!File.Exists(txtInputExtract.Text)) { errorProvider.SetError(txtInputExtract, Resources.ZIP_FILE_DOES_NOT_EXIST); nrErrors += 1; } } if (nrErrors > 0) { errorProvider.SetError(btnExtract, nrErrors == 1 ? Resources.EXPORT_ERROR : string.Format(CultureInfo.InvariantCulture, Resources.EXPORT_ERRORS, nrErrors)); return; } var parameters = new SolutionPackagerCaller.Parameters() { Action = "Extract", ZipFile = txtInputExtract.Text, OutputFolder = txtOutputExtract.Text, PackageType = packageTypes[cmbPackageTypeExtract.SelectedIndex], AllowWrite = chkAllowWriteExtract.Checked, AllowDelete = radAllowDeleteYes.Checked ? true : (radAllowDeleteNo.Checked ? false : default(bool?)), Clobber = chkClobberExtract.Checked, ErrorLevel = errorLevels[cmbErrorLevelExtract.SelectedIndex], MapFile = txtMapExtract.Text, NoLogo = chkNoLogoExtract.Checked, LogFile = txtLogExtract.Text, Arguments = txtArgumentsExtract.Text, SourceLocale = languageCodes[cmbSourceLocaleExtract.SelectedIndex], Localize = chkLocalizeExtract.Checked, FormatXml = chkFormatDocumentExtract.Checked }; if (localOrCrm.Checked) { crmSolutionManager.DownloadSolution( new CrmSolutionManager.DownloadSolutionParams( cmbCrmSolutions.SelectedItem as Models.Solution, zipDirectory: txtInputExtract.Text, solutionPackagerParameters: parameters, managed: parameters.PackageType == "Both" ? new bool[] { true, false } : new bool[] { radManaged.Checked }, exportAutoNumberingSettings: chkExportAutoNumbering.Checked, exportCalendarSettings: chkExportCalendar.Checked, exportCustomizationSettings: chkExportCustomization.Checked, exportEmailTrackingSettings: chkExportEmailTracking.Checked, exportExternalApplications: chkExportExternalApplications.Checked, exportGeneralSettings: chkExportGeneralSettings.Checked, exportIsvConfig: chkExportISVConfig.Checked, exportMarketingSettings: chkExportMarketing.Checked, exportOutlookSynchronizationSettings: chkExportOutlookSynchronization.Checked, exportRelationshipRoles: chkExportRelationshipRoles.Checked, exportSales: chkExportSales.Checked)); } else { solutionPackagerCaller.ManageSolution(parameters); } }