コード例 #1
0
ファイル: MainWindow.xaml.cs プロジェクト: renngar/wabbajack
        public MainWindow()
        {
            var    args = Environment.GetCommandLineArgs();
            bool   DebugMode = false;
            string MO2Folder = null, InstallFolder = null, MO2Profile = null;

            if (args.Length > 1)
            {
                DebugMode     = true;
                MO2Folder     = args[1];
                MO2Profile    = args[2];
                InstallFolder = args[3];
            }

            InitializeComponent();

            var context = new AppState(Dispatcher, "Building");

            this.DataContext = context;
            WorkQueue.Init((id, msg, progress) => context.SetProgress(id, msg, progress),
                           (max, current) => context.SetQueueSize(max, current));


            if (DebugMode)
            {
                new Thread(() =>
                {
                    var compiler = new Compiler(MO2Folder, msg => context.LogMsg(msg));

                    compiler.MO2Profile = MO2Profile;
                    context.ModListName = compiler.MO2Profile;

                    context.Mode = "Building";
                    compiler.LoadArchives();
                    compiler.Compile();

                    var modlist = compiler.ModList.ToJSON();
                    compiler    = null;

                    context.ConfigureForInstall(modlist);
                }).Start();
            }
            else
            {
                new Thread(() =>
                {
                    var modlist = Installer.CheckForModPack();
                    if (modlist == null)
                    {
                    }
                    else
                    {
                        context.ConfigureForInstall(modlist);
                    }
                }).Start();
            }
        }
コード例 #2
0
ファイル: MainWindow.xaml.cs プロジェクト: mstyles/wabbajack
        public MainWindow()
        {
            var    args = Environment.GetCommandLineArgs();
            bool   DebugMode = false;
            string MO2Folder = null, InstallFolder = null, MO2Profile = null;

            if (args.Length > 1)
            {
                DebugMode     = true;
                MO2Folder     = args[1];
                MO2Profile    = args[2];
                InstallFolder = args[3];
            }

            InitializeComponent();

            var context = new AppState(Dispatcher, "Building");

            context.LogMsg($"Wabbajack Build - {ThisAssembly.Git.Sha}");
            SetupHandlers(context);
            this.DataContext = context;
            WorkQueue.Init((id, msg, progress) => context.SetProgress(id, msg, progress),
                           (max, current) => context.SetQueueSize(max, current));

            Utils.SetLoggerFn(s => context.LogMsg(s));
            Utils.SetStatusFn((msg, progress) => WorkQueue.Report(msg, progress));



            if (DebugMode)
            {
                new Thread(() =>
                {
                    var compiler = new Compiler(MO2Folder, msg => context.LogMsg(msg));

                    compiler.MO2Profile = MO2Profile;
                    context.ModListName = compiler.MO2Profile;

                    context.Mode = "Building";
                    compiler.Compile();

                    var modlist = compiler.ModList.ToJSON();
                    compiler    = null;

                    context.ConfigureForInstall(modlist);
                }).Start();
            }
            else
            {
                new Thread(() =>
                {
                    var modlist = Installer.CheckForModPack();
                    if (modlist == null)
                    {
                        Utils.Log("No Modlist found, running in Compiler mode.");
                    }
                    else
                    {
                        context.ConfigureForInstall(modlist);
                    }
                }).Start();
            }
        }