diff --git a/Wabbajack.Lib/ACompiler.cs b/Wabbajack.Lib/ACompiler.cs
index eecc34f1..b11208d2 100644
--- a/Wabbajack.Lib/ACompiler.cs
+++ b/Wabbajack.Lib/ACompiler.cs
@@ -22,6 +22,7 @@ namespace Wabbajack.Lib
public abstract class ACompiler : ABatchProcessor
{
public string ModListName, ModListAuthor, ModListDescription, ModListImage, ModListWebsite, ModListReadme;
+ public bool ReadmeIsWebsite;
public string WabbajackVersion;
protected static string _vfsCacheName = "vfs_compile_cache.bin";
@@ -94,6 +95,8 @@ namespace Wabbajack.Lib
ModList.Readme = $"readme{readme.Extension}";
}
+ ModList.ReadmeIsWebsite = ReadmeIsWebsite;
+
//ModList.ToJSON(Path.Combine(ModListOutputFolder, "modlist.json"));
ModList.ToCERAS(Path.Combine(ModListOutputFolder, "modlist"), ref CerasConfig.Config);
diff --git a/Wabbajack.Lib/Data.cs b/Wabbajack.Lib/Data.cs
index 2a7f1674..e438eadc 100644
--- a/Wabbajack.Lib/Data.cs
+++ b/Wabbajack.Lib/Data.cs
@@ -87,10 +87,15 @@ namespace Wabbajack.Lib
public string Website;
///
- /// Hash of the readme
+ /// readme path or website
///
public string Readme;
+ ///
+ /// Whether readme is a website
+ ///
+ public bool ReadmeIsWebsite;
+
///
/// Content Report in HTML form
///
diff --git a/Wabbajack/Settings.cs b/Wabbajack/Settings.cs
index ceae3308..f6111ebd 100644
--- a/Wabbajack/Settings.cs
+++ b/Wabbajack/Settings.cs
@@ -75,6 +75,7 @@ namespace Wabbajack
public string Author { get; set; }
public string Description { get; set; }
public string Website { get; set; }
+ public bool ReadmeIsWebsite { get; set; }
public string Readme { get; set; }
public string SplashScreen { get; set; }
}
diff --git a/Wabbajack/View Models/Compilers/MO2CompilerVM.cs b/Wabbajack/View Models/Compilers/MO2CompilerVM.cs
index 7b5971dc..55576556 100644
--- a/Wabbajack/View Models/Compilers/MO2CompilerVM.cs
+++ b/Wabbajack/View Models/Compilers/MO2CompilerVM.cs
@@ -191,7 +191,8 @@ namespace Wabbajack
ModListDescription = ModlistSettings.Description,
ModListImage = ModlistSettings.ImagePath.TargetPath,
ModListWebsite = ModlistSettings.Website,
- ModListReadme = ModlistSettings.ReadMeText.TargetPath,
+ ModListReadme = ModlistSettings.ReadmeIsWebsite ? ModlistSettings.ReadmeWebsite : ModlistSettings.ReadmeFilePath.TargetPath,
+ ReadmeIsWebsite = ModlistSettings.ReadmeIsWebsite,
};
await ActiveCompilation.Begin();
}
diff --git a/Wabbajack/View Models/Compilers/ModlistSettingsEditorVM.cs b/Wabbajack/View Models/Compilers/ModlistSettingsEditorVM.cs
index 426f7c07..3e91c002 100644
--- a/Wabbajack/View Models/Compilers/ModlistSettingsEditorVM.cs
+++ b/Wabbajack/View Models/Compilers/ModlistSettingsEditorVM.cs
@@ -1,7 +1,9 @@
using System;
using System.Reactive.Linq;
+using System.Windows.Input;
using DynamicData;
using Microsoft.WindowsAPICodePack.Dialogs;
+using ReactiveUI;
using ReactiveUI.Fody.Helpers;
using Wabbajack.Lib;
@@ -22,13 +24,22 @@ namespace Wabbajack
public FilePickerVM ImagePath { get; }
- public FilePickerVM ReadMeText { get; }
+ public FilePickerVM ReadmeFilePath { get; }
+
+ [Reactive]
+ public string ReadmeWebsite { get; set; }
[Reactive]
public string Website { get; set; }
+ [Reactive]
+ public bool ReadmeIsWebsite { get; set; }
+
public IObservable InError { get; }
+ public ICommand SwapToTextReadmeCommand { get; }
+ public ICommand SwapToWebsiteReadmeCommand { get; }
+
public ModlistSettingsEditorVM(CompilationModlistSettings settings)
{
this._settings = settings;
@@ -38,19 +49,24 @@ namespace Wabbajack
PathType = FilePickerVM.PathTypeOptions.File,
};
ImagePath.Filters.Add(new CommonFileDialogFilter("Banner image", "*.png"));
- ReadMeText = new FilePickerVM()
+ ReadmeFilePath = new FilePickerVM()
{
PathType = FilePickerVM.PathTypeOptions.File,
ExistCheckOption = FilePickerVM.CheckOptions.IfPathNotEmpty,
};
- ReadMeText.Filters.Add(new CommonFileDialogFilter("Text", "*.txt"));
+ ReadmeFilePath.Filters.Add(new CommonFileDialogFilter("Text", "*.txt"));
+ ReadmeFilePath.Filters.Add(new CommonFileDialogFilter("HTML File", "*.html"));
InError = Observable.CombineLatest(
this.WhenAny(x => x.ImagePath.ErrorState).Select(err => err.Failed),
- this.WhenAny(x => x.ReadMeText.ErrorState).Select(err => err.Failed),
- resultSelector: (img, readme) => img || readme)
+ this.WhenAny(x => x.ReadmeFilePath.ErrorState).Select(err => err.Failed),
+ this.WhenAny(x => x.ReadmeIsWebsite),
+ resultSelector: (img, readme, isWebsite) => img || (readme && isWebsite))
.Publish()
.RefCount();
+
+ SwapToTextReadmeCommand = ReactiveCommand.Create(() => ReadmeIsWebsite = false);
+ SwapToWebsiteReadmeCommand = ReactiveCommand.Create(() => ReadmeIsWebsite = true);
}
public void Init()
@@ -61,7 +77,15 @@ namespace Wabbajack
ModListName = _settings.ModListName;
}
Description = _settings.Description;
- ReadMeText.TargetPath = _settings.Readme;
+ ReadmeIsWebsite = _settings.ReadmeIsWebsite;
+ if (ReadmeIsWebsite)
+ {
+ ReadmeWebsite = _settings.Readme;
+ }
+ else
+ {
+ ReadmeFilePath.TargetPath = _settings.Readme;
+ }
ImagePath.TargetPath = _settings.SplashScreen;
Website = _settings.Website;
}
@@ -71,7 +95,15 @@ namespace Wabbajack
_settings.Author = AuthorText;
_settings.ModListName = ModListName;
_settings.Description = Description;
- _settings.Readme = ReadMeText.TargetPath;
+ _settings.ReadmeIsWebsite = ReadmeIsWebsite;
+ if (ReadmeIsWebsite)
+ {
+ _settings.Readme = ReadmeWebsite;
+ }
+ else
+ {
+ _settings.Readme = ReadmeFilePath.TargetPath;
+ }
_settings.SplashScreen = ImagePath.TargetPath;
_settings.Website = Website;
}
diff --git a/Wabbajack/View Models/Compilers/VortexCompilerVM.cs b/Wabbajack/View Models/Compilers/VortexCompilerVM.cs
index ca1399eb..2e9136d2 100644
--- a/Wabbajack/View Models/Compilers/VortexCompilerVM.cs
+++ b/Wabbajack/View Models/Compilers/VortexCompilerVM.cs
@@ -204,7 +204,8 @@ namespace Wabbajack
ModListDescription = ModlistSettings.Description,
ModListImage = ModlistSettings.ImagePath.TargetPath,
ModListWebsite = ModlistSettings.Website,
- ModListReadme = ModlistSettings.ReadMeText.TargetPath,
+ ModListReadme = ModlistSettings.ReadmeIsWebsite ? ModlistSettings.ReadmeWebsite : ModlistSettings.ReadmeFilePath.TargetPath,
+ ReadmeIsWebsite = ModlistSettings.ReadmeIsWebsite,
};
await ActiveCompilation.Begin();
}
diff --git a/Wabbajack/View Models/ModListVM.cs b/Wabbajack/View Models/ModListVM.cs
index 603041c2..184d3d6b 100644
--- a/Wabbajack/View Models/ModListVM.cs
+++ b/Wabbajack/View Models/ModListVM.cs
@@ -1,5 +1,6 @@
using ReactiveUI;
using System;
+using System.Diagnostics;
using System.IO;
using System.IO.Compression;
using System.Reactive;
@@ -86,25 +87,32 @@ namespace Wabbajack
public void OpenReadmeWindow()
{
if (string.IsNullOrEmpty(Readme)) return;
- using (var fs = new FileStream(ModListPath, FileMode.Open, FileAccess.Read, FileShare.Read))
- using (var ar = new ZipArchive(fs, ZipArchiveMode.Read))
- using (var ms = new MemoryStream())
+ if (SourceModList.ReadmeIsWebsite)
{
- var entry = ar.GetEntry(Readme);
- if (entry == null)
+ Process.Start(Readme);
+ }
+ else
+ {
+ using (var fs = new FileStream(ModListPath, FileMode.Open, FileAccess.Read, FileShare.Read))
+ using (var ar = new ZipArchive(fs, ZipArchiveMode.Read))
+ using (var ms = new MemoryStream())
{
- Utils.Log($"Tried to open a non-existant readme: {Readme}");
- return;
- }
- using (var e = entry.Open())
- {
- e.CopyTo(ms);
- }
- ms.Seek(0, SeekOrigin.Begin);
- using (var reader = new StreamReader(ms))
- {
- var viewer = new TextViewer(reader.ReadToEnd(), Name);
- viewer.Show();
+ var entry = ar.GetEntry(Readme);
+ if (entry == null)
+ {
+ Utils.Log($"Tried to open a non-existant readme: {Readme}");
+ return;
+ }
+ using (var e = entry.Open())
+ {
+ e.CopyTo(ms);
+ }
+ ms.Seek(0, SeekOrigin.Begin);
+ using (var reader = new StreamReader(ms))
+ {
+ var viewer = new TextViewer(reader.ReadToEnd(), Name);
+ viewer.Show();
+ }
}
}
}
diff --git a/Wabbajack/Views/Compilers/CompilerView.xaml b/Wabbajack/Views/Compilers/CompilerView.xaml
index 92f37313..409b9104 100644
--- a/Wabbajack/Views/Compilers/CompilerView.xaml
+++ b/Wabbajack/Views/Compilers/CompilerView.xaml
@@ -150,12 +150,69 @@
-
+
+
+
+
+
+
+
+
+
+
+