TexturePacker 批量处理

using System.IO;
using System.Text.RegularExpressions;

namespace ConsoleApplication1
{
    class Program
    {
        static void StartCmdProcess(string command)
        {
            var process = new System.Diagnostics.Process();
            var startInfo = new System.Diagnostics.ProcessStartInfo();
            //startInfo.WindowStyle = System.Diagnostics.ProcessWindowStyle.Hidden;
            startInfo.FileName = "cmd.exe";
            startInfo.Arguments = "/C " + command;
            process.StartInfo = startInfo;
            process.Start();
            process.WaitForExit();
        }

        static void Main(string[] args)
        {
            var output = @"C:\Users\664301573\Desktop\subgame\fish\jinchanbuyu\Client\res\";

            var files = Directory.GetFiles(@"C:\Users\664301573\Desktop\subgame\fish\jinchanbuyu\tp", "*", SearchOption.AllDirectories);
            foreach (var path in files)
            {
                if (Path.GetExtension(path) != ".tps")
                    continue;

                var filename = Path.GetFileNameWithoutExtension(path);
                var data = output + filename + ".plist";
                var sheet = output + filename + ".png";
                StartCmdProcess("TexturePacker " + path + " --texture-format png --content-protection \"\" --data " + data + " --sheet " + sheet);
            }
        }
    }
}

你可能感兴趣的:(TexturePacker 批量处理)