2019-11-11 18:08:08 +00:00
|
|
|
using Syroot.Windows.IO;
|
2019-10-11 22:18:51 +00:00
|
|
|
using System;
|
2019-10-12 21:10:58 +00:00
|
|
|
using ReactiveUI;
|
2019-08-30 23:57:56 +00:00
|
|
|
using System.Diagnostics;
|
2019-07-22 22:17:46 +00:00
|
|
|
using System.IO;
|
2019-10-11 11:15:54 +00:00
|
|
|
using System.IO.Compression;
|
2019-09-26 03:18:36 +00:00
|
|
|
using System.Linq;
|
2019-10-12 03:07:57 +00:00
|
|
|
using System.Reactive.Disposables;
|
|
|
|
using System.Reactive.Linq;
|
2019-07-22 22:17:46 +00:00
|
|
|
using System.Reflection;
|
|
|
|
using System.Threading;
|
2019-07-31 03:59:19 +00:00
|
|
|
using System.Windows;
|
2019-09-26 03:18:36 +00:00
|
|
|
using System.Windows.Media.Imaging;
|
2019-07-22 22:17:46 +00:00
|
|
|
using Wabbajack.Common;
|
2019-10-16 03:10:34 +00:00
|
|
|
using Wabbajack.Lib;
|
2019-11-02 23:23:11 +00:00
|
|
|
using ReactiveUI.Fody.Helpers;
|
2019-11-09 01:53:32 +00:00
|
|
|
using System.Windows.Media;
|
2019-07-22 22:17:46 +00:00
|
|
|
|
|
|
|
namespace Wabbajack
|
|
|
|
{
|
2019-10-30 19:45:42 +00:00
|
|
|
public class InstallerVM : ViewModel
|
2019-07-22 22:17:46 +00:00
|
|
|
{
|
2019-10-13 19:12:33 +00:00
|
|
|
public SlideShow Slideshow { get; }
|
2019-10-30 19:45:42 +00:00
|
|
|
|
2019-10-22 03:03:01 +00:00
|
|
|
public MainWindowVM MWVM { get; }
|
2019-10-11 10:14:01 +00:00
|
|
|
|
2019-11-02 07:06:01 +00:00
|
|
|
public BitmapImage WabbajackLogo { get; } = UIUtils.BitmapImageFromResource("Wabbajack.Resources.Wabba_Mouth.png");
|
2019-10-30 19:45:42 +00:00
|
|
|
|
2019-11-03 06:01:19 +00:00
|
|
|
private readonly ObservableAsPropertyHelper<ModListVM> _ModList;
|
|
|
|
public ModListVM ModList => _ModList.Value;
|
2019-10-12 03:07:57 +00:00
|
|
|
|
2019-11-02 23:23:11 +00:00
|
|
|
[Reactive]
|
|
|
|
public string ModListPath { get; set; }
|
2019-10-12 03:31:33 +00:00
|
|
|
|
2019-11-02 23:23:11 +00:00
|
|
|
[Reactive]
|
|
|
|
public bool UIReady { get; set; }
|
2019-10-12 18:42:47 +00:00
|
|
|
|
2019-10-28 04:59:58 +00:00
|
|
|
private readonly ObservableAsPropertyHelper<string> _HTMLReport;
|
|
|
|
public string HTMLReport => _HTMLReport.Value;
|
2019-10-12 19:11:52 +00:00
|
|
|
|
2019-11-01 00:21:24 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Tracks whether an install is currently in progress
|
|
|
|
/// </summary>
|
2019-11-02 23:23:11 +00:00
|
|
|
[Reactive]
|
|
|
|
public bool Installing { get; set; }
|
2019-10-12 21:04:14 +00:00
|
|
|
|
2019-11-01 00:21:24 +00:00
|
|
|
/// <summary>
|
|
|
|
/// Tracks whether to show the installing pane
|
|
|
|
/// </summary>
|
2019-11-02 23:23:11 +00:00
|
|
|
[Reactive]
|
|
|
|
public bool InstallingMode { get; set; }
|
2019-11-01 00:21:24 +00:00
|
|
|
|
2019-11-11 12:03:46 +00:00
|
|
|
[Reactive]
|
|
|
|
public bool IsMO2ModList { get; set; }
|
|
|
|
|
2019-11-11 18:08:08 +00:00
|
|
|
public FilePickerVM Location { get; }
|
2019-11-11 12:03:46 +00:00
|
|
|
|
2019-11-09 20:20:32 +00:00
|
|
|
public FilePickerVM DownloadLocation { get; }
|
2019-11-03 03:36:53 +00:00
|
|
|
|
2019-11-11 18:08:08 +00:00
|
|
|
public FilePickerVM StagingLocation { get; }
|
2019-11-11 12:03:46 +00:00
|
|
|
|
2019-11-01 00:21:24 +00:00
|
|
|
private readonly ObservableAsPropertyHelper<float> _ProgressPercent;
|
|
|
|
public float ProgressPercent => _ProgressPercent.Value;
|
|
|
|
|
2019-11-09 01:53:32 +00:00
|
|
|
private readonly ObservableAsPropertyHelper<ImageSource> _Image;
|
|
|
|
public ImageSource Image => _Image.Value;
|
2019-10-30 19:45:42 +00:00
|
|
|
|
2019-11-01 01:02:39 +00:00
|
|
|
private readonly ObservableAsPropertyHelper<string> _TitleText;
|
|
|
|
public string TitleText => _TitleText.Value;
|
|
|
|
|
|
|
|
private readonly ObservableAsPropertyHelper<string> _AuthorText;
|
|
|
|
public string AuthorText => _AuthorText.Value;
|
|
|
|
|
2019-11-01 04:59:10 +00:00
|
|
|
private readonly ObservableAsPropertyHelper<string> _Description;
|
|
|
|
public string Description => _Description.Value;
|
2019-11-01 01:02:39 +00:00
|
|
|
|
2019-11-07 05:33:08 +00:00
|
|
|
private readonly ObservableAsPropertyHelper<string> _ProgressTitle;
|
|
|
|
public string ProgressTitle => _ProgressTitle.Value;
|
|
|
|
|
2019-11-07 05:37:40 +00:00
|
|
|
private readonly ObservableAsPropertyHelper<string> _ModListName;
|
|
|
|
public string ModListName => _ModListName.Value;
|
|
|
|
|
2019-10-11 22:30:12 +00:00
|
|
|
// Command properties
|
2019-10-12 18:42:47 +00:00
|
|
|
public IReactiveCommand BeginCommand { get; }
|
2019-10-13 08:03:41 +00:00
|
|
|
public IReactiveCommand ShowReportCommand { get; }
|
2019-10-12 03:07:57 +00:00
|
|
|
public IReactiveCommand OpenReadmeCommand { get; }
|
2019-11-01 02:57:49 +00:00
|
|
|
public IReactiveCommand VisitWebsiteCommand { get; }
|
2019-10-11 22:30:12 +00:00
|
|
|
|
2019-11-06 03:22:38 +00:00
|
|
|
public InstallerVM(MainWindowVM mainWindowVM, string source)
|
2019-07-30 21:45:04 +00:00
|
|
|
{
|
2019-10-12 08:02:58 +00:00
|
|
|
if (Path.GetDirectoryName(Assembly.GetEntryAssembly().Location.ToLower()) == KnownFolders.Downloads.Path.ToLower())
|
2019-09-14 04:35:42 +00:00
|
|
|
{
|
|
|
|
MessageBox.Show(
|
2019-10-12 09:12:53 +00:00
|
|
|
"Wabbajack is running inside your Downloads folder. This folder is often highly monitored by antivirus software and these can often " +
|
2019-10-12 08:02:58 +00:00
|
|
|
"conflict with the operations Wabbajack needs to perform. Please move this executable outside of your Downloads folder and then restart the app.",
|
|
|
|
"Cannot run inside Downloads",
|
2019-09-14 04:35:42 +00:00
|
|
|
MessageBoxButton.OK,
|
|
|
|
MessageBoxImage.Error);
|
|
|
|
Environment.Exit(1);
|
|
|
|
}
|
|
|
|
|
2019-10-22 03:03:01 +00:00
|
|
|
this.MWVM = mainWindowVM;
|
2019-11-06 03:22:38 +00:00
|
|
|
this.ModListPath = source;
|
|
|
|
|
2019-11-09 20:20:32 +00:00
|
|
|
this.Location = new FilePickerVM()
|
|
|
|
{
|
|
|
|
DoExistsCheck = false,
|
|
|
|
PathType = FilePickerVM.PathTypeOptions.Folder,
|
|
|
|
PromptTitle = "Select Installation Directory",
|
|
|
|
};
|
|
|
|
this.Location.AdditionalError = this.WhenAny(x => x.Location.TargetPath)
|
|
|
|
.Select(x => Utils.IsDirectoryPathValid(x));
|
|
|
|
this.DownloadLocation = new FilePickerVM()
|
|
|
|
{
|
|
|
|
DoExistsCheck = false,
|
|
|
|
PathType = FilePickerVM.PathTypeOptions.Folder,
|
|
|
|
PromptTitle = "Select a location for MO2 downloads",
|
|
|
|
};
|
|
|
|
this.DownloadLocation.AdditionalError = this.WhenAny(x => x.DownloadLocation.TargetPath)
|
|
|
|
.Select(x => Utils.IsDirectoryPathValid(x));
|
|
|
|
|
2019-11-11 18:08:08 +00:00
|
|
|
StagingLocation = new FilePickerVM
|
|
|
|
{
|
|
|
|
DoExistsCheck = true,
|
|
|
|
PathType = FilePickerVM.PathTypeOptions.Folder,
|
|
|
|
PromptTitle = "Select your Vortex Staging Folder",
|
|
|
|
AdditionalError = this.WhenAny(x => x.StagingLocation.TargetPath)
|
|
|
|
.Select(Utils.IsDirectoryPathValid)
|
|
|
|
};
|
|
|
|
|
2019-11-06 03:22:38 +00:00
|
|
|
// Load settings
|
|
|
|
InstallationSettings settings = this.MWVM.Settings.InstallationSettings.TryCreate(source);
|
|
|
|
this.MWVM.Settings.SaveSignal
|
|
|
|
.Subscribe(_ =>
|
|
|
|
{
|
2019-11-09 20:20:32 +00:00
|
|
|
settings.InstallationLocation = this.Location.TargetPath;
|
|
|
|
settings.DownloadLocation = this.DownloadLocation.TargetPath;
|
2019-11-06 03:22:38 +00:00
|
|
|
})
|
|
|
|
.DisposeWith(this.CompositeDisposable);
|
2019-09-14 04:35:42 +00:00
|
|
|
|
2019-10-28 04:59:58 +00:00
|
|
|
this._ModList = this.WhenAny(x => x.ModListPath)
|
2019-10-30 19:45:42 +00:00
|
|
|
.ObserveOn(RxApp.TaskpoolScheduler)
|
2019-11-06 03:22:38 +00:00
|
|
|
.Select(modListPath =>
|
2019-10-28 04:59:58 +00:00
|
|
|
{
|
2019-11-06 03:22:38 +00:00
|
|
|
if (modListPath == null) return default(ModListVM);
|
|
|
|
var modList = Installer.LoadFromFile(modListPath);
|
2019-11-03 06:01:19 +00:00
|
|
|
if (modList == null)
|
2019-10-28 04:59:58 +00:00
|
|
|
{
|
|
|
|
MessageBox.Show("Invalid Modlist, or file not found.", "Invalid Modlist", MessageBoxButton.OK,
|
|
|
|
MessageBoxImage.Error);
|
|
|
|
Application.Current.Dispatcher.Invoke(() =>
|
|
|
|
{
|
|
|
|
this.MWVM.MainWindow.ExitWhenClosing = false;
|
|
|
|
var window = new ModeSelectionWindow
|
|
|
|
{
|
|
|
|
ShowActivated = true
|
|
|
|
};
|
|
|
|
window.Show();
|
|
|
|
this.MWVM.MainWindow.Close();
|
|
|
|
});
|
2019-11-03 06:01:19 +00:00
|
|
|
return default(ModListVM);
|
2019-11-11 12:03:46 +00:00
|
|
|
}
|
|
|
|
if (modList.ModManager == ModManager.Vortex)
|
2019-11-11 11:50:16 +00:00
|
|
|
{
|
2019-11-11 12:03:46 +00:00
|
|
|
IsMO2ModList = false;
|
2019-11-11 12:10:38 +00:00
|
|
|
var vortexFolder =
|
|
|
|
Path.Combine(Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData),
|
|
|
|
"Vortex");
|
|
|
|
var stagingFolder = Path.Combine(vortexFolder, GameRegistry.Games[modList.GameType].NexusName,
|
|
|
|
"mods");
|
|
|
|
var downloadFolder = Path.Combine(vortexFolder, "downloads",
|
|
|
|
GameRegistry.Games[modList.GameType].NexusName);
|
2019-11-11 11:50:16 +00:00
|
|
|
MessageBox.Show(
|
|
|
|
"The ModList you are about to install was compiled from a Vortex installation. " +
|
|
|
|
"Vortex support is still very bleeding edge and installing this ModList WILL OVERRIDE your existing mods. " +
|
|
|
|
"If you encounter any errors during installation go to our discord and ping erri120#2285 with your error and a log file.",
|
|
|
|
"Important information regarding Vortex support", MessageBoxButton.OK, MessageBoxImage.Stop);
|
2019-11-11 12:10:38 +00:00
|
|
|
|
|
|
|
if (!Directory.Exists(vortexFolder)) return new ModListVM(modList, modListPath);
|
|
|
|
if (Directory.Exists(stagingFolder) &&
|
|
|
|
File.Exists(Path.Combine(stagingFolder, "__vortex_staging_folder")))
|
2019-11-11 18:08:08 +00:00
|
|
|
StagingLocation.TargetPath = stagingFolder;
|
2019-11-11 12:10:38 +00:00
|
|
|
if (Directory.Exists(Path.Combine(vortexFolder, "downloads")) &&
|
|
|
|
File.Exists(Path.Combine(vortexFolder, "downloads", "__vortex_downloads_folder")))
|
2019-11-11 18:08:08 +00:00
|
|
|
DownloadLocation.TargetPath = downloadFolder;
|
2019-10-28 04:59:58 +00:00
|
|
|
}
|
2019-11-11 12:03:46 +00:00
|
|
|
else
|
|
|
|
{
|
2019-11-11 18:08:08 +00:00
|
|
|
Location.TargetPath = settings.InstallationLocation;
|
|
|
|
DownloadLocation.TargetPath = settings.DownloadLocation;
|
2019-11-11 12:03:46 +00:00
|
|
|
IsMO2ModList = true;
|
|
|
|
}
|
2019-11-06 03:22:38 +00:00
|
|
|
return new ModListVM(modList, modListPath);
|
2019-10-28 04:59:58 +00:00
|
|
|
})
|
|
|
|
.ObserveOnGuiThread()
|
2019-11-03 06:01:19 +00:00
|
|
|
.StartWith(default(ModListVM))
|
2019-10-28 04:59:58 +00:00
|
|
|
.ToProperty(this, nameof(this.ModList));
|
|
|
|
this._HTMLReport = this.WhenAny(x => x.ModList)
|
|
|
|
.Select(modList => modList?.ReportHTML)
|
|
|
|
.ToProperty(this, nameof(this.HTMLReport));
|
2019-11-01 00:21:24 +00:00
|
|
|
this._ProgressPercent = Observable.CombineLatest(
|
|
|
|
this.WhenAny(x => x.Installing),
|
|
|
|
this.WhenAny(x => x.InstallingMode),
|
|
|
|
resultSelector: (installing, mode) => !installing && mode)
|
|
|
|
.Select(show => show ? 1f : 0f)
|
|
|
|
// Disable for now, until more reliable
|
|
|
|
//this.WhenAny(x => x.MWVM.QueueProgress)
|
|
|
|
// .Select(i => i / 100f)
|
|
|
|
.ToProperty(this, nameof(this.ProgressPercent));
|
2019-10-28 04:59:58 +00:00
|
|
|
|
2019-10-30 19:45:42 +00:00
|
|
|
this.Slideshow = new SlideShow(this);
|
|
|
|
|
2019-11-01 01:02:39 +00:00
|
|
|
// Set display items to modlist if configuring or complete,
|
|
|
|
// or to the current slideshow data if installing
|
2019-10-30 19:45:42 +00:00
|
|
|
this._Image = Observable.CombineLatest(
|
2019-11-03 06:01:19 +00:00
|
|
|
this.WhenAny(x => x.ModList)
|
|
|
|
.SelectMany(x => x?.ImageObservable ?? Observable.Empty<BitmapImage>())
|
|
|
|
.NotNull()
|
|
|
|
.StartWith(WabbajackLogo),
|
2019-11-01 01:02:39 +00:00
|
|
|
this.WhenAny(x => x.Slideshow.Image)
|
|
|
|
.StartWith(default(BitmapImage)),
|
|
|
|
this.WhenAny(x => x.Installing),
|
|
|
|
resultSelector: (modList, slideshow, installing) => installing ? slideshow : modList)
|
2019-11-09 01:53:32 +00:00
|
|
|
.Select<BitmapImage, ImageSource>(x => x)
|
2019-10-30 19:45:42 +00:00
|
|
|
.ToProperty(this, nameof(this.Image));
|
2019-11-01 01:02:39 +00:00
|
|
|
this._TitleText = Observable.CombineLatest(
|
2019-11-01 04:59:10 +00:00
|
|
|
this.WhenAny(x => x.ModList.Name),
|
2019-11-03 06:01:19 +00:00
|
|
|
this.WhenAny(x => x.Slideshow.TargetMod.ModName)
|
|
|
|
.StartWith(default(string)),
|
2019-11-01 01:02:39 +00:00
|
|
|
this.WhenAny(x => x.Installing),
|
|
|
|
resultSelector: (modList, mod, installing) => installing ? mod : modList)
|
|
|
|
.ToProperty(this, nameof(this.TitleText));
|
|
|
|
this._AuthorText = Observable.CombineLatest(
|
2019-11-01 04:59:10 +00:00
|
|
|
this.WhenAny(x => x.ModList.Author),
|
2019-11-03 06:01:19 +00:00
|
|
|
this.WhenAny(x => x.Slideshow.TargetMod.ModAuthor)
|
|
|
|
.StartWith(default(string)),
|
2019-11-01 01:02:39 +00:00
|
|
|
this.WhenAny(x => x.Installing),
|
|
|
|
resultSelector: (modList, mod, installing) => installing ? mod : modList)
|
|
|
|
.ToProperty(this, nameof(this.AuthorText));
|
2019-11-01 04:59:10 +00:00
|
|
|
this._Description = Observable.CombineLatest(
|
|
|
|
this.WhenAny(x => x.ModList.Description),
|
2019-11-03 06:01:19 +00:00
|
|
|
this.WhenAny(x => x.Slideshow.TargetMod.ModDescription)
|
|
|
|
.StartWith(default(string)),
|
2019-11-01 01:02:39 +00:00
|
|
|
this.WhenAny(x => x.Installing),
|
|
|
|
resultSelector: (modList, mod, installing) => installing ? mod : modList)
|
2019-11-01 04:59:10 +00:00
|
|
|
.ToProperty(this, nameof(this.Description));
|
2019-11-07 05:37:40 +00:00
|
|
|
this._ModListName = this.WhenAny(x => x.ModList)
|
|
|
|
.Select(x => x?.Name)
|
|
|
|
.ToProperty(this, nameof(this.ModListName));
|
2019-10-30 19:45:42 +00:00
|
|
|
|
2019-10-13 08:03:41 +00:00
|
|
|
// Define commands
|
|
|
|
this.ShowReportCommand = ReactiveCommand.Create(ShowReport);
|
2019-10-12 03:07:57 +00:00
|
|
|
this.OpenReadmeCommand = ReactiveCommand.Create(
|
|
|
|
execute: this.OpenReadmeWindow,
|
2019-10-13 20:14:11 +00:00
|
|
|
canExecute: this.WhenAny(x => x.ModList)
|
|
|
|
.Select(modList => !string.IsNullOrEmpty(modList?.Readme))
|
2019-10-12 18:42:47 +00:00
|
|
|
.ObserveOnGuiThread());
|
|
|
|
this.BeginCommand = ReactiveCommand.Create(
|
|
|
|
execute: this.ExecuteBegin,
|
2019-11-03 03:36:53 +00:00
|
|
|
canExecute: Observable.CombineLatest(
|
|
|
|
this.WhenAny(x => x.Installing),
|
2019-11-11 18:08:08 +00:00
|
|
|
this.WhenAny(x => x.Location.InError),
|
|
|
|
this.WhenAny(x => x.DownloadLocation.InError),
|
|
|
|
this.WhenAny(x => x.StagingLocation.InError),
|
2019-11-11 12:18:37 +00:00
|
|
|
resultSelector: (installing, loc, download, staging) =>
|
2019-11-03 03:36:53 +00:00
|
|
|
{
|
|
|
|
if (installing) return false;
|
2019-11-11 12:18:37 +00:00
|
|
|
if (IsMO2ModList)
|
|
|
|
return !loc && !download;
|
|
|
|
return !loc && !staging;
|
2019-11-03 03:36:53 +00:00
|
|
|
})
|
2019-10-12 18:42:47 +00:00
|
|
|
.ObserveOnGuiThread());
|
2019-11-01 02:57:49 +00:00
|
|
|
this.VisitWebsiteCommand = ReactiveCommand.Create(
|
|
|
|
execute: () => Process.Start(this.ModList.Website),
|
|
|
|
canExecute: this.WhenAny(x => x.ModList.Website)
|
|
|
|
.Select(x => x?.StartsWith("https://") ?? false)
|
|
|
|
.ObserveOnGuiThread());
|
2019-10-12 03:07:57 +00:00
|
|
|
|
2019-10-30 19:45:42 +00:00
|
|
|
// Have Installation location updates modify the downloads location if empty
|
2019-11-09 20:20:32 +00:00
|
|
|
this.WhenAny(x => x.Location.TargetPath)
|
2019-11-03 03:36:53 +00:00
|
|
|
.Skip(1) // Don't do it initially
|
2019-10-30 19:45:42 +00:00
|
|
|
.Subscribe(installPath =>
|
|
|
|
{
|
2019-11-09 20:20:32 +00:00
|
|
|
if (string.IsNullOrWhiteSpace(this.DownloadLocation.TargetPath))
|
2019-10-30 19:45:42 +00:00
|
|
|
{
|
2019-11-09 20:20:32 +00:00
|
|
|
this.DownloadLocation.TargetPath = Path.Combine(installPath, "downloads");
|
2019-10-30 19:45:42 +00:00
|
|
|
}
|
|
|
|
})
|
|
|
|
.DisposeWith(this.CompositeDisposable);
|
2019-11-07 05:33:08 +00:00
|
|
|
|
|
|
|
this._ProgressTitle = Observable.CombineLatest(
|
|
|
|
this.WhenAny(x => x.Installing),
|
|
|
|
this.WhenAny(x => x.InstallingMode),
|
|
|
|
resultSelector: (installing, mode) =>
|
|
|
|
{
|
|
|
|
if (!installing) return "Configuring";
|
|
|
|
return mode ? "Installing" : "Installed";
|
|
|
|
})
|
|
|
|
.ToProperty(this, nameof(this.ProgressTitle));
|
2019-10-09 09:22:03 +00:00
|
|
|
}
|
2019-09-26 03:18:36 +00:00
|
|
|
|
2019-10-09 09:22:03 +00:00
|
|
|
private void ShowReport()
|
|
|
|
{
|
|
|
|
var file = Path.GetTempFileName() + ".html";
|
|
|
|
File.WriteAllText(file, HTMLReport);
|
|
|
|
Process.Start(file);
|
|
|
|
}
|
|
|
|
|
2019-10-11 12:57:42 +00:00
|
|
|
private void OpenReadmeWindow()
|
|
|
|
{
|
2019-10-13 20:14:11 +00:00
|
|
|
if (string.IsNullOrEmpty(this.ModList.Readme)) return;
|
2019-10-12 03:12:43 +00:00
|
|
|
using (var fs = new FileStream(this.ModListPath, FileMode.Open, FileAccess.Read, FileShare.Read))
|
2019-10-11 13:06:56 +00:00
|
|
|
using (var ar = new ZipArchive(fs, ZipArchiveMode.Read))
|
|
|
|
using (var ms = new MemoryStream())
|
2019-10-11 12:57:42 +00:00
|
|
|
{
|
2019-10-12 03:07:57 +00:00
|
|
|
var entry = ar.GetEntry(this.ModList.Readme);
|
2019-10-30 19:45:42 +00:00
|
|
|
if (entry == null)
|
|
|
|
{
|
|
|
|
Utils.Log($"Tried to open a non-existant readme: {this.ModList.Readme}");
|
|
|
|
return;
|
|
|
|
}
|
2019-10-11 13:06:56 +00:00
|
|
|
using (var e = entry.Open())
|
2019-10-13 20:21:09 +00:00
|
|
|
{
|
2019-10-11 13:06:56 +00:00
|
|
|
e.CopyTo(ms);
|
2019-10-13 20:21:09 +00:00
|
|
|
}
|
2019-10-11 13:06:56 +00:00
|
|
|
ms.Seek(0, SeekOrigin.Begin);
|
2019-10-13 20:21:09 +00:00
|
|
|
using (var reader = new StreamReader(ms))
|
2019-10-11 12:57:42 +00:00
|
|
|
{
|
2019-11-01 04:59:10 +00:00
|
|
|
var viewer = new TextViewer(reader.ReadToEnd(), this.ModList.Name);
|
2019-10-13 20:21:09 +00:00
|
|
|
viewer.Show();
|
2019-10-11 12:57:42 +00:00
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
2019-09-26 03:18:36 +00:00
|
|
|
|
2019-07-31 03:59:19 +00:00
|
|
|
private void ExecuteBegin()
|
|
|
|
{
|
2019-11-10 16:44:56 +00:00
|
|
|
Installing = true;
|
|
|
|
InstallingMode = true;
|
2019-11-11 11:40:05 +00:00
|
|
|
if (ModList.ModManager == ModManager.Vortex)
|
2019-07-31 03:59:19 +00:00
|
|
|
{
|
2019-11-11 12:05:21 +00:00
|
|
|
var installer = new VortexInstaller(ModListPath, ModList.SourceModList)
|
|
|
|
{
|
2019-11-11 18:08:08 +00:00
|
|
|
StagingFolder = StagingLocation.TargetPath,
|
|
|
|
DownloadFolder = DownloadLocation.TargetPath
|
2019-11-11 12:05:21 +00:00
|
|
|
};
|
2019-11-10 16:44:56 +00:00
|
|
|
var th = new Thread(() =>
|
2019-07-31 03:59:19 +00:00
|
|
|
{
|
2019-11-10 16:44:56 +00:00
|
|
|
try
|
|
|
|
{
|
|
|
|
installer.Install();
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
while (ex.InnerException != null) ex = ex.InnerException;
|
|
|
|
Utils.Log(ex.StackTrace);
|
|
|
|
Utils.Log(ex.ToString());
|
|
|
|
Utils.Log($"{ex.Message} - Can't continue");
|
|
|
|
}
|
|
|
|
finally
|
|
|
|
{
|
|
|
|
Installing = false;
|
|
|
|
}
|
|
|
|
})
|
2019-10-07 11:48:39 +00:00
|
|
|
{
|
2019-11-10 16:44:56 +00:00
|
|
|
Priority = ThreadPriority.BelowNormal
|
|
|
|
};
|
|
|
|
th.Start();
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
var installer = new Installer(this.ModListPath, this.ModList.SourceModList, Location.TargetPath)
|
2019-11-01 00:21:24 +00:00
|
|
|
{
|
2019-11-10 16:44:56 +00:00
|
|
|
DownloadFolder = DownloadLocation.TargetPath
|
|
|
|
};
|
|
|
|
var th = new Thread(() =>
|
|
|
|
{
|
|
|
|
try
|
|
|
|
{
|
|
|
|
installer.Install();
|
|
|
|
}
|
|
|
|
catch (Exception ex)
|
|
|
|
{
|
|
|
|
while (ex.InnerException != null) ex = ex.InnerException;
|
|
|
|
Utils.Log(ex.StackTrace);
|
|
|
|
Utils.Log(ex.ToString());
|
|
|
|
Utils.Log($"{ex.Message} - Can't continue");
|
|
|
|
}
|
|
|
|
finally
|
|
|
|
{
|
2019-11-01 00:21:24 +00:00
|
|
|
|
2019-11-10 16:44:56 +00:00
|
|
|
this.Installing = false;
|
|
|
|
}
|
|
|
|
})
|
|
|
|
{
|
|
|
|
Priority = ThreadPriority.BelowNormal
|
|
|
|
};
|
|
|
|
th.Start();
|
|
|
|
}
|
2019-07-31 03:59:19 +00:00
|
|
|
}
|
2019-10-09 22:59:58 +00:00
|
|
|
}
|
2019-07-22 22:17:46 +00:00
|
|
|
}
|