Exemplo n.º 1
0
        public static void Help(string item = null)
        {
            Usage usage = new Usage();

            switch (item)
            {
            default:
                helpUsage(1);
                break;;

            case "mod":
                ArgumentUsage.Mod(null, 0);
                break;;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Mod category
        /// </summary>
        /// <param name="arg">current argument</param>
        /// <param name="args">argument array</param>
        public static void Mod(string arg, string[] args)
        {
            if (mod_create)
            {
                switch (arg)
                {
                default:
                    if (!arg.StartsWith("-"))
                    {
                        if (!mod_dir_next)
                        {
                            if (mod_name == null)
                            {
                                mod_name = arg;
                            }
                            else
                            {
                                ArgumentUsage.Mod("create");
                            }
                        }
                        else
                        {
                            mod_dir_next = false;
                        }
                    }
                    else
                    {
                        ArgumentUsage.Mod("create");
                    }
                    break;;

                case "-o":
                    goto case "--out";;

                case "--out":
                    if (args.Length >= counter)
                    {
                        mod_dir      = args[counter];
                        mod_dir_next = true;
                    }
                    break;;
                }

                if (args.Length == counter)
                {
                    if (mod_name == null)
                    {
                        ArgumentUsage.Mod("create");
                    }

                    if (mod_name.Contains(' '))
                    {
                        throw new ArgumentException("invalid mod name!");
                    }

                    Mods.Mod.Create(mod_name, mod_dir);
                    Environment.Exit(0);
                }
            }

            else
            {
                switch (arg)
                {
                default:
                    ArgumentUsage.Mod();
                    break;;

                case "create":
                    mod_create = true;
                    break;;
                }
            }
        }