Пример #1
0
        public void GetFilesToPatch(ConcurrentBag <FileToPatch> filesToPatch, IGraphicsInfo gInfo)
        {
            if (!(gInfo is ScbgConstants scbgInfo))
            {
                return;
            }

            var spriteFiles = _overrideSpriteProvider.GetAllSpriteFiles(scbgInfo.Type);

            if (!spriteFiles.Any(i => i.IsOverride))
            {
                return;
            }

            string[] filesToPack = spriteFiles.Select(i => i.File).ToArray();
            string   data        = Path.GetTempFileName();
            string   info        = Path.GetTempFileName();

            SCBGCollection
            .LoadPngs(filesToPack, tiled: true)
            .Save(data, info);

            filesToPatch.Add(new FileToPatch(scbgInfo.Data, data, FilePatchOptions.DeleteSourceWhenDone | FilePatchOptions.VariableLength));
            filesToPatch.Add(new FileToPatch(scbgInfo.Info, info, FilePatchOptions.DeleteSourceWhenDone | FilePatchOptions.VariableLength));
        }
Пример #2
0
    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");
        }

        SCBGCollection
        .LoadPngs(DirPath, tiled: Tiled)
        .Save(scbgDataFile: DestinationDataFile, scbgInfoFile: DestinationInfoFile);

        console.Output.WriteLine("Complete!");

        return(default);