// 生成 TS 代码读取器 和对应的 csv static void langreader() { string[] dirs = Directory.GetDirectories(Setting.Options.langDir); XlsxManager xlsxManager = null; foreach (string dir in dirs) { string dirname = Path.GetFileName(dir); if (dirname == "editor") { continue; } string csvRoot = Setting.CsvRoot + "/" + dirname; xlsxManager = new XlsxManager(); xlsxManager.LoadAllTable(dir); xlsxManager.ExportCsvs(csvRoot); } if (xlsxManager != null) { GenerateLangConfigLoaderList generate = new GenerateLangConfigLoaderList(xlsxManager); generate.Generate(); } }
public OutputGen(string xlsPath, string imgPath, string dstPath) { xlsMan = new XlsxManager(xlsPath); this.xlsPath = xlsPath; this.imgPath = imgPath; this.dstPath = dstPath + @"\"; }
/// <summary> /// 设置代码名称 /// </summary> /// <param name="codeName"></param> public void SetCodeName(string codeName) { this.codeName = codeName; needGenCodeNameCheckBox.Content = codeName; exportXmlRootPathTextBox.Text = XlsxManager.GetExportXmlAbsolutePathByCodeName(codeName); exportCodeRootPathTextBox.Text = XlsxManager.GetExportCodeAbsolutePathByCodeName(codeName); }
public static void xlsTest() { var xlsPath = @"D:\Desktop\CAUDRON 16 juillet 2020 vacation étude.xls"; var xlsMan = new XlsxManager(xlsPath); xlsMan.exctractUnsaled(); xlsMan.buildXls(@"D:\Desktop\dst.xls"); }
private void SelectDifferentFileButton_Click(object sender, RoutedEventArgs e) { List <string> fileList = XlsxManager.GetDifferentFileRelativePathList(); foreach (var item in fileList) { AddRelativeFileToFileList(item); } }
// 将 Lang/editor 里的xlsx 分给各自语言包 Lang/zh-cn, Lang/en static void langpackage() { XlsxManager xlsxManager = new XlsxManager(); xlsxManager.LoadAllTable(Setting.Options.langDir + "/editor"); GenerateLangPackage generateLangPackage = new GenerateLangPackage(xlsxManager); generateLangPackage.Generate(); }
// 将Editor里的文本替换原文本 static void editor2source() { XlsxManager xlsxManager = new XlsxManager(); xlsxManager.LoadAllTable(Setting.Options.langDir + "/editor"); Lang2SourceManager generateLangPackage = new Lang2SourceManager(xlsxManager); generateLangPackage.Run(); }
// 将 config 里带有 zh_cn表分离出来 static void generateconfig() { XlsxManager xlsxManager = new XlsxManager(); xlsxManager.LoadIgnore(Setting.Options.exportSettingXlsx, Setting.Options.settingIgnoreSheet); xlsxManager.LoadAllTable(Setting.Options.xlsxDir, Setting.Options.enableReadLangFieldPrefixs(), Setting.Options.getLangFieldPrefixs()); GenerateConfigManager generateConfigManager = new GenerateConfigManager(xlsxManager); generateConfigManager.Generate(); }
private void SelectExportCodeRootPathButton_Click(object sender, RoutedEventArgs e) { CommonOpenFileDialog dialog = new CommonOpenFileDialog(); dialog.IsFolderPicker = true;//设置为选择文件夹 dialog.InitialDirectory = exportCodeRootPathTextBox.Text; if (dialog.ShowDialog() == CommonFileDialogResult.Ok) { exportCodeRootPathTextBox.Text = dialog.FileName; XlsxManager.SetExportCodeAbsolutePathByCodeName(codeName, dialog.FileName); } }
private void SelectImportXlsxRootPathButton_Click(object sender, RoutedEventArgs e) { CommonOpenFileDialog dialog = new CommonOpenFileDialog(); dialog.IsFolderPicker = true;//设置为选择文件夹 dialog.InitialDirectory = importXlsxRootPathTextBox.Text; if (dialog.ShowDialog() == CommonFileDialogResult.Ok) { importXlsxRootPathTextBox.Text = dialog.FileName; XlsxManager.SetImportXlsxAbsolutePath(dialog.FileName); fileListBox.Items.Clear(); } }
void GenAllFile() { XlsxManager.GenAllFile((result) => { if (result) { MessageBox.Show("生成文件成功!", "提示", MessageBoxButton.OK, MessageBoxImage.Information); } else { MessageBox.Show("生成文件失败!", "提示", MessageBoxButton.OK, MessageBoxImage.Error); } }, ProgressCallback); }
/// <summary> /// 添加文件到列表中 /// </summary> /// <param name="filePath"></param> void AddFileToFileList(string filePath) { if (filePath.StartsWith(importXlsxRootPathTextBox.Text)) { if (XlsxManager.CheckIsXlsxFile(filePath)) { string fileRelativePath = System.IO.Path.GetRelativePath(importXlsxRootPathTextBox.Text, filePath); AddRelativeFileToFileList(fileRelativePath); } } else { Log(false, $"选择的文件:{filePath}不在xlsx根路径下。"); } }
public static void folderTest() { var dstPath2 = @"D:\Desktop\"; var dstFolderName2 = "CAUDRON 16 juillet 2020 vacation étude INVENDU"; var xlsPath = @"D:\Desktop\CAUDRON 16 juillet 2020 vacation étude.xls"; var xlsMan = new XlsxManager(xlsPath); xlsMan.exctractUnsaled(); var fo = new FolderManager(dstPath2, dstFolderName2); fo.foldersBuild(); xlsMan.buildXls(fo.dstPath + @"\" + dstFolderName2 + ".xls"); fo.copyImgToDir(dstPath2 + "image", xlsMan.rowNbs); }
void GenFile() { List <string> fileRelaticePathList = new List <string>(); foreach (string item in fileListBox.Items) { fileRelaticePathList.Add(item); } XlsxManager.GenFile(fileRelaticePathList, (result) => { if (result) { MessageBox.Show("生成文件成功!", "提示", MessageBoxButton.OK, MessageBoxImage.Information); } else { MessageBox.Show("生成文件失败!", "提示", MessageBoxButton.OK, MessageBoxImage.Error); } }, ProgressCallback); }
public MainWindow() { InitializeComponent(); XlsxManager.Init(Environment.CurrentDirectory, Log); //初始化xlsx文件列表的右键菜单 MenuItem deleteMenuItem = new MenuItem(); deleteMenuItem.Header = "删除"; deleteMenuItem.Click += (sender, e) => { RemoveCurrentSelectFile(); }; fileListBox.ContextMenu.Items.Add(deleteMenuItem); fileListBox.SelectionMode = SelectionMode.Extended; //初始化配置 importXlsxRootPathTextBox.Text = XlsxManager.GetImportXlsxAbsolutePath(); List <string> codeNameList = XlsxManager.GetCodeNameList(); for (int i = 0; i < codeNameList.Count; i++) { CodeInfoControl codeInfoControl = new CodeInfoControl(); codeInfoControlMap.Add(codeNameList[i], codeInfoControl); codeInfoControl.SetCodeName(codeNameList[i]); codeInfoControlGrid.Children.Add(codeInfoControl); if (codeNameList.Count == 1) { codeInfoControl.VerticalAlignment = VerticalAlignment.Center; } else { codeInfoControl.VerticalAlignment = VerticalAlignment.Top; codeInfoControl.Margin = new Thickness(0, i * 120, 0, 0); } } }
private void ExportAllRecorderOverviewButton_Click(object sender, RoutedEventArgs e) { string allRecorderOverviewFileName = "AllRecorderOverview.xml"; CommonOpenFileDialog dialog = new CommonOpenFileDialog(); dialog.IsFolderPicker = true;//设置为选择文件夹 if (dialog.ShowDialog() == CommonFileDialogResult.Ok) { string allRecorderOverviewRootPath = dialog.FileName; string allRecorderOverviewFilePath = $"{allRecorderOverviewRootPath}\\{allRecorderOverviewFileName}"; bool needExport = false; if (File.Exists(allRecorderOverviewFilePath)) { if (MessageBox.Show($"当前路径已经存在文件:{allRecorderOverviewFileName},是否覆盖", "提示", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { needExport = true; } } else { needExport = true; } if (needExport) { XlsxManager.ExportAllRecorderOverview(allRecorderOverviewFilePath); if (MessageBox.Show($"配置的总览文件已经导出,是否打开?", "提示", MessageBoxButton.YesNo) == MessageBoxResult.Yes) { Process process = new Process(); ProcessStartInfo processStartInfo = new ProcessStartInfo(allRecorderOverviewFilePath); process.StartInfo = processStartInfo; process.StartInfo.UseShellExecute = true; process.Start(); } } } }
private void NeedGenCodeNameCheckBox_Click(object sender, RoutedEventArgs e) { XlsxManager.SetNeedExportByCodeName(codeName, (bool)needGenCodeNameCheckBox.IsChecked); }
public GenerateLangConfigLoaderList(XlsxManager xlsxManager) { this.xlsxManager = xlsxManager; }
public Lang2SourceManager(XlsxManager xlsxManager) { this.xlsxManager = xlsxManager; }
private void Window_Closing(object sender, System.ComponentModel.CancelEventArgs e) { XlsxManager.UnInit(); }
public GenerateLangPackage(XlsxManager xlsxManager) { this.xlsxManager = xlsxManager; }
public GenerateConfigManager(XlsxManager xlsxManager) { this.xlsxManager = xlsxManager; }