From 8d650fcbd93d11a2100a1207e602f7f2230b151d Mon Sep 17 00:00:00 2001 From: erri120 Date: Mon, 4 Nov 2019 13:30:02 +0100 Subject: [PATCH] Fixed some stuff --- Wabbajack.Lib/VortexCompiler.cs | 26 ++++---- Wabbajack/View Models/CompilerVM.cs | 94 ++++++++++++++++++----------- 2 files changed, 74 insertions(+), 46 deletions(-) diff --git a/Wabbajack.Lib/VortexCompiler.cs b/Wabbajack.Lib/VortexCompiler.cs index c1293974..8042a6e3 100644 --- a/Wabbajack.Lib/VortexCompiler.cs +++ b/Wabbajack.Lib/VortexCompiler.cs @@ -100,15 +100,18 @@ namespace Wabbajack.Lib IEnumerable game_files = Directory.EnumerateFiles(GamePath, "*", SearchOption.AllDirectories) .Where(p => p.FileExists()) .Select(p => new RawSourceFile(VFS.Lookup(p)) - { Path = Alphaleonis.Win32.Filesystem.Path.Combine(Consts.GameFolderFilesDir, p.RelativeTo(GamePath)) }); + { Path = Path.Combine(Consts.GameFolderFilesDir, p.RelativeTo(GamePath)) }); Info("Indexing Archives"); IndexedArchives = Directory.EnumerateFiles(DownloadsFolder) + //.Where(f => File.Exists(f+".meta")) .Where(File.Exists) .Select(f => new IndexedArchive { File = VFS.Lookup(f), - Name = Path.GetFileName(f) + Name = Path.GetFileName(f), + //IniData = (f+"meta").LoadIniFile(), + //Meta = File.ReadAllText(f+".meta") }) .ToList(); @@ -131,7 +134,7 @@ namespace Wabbajack.Lib .Where(fs => fs.Count() > 1) .Select(fs => { - Utils.Log($"Duplicate files installed to {fs.Key} from : {String.Join(", ", fs.Select(f => f.AbsolutePath))}"); + Utils.Log($"Duplicate files installed to {fs.Key} from : {string.Join(", ", fs.Select(f => f.AbsolutePath))}"); return fs; }).ToList(); @@ -205,7 +208,7 @@ namespace Wabbajack.Lib using (var za = new ZipArchive(fs, ZipArchiveMode.Create)) { Directory.EnumerateFiles(ModListOutputFolder, "*.*") - .DoProgress("Compressing Modlist", + .DoProgress("Compressing ModList", f => { var ze = za.CreateEntry(Path.GetFileName(f)); @@ -218,7 +221,7 @@ namespace Wabbajack.Lib } } Utils.Log("Removing ModList staging folder"); - Directory.Delete(ModListOutputFolder, true); + //Directory.Delete(ModListOutputFolder, true); } private void GatherArchives() @@ -288,12 +291,13 @@ namespace Wabbajack.Lib { //new IncludePropertyFiles(this), - new IgnoreGameFiles(this), - - new IgnoreStartsWith(this, Path.Combine(Consts.GameFolderFilesDir, "Data")), - new IgnoreStartsWith(this, Path.Combine(Consts.GameFolderFilesDir, "Papyrus Compiler")), - new IgnoreStartsWith(this, Path.Combine(Consts.GameFolderFilesDir, "Skyrim")), - new IgnoreRegex(this, Consts.GameFolderFilesDir + "\\\\.*\\.bsa"), + new IgnoreGameFiles(this), + new IncludeRegex(this, @".*\.zip?$"), + //new IncludeRegex(this, "*.zip"), + //new IgnoreStartsWith(this, Path.Combine(Consts.GameFolderFilesDir, "Data")), + //new IgnoreStartsWith(this, Path.Combine(Consts.GameFolderFilesDir, "Papyrus Compiler")), + //new IgnoreStartsWith(this, Path.Combine(Consts.GameFolderFilesDir, "Skyrim")), + //new IgnoreRegex(this, Consts.GameFolderFilesDir + "\\\\.*\\.bsa"), new DirectMatch(this), diff --git a/Wabbajack/View Models/CompilerVM.cs b/Wabbajack/View Models/CompilerVM.cs index 3362eb0b..b58c4d18 100644 --- a/Wabbajack/View Models/CompilerVM.cs +++ b/Wabbajack/View Models/CompilerVM.cs @@ -196,47 +196,71 @@ namespace Wabbajack private async Task ExecuteBegin() { - Compiler compiler; - try + if (true) { - compiler = new Compiler(this.Mo2Folder) + var compiler = new VortexCompiler("darkestdungeon", "S:\\SteamLibrary\\steamapps\\common\\DarkestDungeon"); + await Task.Run(() => { - MO2Profile = this.MOProfile, - ModListName = this.ModListName, - ModListAuthor = this.AuthorText, - ModListDescription = this.Description, - ModListImage = this.ImagePath.TargetPath, - ModListWebsite = this.Website, - ModListReadme = this.ReadMeText.TargetPath, - }; - } - catch (Exception ex) - { - while (ex.InnerException != null) ex = ex.InnerException; - Utils.Log($"Compiler error: {ex.ExceptionToString()}"); - return; - } - await Task.Run(() => - { - Compiling = true; - try - { - compiler.Compile(); - if (compiler.ModList?.ReportHTML != null) + UIReady = false; + try { - this.HTMLReport = compiler.ModList.ReportHTML; + compiler.Compile(); } - } - catch (Exception ex) + catch (Exception ex) + { + while (ex.InnerException != null) ex = ex.InnerException; + this.Log().Warn(ex, "Can't continue"); + } + finally + { + UIReady = true; + } + }); + }else{ + if (this.Mo2Folder != null) { - while (ex.InnerException != null) ex = ex.InnerException; - Utils.Log($"Compiler error: {ex.ExceptionToString()}"); + Compiler compiler; + try { + compiler = new Compiler(this.Mo2Folder) + { + MO2Profile = this.MOProfile, + ModListName = this.ModListName, + ModListAuthor = this.AuthorText, + ModListDescription = this.Description, + ModListImage = this.ImagePath.TargetPath, + ModListWebsite = this.Website, + ModListReadme = this.ReadMeText.TargetPath, + }; + } + catch (Exception ex) + { + while (ex.InnerException != null) ex = ex.InnerException; + Utils.Log($"Compiler error: {ex.ExceptionToString()}"); + return; + } + await Task.Run(() => + { + Compiling = true; + try + { + compiler.Compile(); + if (compiler.ModList?.ReportHTML != null) + { + this.HTMLReport = compiler.ModList.ReportHTML; + } + } + catch (Exception ex) + { + while (ex.InnerException != null) ex = ex.InnerException; + Utils.Log($"Compiler error: {ex.ExceptionToString()}"); + } + finally + { + Compiling = false; + } + }); } - finally - { - Compiling = false; - } - }); + } } } }