private async Task PerformExportAssemblyDescriptionToFileAsync(Guid idAssembly, string assemblyName, Func <Task <IOrganizationServiceExtented> > getService) { if (!this.IsControlsEnabled) { return; } ToggleControls(false, Properties.WindowStatusStrings.CreatingPluginAssebmltyDescriptionFormat1, assemblyName); var service = await getService(); if (service != null) { var repository = new PluginAssemblyRepository(service); var assembly = await repository.GetAssemblyByIdRetrieveRequestAsync(idAssembly, new ColumnSet(PluginAssembly.Schema.Attributes.name)); PluginAssemblyDescriptionHandler handler = new PluginAssemblyDescriptionHandler(service, service.ConnectionData.GetConnectionInfo()); string description = await handler.CreateDescriptionAsync(assembly.Id, assembly.Name, DateTime.Now); string filePath = await CreateDescriptionFileAsync(service.ConnectionData, assembly.Name, "Description", description); this._iWriteToOutput.PerformAction(service.ConnectionData, filePath); } ToggleControls(true, Properties.WindowStatusStrings.CreatingPluginAssebmltyDescriptionCompletedFormat1, assemblyName); }
private async Task PerformShowingDifferenceAssemblyDescriptionAsync(LinkedEntities <PluginAssembly> linked, bool showAllways) { if (!this.IsControlsEnabled) { return; } ToggleControls(false, Properties.WindowStatusStrings.ShowingDifferencePluginAssemblyDescriptionFormat1, linked.Entity1.Name); var service1 = await GetService1(); var service2 = await GetService2(); if (service1 != null && service2 != null) { var handler1 = new PluginAssemblyDescriptionHandler(service1, service1.ConnectionData.GetConnectionInfo()); var handler2 = new PluginAssemblyDescriptionHandler(service2, service2.ConnectionData.GetConnectionInfo()); DateTime now = DateTime.Now; string desc1 = await handler1.CreateDescriptionAsync(linked.Entity1.Id, linked.Entity1.Name, now); string desc2 = await handler2.CreateDescriptionAsync(linked.Entity2.Id, linked.Entity2.Name, now); if (showAllways || desc1 != desc2) { string filePath1 = await CreateDescriptionFileAsync(service1.ConnectionData, linked.Entity1.Name, "Description", desc1); string filePath2 = await CreateDescriptionFileAsync(service2.ConnectionData, linked.Entity2.Name, "Description", desc2); if (File.Exists(filePath1) && File.Exists(filePath2)) { this._iWriteToOutput.ProcessStartProgramComparer(filePath1, filePath2, Path.GetFileName(filePath1), Path.GetFileName(filePath2)); } else { this._iWriteToOutput.PerformAction(service1.ConnectionData, filePath1); this._iWriteToOutput.PerformAction(service2.ConnectionData, filePath2); } } } ToggleControls(true, Properties.WindowStatusStrings.ShowingDifferencePluginAssemblyDescriptionCompletedFormat1, linked.Entity1.Name); }
private async Task PerformExportAssemblyDescription(string folder, Guid idPluginAssembly, string name) { var service = await GetService(); ToggleControls(service.ConnectionData, false, Properties.WindowStatusStrings.CreatingPluginAssebmltyDescriptionFormat1, name); string fileName = EntityFileNameFormatter.GetPluginAssemblyFileName(service.ConnectionData.Name, name, "Description", "txt"); string filePath = Path.Combine(folder, FileOperations.RemoveWrongSymbols(fileName)); PluginAssemblyDescriptionHandler handler = new PluginAssemblyDescriptionHandler(service, service.ConnectionData.GetConnectionInfo()); await handler.CreateFileWithDescriptionAsync(filePath, idPluginAssembly, name, DateTime.Now); this._iWriteToOutput.WriteToOutput(service.ConnectionData, Properties.OutputStrings.EntityFieldExportedToFormat5, service.ConnectionData.Name, PluginAssembly.Schema.EntityLogicalName, name, "Description", filePath); this._iWriteToOutput.PerformAction(service.ConnectionData, filePath); ToggleControls(service.ConnectionData, true, Properties.WindowStatusStrings.CreatingPluginAssebmltyDescriptionCompletedFormat1, name); }