Exemple #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));
        }
Exemple #2
0
        public void ProcessExportedFiles(string defaultDataFolder, IGraphicsInfo gInfo)
        {
            if (!(gInfo is ScbgConstants scbgInfo))
            {
                return;
            }
            string data   = Path.Combine(defaultDataFolder, scbgInfo.Data);
            string info   = Path.Combine(defaultDataFolder, scbgInfo.Info);
            bool   tiled  = true;
            string pngDir = Path.Combine(defaultDataFolder, scbgInfo.PngFolder);

            SCBGCollection.Load(data, info).SaveAsPngs(pngDir, tiled);
        }
    public ValueTask ExecuteAsync(IConsole console)
    {
        if (DestinationFolder == null)
        {
            DestinationFolder = Path.Combine(Path.GetDirectoryName(FilePath), Path.GetFileNameWithoutExtension(FilePath) + " - Unpacked");
        }
        Directory.CreateDirectory(DestinationFolder);

        using var br = new BinaryReader(File.OpenRead(FilePath));

        SCBGCollection
        .Load(FilePath, InfoFile)
        .SaveAsPngs(DestinationFolder, 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");
        }

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

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

        return(default);