示例#1
0
        private static void ProcessAddons(string relativeDir)
        {
            //Use the MissionMergeForm to do the work
            MissionMergeForm form = new MissionMergeForm();

            form.ConsoleMode           = true;
            form.DefaultOutputFileName = relativeDir + "mission.lvl";
            form.BaseFileName          = "base.mission.lvl";
            string mission_file = "";

            Console.WriteLine("Reading files...");
            for (int i = 0; i < 1000; i++)
            {
                if (relativeDir == ".\\")
                {
                    mission_file = String.Format(".\\addon\\{0:000}\\mission.lvl", i);
                }
                else
                {
                    mission_file = String.Format(".\\{0:000}\\mission.lvl", i);
                }
                if (File.Exists(mission_file))
                {
                    Console.WriteLine("Merging '{0}'...", mission_file);
                    form.AddonMissionFileName = mission_file;
                    form.MergeLevels();
                }
            }
            Console.WriteLine("Saving...");
            string outFile = form.SaveMissionFile();

            MessageBox.Show("New mission file saved to:\r\n" + Path.GetFullPath(outFile));
            form.Dispose();
        }
示例#2
0
        static int Main(string[] args)
        {
            if (args.Length == 0)
            {
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(false);
                Application.Run(new MissionMergeForm());
                return(0);
            }
            #region process args...
            string arg = "";
            for (int i = 0; i < args.Length; i += 2)
            {
                arg = args[i].ToLower();
                if ("-h /h /? --help".IndexOf(arg) > -1)
                {
                    Console.WriteLine(sHelpMsg);
                    return(0);
                }
                else if (arg == "-base_mission" && args.Length > i + 1)
                {
                    sBaseFile = args[i + 1];
                }
                else if (arg == "-addon_missions" && args.Length > i + 1)
                {
                    sAddonFile = args[i + 1];
                }
                else if (arg == "-output" && args.Length > i + 1)
                {
                    sOutputFile = args[i + 1];
                }
            }
            #endregion

            if (!File.Exists(sBaseFile) || !File.Exists(sAddonFile))
            {
                Console.Error.WriteLine("Both 'base_mission' and 'addon_missions' files must be specified!\n");
                Console.Error.WriteLine(sHelpMsg);
                return(1);
            }
            //Use the MissionMergeForm to do our bidding
            MissionMergeForm form = new MissionMergeForm();
            form.ConsoleMode = true;
            Console.WriteLine("Reading files...");
            form.DefaultOutputFileName = sOutputFile;
            form.BaseFileName          = sBaseFile;
            form.AddonMissionFileName  = sAddonFile;
            Console.WriteLine("Merging...");
            form.MergeLevels();
            Console.WriteLine("Saving...");
            form.SaveMissionFile();
            form.Dispose();

            return(0);
        }