public void ProcessExportedFiles(string defaultDataFolder, IGraphicsInfo gInfo) { if (!(gInfo is StlConstants stlInfo)) { return; } LINK.Unpack(Path.Combine(defaultDataFolder, stlInfo.Link), Path.Combine(defaultDataFolder, stlInfo.LinkFolder), true, 4); var ncer = NCER.Load(Path.Combine(defaultDataFolder, stlInfo.Ncer)); string data = Path.Combine(defaultDataFolder, stlInfo.TexData ?? stlInfo.Data); string info = Path.Combine(defaultDataFolder, stlInfo.TexInfo ?? stlInfo.Info); bool tiled = stlInfo.TexData == null; string pngDir = Path.Combine(defaultDataFolder, stlInfo.PngFolder); STLCollection.Load(data, info).SaveAsPngs(pngDir, ncer, tiled); }
public ValueTask ExecuteAsync(IConsole console) { if (DestinationFolder == null) { DestinationFolder = Path.Combine(Path.GetDirectoryName(FilePath), Path.GetFileNameWithoutExtension(FilePath) + " - Unpacked"); } Directory.CreateDirectory(DestinationFolder); NCER ncer = NCER.Load(NcerPath); using var br = new BinaryReader(File.OpenRead(FilePath)); STLCollection .Load(FilePath, InfoFile) .SaveAsPngs(DestinationFolder, ncer, tiled: Tiled); console.Output.WriteLine("Complete!"); return(default);
public ValueTask ExecuteAsync(IConsole console) { if (DestinationDataFile == null) { DestinationDataFile = Path.Combine(Path.GetDirectoryName(DirPath), Path.GetFileNameWithoutExtension(DirPath) + " - PackedData.dat"); } if (DestinationInfoFile == null) { DestinationInfoFile = Path.Combine(Path.GetDirectoryName(DirPath), Path.GetFileNameWithoutExtension(DirPath) + " - PackedInfo.dat"); } NCER ncer = NCER.Load(NcerPath); STLCollection .LoadPngs(DirPath, ncer, tiled: Tiled) .Save(stlDataFile: DestinationDataFile, stlInfoFile: DestinationInfoFile); console.Output.WriteLine("Complete!"); return(default);
public void GetFilesToPatch(ConcurrentBag <FileToPatch> filesToPatch, IGraphicsInfo gInfo) { if (!(gInfo is StlConstants stlInfo)) { return; } var spriteFiles = _overrideSpriteProvider.GetAllSpriteFiles(stlInfo.Type); if (!spriteFiles.Any(i => i.IsOverride)) { return; } string[] filesToPack = spriteFiles.Select(i => i.File).ToArray(); var ncer = NCER.Load(Path.Combine(_graphicsProviderFolder, stlInfo.Ncer)); if (stlInfo.TexInfo != null) { string texData = Path.GetTempFileName(); string texInfo = Path.GetTempFileName(); STLCollection .LoadPngs(filesToPack, ncer, tiled: false) .Save(texData, texInfo); filesToPatch.Add(new FileToPatch(stlInfo.TexInfo, texInfo, FilePatchOptions.DeleteSourceWhenDone | FilePatchOptions.VariableLength)); filesToPatch.Add(new FileToPatch(stlInfo.TexData, texData, FilePatchOptions.DeleteSourceWhenDone | FilePatchOptions.VariableLength)); } if (stlInfo.Info != null) { string info = Path.GetTempFileName(); string data = Path.GetTempFileName(); STLCollection .LoadPngs(filesToPack, ncer, tiled: true) .Save(data, info); filesToPatch.Add(new FileToPatch(stlInfo.Info, info, FilePatchOptions.DeleteSourceWhenDone | FilePatchOptions.VariableLength)); filesToPatch.Add(new FileToPatch(stlInfo.Data, data, FilePatchOptions.DeleteSourceWhenDone | FilePatchOptions.VariableLength)); } }