public void ApplyFilter(IGraphicFilter filter) => this.img = filter.Apply(img);
private static void run(EnumResourcePackType packType, string packPath, string outputZipPath, IGraphicFilter filter) { using var tempDir = new TemporaryDirectory(); Debug.WriteLine($"tempDir: {tempDir.Path}"); var resourcePack = ResourcePackLoaders.Load(packType, packPath); foreach (var texture in resourcePack.EnumerateTextures()) { texture.LoadPngFileToMemory(); texture.ApplyFilter(filter); texture.WriteToResourcePack(tempDir.Path); texture.Dispose(); } ZipFile.CreateFromDirectory(tempDir.Path, outputZipPath, CompressionLevel.Fastest, false, Encoding.UTF8); using (var ar = ZipFile.Open(outputZipPath, ZipArchiveMode.Update)) { var entry = ar.CreateEntry("pack.mcmeta"); using (var writer = new StreamWriter(entry.Open(), Encoding.UTF8)) { writer.WriteLine( "{\n" + " \"pack\": {\n" + " \"pack_format\": 2,\n" + " \"description\": \"Made by MCResourcePackUtil (dev: yuma140902)\"\n" + " }\n" + "}"); } } }