Beispiel #1
0
        static int Run(CommandLineArguments args)
        {
            Logger logger;

            if (args.JsonOutput)
            {
                logger = new JsonLogger();
            }
            else
            {
                logger = new ConsoleLogger();
            }

            using (var modCompiler = new ModCompiler(logger, args.GameDataPath))
            {
                modCompiler.SetWarningOptions(CommandLineArguments.GetWarningOptions(args.Warnings));
                modCompiler.CheckGameObjects  = args.CheckGameObjects;
                modCompiler.CheckOnly         = args.CheckOnly;
                modCompiler.LoadPackages      = !args.NoPackages;
                modCompiler.AllowTypeCoercion = args.AllowTypeCoercion;
                modCompiler.OsiExtender       = args.OsiExtender;
                if (args.Game == "dos2")
                {
                    modCompiler.Game = TargetGame.DOS2;
                }
                else if (args.Game == "dos2de")
                {
                    modCompiler.Game = TargetGame.DOS2DE;
                }
                else if (args.Game == "bg3")
                {
                    modCompiler.Game = TargetGame.BG3;
                }
                else
                {
                    throw new ArgumentException("Unsupported game type");
                }

                var mods = new List <string>(args.Mods);
                if (!modCompiler.Compile(args.OutputPath, args.DebugInfoOutputPath, mods))
                {
                    return(3);
                }

                if (args.DebugLogOutputPath != null && !args.CheckOnly)
                {
                    DebugDump(args.OutputPath, args.DebugLogOutputPath);
                }
            }

            return(0);
        }
Beispiel #2
0
        static void Run(CommandLineArguments args)
        {
            Logger logger;

            if (args.JsonOutput)
            {
                logger = new JsonLogger();
            }
            else
            {
                logger = new ConsoleLogger();
            }

            var modCompiler = new ModCompiler(logger, args.GameDataPath);

            modCompiler.SetWarningOptions(CommandLineArguments.GetWarningOptions(args.Warnings));
            modCompiler.CheckGameObjects = args.CheckGameObjects;
            modCompiler.CheckOnly        = args.CheckOnly;
            modCompiler.LoadPackages     = !args.NoPackages;
            if (args.Game == "dos2")
            {
                modCompiler.Game = TargetGame.DOS2;
            }
            else if (args.Game == "dos2de")
            {
                modCompiler.Game = TargetGame.DOS2DE;
            }
            else
            {
                throw new ArgumentException("Unsupported game type");
            }

            var mods = new List <string>(args.Mods);

            if (!modCompiler.Compile(args.OutputPath, args.DebugInfoOutputPath, mods))
            {
                Environment.Exit(3);
            }

            if (args.DebugLogOutputPath != null)
            {
                DebugDump(args.OutputPath, args.DebugLogOutputPath);
            }
        }