private void Write(Project project, ResXInfo settings, CremaDataTable projectInfoTable) { var successCount = 0; var failCount = 0; var items = project.GetProjectItems(); if (items.Any() == true) { GenerationOutput.WriteLine($"------ Update from {settings.Address} \"{settings.DataBase}\" \"{settings.ProjectInfo}\": Project: {project.Name} ------"); foreach (var item in project.GetProjectItems()) { try { item.Write(projectInfoTable); GenerationOutput.WriteLine($"O>{item.GetFullPath()}"); successCount++; } catch (Exception ex) { GenerationOutput.WriteLine($" >{item.GetFullPath()}: error: {ex.Message}"); failCount++; } } GenerationOutput.WriteLine($"========== Update: Success {successCount}, Fail {failCount}: {DateTime.Now} =========="); } else { GenerationOutput.WriteLine($"========== skip: {project.Name} has no resources file. =========="); } }
/// <summary> /// This function is the callback used to execute the command when the menu item is clicked. /// See the constructor to see how the menu item is associated with this function using /// OleMenuCommandService service and MenuCommand class. /// </summary> /// <param name="sender">Event sender.</param> /// <param name="e">Event args.</param> private void ItemMenuItemCallback(object sender, EventArgs e) { var runtimeService = this.container.GetExportedValue <IRuntimeService>(); var settings = this.Solution.GetSettings(); var data = runtimeService.GetDataGenerationData(settings.Address, settings.DataBase, $"{TagInfo.All}", string.Empty, false, -1); var dataSet = SerializationUtility.Create(data); var projectInfoTable = dataSet.Tables[settings.ProjectInfo]; var successCount = 0; var failCount = 0; GenerationOutput.WriteLine($"------ Update from {settings.Address} \"{settings.DataBase}\" \"{settings.ProjectInfo}\": Selected Resource Files ------"); foreach (var item in this.GetSelectedItems()) { try { item.Write(projectInfoTable); GenerationOutput.WriteLine($"O>{item.GetFullPath()}"); successCount++; } catch (Exception ex) { GenerationOutput.WriteLine($" >{item.GetFullPath()}: error: {ex.Message}"); failCount++; } } GenerationOutput.WriteLine($"========== Update: Success {successCount}, Fail {failCount}: {DateTime.Now} =========="); GenerationOutput.WriteLine(); }
private void SolutionMenuItemCallback(object sender, EventArgs e) { var runtimeService = this.container.GetExportedValue <IRuntimeService>(); var settings = this.Solution.GetSettings(); var data = runtimeService.GetDataGenerationData(settings.Address, settings.DataBase, $"{TagInfo.All}", string.Empty, false, -1); var dataSet = SerializationUtility.Create(data); var projectInfoTable = dataSet.Tables[settings.ProjectInfo]; foreach (var item in this.Solution.GetProjects()) { this.Write(item, settings, projectInfoTable); } GenerationOutput.WriteLine(); }
private async void SolutionMenuItemCallback(object sender, EventArgs e) { var runtimeService = this.container.GetExportedValue <IRuntimeService>(); var settings = this.Solution.GetSettings(); try { var data = await runtimeService.GetDataGenerationDataAsync(settings.Address, settings.DataBase, $"{TagInfo.All}", string.Empty, null); var dataSet = SerializationUtility.Create(data); var projectInfoTable = dataSet.Tables[settings.ProjectInfo]; foreach (var item in this.Solution.GetProjects()) { this.Write(item, settings, projectInfoTable); } GenerationOutput.WriteLine(); } catch (Exception ex) { GenerationOutput.WriteLine($" > : error: {ex.Message}"); } }