Beispiel #1
0
        static void Main(string[] args)
        {
            FileSettings settings = new FileSettings();

            for (int i = 0; i < args.Length; i++)
            {
                switch (args[i])
                {
                case "-h":
                case "--help":
                case "-help":
                    Console.WriteLine(
                        "How to use:\n" +
                        "-i --input (Selects input file)\n" +
                        "-id --input-dir (Selects input directory)\n" +
                        "-o --output (Selects output file)\n" +
                        "-od --output-dir (Selects output directory)\n");
                    return;

                case "-i":
                case "--input":
                    settings.inputFiles.Add(args[i + 1]);
                    break;

                case "-o":
                case "--output":
                    settings.outputFiles.Add(args[i + 1]);
                    break;

                case "-id":
                case "--input-dir":
                    settings.inputDir = args[i + 1];
                    break;

                case "-od":
                case "--output-dir":
                    settings.outputDir = args[i + 1];
                    break;

                case "-e":
                case "--output-ext":
                    settings.OutputExtension = args[i + 1];
                    break;
                }
            }

            if (settings.inputFiles.Count == 0 &&
                settings.inputDir == string.Empty)
            {
                Console.WriteLine("You must select a valid input file or directory (-i/-id)");
                return;
            }

            if (settings.outputFiles.Count == 0 &&
                settings.outputDir == string.Empty)
            {
                Console.WriteLine("You must select a valid output file or directory (-o/-od)");
                return;
            }

            var  formats  = FindFormats();
            bool executed = false;

            foreach (IConvertableBinary conv in formats)
            {
                if (args.Contains(conv.CommandActivate))
                {
                    conv.GenerateBinary(settings, args);
                    executed = true;
                }
            }

            if (!executed)
            {
                Console.WriteLine("No formats selected. Choose one of the supported formats.");
                foreach (IConvertableBinary conv in formats)
                {
                    Console.WriteLine(conv.CommandActivate);
                }
            }
            //   foreach (var arg in args)
            //      BFRESU.BatchCreateTextures(arg);
            return;

            args = new string[4]
            {
                "-i", "cube.dae", "-o", "cube.bfres"
            };

            BFRES bfres = new BFRES();

            bfres.GenerateBinary(new FileSettings(), args);

            Console.Read();
            return;

            /* if (args.Length == 0)
             * {
             *   Console.WriteLine("Drag some DDS files to test this out! Note this will be able to convert many formats, current bntx is only supported at this time!");
             *   Console.Read();
             *   return;
             * }*/
        }
Beispiel #2
0
 public void GenerateBinary(FileSettings settings, string[] args)
 {
 }