/// <summary> /// Background Worker Event DoWork /// </summary> /// <param name="sender">The sender.</param> /// <param name="e">The <see cref="DoWorkEventArgs"/> instance containing the event data.</param> private void Worker_DoWork(object sender, DoWorkEventArgs e) { CrmSolution crmSolution = (CrmSolution)e.Argument; ToolingConnector toolingConnector = new ToolingConnector(); try { toolingConnector.UploadCrmSolution(crmSolution: crmSolution, crmServiceClient: toolingConnector.GetCrmServiceClient(this.crmConnection.ConnectionString), overwriteCustomizing: this.overwriteCustomizings); } catch (System.Exception ex) { this.tbx_status.Text += $"\n {ex.Message} \nStackTrace: {ex.StackTrace}"; } }
/// <summary> /// Will Extract the Solution into the folder /// </summary> /// <param name="solution">CRM Solution which should be extracted</param> private void ProcessSolutions(CrmSolution solution) { using (ToolingConnector toolingConnector = new ToolingConnector()) { // Delete Solution File if it exists if (File.Exists(Path.Combine(this.selectedPath, solution.UniqueName + ".zip"))) { File.Delete(Path.Combine(this.selectedPath, solution.UniqueName + ".zip")); } this.crmServiceClient = toolingConnector.GetCrmServiceClient(connectionString: this.CRMConnection.ConnectionString); try { toolingConnector.DownloadSolution(this.crmServiceClient, solution.UniqueName, this.selectedPath); CrmSolutionPackager crmSolutionPackager = new CrmSolutionPackager(); if (Directory.Exists(Path.Combine(this.selectedPath, solution.UniqueName))) { Core.IO.Directory.DeleteDirectory(Path.Combine(this.selectedPath, solution.UniqueName)); DownloadMultiple.UpdateUI($"Delete {Path.Combine(this.selectedPath, solution.UniqueName).ToString()}", true); } string log = crmSolutionPackager.ExtractCustomizing(Path.Combine(this.selectedPath, solution.UniqueName + ".zip"), Path.Combine(this.selectedPath, solution.UniqueName), Properties.Settings.Default.SolutionPackagerLogPath, this.localizeSupport); DownloadMultiple.UpdateUI(log, false); } catch (Exception ex) { Log.Error(ex.Message, ex); if (!Properties.Settings.Default.DisableErrorReports) { throw; } } finally { if (File.Exists(Path.Combine(this.selectedPath, solution.UniqueName + ".zip").ToString())) { File.Delete(Path.Combine(this.selectedPath, solution.UniqueName + ".zip")); DownloadMultiple.UpdateUI($"Delete {Path.Combine(this.selectedPath, solution.UniqueName + ".zip").ToString()}", true); } } } }