Create() публичный статический Метод

public static Create ( string folder ) : Ctpk
folder string
Результат Ctpk
Пример #1
0
        static void Main(string[] args)
        {
            if (args.Length != 1)
            {
                Console.WriteLine("usage: {0} input.ctpk/input_folder", AppDomain.CurrentDomain.FriendlyName);
                Environment.Exit(0);
            }

            if (Directory.Exists(args[0]))
            {
                Ctpk.Create(args[0]);
            }
            else if (File.Exists(args[0]))
            {
                Ctpk.Read(args[0]);
            }
            else
            {
                Console.WriteLine("Could not find path or file '{0}'", args[0]);
            }
        }
Пример #2
0
        static int Main(string[] args)
        {
            if (args.Length == 0)
            {
                Console.WriteLine("need args");
                return(1);
            }
            string patchPath = null;

            for (int i = 0; i < args.Length; i += 2)
            {
                switch (args[i][0])
                {
                case 'x':
                    InputFile = args[i + 1];
                    break;

                case 'r':
                    InputFileRaw = args[i + 1];
                    break;

                case 'c':
                    InputFolder = args[i + 1];
                    break;

                case 'o':
                    OutputPath = args[i + 1];
                    break;

                case 'p':
                    patchPath = args[i + 1];
                    break;

                default:
                    Console.WriteLine("Bad argument 0 " + args[i][0]);
                    break;
                }
            }


            string inputPath = null, outputPath = null;
            bool   isExtract = false, isRawExtract = false, isCreate = false;

            if (!String.IsNullOrWhiteSpace(InputFileRaw))
            {
                inputPath    = InputFileRaw;
                isRawExtract = true;
                isExtract    = true;
            }
            else if (!String.IsNullOrWhiteSpace(InputFile))
            {
                inputPath = InputFile;
                isExtract = true;
            }
            else if (!String.IsNullOrWhiteSpace(InputFolder))
            {
                inputPath = InputFolder;
                isCreate  = true;
            }

            if (!String.IsNullOrWhiteSpace(OutputPath))
            {
                outputPath = OutputPath;
            }
            else
            {
                if (isCreate)
                {
                    outputPath = inputPath + ".ctpk";
                }
                else
                {
                    string basePath     = Path.GetDirectoryName(inputPath);
                    string baseFilename = Path.GetFileNameWithoutExtension(inputPath);

                    if (!String.IsNullOrWhiteSpace(basePath))
                    {
                        baseFilename = Path.Combine(basePath, baseFilename);
                    }

                    outputPath = baseFilename;
                }
            }


            if (isCreate)
            {
                Ctpk.Create(inputPath, outputPath, patchPath);
            }
            else if (isExtract)
            {
                Ctpk.Read(inputPath, outputPath, isRawExtract);
            }
            else
            {
                Console.WriteLine("Could not find path or file '{0}'", args[0]);
            }
            return(0);
        }
Пример #3
0
        static void Main(string[] args)
        {
            var config = new Config();

            var settings = new CommandLine.ParserSettings(true, true, false, Console.Error);
            var parser   = new CommandLine.Parser(settings);

            string inputPath = null, outputPath = null;
            bool   isExtract = false, isRawExtract = false, isCreate = false;

            if (args.Length == 0)
            {
                // Don't try to parse zero arguments or else it results in an exception
                Console.WriteLine(config.GetUsage());
                Environment.Exit(-1);
            }

            if (parser.ParseArguments(args, config))
            {
                if (!String.IsNullOrWhiteSpace(config.InputFileRaw))
                {
                    inputPath    = config.InputFileRaw;
                    isRawExtract = true;
                    isExtract    = true;
                }
                else if (!String.IsNullOrWhiteSpace(config.InputFile))
                {
                    inputPath = config.InputFile;
                    isExtract = true;
                }
                else if (!String.IsNullOrWhiteSpace(config.InputFolder))
                {
                    inputPath = config.InputFolder;
                    isCreate  = true;
                }

                if (!String.IsNullOrWhiteSpace(config.OutputPath))
                {
                    outputPath = config.OutputPath;
                }
                else
                {
                    if (isCreate)
                    {
                        outputPath = inputPath + ".ctpk";
                    }
                    else
                    {
                        string basePath     = Path.GetDirectoryName(inputPath);
                        string baseFilename = Path.GetFileNameWithoutExtension(inputPath);

                        if (!String.IsNullOrWhiteSpace(basePath))
                        {
                            baseFilename = Path.Combine(basePath, baseFilename);
                        }

                        outputPath = baseFilename;
                    }
                }
            }

            if (isCreate)
            {
                Ctpk.Create(inputPath, outputPath);
            }
            else if (isExtract)
            {
                Ctpk.Read(inputPath, outputPath, isRawExtract);
            }
            else
            {
                Console.WriteLine("Could not find path or file '{0}'", args[0]);
            }
        }