public DialogStats(List <Dialogue> dialogues, Language language = null) { InitializeComponent(); bool workstringOnly = true; List <Language> languages = null; if (language == null || language == EditorCore.LanguageWorkstring) { workstringOnly = true; language = null; } else { workstringOnly = false; languages = new List <Language>() { language }; } var stats = ExporterStats.GatherStats(dialogues, language, DateTime.MinValue, workstringOnly, false); using (System.IO.StringWriter writer = new System.IO.StringWriter()) { ExporterStats.WriteStats(writer, stats, languages, workstringOnly, false); textBoxResults.Text = writer.ToString(); } }
private void OnExportStats(object sender, EventArgs e) { if (ResourcesHandler.Project != null) { if (ExporterStats.ExportAll()) EditorCore.LogInfo("Export Stats Finished"); } }
//-------------------------------------------------------------------------------------------------------------- // Exports static public bool ExportToCsv() { var project = ResourcesHandler.Project; string projectDirectory = EditorHelper.GetProjectDirectory(); string exportDirectory = Path.Combine(projectDirectory, EditorCore.Settings.DirectoryExportDialogues); var dialog = new DialogExport("Export Dialogues", exportDirectory, true, false, true, false, true, DateTime.MinValue); DialogResult result = dialog.ShowDialog(); if (result == DialogResult.Cancel) { return(false); } EditorCore.Settings.DirectoryExportDialogues = Utility.GetRelativePath(dialog.ExportPath, projectDirectory); exportDirectory = dialog.ExportPath; if (dialog.UseDateDirectory) { exportDirectory = Path.Combine(exportDirectory, Utility.GetCurrentDateAsString()); } if (!Directory.Exists(exportDirectory)) { Directory.CreateDirectory(exportDirectory); } var packageGroups = new List <List <Package> >(); if (dialog.UsePackagesDirectory) { foreach (var package in dialog.ListPackages) { packageGroups.Add(new List <Package>() { package }); } } else { packageGroups.Add(dialog.ListPackages); } ExporterStats.ProjectStats projectStats = new ExporterStats.ProjectStats(); //Ensure no export of a Workstring language var listLanguages = new List <Language>(); // { EditorCore.LanguageWorkstring }; if (!dialog.WorkstringOnly) { listLanguages = dialog.ListLanguages; } foreach (var packageGroup in packageGroups) //Either a list of individual packages, or 1 entry with all the packages { var packageDirectory = exportDirectory; if (dialog.UsePackagesDirectory) { packageDirectory = Path.Combine(packageDirectory, packageGroup[0].Name); } if (!Directory.Exists(packageDirectory)) { Directory.CreateDirectory(packageDirectory); } var dialogues = dialog.SelectedDialogues; if (!dialog.UseCustomSelection) { dialogues = ResourcesHandler.GetAllDialoguesFromPackages(packageGroup); } ExportDialoguesToCsv(packageDirectory, project, dialogues, listLanguages, dialog.DateFrom, projectStats); ExporterStats.Export("TodoTranslationsCount", projectStats, packageDirectory, packageGroup, listLanguages, dialog.WorkstringOnly, dialog.WorkstringFallback); } if (dialog.Constants) { ExportConstantsToCsv(exportDirectory, project, listLanguages); } System.Diagnostics.Process.Start(exportDirectory); return(true); }
//-------------------------------------------------------------------------------------------------------------- // Exports static public bool ExportAll() { Project project = ResourcesHandler.Project; string projectDirectory = EditorHelper.GetProjectDirectory(); string exportDirectory = Path.Combine(projectDirectory, EditorCore.Settings.DirectoryExportVoicing); var dialog = new DialogExport("Export Voicing", exportDirectory, true, false, false, true, true, project.LastVoicingExportDate); DialogResult result = dialog.ShowDialog(); if (result == DialogResult.Cancel) { return(false); } EditorCore.Settings.DirectoryExportVoicing = Utility.GetRelativePath(dialog.ExportPath, projectDirectory); DateTime dateNow = Utility.GetCurrentTime(); project.LastVoicingExportDate = dateNow; project.Dirty = true; exportDirectory = dialog.ExportPath; if (dialog.UseDateDirectory) { exportDirectory = Path.Combine(exportDirectory, Utility.GetDateAsString(dateNow)); } if (!Directory.Exists(exportDirectory)) { Directory.CreateDirectory(exportDirectory); } var packageGroups = new List <List <Package> >(); if (dialog.UsePackagesDirectory) { foreach (var package in dialog.ListPackages) { packageGroups.Add(new List <Package>() { package }); } } else { packageGroups.Add(dialog.ListPackages); } var listLanguages = new List <Language>() { EditorCore.LanguageWorkstring }; if (!dialog.WorkstringOnly) { listLanguages = dialog.ListLanguages; } ExporterStats.ProjectStats projectStats = new ExporterStats.ProjectStats(); foreach (var packageGroup in packageGroups) //Either a list of individual packages, or 1 entry with all the packages { var packageDirectory = exportDirectory; if (dialog.UsePackagesDirectory) { packageDirectory = Path.Combine(packageDirectory, packageGroup[0].Name); } var dialogues = dialog.SelectedDialogues; if (!dialog.UseCustomSelection) { dialogues = ResourcesHandler.GetAllDialoguesFromPackages(packageGroup); } var dateFrom = dialog.DateFrom; foreach (var language in listLanguages) { string languageDirectory = Path.Combine(packageDirectory, language.VoicingCode); if (!Directory.Exists(languageDirectory)) { Directory.CreateDirectory(languageDirectory); } ExportLocasToCSVFile(languageDirectory, project, dialogues, language, dialog.WorkstringOnly, dialog.WorkstringFallback, dateFrom, projectStats); ExportDialoguesToCSVFile(languageDirectory, project, dialogues, language, dateFrom); ExportActorsToCSVFile(languageDirectory, project, dialogues, language, dateFrom); ExportDialoguesToWwiseTextFile(languageDirectory, project, dialogues, language, dateFrom); } } ExporterStats.Export("TodoVoicingCount", projectStats, exportDirectory, dialog.ListPackages, listLanguages, dialog.WorkstringOnly, dialog.WorkstringFallback); System.Diagnostics.Process.Start(exportDirectory); return(true); }