public async Task AddToPatchTest( string filename, string newFileName, string parameterName, string lyricDir, string commuName, string gtfDir) { using PatchZipFile patchZipFile = new PatchZipFile(filename, PatchZipMode.Create); patchZipFile.AddFile(newFileName, "im2nx_font.par"); patchZipFile.AddParameterFiles(parameterName); await patchZipFile.AddLyrics(lyricDir); await patchZipFile.AddCommus(commuName, null, new System.Progress <ProgressData>(data => System.Console.WriteLine(data.ToString()))); await patchZipFile.AddGtfs(gtfDir); }
static async Task MakePatch(MakePatchOptions o) { var progress = o.Verbose ? consoleProgress : null; using PatchZipFile patchZipFile = new PatchZipFile(o.Patch, o.Overwrite ? PatchZipMode.Create : PatchZipMode.Update); if (o.Files.Any()) { List <string> files = o.Files.ToList(); if (files.Count % 2 != 0) { Console.Error.WriteLine("Odd number of --file command-line parameters."); return; } else { for (int i = 0; i < files.Count; i += 2) { progress?.Report(string.Format("Adding file {0} as {1}.", files[i], files[i + 1])); patchZipFile.AddFile(files[i], files[i + 1]); } } } if (o.Commu != null) { progress?.Report("Adding commus."); await patchZipFile.AddCommus(o.Commu, progress, progress); } if (o.Parameter != null) { progress?.Report("Adding parameter files."); patchZipFile.AddParameterFiles(o.Parameter); } if (o.Image != null) { progress?.Report("Adding images."); await patchZipFile.AddGtfs(o.Image, progress); } if (o.Lyrics != null) { progress?.Report("Adding lyrics."); await patchZipFile.AddLyrics(o.Lyrics, progress); } progress?.Report("Done."); }
public async Task AddCommus() { try { string srcFileName = _getFileName.OpenGetFileName("Open Commu Spreadsheet", "Excel Spreadsheet (*.xlsx)|*.xlsx"); if (srcFileName != null) { if (!File.Exists(srcFileName)) { ReportMessage("Selected file not found."); return; } await _patchZipFile.AddCommus(srcFileName, ProgressReporter, ProgressReporter); SetBrowserEntries(); ReportMessage("Done."); } } catch (Exception ex) { ReportException(ex); } }