public async Task AddFile() { try { string srcFileName = _getFileName.OpenGetFileName("Select File", "All Files (*.*)|*.*"); if (srcFileName != null) { if (!File.Exists(srcFileName)) { ReportMessage("Selected file not found."); return; } string destFileName = _getFileName.GetString(); if (destFileName == null) { return; } if (string.IsNullOrWhiteSpace(destFileName)) { ReportMessage("Filename not valid."); return; } await Task.Run(() => _patchZipFile.AddFile(srcFileName, destFileName)); SetBrowserEntries(); ReportMessage("Done."); } } catch (Exception ex) { ReportException(ex); } }
public async Task EditPatchTest(string refFile, string filename, string newFileName) { File.Copy(refFile, filename, true); using PatchZipFile patchZipFile = new PatchZipFile(filename, PatchZipMode.Update); using FileStream fileStream = new FileStream(newFileName, FileMode.Open, FileAccess.Read); await patchZipFile.AddFile(fileStream, "im2nx_font.par"); }
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 CreatePatchTest(string filename, string newFileName) { using PatchZipFile patchZipFile = new PatchZipFile(filename, PatchZipMode.Create); using FileStream fileStream = new FileStream(newFileName, FileMode.Open, FileAccess.Read); await patchZipFile.AddFile(fileStream, "im2nx_font.par"); }