Process() public méthode

public Process ( string _SourceDir, string _Pattern, int _AtlasSize, int _Padding, bool _DebugMode ) : void
_SourceDir string
_Pattern string
_AtlasSize int
_Padding int
_DebugMode bool
Résultat void
Exemple #1
0
        private static void Main(string[] args)
        {
            Console.WriteLine("TexturePacker - Package rect/non pow 2 textures into square power of 2 atlas");

            if (args.Length == 0)
            {
                DisplayInfo();
                return;
            }

            List <string> prms = args.ToList();

            string sourcePath    = "";
            string searchPattern = "";
            string outName       = "";
            int    textureSize   = 1024;
            int    border        = 0;
            bool   debug         = false;

            for (int ip = 0; ip < prms.Count; ++ip)
            {
                prms[ip] = prms[ip].ToLowerInvariant();

                switch (prms[ip])
                {
                case "-sp":
                case "--sourcepath":
                    if (!prms[ip + 1].StartsWith("-"))
                    {
                        sourcePath = prms[ip + 1];
                        ++ip;
                    }
                    break;

                case "-ft":
                case "--filetype":
                    if (!prms[ip + 1].StartsWith("-"))
                    {
                        searchPattern = prms[ip + 1];
                        ++ip;
                    }
                    break;

                case "-o":
                case "--output":
                    if (!prms[ip + 1].StartsWith("-"))
                    {
                        outName = prms[ip + 1];
                        ++ip;
                    }
                    break;

                case "-s":
                case "--size":
                    if (!prms[ip + 1].StartsWith("-"))
                    {
                        textureSize = int.Parse(prms[ip + 1]);
                        ++ip;
                    }
                    break;

                case "-b":
                case "--border":
                    if (!prms[ip + 1].StartsWith("-"))
                    {
                        border = int.Parse(prms[ip + 1]);
                        ++ip;
                    }
                    break;

                case "-d":
                case "--debug":
                    debug = true;
                    break;
                }
            }

            if (sourcePath == "" || searchPattern == "" || outName == "")
            {
                DisplayInfo();
                return;
            }
            else
            {
                Console.WriteLine("Processing, please wait");
            }

            Packer packer = new Packer();

            packer.Process(sourcePath, searchPattern, textureSize, border, debug);
            packer.SaveAtlasses(outName);
            packer.SerializeAtlasses();
        }
Exemple #2
0
        static void Main(string[] args)
        {
            Console.WriteLine("TexturePacker - Package rect/non pow 2 textures into square power of 2 atlas");

            if (args.Length == 0)
            {
                DisplayInfo();
                return;
            }

            List<string> prms = args.ToList();

            string sourcePath = "";
            string searchPattern = "";
            string outName = "";
            int textureSize = 1024;
            int border = 0;
            bool debug = false;

            for (int ip = 0; ip < prms.Count; ++ip)
            {
                prms[ip] = prms[ip].ToLowerInvariant();

                switch (prms[ip])
                {
                    case "-sp":
                    case "--sourcepath":
                        if (!prms[ip + 1].StartsWith("-"))
                        {
                            sourcePath = prms[ip + 1];
                            ++ip;
                        }
                        break;

                    case "-ft":
                    case "--filetype":
                        if (!prms[ip + 1].StartsWith("-"))
                        {
                            searchPattern = prms[ip + 1];
                            ++ip;
                        }
                        break;

                    case "-o":
                    case "--output":
                        if (!prms[ip + 1].StartsWith("-"))
                        {
                            outName = prms[ip + 1];
                            ++ip;
                        }
                        break;

                    case "-s":
                    case "--size":
                        if (!prms[ip + 1].StartsWith("-"))
                        {
                            textureSize = int.Parse(prms[ip + 1]);
                            ++ip;
                        }
                        break;

                    case "-b":
                    case "--border":
                        if (!prms[ip + 1].StartsWith("-"))
                        {
                            border = int.Parse(prms[ip + 1]);
                            ++ip;
                        }
                        break;

                    case "-d":
                    case "--debug":
                        debug = true;
                        break;
                }
            }

            if (sourcePath == "" || searchPattern == "" || outName == "")
            {
                DisplayInfo();
                return;
            }
            else
            {
                Console.WriteLine("Processing, please wait");
            }

            Packer packer = new Packer();

            packer.Process(sourcePath, searchPattern, textureSize, border, debug);
            packer.SaveAtlasses(outName);
        }
Exemple #3
0
        private static void Main(string[] args)
        {
            Console.WriteLine("TexturePacker - Package rect/non pow 2 textures into square power of 2 atlas");

            if (args.Length == 0)
            {
                DisplayInfo();
                return;
            }

            List <string> prms = args.ToList();

            string     sourcePath    = "";
            string     searchPattern = "";
            string     outName       = "";
            OutputType type          = default;
            int        textureSize   = 1024;
            int        border        = 0;
            bool       safeMode      = false;
            bool       fullPath      = false;
            bool       debug         = false;

            for (int ip = 0; ip < prms.Count; ++ip)
            {
                prms[ip] = prms[ip].ToLowerInvariant();

                switch (prms[ip])
                {
                case "-sp":
                case "--sourcepath":
                    if (!prms[ip + 1].StartsWith("-"))
                    {
                        sourcePath = prms[ip + 1];
                        ++ip;
                    }
                    break;

                case "-ft":
                case "--filetype":
                    if (!prms[ip + 1].StartsWith("-"))
                    {
                        searchPattern = prms[ip + 1];
                        ++ip;
                    }
                    break;

                case "-f":
                case "--filename":
                    if (!prms[ip + 1].StartsWith("-"))
                    {
                        outName = prms[ip + 1];
                        ++ip;
                    }
                    break;

                case "-o":
                case "--output":
                    if (!prms[ip + 1].StartsWith("-"))
                    {
                        string rawType = prms[ip + 1];
                        type = (OutputType)Enum.Parse(typeof(OutputType), rawType, true);
                        ++ip;
                    }
                    break;

                case "-s":
                case "--size":
                    if (!prms[ip + 1].StartsWith("-"))
                    {
                        textureSize = int.Parse(prms[ip + 1]);
                        ++ip;
                    }
                    break;

                case "-b":
                case "--border":
                    if (!prms[ip + 1].StartsWith("-"))
                    {
                        border = int.Parse(prms[ip + 1]);
                        ++ip;
                    }
                    break;

                case "-sm":
                case "--safemode":
                    safeMode = true;
                    break;

                case "-fp":
                case "--fullpath":
                    fullPath = true;
                    break;

                case "-d":
                case "--debug":
                    debug = true;
                    break;
                }
            }

            if (sourcePath == "" || searchPattern == "" || outName == "")
            {
                DisplayInfo();
                return;
            }
            else
            {
                Console.WriteLine("Processing, please wait");
            }

            Packer packer = new Packer();

            packer.Process(type, outName, sourcePath, searchPattern, textureSize, border, debug, safeMode, fullPath);
        }