mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
Can install compile install verify TPF!
This commit is contained in:
parent
72be066bbf
commit
c7908fe08e
@ -17,6 +17,8 @@ public class CompilerSettings
|
|||||||
|
|
||||||
public AbsolutePath ModListImage { get; set; }
|
public AbsolutePath ModListImage { get; set; }
|
||||||
public bool UseGamePaths { get; set; }
|
public bool UseGamePaths { get; set; }
|
||||||
|
|
||||||
|
public bool UseTextureRecompression { get; set; } = false;
|
||||||
public Game[] OtherGames { get; set; } = Array.Empty<Game>();
|
public Game[] OtherGames { get; set; } = Array.Empty<Game>();
|
||||||
|
|
||||||
public TimeSpan MaxVerificationTime { get; set; } = TimeSpan.FromMinutes(1);
|
public TimeSpan MaxVerificationTime { get; set; } = TimeSpan.FromMinutes(1);
|
||||||
|
@ -27,7 +27,7 @@ public class CompilerSettingsInferencer
|
|||||||
public async Task<CompilerSettings?> InferFromRootPath(AbsolutePath rootPath)
|
public async Task<CompilerSettings?> InferFromRootPath(AbsolutePath rootPath)
|
||||||
{
|
{
|
||||||
var mo2File = rootPath.Combine(Consts.MO2IniName).LoadIniFile();
|
var mo2File = rootPath.Combine(Consts.MO2IniName).LoadIniFile();
|
||||||
var profile = mo2File["General"]["selected_profile"];
|
var profile = mo2File["General"]["selected_profile"].FromMO2Ini();
|
||||||
|
|
||||||
return await InferModListFromLocation(rootPath.Combine(Consts.MO2Profiles, profile, Consts.ModListTxt));
|
return await InferModListFromLocation(rootPath.Combine(Consts.MO2Profiles, profile, Consts.ModListTxt));
|
||||||
}
|
}
|
||||||
@ -88,6 +88,10 @@ public class CompilerSettingsInferencer
|
|||||||
if ((generalModData["notes"]?.Contains(Consts.WABBAJACK_NOMATCH_INCLUDE) ?? false) ||
|
if ((generalModData["notes"]?.Contains(Consts.WABBAJACK_NOMATCH_INCLUDE) ?? false) ||
|
||||||
(generalModData["comments"]?.Contains(Consts.WABBAJACK_NOMATCH_INCLUDE) ?? false))
|
(generalModData["comments"]?.Contains(Consts.WABBAJACK_NOMATCH_INCLUDE) ?? false))
|
||||||
cs.NoMatchInclude = cs.NoMatchInclude.Append(modFolder.RelativeTo(mo2Folder)).ToArray();
|
cs.NoMatchInclude = cs.NoMatchInclude.Append(modFolder.RelativeTo(mo2Folder)).ToArray();
|
||||||
|
|
||||||
|
if ((generalModData["notes"]?.Contains(Consts.WABBAJACK_INCLUDE) ?? false) ||
|
||||||
|
(generalModData["comments"]?.Contains(Consts.WABBAJACK_INCLUDE) ?? false))
|
||||||
|
cs.Include = cs.Include.Append(modFolder.RelativeTo(mo2Folder)).ToArray();
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.LogInformation("Finding other profiles");
|
_logger.LogInformation("Finding other profiles");
|
||||||
|
@ -313,8 +313,8 @@ public class MO2Compiler : ACompiler
|
|||||||
new DropAll(this)
|
new DropAll(this)
|
||||||
};
|
};
|
||||||
|
|
||||||
//if (DisableTextureResizing)
|
if (!_settings.UseTextureRecompression)
|
||||||
// steps = steps.Where(s => !(s is MatchSimilarTextures)).ToList();
|
steps = steps.Where(s => s is not MatchSimilarTextures).ToList();
|
||||||
|
|
||||||
return steps;
|
return steps;
|
||||||
}
|
}
|
||||||
|
@ -251,6 +251,7 @@ public abstract class AInstaller<T>
|
|||||||
await using var s = await sf.GetStream();
|
await using var s = await sf.GetStream();
|
||||||
await using var of = directive.Directive.To.RelativeTo(_configuration.Install)
|
await using var of = directive.Directive.To.RelativeTo(_configuration.Install)
|
||||||
.Open(FileMode.Create, FileAccess.Write);
|
.Open(FileMode.Create, FileAccess.Write);
|
||||||
|
_logger.LogInformation("Recompressing {Filename}", tt.To.FileName);
|
||||||
await ImageLoader.Recompress(s, tt.ImageState.Width, tt.ImageState.Height, tt.ImageState.Format,
|
await ImageLoader.Recompress(s, tt.ImageState.Width, tt.ImageState.Height, tt.ImageState.Format,
|
||||||
of, token);
|
of, token);
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
|
using System.Security.AccessControl;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using System.Threading;
|
using System.Threading;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
@ -22,9 +23,27 @@ public static class AbsolutePathExtensions
|
|||||||
{
|
{
|
||||||
var path = file.ToNativePath();
|
var path = file.ToNativePath();
|
||||||
if (File.Exists(path))
|
if (File.Exists(path))
|
||||||
File.Delete(path);
|
{
|
||||||
|
try
|
||||||
|
{
|
||||||
|
File.Delete(path);
|
||||||
|
}
|
||||||
|
catch (UnauthorizedAccessException ex)
|
||||||
|
{
|
||||||
|
var fi = new FileInfo(path);
|
||||||
|
if (fi.IsReadOnly)
|
||||||
|
{
|
||||||
|
fi.IsReadOnly = false;
|
||||||
|
File.Delete(path);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
throw;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
if (Directory.Exists(path))
|
if (Directory.Exists(path))
|
||||||
Directory.Delete(path, true);
|
file.DeleteDirectory();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static long Size(this AbsolutePath file)
|
public static long Size(this AbsolutePath file)
|
||||||
@ -188,17 +207,19 @@ public static class AbsolutePathExtensions
|
|||||||
if (!path.DirectoryExists()) return;
|
if (!path.DirectoryExists()) return;
|
||||||
if (dontDeleteIfNotEmpty && (path.EnumerateFiles().Any() || path.EnumerateDirectories().Any())) return;
|
if (dontDeleteIfNotEmpty && (path.EnumerateFiles().Any() || path.EnumerateDirectories().Any())) return;
|
||||||
|
|
||||||
foreach (string directory in Directory.GetDirectories(path.ToString()))
|
foreach (var directory in Directory.GetDirectories(path.ToString()))
|
||||||
{
|
{
|
||||||
DeleteDirectory(directory.ToAbsolutePath(), dontDeleteIfNotEmpty);
|
DeleteDirectory(directory.ToAbsolutePath(), dontDeleteIfNotEmpty);
|
||||||
}
|
}
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
Directory.Delete(path.ToString(), true);
|
Directory.Delete(path.ToString(), true);
|
||||||
}
|
}
|
||||||
catch (IOException)
|
catch (IOException)
|
||||||
{
|
{
|
||||||
|
var di = new DirectoryInfo(path.ToString());
|
||||||
|
if (di.Attributes.HasFlag(FileAttributes.ReadOnly))
|
||||||
|
di.Attributes &= ~FileAttributes.ReadOnly;
|
||||||
Directory.Delete(path.ToString(), true);
|
Directory.Delete(path.ToString(), true);
|
||||||
}
|
}
|
||||||
catch (UnauthorizedAccessException)
|
catch (UnauthorizedAccessException)
|
||||||
|
Loading…
Reference in New Issue
Block a user