diff --git a/CHANGELOG.md b/CHANGELOG.md index d56bdc65..7bbe1b65 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -10,6 +10,7 @@ * Add unit/integration tests. * Don't assume *everyone* has LOOT * Added support for `.exe` installers +* Rework UI to support a slideshow of used mods during installation and compilation #### Version 0.9.2 - 9/18/2013 * Fixed a bug with BSA string encoding diff --git a/VirtualFileSystem.Test/Program.cs b/VirtualFileSystem.Test/Program.cs index d1da3766..29335225 100644 --- a/VirtualFileSystem.Test/Program.cs +++ b/VirtualFileSystem.Test/Program.cs @@ -1,5 +1,6 @@ using System; using Wabbajack.Common; +using Microsoft.Win32; namespace VirtualFileSystem.Test { @@ -7,6 +8,8 @@ namespace VirtualFileSystem.Test { private static void Main(string[] args) { + var result = Registry.LocalMachine.OpenSubKey(@"SOFTWARE\7-zip\"); + Utils.SetLoggerFn(s => Console.WriteLine(s)); Utils.SetStatusFn((s, i) => Console.Write(s + "\r")); WorkQueue.Init((a, b, c) => { }, diff --git a/Wabbajack/AppState.cs b/Wabbajack/AppState.cs index 177a5c22..eb4dd456 100644 --- a/Wabbajack/AppState.cs +++ b/Wabbajack/AppState.cs @@ -4,12 +4,15 @@ using System.Collections.ObjectModel; using System.ComponentModel; using System.Diagnostics; using System.IO; +using System.Linq; using System.Reflection; using System.Threading; using System.Windows; using System.Windows.Input; +using System.Windows.Media.Imaging; using System.Windows.Threading; using Wabbajack.Common; +using Wabbajack.Properties; namespace Wabbajack { @@ -37,6 +40,8 @@ namespace Wabbajack private int _queueProgress; private ICommand _showReportCommand; + private ICommand _visitNexusSiteCommand; + private readonly DateTime _startTime; public volatile bool Dirty; @@ -45,6 +50,16 @@ namespace Wabbajack public AppState(Dispatcher d, string mode) { + + var image = new BitmapImage(); + image.BeginInit(); + image.StreamSource = Assembly.GetExecutingAssembly().GetManifestResourceStream("Wabbajack.banner.png"); + image.EndInit(); + _wabbajackLogo = image; + _splashScreenImage = image; + + SetupSlideshow(); + if (Assembly.GetEntryAssembly().Location.ToLower().Contains("\\downloads\\")) { MessageBox.Show( @@ -75,6 +90,19 @@ namespace Wabbajack th.Start(); } + private void SetupSlideshow() + { + var files = NexusAPI.CachedSlideShow; + if (files.Any()) + { + SlideShowElements = files.ToList(); + } + } + + public Random _random = new Random(); + public List SlideShowElements = new List(); + private DateTime _lastSlideShowUpdate = new DateTime(); + public ObservableCollection Log { get; } public ObservableCollection Status { get; } @@ -207,6 +235,26 @@ namespace Wabbajack } } + public ICommand VisitNexusSiteCommand + { + get + { + if (_visitNexusSiteCommand == null) _visitNexusSiteCommand = new LambdaCommand(() => true, () => VisitNexusSite()); + return _visitNexusSiteCommand; + } + } + + private string _nexusSiteURL = null; + + private void VisitNexusSite() + { + if (_nexusSiteURL != null && _nexusSiteURL.StartsWith("https://")) + { + Process.Start(_nexusSiteURL); + } + } + + private bool _uiReady = false; public bool UIReady { @@ -218,6 +266,51 @@ namespace Wabbajack } } + private BitmapImage _wabbajackLogo = null; + private BitmapImage _splashScreenImage = null; + public BitmapImage SplashScreenImage + { + get => _splashScreenImage; + set + { + _splashScreenImage = value; + OnPropertyChanged("SplashScreenImage"); + } + } + + public string _splashScreenModName = "Wabbajack"; + public string SplashScreenModName + { + get => _splashScreenModName; + set + { + _splashScreenModName = value; + OnPropertyChanged("SplashScreenModName"); + } + } + + public string _splashScreenAuthorName = "Halgari & the Wabbajack Team"; + public string SplashScreenAuthorName + { + get => _splashScreenAuthorName; + set + { + _splashScreenAuthorName = value; + OnPropertyChanged("SplashScreenAuthorName"); + } + } + + public string _splashScreenSummary = ""; + public string SplashScreenSummary + { + get => _splashScreenSummary; + set + { + _splashScreenSummary = value; + OnPropertyChanged("SplashScreenSummary"); + } + } + public event PropertyChangedEventHandler PropertyChanged; public void OnPropertyChanged(string name) @@ -244,6 +337,24 @@ namespace Wabbajack Dirty = false; } + if (SlideShowElements.Any()) + { + if (DateTime.Now - _lastSlideShowUpdate > TimeSpan.FromSeconds(10)) + { + dispatcher.Invoke(() => + { + var element = SlideShowElements[_random.Next(0, SlideShowElements.Count)]; + SplashScreenImage = new BitmapImage(new Uri(element.ImageURL)); + SplashScreenModName = element.ModName; + SplashScreenAuthorName = element.AuthorName; + SplashScreenSummary = element.ModSummary; + _nexusSiteURL = element.ModURL; + + _lastSlideShowUpdate = DateTime.Now; + }); + } + } + Thread.Sleep(1000); } } @@ -255,6 +366,15 @@ namespace Wabbajack ModListName = _modList.Name; HTMLReport = _modList.ReportHTML; Location = Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location); + + SlideShowElements = modlist.Archives.OfType().Select(m => new NexusAPI.SlideShowItem + { + ModName = NexusAPI.FixupSummary(m.ModName), + AuthorName = NexusAPI.FixupSummary(m.Author), + ModSummary = NexusAPI.FixupSummary(m.Summary), + ImageURL = m.SlideShowPic, + ModURL = m.NexusURL, + }).ToList(); } public void LogMsg(string msg) @@ -353,6 +473,7 @@ namespace Wabbajack if (Mode == "Installing") { var installer = new Installer(_modList, Location, msg => LogMsg(msg)); + installer.IgnoreMissingFiles = IgnoreMissingFiles; installer.DownloadFolder = DownloadLocation; var th = new Thread(() => @@ -408,6 +529,8 @@ namespace Wabbajack } } + + public class CPUStatus { public int Progress { get; internal set; } diff --git a/Wabbajack/Compiler.cs b/Wabbajack/Compiler.cs index 1ec3079f..8744e0ba 100644 --- a/Wabbajack/Compiler.cs +++ b/Wabbajack/Compiler.cs @@ -234,7 +234,7 @@ namespace Wabbajack Info("Getting nexus api_key please click authorize if a browser window appears"); - if (IndexedArchives.OfType().Any()) + if (IndexedArchives.Any(a => a.IniData?.General?.gameName != null)) { NexusKey = GetNexusAPIKey(); User = GetUserStatus(NexusKey); @@ -473,6 +473,11 @@ namespace Wabbajack nm.Author = info.author; nm.UploadedBy = info.uploaded_by; nm.UploaderProfile = info.uploaded_users_profile_url; + nm.ModName = info.name; + nm.SlideShowPic = info.picture_url; + nm.NexusURL = NexusAPI.GetModURL(info.game_name, info.mod_id); + nm.Summary = info.summary; + result = nm; } else if (general.manualURL != null) diff --git a/Wabbajack/Data.cs b/Wabbajack/Data.cs index cc7f520f..7552dcfb 100644 --- a/Wabbajack/Data.cs +++ b/Wabbajack/Data.cs @@ -192,6 +192,10 @@ namespace Wabbajack public string UploadedBy; public string UploaderProfile; public string Version; + public string SlideShowPic; + public string ModName; + public string NexusURL; + public string Summary; } [Serializable] diff --git a/Wabbajack/MainWindow.xaml b/Wabbajack/MainWindow.xaml index 6eaf590b..dc754525 100644 --- a/Wabbajack/MainWindow.xaml +++ b/Wabbajack/MainWindow.xaml @@ -5,14 +5,14 @@ xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:local="clr-namespace:Wabbajack" mc:Ignorable="d" - Title="Wabbajack" Height="800" Width="800" + Title="Wabbajack" Height="960" Width="1448" Style="{StaticResource {x:Type Window}}" Icon="square_transparent_icon.ico" WindowStyle="ToolWindow" + ResizeMode="NoResize" Closing="Window_Closing"> - - + @@ -20,12 +20,40 @@ + + + + + - + + + + + + + + + + + + + + + + + + + + + + @@ -43,7 +71,14 @@