2019-07-22 22:17:46 +00:00
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
2019-07-26 20:59:14 +00:00
|
|
|
|
using System.IO;
|
2019-07-22 22:17:46 +00:00
|
|
|
|
using System.Linq;
|
|
|
|
|
using System.Text;
|
|
|
|
|
using System.Threading;
|
|
|
|
|
using System.Threading.Tasks;
|
|
|
|
|
using System.Windows;
|
|
|
|
|
using System.Windows.Controls;
|
|
|
|
|
using System.Windows.Data;
|
|
|
|
|
using System.Windows.Documents;
|
|
|
|
|
using System.Windows.Input;
|
|
|
|
|
using System.Windows.Media;
|
|
|
|
|
using System.Windows.Media.Imaging;
|
|
|
|
|
using System.Windows.Navigation;
|
|
|
|
|
using System.Windows.Shapes;
|
|
|
|
|
using Wabbajack.Common;
|
|
|
|
|
|
|
|
|
|
namespace Wabbajack
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Interaction logic for MainWindow.xaml
|
|
|
|
|
/// </summary>
|
|
|
|
|
public partial class MainWindow : Window
|
|
|
|
|
{
|
|
|
|
|
public MainWindow()
|
|
|
|
|
{
|
2019-07-31 03:59:19 +00:00
|
|
|
|
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];
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-22 22:17:46 +00:00
|
|
|
|
InitializeComponent();
|
2019-07-26 20:59:14 +00:00
|
|
|
|
|
2019-07-22 22:17:46 +00:00
|
|
|
|
var context = new AppState(Dispatcher, "Building");
|
2019-07-30 21:45:04 +00:00
|
|
|
|
this.DataContext = context;
|
2019-07-22 22:17:46 +00:00
|
|
|
|
WorkQueue.Init((id, msg, progress) => context.SetProgress(id, msg, progress));
|
|
|
|
|
|
2019-07-30 21:45:04 +00:00
|
|
|
|
|
2019-07-31 03:59:19 +00:00
|
|
|
|
if (DebugMode)
|
2019-07-22 22:17:46 +00:00
|
|
|
|
{
|
2019-07-31 03:59:19 +00:00
|
|
|
|
new Thread(() =>
|
|
|
|
|
{
|
|
|
|
|
var compiler = new Compiler(MO2Folder, msg => context.LogMsg(msg));
|
2019-07-23 04:27:26 +00:00
|
|
|
|
|
2019-07-31 03:59:19 +00:00
|
|
|
|
compiler.MO2Profile = MO2Profile;
|
|
|
|
|
context.ModListName = compiler.MO2Profile;
|
2019-07-30 21:45:04 +00:00
|
|
|
|
|
2019-07-31 03:59:19 +00:00
|
|
|
|
context.Mode = "Building";
|
|
|
|
|
compiler.LoadArchives();
|
|
|
|
|
compiler.Compile();
|
2019-07-30 21:45:04 +00:00
|
|
|
|
|
2019-07-31 03:59:19 +00:00
|
|
|
|
var modlist = compiler.ModList.ToJSON();
|
|
|
|
|
compiler = null;
|
2019-07-23 04:27:26 +00:00
|
|
|
|
|
2019-07-31 03:59:19 +00:00
|
|
|
|
context.ConfigureForInstall(modlist);
|
2019-07-22 22:17:46 +00:00
|
|
|
|
|
2019-07-31 03:59:19 +00:00
|
|
|
|
}).Start();
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
new Thread(() =>
|
|
|
|
|
{
|
|
|
|
|
var modlist = Installer.CheckForModPack();
|
|
|
|
|
context.LogMsg($"Modlist returned {modlist != null}");
|
2019-07-22 22:17:46 +00:00
|
|
|
|
|
2019-07-31 03:59:19 +00:00
|
|
|
|
if (modlist == null)
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
else
|
|
|
|
|
{
|
|
|
|
|
context.ConfigureForInstall(modlist);
|
|
|
|
|
}
|
|
|
|
|
}).Start();
|
2019-07-22 22:17:46 +00:00
|
|
|
|
|
2019-07-31 03:59:19 +00:00
|
|
|
|
}
|
2019-07-22 22:17:46 +00:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|