mirror of
https://github.com/wabbajack-tools/wabbajack.git
synced 2024-08-30 18:42:17 +00:00
dump stack info to disk and load it during compilation
This commit is contained in:
parent
eb6bf289a7
commit
0151b219bf
@ -244,16 +244,20 @@ namespace Wabbajack.Common
|
||||
return (ulong) (date - new DateTime(1970, 1, 1)).TotalMilliseconds;
|
||||
}
|
||||
|
||||
public static string ToJSON<T>(this T obj)
|
||||
public static string ToJSON<T>(this T obj,
|
||||
TypeNameHandling handling = TypeNameHandling.All,
|
||||
TypeNameAssemblyFormatHandling format = TypeNameAssemblyFormatHandling.Full)
|
||||
{
|
||||
return JsonConvert.SerializeObject(obj, Formatting.Indented,
|
||||
new JsonSerializerSettings {TypeNameHandling = TypeNameHandling.All});
|
||||
new JsonSerializerSettings {TypeNameHandling = handling, TypeNameAssemblyFormatHandling = format});
|
||||
}
|
||||
|
||||
public static T FromJSON<T>(this string filename)
|
||||
public static T FromJSON<T>(this string filename,
|
||||
TypeNameHandling handling = TypeNameHandling.All,
|
||||
TypeNameAssemblyFormatHandling format = TypeNameAssemblyFormatHandling.Full)
|
||||
{
|
||||
return JsonConvert.DeserializeObject<T>(File.ReadAllText(filename),
|
||||
new JsonSerializerSettings {TypeNameHandling = TypeNameHandling.Auto});
|
||||
new JsonSerializerSettings {TypeNameHandling = handling, TypeNameAssemblyFormatHandling = format});
|
||||
}
|
||||
/*
|
||||
public static T FromBSON<T>(this string filename, bool root_is_array = false)
|
||||
@ -267,10 +271,12 @@ namespace Wabbajack.Common
|
||||
}
|
||||
}*/
|
||||
|
||||
public static T FromJSONString<T>(this string data)
|
||||
public static T FromJSONString<T>(this string data,
|
||||
TypeNameHandling handling = TypeNameHandling.All,
|
||||
TypeNameAssemblyFormatHandling format = TypeNameAssemblyFormatHandling.Full)
|
||||
{
|
||||
return JsonConvert.DeserializeObject<T>(data,
|
||||
new JsonSerializerSettings {TypeNameHandling = TypeNameHandling.Auto});
|
||||
new JsonSerializerSettings {TypeNameHandling = handling, TypeNameAssemblyFormatHandling = format});
|
||||
}
|
||||
public static T FromJSON<T>(this Stream data)
|
||||
{
|
||||
|
@ -99,8 +99,8 @@
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="YamlDotNet, Version=7.0.0.0, Culture=neutral, PublicKeyToken=ec19458f3c15af5e, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\YamlDotNet.7.0.0\lib\net45\YamlDotNet.dll</HintPath>
|
||||
<Reference Include="YamlDotNet, Version=8.0.0.0, Culture=neutral, PublicKeyToken=ec19458f3c15af5e, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\YamlDotNet.8.0.0\lib\net45\YamlDotNet.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -13,5 +13,5 @@
|
||||
<package id="System.Buffers" version="4.5.0" targetFramework="net472" />
|
||||
<package id="System.Runtime.CompilerServices.Unsafe" version="4.5.2" targetFramework="net472" />
|
||||
<package id="System.Runtime.Numerics" version="4.3.0" targetFramework="net472" />
|
||||
<package id="YamlDotNet" version="7.0.0" targetFramework="net472" />
|
||||
<package id="YamlDotNet" version="8.0.0" targetFramework="net472" />
|
||||
</packages>
|
@ -8,7 +8,7 @@ namespace Wabbajack.Lib
|
||||
{
|
||||
public class CerasConfig
|
||||
{
|
||||
public static SerializerConfig Config = new SerializerConfig()
|
||||
public static SerializerConfig Config = new SerializerConfig
|
||||
{
|
||||
KnownTypes =
|
||||
{
|
||||
|
@ -1,10 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
public abstract class ACompilationStep : ICompilationStep
|
||||
{
|
||||
@ -16,5 +10,6 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
}
|
||||
|
||||
public abstract Directive Run(RawSourceFile source);
|
||||
public abstract IState GetState();
|
||||
}
|
||||
}
|
||||
}
|
@ -3,19 +3,20 @@ using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Alphaleonis.Win32.Filesystem;
|
||||
using Compression.BSA;
|
||||
using Newtonsoft.Json;
|
||||
using Wabbajack.Common;
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
class DeconstructBSAs : ACompilationStep
|
||||
public class DeconstructBSAs : ACompilationStep
|
||||
{
|
||||
private readonly IEnumerable<string> _include_directly;
|
||||
private readonly List<ICompilationStep> _microstack;
|
||||
private readonly List<ICompilationStep> _microstackWithInclude;
|
||||
private readonly IEnumerable<string> _include_directly;
|
||||
|
||||
public DeconstructBSAs(Compiler compiler) : base(compiler)
|
||||
{
|
||||
_include_directly = _compiler.ModInis.Where(kv =>
|
||||
_include_directly = _compiler.ModInis.Where(kv =>
|
||||
{
|
||||
var general = kv.Value.General;
|
||||
if (general.notes != null && general.notes.Contains(Consts.WABBAJACK_INCLUDE)) return true;
|
||||
@ -38,7 +39,11 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
new IncludePatches(_compiler),
|
||||
new IncludeAll(_compiler)
|
||||
};
|
||||
}
|
||||
|
||||
public override IState GetState()
|
||||
{
|
||||
return new State();
|
||||
}
|
||||
|
||||
public override Directive Run(RawSourceFile source)
|
||||
@ -47,12 +52,8 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
|
||||
var defaultInclude = false;
|
||||
if (source.Path.StartsWith("mods"))
|
||||
{
|
||||
if (_include_directly.Any(path => source.Path.StartsWith(path)))
|
||||
{
|
||||
defaultInclude = true;
|
||||
}
|
||||
}
|
||||
|
||||
var source_files = source.File.FileInArchive;
|
||||
|
||||
@ -68,11 +69,11 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
|
||||
foreach (var match in matches)
|
||||
{
|
||||
if (match is IgnoredDirectly)
|
||||
if (match is IgnoredDirectly)
|
||||
Utils.Error($"File required for BSA {source.Path} creation doesn't exist: {match.To}");
|
||||
_compiler.ExtraFiles.Add(match);
|
||||
}
|
||||
|
||||
|
||||
CreateBSA directive;
|
||||
using (var bsa = BSADispatch.OpenRead(source.AbsolutePath))
|
||||
{
|
||||
@ -87,5 +88,14 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
|
||||
return directive;
|
||||
}
|
||||
|
||||
[JsonObject("DeconstructBSAs")]
|
||||
public class State : IState
|
||||
{
|
||||
public ICompilationStep CreateStep(Compiler compiler)
|
||||
{
|
||||
return new DeconstructBSAs(compiler);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +1,10 @@
|
||||
using System.Linq;
|
||||
using Alphaleonis.Win32.Filesystem;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
class DirectMatch : ACompilationStep
|
||||
public class DirectMatch : ACompilationStep
|
||||
{
|
||||
public DirectMatch(Compiler compiler) : base(compiler)
|
||||
{
|
||||
@ -17,13 +18,26 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
var match = found.Where(f =>
|
||||
Path.GetFileName(f.Paths[f.Paths.Length - 1]) == Path.GetFileName(source.Path))
|
||||
.OrderBy(f => f.Paths.Length)
|
||||
.FirstOrDefault()
|
||||
.FirstOrDefault()
|
||||
?? found.OrderBy(f => f.Paths.Length).FirstOrDefault();
|
||||
|
||||
result.ArchiveHashPath = match.MakeRelativePaths();
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public override IState GetState()
|
||||
{
|
||||
return new State();
|
||||
}
|
||||
|
||||
[JsonObject("DirectMatch")]
|
||||
public class State : IState
|
||||
{
|
||||
public ICompilationStep CreateStep(Compiler compiler)
|
||||
{
|
||||
return new DirectMatch(compiler);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using Wabbajack.Common;
|
||||
using Newtonsoft.Json;
|
||||
using Wabbajack.Common;
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
@ -15,5 +16,19 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
Utils.Log($"No match for: {source.Path}");
|
||||
return result;
|
||||
}
|
||||
|
||||
public override IState GetState()
|
||||
{
|
||||
return new State();
|
||||
}
|
||||
|
||||
[JsonObject("DropAll")]
|
||||
public class State : IState
|
||||
{
|
||||
public ICompilationStep CreateStep(Compiler compiler)
|
||||
{
|
||||
return new DropAll(compiler);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,13 +1,13 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
public interface ICompilationStep
|
||||
{
|
||||
Directive Run(RawSourceFile source);
|
||||
IState GetState();
|
||||
}
|
||||
}
|
||||
|
||||
public interface IState
|
||||
{
|
||||
ICompilationStep CreateStep(Compiler compiler);
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Alphaleonis.Win32.Filesystem;
|
||||
using Newtonsoft.Json;
|
||||
using Wabbajack.Common;
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
@ -31,6 +32,11 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
return r;
|
||||
}
|
||||
|
||||
public override IState GetState()
|
||||
{
|
||||
return new State();
|
||||
}
|
||||
|
||||
|
||||
private static bool IsAlwaysEnabled(dynamic data)
|
||||
{
|
||||
@ -45,5 +51,14 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
[JsonObject("IgnoreDisabledMods")]
|
||||
public class State : IState
|
||||
{
|
||||
public ICompilationStep CreateStep(Compiler compiler)
|
||||
{
|
||||
return new IgnoreDisabledMods(compiler);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,15 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
public class IgnoreEndsWith : ACompilationStep
|
||||
{
|
||||
private readonly string _reason;
|
||||
private readonly string _postfix;
|
||||
private readonly string _reason;
|
||||
|
||||
public IgnoreEndsWith(Compiler compiler, string postfix) : base(compiler)
|
||||
{
|
||||
@ -23,7 +19,31 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
var result = source.EvolveTo<IgnoredDirectly>();
|
||||
result.Reason = _reason;
|
||||
return result;
|
||||
}
|
||||
|
||||
public override IState GetState()
|
||||
{
|
||||
return new State(_postfix);
|
||||
}
|
||||
|
||||
[JsonObject("IgnoreEndsWith")]
|
||||
public class State : IState
|
||||
{
|
||||
public State(string postfix)
|
||||
{
|
||||
Postfix = postfix;
|
||||
}
|
||||
|
||||
public State()
|
||||
{
|
||||
}
|
||||
|
||||
public string Postfix { get; set; }
|
||||
|
||||
public ICompilationStep CreateStep(Compiler compiler)
|
||||
{
|
||||
return new IgnoreEndsWith(compiler, Postfix);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using Wabbajack.Common;
|
||||
using Newtonsoft.Json;
|
||||
using Wabbajack.Common;
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
@ -17,7 +18,20 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
var i = source.EvolveTo<IgnoredDirectly>();
|
||||
i.Reason = "Default game file";
|
||||
return i;
|
||||
}
|
||||
|
||||
public override IState GetState()
|
||||
{
|
||||
return new State();
|
||||
}
|
||||
|
||||
[JsonObject("IgnoreGameFiles")]
|
||||
public class State : IState
|
||||
{
|
||||
public ICompilationStep CreateStep(Compiler compiler)
|
||||
{
|
||||
return new IgnoreGameFiles(compiler);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,8 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
@ -23,7 +19,31 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
var result = source.EvolveTo<IgnoredDirectly>();
|
||||
result.Reason = _reason;
|
||||
return result;
|
||||
}
|
||||
|
||||
public override IState GetState()
|
||||
{
|
||||
return new State(_pattern);
|
||||
}
|
||||
|
||||
[JsonObject("IgnorePathContains")]
|
||||
public class State : IState
|
||||
{
|
||||
public State()
|
||||
{
|
||||
}
|
||||
|
||||
public State(string pattern)
|
||||
{
|
||||
Pattern = pattern;
|
||||
}
|
||||
|
||||
public string Pattern { get; set; }
|
||||
|
||||
public ICompilationStep CreateStep(Compiler compiler)
|
||||
{
|
||||
return new IgnorePathContains(compiler, Pattern);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,12 +1,13 @@
|
||||
using System.Text.RegularExpressions;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
public class IgnoreRegex : ACompilationStep
|
||||
{
|
||||
private readonly string _reason;
|
||||
private string _pattern;
|
||||
private readonly Regex _regex;
|
||||
private readonly string _pattern;
|
||||
|
||||
public IgnoreRegex(Compiler compiler, string pattern) : base(compiler)
|
||||
{
|
||||
@ -21,7 +22,31 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
var result = source.EvolveTo<IgnoredDirectly>();
|
||||
result.Reason = _reason;
|
||||
return result;
|
||||
}
|
||||
|
||||
public override IState GetState()
|
||||
{
|
||||
return new State(_pattern);
|
||||
}
|
||||
|
||||
[JsonObject("IgnorePattern")]
|
||||
public class State : IState
|
||||
{
|
||||
public State()
|
||||
{
|
||||
}
|
||||
|
||||
public State(string pattern)
|
||||
{
|
||||
Pattern = pattern;
|
||||
}
|
||||
|
||||
public string Pattern { get; set; }
|
||||
|
||||
public ICompilationStep CreateStep(Compiler compiler)
|
||||
{
|
||||
return new IgnoreRegex(compiler, Pattern);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,15 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
public class IgnoreStartsWith : ACompilationStep
|
||||
{
|
||||
private readonly string _reason;
|
||||
private readonly string _prefix;
|
||||
private readonly string _reason;
|
||||
|
||||
public IgnoreStartsWith(Compiler compiler, string prefix) : base(compiler)
|
||||
{
|
||||
@ -25,7 +21,33 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
result.Reason = _reason;
|
||||
return result;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public override IState GetState()
|
||||
{
|
||||
return new State(_prefix);
|
||||
}
|
||||
|
||||
[JsonObject("IgnoreStartsWith")]
|
||||
public class State : IState
|
||||
{
|
||||
public State()
|
||||
{
|
||||
}
|
||||
|
||||
public State(string prefix)
|
||||
{
|
||||
Prefix = prefix;
|
||||
}
|
||||
|
||||
public string Prefix { get; set; }
|
||||
|
||||
public ICompilationStep CreateStep(Compiler compiler)
|
||||
{
|
||||
return new IgnoreStartsWith(compiler, Prefix);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,15 +1,16 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using Wabbajack.Common;
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
class IgnoreWabbajackInstallCruft : ACompilationStep
|
||||
public class IgnoreWabbajackInstallCruft : ACompilationStep
|
||||
{
|
||||
private readonly HashSet<string> _cruftFiles;
|
||||
|
||||
public IgnoreWabbajackInstallCruft(Compiler compiler) : base(compiler)
|
||||
{
|
||||
{
|
||||
_cruftFiles = new HashSet<string>
|
||||
{
|
||||
"7z.dll", "7z.exe", "vfs_staged_files\\", "nexus.key_cache", "patch_cache\\",
|
||||
@ -24,5 +25,19 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
result.Reason = "Wabbajack Cruft file";
|
||||
return result;
|
||||
}
|
||||
|
||||
public override IState GetState()
|
||||
{
|
||||
return new State();
|
||||
}
|
||||
|
||||
[JsonObject("IgnoreWabbajackInstallCruft")]
|
||||
public class State : IState
|
||||
{
|
||||
public ICompilationStep CreateStep(Compiler compiler)
|
||||
{
|
||||
return new IgnoreWabbajackInstallCruft(compiler);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using Alphaleonis.Win32.Filesystem;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
@ -14,5 +15,19 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
inline.SourceDataID = _compiler.IncludeFile(File.ReadAllBytes(source.AbsolutePath));
|
||||
return inline;
|
||||
}
|
||||
|
||||
public override IState GetState()
|
||||
{
|
||||
return new State();
|
||||
}
|
||||
|
||||
[JsonObject("IncludeAll")]
|
||||
public class State : IState
|
||||
{
|
||||
public ICompilationStep CreateStep(Compiler compiler)
|
||||
{
|
||||
return new IncludeAll(compiler);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +1,10 @@
|
||||
using Alphaleonis.Win32.Filesystem;
|
||||
using Newtonsoft.Json;
|
||||
using Wabbajack.Common;
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
class IncludeAllConfigs : ACompilationStep
|
||||
public class IncludeAllConfigs : ACompilationStep
|
||||
{
|
||||
public IncludeAllConfigs(Compiler compiler) : base(compiler)
|
||||
{
|
||||
@ -16,5 +17,19 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
result.SourceDataID = _compiler.IncludeFile(File.ReadAllBytes(source.AbsolutePath));
|
||||
return result;
|
||||
}
|
||||
|
||||
public override IState GetState()
|
||||
{
|
||||
return new State();
|
||||
}
|
||||
|
||||
[JsonObject("IncludeAllConfigs")]
|
||||
public class State : IState
|
||||
{
|
||||
public ICompilationStep CreateStep(Compiler compiler)
|
||||
{
|
||||
return new IncludeAllConfigs(compiler);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using Alphaleonis.Win32.Filesystem;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
@ -12,19 +13,33 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
if (Path.GetExtension(source.AbsolutePath) != ".esp" &&
|
||||
Path.GetExtension(source.AbsolutePath) != ".esm") return null;
|
||||
|
||||
|
||||
var bsa = Path.Combine(Path.GetDirectoryName(source.AbsolutePath),
|
||||
Path.GetFileNameWithoutExtension(source.AbsolutePath) + ".bsa");
|
||||
var bsaTextures = Path.Combine(Path.GetDirectoryName(source.AbsolutePath),
|
||||
Path.GetFileNameWithoutExtension(source.AbsolutePath) + " - Textures.bsa");
|
||||
var espSize = new FileInfo(source.AbsolutePath).Length;
|
||||
|
||||
if (espSize > 250 || (!File.Exists(bsa) && !File.Exists(bsaTextures))) return null;
|
||||
|
||||
|
||||
if (espSize > 250 || !File.Exists(bsa) && !File.Exists(bsaTextures)) return null;
|
||||
|
||||
var inline = source.EvolveTo<InlineFile>();
|
||||
inline.SourceDataID = _compiler.IncludeFile(File.ReadAllBytes(source.AbsolutePath));
|
||||
return inline;
|
||||
}
|
||||
|
||||
public override IState GetState()
|
||||
{
|
||||
return new State();
|
||||
}
|
||||
|
||||
|
||||
[JsonObject("IncludeDummyESPs")]
|
||||
public class State : IState
|
||||
{
|
||||
public ICompilationStep CreateStep(Compiler compiler)
|
||||
{
|
||||
return new IncludeDummyESPs(compiler);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,4 +1,5 @@
|
||||
using Alphaleonis.Win32.Filesystem;
|
||||
using Newtonsoft.Json;
|
||||
using Wabbajack.Common;
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
@ -18,7 +19,20 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
var result = source.EvolveTo<InlineFile>();
|
||||
result.SourceDataID = _compiler.IncludeFile(File.ReadAllBytes(source.AbsolutePath).ToBase64());
|
||||
return result;
|
||||
}
|
||||
|
||||
public override IState GetState()
|
||||
{
|
||||
return new State();
|
||||
}
|
||||
|
||||
[JsonObject("IncludeLootFiles")]
|
||||
public class State : IState
|
||||
{
|
||||
public ICompilationStep CreateStep(Compiler compiler)
|
||||
{
|
||||
return new IncludeLootFiles(compiler);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,8 +1,9 @@
|
||||
using Alphaleonis.Win32.Filesystem;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
class IncludeModIniData : ACompilationStep
|
||||
public class IncludeModIniData : ACompilationStep
|
||||
{
|
||||
public IncludeModIniData(Compiler compiler) : base(compiler)
|
||||
{
|
||||
@ -14,7 +15,20 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
var e = source.EvolveTo<InlineFile>();
|
||||
e.SourceDataID = _compiler.IncludeFile(File.ReadAllBytes(source.AbsolutePath));
|
||||
return e;
|
||||
}
|
||||
|
||||
public override IState GetState()
|
||||
{
|
||||
return new State();
|
||||
}
|
||||
|
||||
[JsonObject("IncludeModIniData")]
|
||||
public class State : IState
|
||||
{
|
||||
public ICompilationStep CreateStep(Compiler compiler)
|
||||
{
|
||||
return new IncludeModIniData(compiler);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,9 +1,7 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Alphaleonis.Win32.Filesystem;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
@ -25,7 +23,20 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
var c = source.EvolveTo<IgnoredDirectly>();
|
||||
c.Reason = "File not for selected profiles";
|
||||
return c;
|
||||
}
|
||||
|
||||
public override IState GetState()
|
||||
{
|
||||
return new State();
|
||||
}
|
||||
|
||||
[JsonObject("IgnoreOtherProfiles")]
|
||||
public class State : IState
|
||||
{
|
||||
public ICompilationStep CreateStep(Compiler compiler)
|
||||
{
|
||||
return new IgnoreOtherProfiles(compiler);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Alphaleonis.Win32.Filesystem;
|
||||
using Newtonsoft.Json;
|
||||
using VFS;
|
||||
using Wabbajack.Common;
|
||||
|
||||
@ -37,5 +38,19 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
|
||||
return e;
|
||||
}
|
||||
|
||||
public override IState GetState()
|
||||
{
|
||||
return new State();
|
||||
}
|
||||
|
||||
[JsonObject("IncludePatches")]
|
||||
public class State : IState
|
||||
{
|
||||
public ICompilationStep CreateStep(Compiler compiler)
|
||||
{
|
||||
return new IncludePatches(compiler);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,13 +1,11 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Alphaleonis.Win32.Filesystem;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
class IncludePropertyFiles : ACompilationStep
|
||||
public class IncludePropertyFiles : ACompilationStep
|
||||
{
|
||||
public IncludePropertyFiles(Compiler compiler) : base(compiler)
|
||||
{
|
||||
@ -35,9 +33,22 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
result.Type = PropertyType.Readme;
|
||||
_compiler.ModListReadme = result.SourceDataID;
|
||||
}
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public override IState GetState()
|
||||
{
|
||||
return new State();
|
||||
}
|
||||
|
||||
[JsonObject("IncludePropertyFiles")]
|
||||
public class State : IState
|
||||
{
|
||||
public ICompilationStep CreateStep(Compiler compiler)
|
||||
{
|
||||
return new IncludePropertyFiles(compiler);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,29 +1,52 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Text.RegularExpressions;
|
||||
using System.Threading.Tasks;
|
||||
using System.Text.RegularExpressions;
|
||||
using Alphaleonis.Win32.Filesystem;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
public class IncludeRegex : ACompilationStep
|
||||
{
|
||||
private readonly string _pattern;
|
||||
private readonly Regex _regex;
|
||||
|
||||
public IncludeRegex(Compiler compiler, string pattern) : base(compiler)
|
||||
{
|
||||
_pattern = pattern;
|
||||
_regex = new Regex(pattern);
|
||||
}
|
||||
|
||||
public override Directive Run(RawSourceFile source)
|
||||
{
|
||||
if (!_regex.IsMatch(source.Path)) return null;
|
||||
|
||||
|
||||
var result = source.EvolveTo<InlineFile>();
|
||||
result.SourceDataID = _compiler.IncludeFile(File.ReadAllBytes(source.AbsolutePath));
|
||||
return result;
|
||||
}
|
||||
|
||||
public override IState GetState()
|
||||
{
|
||||
return new State(_pattern);
|
||||
}
|
||||
|
||||
[JsonObject("IncludeRegex")]
|
||||
public class State : IState
|
||||
{
|
||||
public State()
|
||||
{
|
||||
}
|
||||
|
||||
public State(string pattern)
|
||||
{
|
||||
Pattern = pattern;
|
||||
}
|
||||
|
||||
public string Pattern { get; set; }
|
||||
|
||||
public ICompilationStep CreateStep(Compiler compiler)
|
||||
{
|
||||
return new IncludeRegex(compiler, Pattern);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,5 +1,6 @@
|
||||
using System.Text;
|
||||
using Alphaleonis.Win32.Filesystem;
|
||||
using Newtonsoft.Json;
|
||||
using Wabbajack.Common;
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
@ -15,6 +16,11 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
return Consts.ConfigFileExtensions.Contains(Path.GetExtension(source.Path)) ? RemapFile(source) : null;
|
||||
}
|
||||
|
||||
public override IState GetState()
|
||||
{
|
||||
return new State();
|
||||
}
|
||||
|
||||
private Directive RemapFile(RawSourceFile source)
|
||||
{
|
||||
var data = File.ReadAllText(source.AbsolutePath);
|
||||
@ -29,7 +35,8 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
data = data.Replace(_compiler.MO2Folder.Replace("\\", "/"), Consts.MO2_PATH_MAGIC_FORWARD);
|
||||
|
||||
data = data.Replace(_compiler.MO2DownloadsFolder, Consts.DOWNLOAD_PATH_MAGIC_BACK);
|
||||
data = data.Replace(_compiler.MO2DownloadsFolder.Replace("\\", "\\\\"), Consts.DOWNLOAD_PATH_MAGIC_DOUBLE_BACK);
|
||||
data = data.Replace(_compiler.MO2DownloadsFolder.Replace("\\", "\\\\"),
|
||||
Consts.DOWNLOAD_PATH_MAGIC_DOUBLE_BACK);
|
||||
data = data.Replace(_compiler.MO2DownloadsFolder.Replace("\\", "/"), Consts.DOWNLOAD_PATH_MAGIC_FORWARD);
|
||||
|
||||
if (data == originalData)
|
||||
@ -38,5 +45,14 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
result.SourceDataID = _compiler.IncludeFile(Encoding.UTF8.GetBytes(data));
|
||||
return result;
|
||||
}
|
||||
|
||||
[JsonObject("IncludeStubbedConfigFiles")]
|
||||
public class State : IState
|
||||
{
|
||||
public ICompilationStep CreateStep(Compiler compiler)
|
||||
{
|
||||
return new IncludeStubbedConfigFiles(compiler);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,13 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Alphaleonis.Win32.Filesystem;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
class IncludeTaggedMods : ACompilationStep
|
||||
public class IncludeTaggedMods : ACompilationStep
|
||||
{
|
||||
private readonly IEnumerable<string> _includeDirectly;
|
||||
private string _tag;
|
||||
private readonly string _tag;
|
||||
|
||||
|
||||
public IncludeTaggedMods(Compiler compiler, string tag) : base(compiler)
|
||||
@ -35,5 +36,30 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public override IState GetState()
|
||||
{
|
||||
return new State(_tag);
|
||||
}
|
||||
|
||||
[JsonObject("IncludeTaggedMods")]
|
||||
public class State : IState
|
||||
{
|
||||
public State()
|
||||
{
|
||||
}
|
||||
|
||||
public State(string tag)
|
||||
{
|
||||
Tag = tag;
|
||||
}
|
||||
|
||||
public string Tag { get; set; }
|
||||
|
||||
public ICompilationStep CreateStep(Compiler compiler)
|
||||
{
|
||||
return new IncludeTaggedMods(compiler, Tag);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -2,6 +2,7 @@
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using Alphaleonis.Win32.Filesystem;
|
||||
using Newtonsoft.Json;
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
@ -18,7 +19,9 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
if (_correctProfiles.Any(p => source.Path.StartsWith(p)))
|
||||
{
|
||||
var data = source.Path.EndsWith("\\modlist.txt") ? ReadAndCleanModlist(source.AbsolutePath) : File.ReadAllBytes(source.AbsolutePath);
|
||||
var data = source.Path.EndsWith("\\modlist.txt")
|
||||
? ReadAndCleanModlist(source.AbsolutePath)
|
||||
: File.ReadAllBytes(source.AbsolutePath);
|
||||
|
||||
var e = source.EvolveTo<InlineFile>();
|
||||
e.SourceDataID = _compiler.IncludeFile(data);
|
||||
@ -27,6 +30,12 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
public override IState GetState()
|
||||
{
|
||||
return new State();
|
||||
}
|
||||
|
||||
private static byte[] ReadAndCleanModlist(string absolutePath)
|
||||
{
|
||||
var lines = File.ReadAllLines(absolutePath);
|
||||
@ -35,5 +44,14 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
select line).ToArray();
|
||||
return Encoding.UTF8.GetBytes(string.Join("\r\n", lines));
|
||||
}
|
||||
|
||||
[JsonObject("IncludeThisProfile")]
|
||||
public class State : IState
|
||||
{
|
||||
public ICompilationStep CreateStep(Compiler compiler)
|
||||
{
|
||||
return new IncludeThisProfile(compiler);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
@ -1,11 +1,12 @@
|
||||
using System.IO;
|
||||
using Newtonsoft.Json;
|
||||
using Wabbajack.Common;
|
||||
using File = Alphaleonis.Win32.Filesystem.File;
|
||||
using Path = Alphaleonis.Win32.Filesystem.Path;
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
class PatchStockESMs : ACompilationStep
|
||||
public class PatchStockESMs : ACompilationStep
|
||||
{
|
||||
public PatchStockESMs(Compiler compiler) : base(compiler)
|
||||
{
|
||||
@ -17,7 +18,7 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
var gameFile = Path.Combine(_compiler.GamePath, "Data", filename);
|
||||
if (!Consts.GameESMs.Contains(filename) || !source.Path.StartsWith("mods\\") ||
|
||||
!File.Exists(gameFile)) return null;
|
||||
|
||||
|
||||
Utils.Log(
|
||||
$"A ESM named {filename} was found in a mod that shares a name with a core game ESMs, it is assumed this is a cleaned ESM and it will be binary patched.");
|
||||
var result = source.EvolveTo<CleanedESM>();
|
||||
@ -30,11 +31,23 @@ namespace Wabbajack.Lib.CompilationSteps
|
||||
var data = ms.ToArray();
|
||||
result.SourceDataID = _compiler.IncludeFile(data);
|
||||
Utils.Log($"Generated a {data.Length} byte patch for {filename}");
|
||||
|
||||
}
|
||||
|
||||
return result;
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
public override IState GetState()
|
||||
{
|
||||
return new State();
|
||||
}
|
||||
|
||||
[JsonObject("PatchStockESMs")]
|
||||
public class State : IState
|
||||
{
|
||||
public ICompilationStep CreateStep(Compiler compiler)
|
||||
{
|
||||
return new PatchStockESMs(compiler);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
22
Wabbajack.Lib/CompilationSteps/Serialization.cs
Normal file
22
Wabbajack.Lib/CompilationSteps/Serialization.cs
Normal file
@ -0,0 +1,22 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using Wabbajack.Common;
|
||||
|
||||
namespace Wabbajack.Lib.CompilationSteps
|
||||
{
|
||||
public static class Serialization
|
||||
{
|
||||
public static string Serialize(IEnumerable<ICompilationStep> stack)
|
||||
{
|
||||
return stack.Select(s => s.GetState()).ToList()
|
||||
.ToJSON(TypeNameHandling.Auto, TypeNameAssemblyFormatHandling.Simple);
|
||||
}
|
||||
|
||||
public static List<ICompilationStep> Deserialize(string stack, Compiler compiler)
|
||||
{
|
||||
return stack.FromJSONString<List<IState>>(TypeNameHandling.Auto, TypeNameAssemblyFormatHandling.Simple)
|
||||
.Select(s => s.CreateStep(compiler)).ToList();
|
||||
}
|
||||
}
|
||||
}
|
@ -512,6 +512,20 @@ namespace Wabbajack.Lib
|
||||
throw new InvalidDataException("Data fell out of the compilation stack");
|
||||
}
|
||||
|
||||
public IEnumerable<ICompilationStep> GetStack()
|
||||
{
|
||||
var user_config = Path.Combine(MO2ProfileDir, "compilation_stack.yml");
|
||||
if (File.Exists(user_config))
|
||||
return Serialization.Deserialize(File.ReadAllText(user_config), this);
|
||||
|
||||
var stack = MakeStack();
|
||||
|
||||
File.WriteAllText(Path.Combine(MO2ProfileDir, "_current_compilation_stack.yml"),
|
||||
Serialization.Serialize(stack));
|
||||
|
||||
return stack;
|
||||
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Creates a execution stack. The stack should be passed into Run stack. Each function
|
||||
@ -519,9 +533,9 @@ namespace Wabbajack.Lib
|
||||
/// result included into the pack
|
||||
/// </summary>
|
||||
/// <returns></returns>
|
||||
private IEnumerable<ICompilationStep> MakeStack()
|
||||
public IEnumerable<ICompilationStep> MakeStack()
|
||||
{
|
||||
Info("Generating compilation stack");
|
||||
Utils.Log("Generating compilation stack");
|
||||
return new List<ICompilationStep>
|
||||
{
|
||||
new IncludePropertyFiles(this),
|
||||
|
@ -113,8 +113,8 @@
|
||||
<HintPath>..\packages\WebSocketSharpFork.1.0.4.0\lib\net35\websocket-sharp.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="YamlDotNet, Version=7.0.0.0, Culture=neutral, PublicKeyToken=ec19458f3c15af5e, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\YamlDotNet.7.0.0\lib\net45\YamlDotNet.dll</HintPath>
|
||||
<Reference Include="YamlDotNet, Version=8.0.0.0, Culture=neutral, PublicKeyToken=ec19458f3c15af5e, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\YamlDotNet.8.0.0\lib\net45\YamlDotNet.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
@ -144,6 +144,7 @@
|
||||
<Compile Include="CompilationSteps\IncludeThisProfile.cs" />
|
||||
<Compile Include="CompilationSteps\IStackStep.cs" />
|
||||
<Compile Include="CompilationSteps\PatchStockESMs.cs" />
|
||||
<Compile Include="CompilationSteps\Serialization.cs" />
|
||||
<Compile Include="Compiler.cs" />
|
||||
<Compile Include="Data.cs" />
|
||||
<Compile Include="Downloaders\AbstractDownloadState.cs" />
|
||||
|
@ -20,5 +20,5 @@
|
||||
<package id="System.Threading.Tasks.Extensions" version="4.5.3" targetFramework="net472" />
|
||||
<package id="System.ValueTuple" version="4.5.0" targetFramework="net472" />
|
||||
<package id="WebSocketSharpFork" version="1.0.4.0" targetFramework="net472" />
|
||||
<package id="YamlDotNet" version="7.0.0" targetFramework="net472" />
|
||||
<package id="YamlDotNet" version="8.0.0" targetFramework="net472" />
|
||||
</packages>
|
@ -3,6 +3,7 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using Newtonsoft.Json;
|
||||
using Wabbajack.Common;
|
||||
using Wabbajack.Lib.CompilationSteps;
|
||||
using Directory = Alphaleonis.Win32.Filesystem.Directory;
|
||||
@ -98,6 +99,20 @@ namespace Wabbajack.Lib
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
public override IState GetState()
|
||||
{
|
||||
return new State();
|
||||
}
|
||||
|
||||
[JsonObject("IncludeZEditPatches")]
|
||||
public class State : IState
|
||||
{
|
||||
public ICompilationStep CreateStep(Compiler compiler)
|
||||
{
|
||||
return new IncludeZEditPatches(compiler);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
class zEditMerge
|
||||
|
55
Wabbajack.Test/ACompilerTest.cs
Normal file
55
Wabbajack.Test/ACompilerTest.cs
Normal file
@ -0,0 +1,55 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using VFS;
|
||||
using Wabbajack.Common;
|
||||
using Wabbajack.Lib;
|
||||
|
||||
namespace Wabbajack.Test
|
||||
{
|
||||
public abstract class ACompilerTest
|
||||
{
|
||||
public TestContext TestContext { get; set; }
|
||||
protected TestUtils utils { get; set; }
|
||||
|
||||
[TestInitialize]
|
||||
public void TestInitialize()
|
||||
{
|
||||
Consts.TestMode = true;
|
||||
|
||||
utils = new TestUtils();
|
||||
utils.GameName = "Skyrim Special Edition";
|
||||
|
||||
Utils.SetStatusFn((f, idx) => { });
|
||||
Utils.SetLoggerFn(f => TestContext.WriteLine(f));
|
||||
WorkQueue.Init((x, y, z) => { }, (min, max) => { });
|
||||
|
||||
}
|
||||
|
||||
[TestCleanup]
|
||||
public void TestCleanup()
|
||||
{
|
||||
utils.Dispose();
|
||||
}
|
||||
|
||||
protected Compiler ConfigureAndRunCompiler(string profile)
|
||||
{
|
||||
var compiler = MakeCompiler();
|
||||
compiler.VFS.Reset();
|
||||
compiler.MO2Profile = profile;
|
||||
compiler.ShowReportWhenFinished = false;
|
||||
Assert.IsTrue(compiler.Compile());
|
||||
return compiler;
|
||||
}
|
||||
|
||||
protected Compiler MakeCompiler()
|
||||
{
|
||||
VirtualFileSystem.Reconfigure(utils.TestFolder);
|
||||
var compiler = new Compiler(utils.MO2Folder);
|
||||
return compiler;
|
||||
}
|
||||
}
|
||||
}
|
30
Wabbajack.Test/CompilationStackTests.cs
Normal file
30
Wabbajack.Test/CompilationStackTests.cs
Normal file
@ -0,0 +1,30 @@
|
||||
using System;
|
||||
using System.Windows.Forms;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using Wabbajack.Lib;
|
||||
using Wabbajack.Lib.CompilationSteps;
|
||||
|
||||
namespace Wabbajack.Test
|
||||
{
|
||||
[TestClass]
|
||||
public class CompilationStackTests : ACompilerTest
|
||||
{
|
||||
[TestMethod]
|
||||
public void TestStackSerialization()
|
||||
{
|
||||
var profile = utils.AddProfile();
|
||||
var mod = utils.AddMod("test");
|
||||
|
||||
utils.Configure();
|
||||
var compiler = ConfigureAndRunCompiler(profile);
|
||||
var stack = compiler.MakeStack();
|
||||
|
||||
var serialized = Serialization.Serialize(stack);
|
||||
var rounded = Serialization.Serialize(Serialization.Deserialize(serialized, compiler));
|
||||
|
||||
Assert.AreEqual(serialized, rounded);
|
||||
|
||||
Assert.IsNotNull(compiler.GetStack());
|
||||
}
|
||||
}
|
||||
}
|
@ -12,32 +12,8 @@ using Wabbajack.Lib;
|
||||
namespace Wabbajack.Test
|
||||
{
|
||||
[TestClass]
|
||||
public class SanityTests
|
||||
public class SanityTests : ACompilerTest
|
||||
{
|
||||
public TestContext TestContext { get; set; }
|
||||
|
||||
private TestUtils utils { get; set; }
|
||||
|
||||
[TestInitialize]
|
||||
public void TestInitialize()
|
||||
{
|
||||
Consts.TestMode = true;
|
||||
|
||||
utils = new TestUtils();
|
||||
utils.GameName = "Skyrim Special Edition";
|
||||
|
||||
Utils.SetStatusFn((f, idx) => { });
|
||||
Utils.SetLoggerFn(f => TestContext.WriteLine(f));
|
||||
WorkQueue.Init((x, y, z) => { }, (min, max) => { });
|
||||
|
||||
}
|
||||
|
||||
[TestCleanup]
|
||||
public void TestCleanup()
|
||||
{
|
||||
utils.Dispose();
|
||||
}
|
||||
|
||||
[TestMethod]
|
||||
public void TestDirectMatch()
|
||||
{
|
||||
@ -112,16 +88,5 @@ namespace Wabbajack.Test
|
||||
installer.GameFolder = utils.GameFolder;
|
||||
installer.Install();
|
||||
}
|
||||
|
||||
private Compiler ConfigureAndRunCompiler(string profile)
|
||||
{
|
||||
VirtualFileSystem.Reconfigure(utils.TestFolder);
|
||||
var compiler = new Compiler(utils.MO2Folder);
|
||||
compiler.VFS.Reset();
|
||||
compiler.MO2Profile = profile;
|
||||
compiler.ShowReportWhenFinished = false;
|
||||
Assert.IsTrue(compiler.Compile());
|
||||
return compiler;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -74,7 +74,9 @@ namespace Wabbajack.Test
|
||||
public string AddMod(string name = null)
|
||||
{
|
||||
string mod_name = name ?? RandomName();
|
||||
Directory.CreateDirectory(Path.Combine(MO2Folder, "mods", mod_name));
|
||||
var mod_folder = Path.Combine(MO2Folder, "mods", mod_name);
|
||||
Directory.CreateDirectory(mod_folder);
|
||||
File.WriteAllText(Path.Combine(mod_folder, "meta.ini"), "[General]");
|
||||
Mods.Add(mod_name);
|
||||
return mod_name;
|
||||
}
|
||||
|
@ -111,6 +111,7 @@
|
||||
<Reference Include="WindowsBase" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ACompilerTest.cs" />
|
||||
<Compile Include="DownloaderTests.cs" />
|
||||
<Compile Include="EndToEndTests.cs" />
|
||||
<Compile Include="Extensions.cs" />
|
||||
@ -119,6 +120,7 @@
|
||||
<Compile Include="SanityTests.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="ContentRightsManagementTests.cs" />
|
||||
<Compile Include="CompilationStackTests.cs" />
|
||||
<Compile Include="WebAutomationTests.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -1,18 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<startup>
|
||||
<supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.7.2" />
|
||||
</startup>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.4.1" newVersion="4.0.4.1" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.3.0" newVersion="4.0.3.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
@ -1,34 +0,0 @@
|
||||
using System;
|
||||
using System.CodeDom;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading;
|
||||
using System.Threading.Tasks;
|
||||
using Wabbajack.Common;
|
||||
|
||||
namespace Wabbajack.WebAutomation.Test
|
||||
{
|
||||
class Program
|
||||
{
|
||||
static void Main(string[] args)
|
||||
{
|
||||
Utils.SetLoggerFn(Console.WriteLine);
|
||||
Utils.SetStatusFn((msg, i) =>
|
||||
{
|
||||
if (i != 0)
|
||||
Console.WriteLine($"{i}% - {msg}");
|
||||
else
|
||||
Console.WriteLine($"{msg}");
|
||||
|
||||
});
|
||||
|
||||
Driver.Init();
|
||||
|
||||
var hook = HookRegistry.FindSiteHook();
|
||||
var site = "http://www.mediafire.com/file/x7dgot1r3z1u8p8/CreationKit_1_5_3.7z";
|
||||
|
||||
hook.Download(null, new Dictionary<string, string>() {{"mediaFireURL", site}}, @"c:\tmp\out.7z");
|
||||
}
|
||||
}
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Wabbajack.WebAutomation.Test")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Wabbajack.WebAutomation.Test")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2019")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("73d0b663-a6fb-4a67-b945-ebb4a234c996")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
@ -1,83 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{73D0B663-A6FB-4A67-B945-EBB4A234C996}</ProjectGuid>
|
||||
<OutputType>Exe</OutputType>
|
||||
<RootNamespace>Wabbajack.WebAutomation.Test</RootNamespace>
|
||||
<AssemblyName>Wabbajack.WebAutomation.Test</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
|
||||
<Deterministic>true</Deterministic>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<PlatformTarget>AnyCPU</PlatformTarget>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<Optimize>true</Optimize>
|
||||
<OutputPath>bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<DebugType>full</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
|
||||
<OutputPath>bin\x64\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<Optimize>true</Optimize>
|
||||
<DebugType>pdbonly</DebugType>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
|
||||
<Prefer32Bit>true</Prefer32Bit>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Net.Http" />
|
||||
<Reference Include="System.Xml" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Program.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="App.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Wabbajack.Common\Wabbajack.Common.csproj">
|
||||
<Project>{b3f3fb6e-b9eb-4f49-9875-d78578bc7ae5}</Project>
|
||||
<Name>Wabbajack.Common</Name>
|
||||
</ProjectReference>
|
||||
<ProjectReference Include="..\Wabbajack.WebAutomation\Wabbajack.WebAutomation.csproj">
|
||||
<Project>{e5a6f0e6-f79e-460d-82e2-e6330ace06ba}</Project>
|
||||
<Name>Wabbajack.WebAutomation</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
</Project>
|
@ -1,105 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using OpenQA.Selenium;
|
||||
using OpenQA.Selenium.Chrome;
|
||||
using OpenQA.Selenium.IE;
|
||||
using Wabbajack.Common;
|
||||
|
||||
namespace Wabbajack.WebAutomation
|
||||
{
|
||||
public class Driver
|
||||
{
|
||||
public static void Init()
|
||||
{
|
||||
Assembly.GetExecutingAssembly()
|
||||
.GetManifestResourceNames()
|
||||
.Where(s => s.StartsWith("Wabbajack.WebAutomation."))
|
||||
.Do(s =>
|
||||
{
|
||||
var filename = s.Substring("Wabbajack.WebAutomation.".Length);
|
||||
|
||||
try
|
||||
{
|
||||
using (var fs = File.OpenWrite(filename))
|
||||
{
|
||||
fs.SetLength(0);
|
||||
Assembly.GetExecutingAssembly()
|
||||
.GetManifestResourceStream(s)
|
||||
.CopyTo(fs);
|
||||
}
|
||||
}
|
||||
catch (IOException)
|
||||
{
|
||||
// Ignore
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public static IWebDriver GetDriver()
|
||||
{
|
||||
if (_foundDriver == null || _foundDriver == DriverType.Chrome)
|
||||
{
|
||||
try
|
||||
{
|
||||
var service = ChromeDriverService.CreateDefaultService();
|
||||
service.HideCommandPromptWindow = true;
|
||||
|
||||
var options = new ChromeOptions();
|
||||
options.AddArguments(new List<string>() {
|
||||
"--silent-launch",
|
||||
"--no-startup-window",
|
||||
"no-sandbox",
|
||||
"headless",});
|
||||
|
||||
|
||||
var driver = new ChromeDriver(service, options);
|
||||
|
||||
ChildProcessTracker.AddProcess(Process.GetProcesses().Single(p => p.Id == service.ProcessId));
|
||||
|
||||
_foundDriver = DriverType.Chrome;
|
||||
return driver;
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
|
||||
if (_foundDriver == null || _foundDriver == DriverType.InternetExplorer)
|
||||
{
|
||||
try
|
||||
{
|
||||
var driver = new InternetExplorerDriver();
|
||||
_foundDriver = DriverType.InternetExplorer;
|
||||
return driver;
|
||||
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
// ignored
|
||||
}
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
private static Object _lockObject = new object();
|
||||
|
||||
public enum DriverType
|
||||
{
|
||||
Chrome,
|
||||
Firefox,
|
||||
InternetExplorer
|
||||
};
|
||||
|
||||
private static DriverType? _foundDriver;
|
||||
}
|
||||
}
|
@ -1,87 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.IO;
|
||||
using System.Linq;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Runtime.Remoting.Messaging;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using OpenQA.Selenium;
|
||||
using Wabbajack.Common;
|
||||
using Cookie = System.Net.Cookie;
|
||||
|
||||
namespace Wabbajack.WebAutomation
|
||||
{
|
||||
public static class Extensions
|
||||
{
|
||||
public static HttpClient ConvertToHTTPClient(this IWebDriver driver)
|
||||
{
|
||||
var user_agent = ((IJavaScriptExecutor) driver).ExecuteScript("return navigator.userAgent");
|
||||
|
||||
var cookies = driver.Manage().Cookies;
|
||||
|
||||
var container = new CookieContainer();
|
||||
foreach (var cookie in cookies.AllCookies)
|
||||
{
|
||||
var uri = new UriBuilder(new Uri(driver.Url));
|
||||
container.Add(uri.Uri, new Cookie(cookie.Name, cookie.Value));
|
||||
}
|
||||
|
||||
var handler = new HttpClientHandler() {CookieContainer = container};
|
||||
var client = new HttpClient(handler);
|
||||
client.DefaultRequestHeaders.Add("User-Agent", (string)user_agent);
|
||||
|
||||
return client;
|
||||
}
|
||||
|
||||
public static bool DownloadUrl(this HttpClient client, string url, string dest, bool download=true)
|
||||
{
|
||||
long total_read = 0;
|
||||
var buffer_size = 1024 * 32;
|
||||
|
||||
var response = client.GetSync(url);
|
||||
var stream = response.Content.ReadAsStreamAsync();
|
||||
try
|
||||
{
|
||||
stream.Wait();
|
||||
}
|
||||
catch (Exception)
|
||||
{
|
||||
}
|
||||
|
||||
if (stream.IsFaulted)
|
||||
{
|
||||
Utils.Log($"While downloading {url} - {stream.Exception.ExceptionToString()}");
|
||||
return false;
|
||||
}
|
||||
|
||||
if (!download)
|
||||
return true;
|
||||
|
||||
var header_var = "1";
|
||||
if (response.Content.Headers.Contains("Content-Length"))
|
||||
header_var = response.Content.Headers.GetValues("Content-Length").FirstOrDefault();
|
||||
|
||||
var content_size = header_var != null ? long.Parse(header_var) : 1;
|
||||
|
||||
var filename = Path.GetFileName(dest);
|
||||
using (var webs = stream.Result)
|
||||
using (var fs = File.OpenWrite(dest))
|
||||
{
|
||||
var buffer = new byte[buffer_size];
|
||||
while (true)
|
||||
{
|
||||
var read = webs.Read(buffer, 0, buffer_size);
|
||||
if (read == 0) break;
|
||||
Utils.Status( $"Downloading {filename}", (int)(total_read * 100 / content_size));
|
||||
|
||||
fs.Write(buffer, 0, read);
|
||||
total_read += read;
|
||||
}
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
@ -1,19 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Wabbajack.WebAutomation.SiteHooks;
|
||||
|
||||
namespace Wabbajack.WebAutomation
|
||||
{
|
||||
public class HookRegistry
|
||||
{
|
||||
private static IEnumerable<ISiteHook> _hooks = new List<ISiteHook>() {new MediaFire()};
|
||||
|
||||
public static ISiteHook FindSiteHook()
|
||||
{
|
||||
return _hooks.First();
|
||||
}
|
||||
}
|
||||
}
|
Binary file not shown.
@ -1,19 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Cryptography.X509Certificates;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using OpenQA.Selenium;
|
||||
|
||||
namespace Wabbajack.WebAutomation
|
||||
{
|
||||
public interface ISiteHook
|
||||
{
|
||||
string SiteHookName { get; }
|
||||
string SiteHookDescription { get; }
|
||||
IEnumerable<(string, string)> RequiredUserParameters { get; }
|
||||
IEnumerable<string> RequiredModMetaInfo { get; }
|
||||
void Download(IDictionary<string, string> userParams, IDictionary<string, string> modMeta, string destination);
|
||||
}
|
||||
}
|
@ -1,36 +0,0 @@
|
||||
using System.Reflection;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
// General Information about an assembly is controlled through the following
|
||||
// set of attributes. Change these attribute values to modify the information
|
||||
// associated with an assembly.
|
||||
[assembly: AssemblyTitle("Wabbajack.WebAutomation")]
|
||||
[assembly: AssemblyDescription("")]
|
||||
[assembly: AssemblyConfiguration("")]
|
||||
[assembly: AssemblyCompany("")]
|
||||
[assembly: AssemblyProduct("Wabbajack.WebAutomation")]
|
||||
[assembly: AssemblyCopyright("Copyright © 2019")]
|
||||
[assembly: AssemblyTrademark("")]
|
||||
[assembly: AssemblyCulture("")]
|
||||
|
||||
// Setting ComVisible to false makes the types in this assembly not visible
|
||||
// to COM components. If you need to access a type in this assembly from
|
||||
// COM, set the ComVisible attribute to true on that type.
|
||||
[assembly: ComVisible(false)]
|
||||
|
||||
// The following GUID is for the ID of the typelib if this project is exposed to COM
|
||||
[assembly: Guid("e5a6f0e6-f79e-460d-82e2-e6330ace06ba")]
|
||||
|
||||
// Version information for an assembly consists of the following four values:
|
||||
//
|
||||
// Major Version
|
||||
// Minor Version
|
||||
// Build Number
|
||||
// Revision
|
||||
//
|
||||
// You can specify all the values or you can default the Build and Revision Numbers
|
||||
// by using the '*' as shown below:
|
||||
// [assembly: AssemblyVersion("1.0.*")]
|
||||
[assembly: AssemblyVersion("1.0.0.0")]
|
||||
[assembly: AssemblyFileVersion("1.0.0.0")]
|
@ -1,31 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using OpenQA.Selenium;
|
||||
using Wabbajack.Common;
|
||||
|
||||
namespace Wabbajack.WebAutomation.SiteHooks
|
||||
{
|
||||
class MediaFire : ISiteHook
|
||||
{
|
||||
public string SiteHookName => "MediaFire";
|
||||
public string SiteHookDescription => "Hook for downloading files from MediaFire";
|
||||
public IEnumerable<(string, string)> RequiredUserParameters => new List<(string, string)>();
|
||||
public IEnumerable<string> RequiredModMetaInfo => new List<string> {"mediaFireURL"};
|
||||
public void Download(IDictionary<string, string> userParams, IDictionary<string, string> modMeta, string dest)
|
||||
{
|
||||
Utils.Status("Getting webdriver");
|
||||
using (var driver = Driver.GetDriver())
|
||||
{
|
||||
Utils.Status($"Navigating to {modMeta["mediaFireURL"]}");
|
||||
driver.Url = modMeta["mediaFireURL"];
|
||||
var href = driver.FindElement(By.CssSelector("a.input")).GetAttribute("href");
|
||||
var client = driver.ConvertToHTTPClient();
|
||||
client.DownloadUrl(href, dest);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
@ -1,135 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
|
||||
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProjectGuid>{E5A6F0E6-F79E-460D-82E2-E6330ACE06BA}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
<AppDesignerFolder>Properties</AppDesignerFolder>
|
||||
<RootNamespace>Wabbajack.WebAutomation</RootNamespace>
|
||||
<AssemblyName>Wabbajack.WebAutomation</AssemblyName>
|
||||
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
|
||||
<FileAlignment>512</FileAlignment>
|
||||
<Deterministic>true</Deterministic>
|
||||
<NuGetPackageImportStamp>
|
||||
</NuGetPackageImportStamp>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
|
||||
<DebugSymbols>true</DebugSymbols>
|
||||
<DebugType>full</DebugType>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>bin\Debug\</OutputPath>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
<ErrorReport>prompt</ErrorReport>
|
||||
<WarningLevel>4</WarningLevel>
|
||||
<PlatformTarget>x64</PlatformTarget>
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
|
||||
<OutputPath>bin\x64\Debug\</OutputPath>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.AspNetCore.WebUtilities, Version=2.0.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.AspNetCore.WebUtilities.2.0.2\lib\netstandard2.0\Microsoft.AspNetCore.WebUtilities.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Microsoft.Net.Http.Headers, Version=2.0.2.0, Culture=neutral, PublicKeyToken=adb9793829ddae60, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Microsoft.Net.Http.Headers.2.0.2\lib\netstandard2.0\Microsoft.Net.Http.Headers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.Buffers, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Buffers.4.4.0\lib\netstandard2.0\System.Buffers.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.ComponentModel.Composition" />
|
||||
<Reference Include="System.Core" />
|
||||
<Reference Include="System.Drawing" />
|
||||
<Reference Include="System.IO, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.IO.4.3.0\lib\net462\System.IO.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Net.Http, Version=4.1.1.3, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Net.Http.4.3.4\lib\net46\System.Net.Http.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.4.3.0\lib\net462\System.Runtime.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Runtime.CompilerServices.Unsafe, Version=4.0.4.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Runtime.CompilerServices.Unsafe.4.5.0\lib\netstandard2.0\System.Runtime.CompilerServices.Unsafe.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Cryptography.Algorithms, Version=4.2.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Security.Cryptography.Algorithms.4.3.0\lib\net463\System.Security.Cryptography.Algorithms.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Cryptography.Encoding, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Security.Cryptography.Encoding.4.3.0\lib\net46\System.Security.Cryptography.Encoding.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Cryptography.Primitives, Version=4.0.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Security.Cryptography.Primitives.4.3.0\lib\net46\System.Security.Cryptography.Primitives.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Security.Cryptography.X509Certificates, Version=4.1.1.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Security.Cryptography.X509Certificates.4.3.0\lib\net461\System.Security.Cryptography.X509Certificates.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System.Text.Encodings.Web, Version=4.0.2.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Text.Encodings.Web.4.4.0\lib\netstandard2.0\System.Text.Encodings.Web.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Threading.Tasks.Extensions, Version=4.2.0.0, Culture=neutral, PublicKeyToken=cc7b13ffcd2ddd51, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\System.Threading.Tasks.Extensions.4.5.1\lib\netstandard2.0\System.Threading.Tasks.Extensions.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="System.Xml.Linq" />
|
||||
<Reference Include="System.Data.DataSetExtensions" />
|
||||
<Reference Include="Microsoft.CSharp" />
|
||||
<Reference Include="System.Data" />
|
||||
<Reference Include="System.Xml" />
|
||||
<Reference Include="WebDriver, Version=3.141.0.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Selenium.WebDriver.3.141.0\lib\net45\WebDriver.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="Driver.cs" />
|
||||
<Compile Include="HookRegistry.cs" />
|
||||
<Compile Include="ISiteHook.cs" />
|
||||
<Compile Include="Properties\AssemblyInfo.cs" />
|
||||
<Compile Include="SiteHooks\MediaFire.cs" />
|
||||
<Compile Include="Extensions.cs" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<None Include="app.config" />
|
||||
<None Include="chromedriver.exe.bz2" />
|
||||
<None Include="IEDriverServer.exe.bz2" />
|
||||
<None Include="packages.config" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<EmbeddedResource Include="chromedriver.exe" />
|
||||
<EmbeddedResource Include="IEDriverServer.exe" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\Wabbajack.Common\Wabbajack.Common.csproj">
|
||||
<Project>{b3f3fb6e-b9eb-4f49-9875-d78578bc7ae5}</Project>
|
||||
<Name>Wabbajack.Common</Name>
|
||||
</ProjectReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup />
|
||||
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
|
||||
<Import Project="..\packages\Selenium.WebDriver.ChromeDriver.77.0.3865.4000\build\Selenium.WebDriver.ChromeDriver.targets" Condition="Exists('..\packages\Selenium.WebDriver.ChromeDriver.77.0.3865.4000\build\Selenium.WebDriver.ChromeDriver.targets')" />
|
||||
<Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
|
||||
<PropertyGroup>
|
||||
<ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
|
||||
</PropertyGroup>
|
||||
<Error Condition="!Exists('..\packages\Selenium.WebDriver.ChromeDriver.77.0.3865.4000\build\Selenium.WebDriver.ChromeDriver.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Selenium.WebDriver.ChromeDriver.77.0.3865.4000\build\Selenium.WebDriver.ChromeDriver.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\Selenium.WebDriver.IEDriver.3.150.0\build\Selenium.WebDriver.IEDriver.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Selenium.WebDriver.IEDriver.3.150.0\build\Selenium.WebDriver.IEDriver.targets'))" />
|
||||
<Error Condition="!Exists('..\packages\Selenium.Firefox.WebDriver.0.24.0\build\Selenium.Firefox.WebDriver.targets')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\Selenium.Firefox.WebDriver.0.24.0\build\Selenium.Firefox.WebDriver.targets'))" />
|
||||
</Target>
|
||||
<Import Project="..\packages\Selenium.WebDriver.IEDriver.3.150.0\build\Selenium.WebDriver.IEDriver.targets" Condition="Exists('..\packages\Selenium.WebDriver.IEDriver.3.150.0\build\Selenium.WebDriver.IEDriver.targets')" />
|
||||
<Import Project="..\packages\Selenium.Firefox.WebDriver.0.24.0\build\Selenium.Firefox.WebDriver.targets" Condition="Exists('..\packages\Selenium.Firefox.WebDriver.0.24.0\build\Selenium.Firefox.WebDriver.targets')" />
|
||||
</Project>
|
@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<configuration>
|
||||
<runtime>
|
||||
<assemblyBinding xmlns="urn:schemas-microsoft-com:asm.v1">
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Runtime.CompilerServices.Unsafe" publicKeyToken="b03f5f7f11d50a3a" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.4.0" newVersion="4.0.4.0" />
|
||||
</dependentAssembly>
|
||||
<dependentAssembly>
|
||||
<assemblyIdentity name="System.Buffers" publicKeyToken="cc7b13ffcd2ddd51" culture="neutral" />
|
||||
<bindingRedirect oldVersion="0.0.0.0-4.0.2.0" newVersion="4.0.2.0" />
|
||||
</dependentAssembly>
|
||||
</assemblyBinding>
|
||||
</runtime>
|
||||
</configuration>
|
Binary file not shown.
@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Selenium.Firefox.WebDriver" version="0.24.0" targetFramework="net472" />
|
||||
<package id="Selenium.WebDriver" version="3.141.0" targetFramework="net472" />
|
||||
<package id="Selenium.WebDriver.ChromeDriver" version="77.0.3865.4000" targetFramework="net472" />
|
||||
<package id="Selenium.WebDriver.IEDriver" version="3.150.0" targetFramework="net472" />
|
||||
<package id="System.IO" version="4.3.0" targetFramework="net472" />
|
||||
<package id="System.Net.Http" version="4.3.4" targetFramework="net472" />
|
||||
<package id="System.Runtime" version="4.3.0" targetFramework="net472" />
|
||||
<package id="System.Security.Cryptography.Algorithms" version="4.3.0" targetFramework="net472" />
|
||||
<package id="System.Security.Cryptography.Encoding" version="4.3.0" targetFramework="net472" />
|
||||
<package id="System.Security.Cryptography.Primitives" version="4.3.0" targetFramework="net472" />
|
||||
<package id="System.Security.Cryptography.X509Certificates" version="4.3.0" targetFramework="net472" />
|
||||
</packages>
|
@ -24,10 +24,6 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VirtualFileSystem", "Virtua
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VirtualFileSystem.Test", "VirtualFileSystem.Test\VirtualFileSystem.Test.csproj", "{A2913DFE-18FF-468B-A6C1-55F7C0CC0CE8}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wabbajack.WebAutomation", "Wabbajack.WebAutomation\Wabbajack.WebAutomation.csproj", "{E5A6F0E6-F79E-460D-82E2-E6330ACE06BA}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wabbajack.WebAutomation.Test", "Wabbajack.WebAutomation.Test\Wabbajack.WebAutomation.Test.csproj", "{73D0B663-A6FB-4A67-B945-EBB4A234C996}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wabbajack.Test", "Wabbajack.Test\Wabbajack.Test.csproj", "{A47FFF32-782B-4D9F-8704-C98FB32FA8CC}"
|
||||
EndProject
|
||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Wabbajack.Lib", "Wabbajack.Lib\Wabbajack.Lib.csproj", "{0A820830-A298-497D-85E0-E9A89EFEF5FE}"
|
||||
@ -114,30 +110,6 @@ Global
|
||||
{A2913DFE-18FF-468B-A6C1-55F7C0CC0CE8}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{A2913DFE-18FF-468B-A6C1-55F7C0CC0CE8}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{A2913DFE-18FF-468B-A6C1-55F7C0CC0CE8}.Release|x64.Build.0 = Release|Any CPU
|
||||
{E5A6F0E6-F79E-460D-82E2-E6330ACE06BA}.Debug (no commandargs)|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E5A6F0E6-F79E-460D-82E2-E6330ACE06BA}.Debug (no commandargs)|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E5A6F0E6-F79E-460D-82E2-E6330ACE06BA}.Debug (no commandargs)|x64.ActiveCfg = Debug|x64
|
||||
{E5A6F0E6-F79E-460D-82E2-E6330ACE06BA}.Debug (no commandargs)|x64.Build.0 = Debug|x64
|
||||
{E5A6F0E6-F79E-460D-82E2-E6330ACE06BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E5A6F0E6-F79E-460D-82E2-E6330ACE06BA}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E5A6F0E6-F79E-460D-82E2-E6330ACE06BA}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{E5A6F0E6-F79E-460D-82E2-E6330ACE06BA}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{E5A6F0E6-F79E-460D-82E2-E6330ACE06BA}.Release|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{E5A6F0E6-F79E-460D-82E2-E6330ACE06BA}.Release|Any CPU.Build.0 = Debug|Any CPU
|
||||
{E5A6F0E6-F79E-460D-82E2-E6330ACE06BA}.Release|x64.ActiveCfg = Debug|Any CPU
|
||||
{E5A6F0E6-F79E-460D-82E2-E6330ACE06BA}.Release|x64.Build.0 = Debug|Any CPU
|
||||
{73D0B663-A6FB-4A67-B945-EBB4A234C996}.Debug (no commandargs)|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{73D0B663-A6FB-4A67-B945-EBB4A234C996}.Debug (no commandargs)|Any CPU.Build.0 = Debug|Any CPU
|
||||
{73D0B663-A6FB-4A67-B945-EBB4A234C996}.Debug (no commandargs)|x64.ActiveCfg = Debug|x64
|
||||
{73D0B663-A6FB-4A67-B945-EBB4A234C996}.Debug (no commandargs)|x64.Build.0 = Debug|x64
|
||||
{73D0B663-A6FB-4A67-B945-EBB4A234C996}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{73D0B663-A6FB-4A67-B945-EBB4A234C996}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||
{73D0B663-A6FB-4A67-B945-EBB4A234C996}.Debug|x64.ActiveCfg = Debug|Any CPU
|
||||
{73D0B663-A6FB-4A67-B945-EBB4A234C996}.Debug|x64.Build.0 = Debug|Any CPU
|
||||
{73D0B663-A6FB-4A67-B945-EBB4A234C996}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||
{73D0B663-A6FB-4A67-B945-EBB4A234C996}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||
{73D0B663-A6FB-4A67-B945-EBB4A234C996}.Release|x64.ActiveCfg = Release|Any CPU
|
||||
{73D0B663-A6FB-4A67-B945-EBB4A234C996}.Release|x64.Build.0 = Release|Any CPU
|
||||
{A47FFF32-782B-4D9F-8704-C98FB32FA8CC}.Debug (no commandargs)|Any CPU.ActiveCfg = Debug|Any CPU
|
||||
{A47FFF32-782B-4D9F-8704-C98FB32FA8CC}.Debug (no commandargs)|Any CPU.Build.0 = Debug|Any CPU
|
||||
{A47FFF32-782B-4D9F-8704-C98FB32FA8CC}.Debug (no commandargs)|x64.ActiveCfg = Debug|x64
|
||||
|
@ -215,8 +215,8 @@
|
||||
<Reference Include="WindowsBase" />
|
||||
<Reference Include="PresentationCore" />
|
||||
<Reference Include="PresentationFramework" />
|
||||
<Reference Include="YamlDotNet, Version=7.0.0.0, Culture=neutral, PublicKeyToken=ec19458f3c15af5e, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\YamlDotNet.7.0.0\lib\net45\YamlDotNet.dll</HintPath>
|
||||
<Reference Include="YamlDotNet, Version=8.0.0.0, Culture=neutral, PublicKeyToken=ec19458f3c15af5e, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\YamlDotNet.8.0.0\lib\net45\YamlDotNet.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
|
@ -21,9 +21,9 @@
|
||||
<package id="ReactiveUI.WPF" version="10.4.1" targetFramework="net472" />
|
||||
<package id="SharpCompress" version="0.23.0" targetFramework="net472" />
|
||||
<package id="SharpZipLib" version="1.2.0" targetFramework="net472" />
|
||||
<package id="Syroot.Windows.IO.KnownFolders" version="1.2.1" targetFramework="net472" />
|
||||
<package id="Splat" version="9.1.1" targetFramework="net472" />
|
||||
<package id="Splat.Drawing" version="9.1.1" targetFramework="net472" />
|
||||
<package id="Syroot.Windows.IO.KnownFolders" version="1.2.1" targetFramework="net472" />
|
||||
<package id="System.Buffers" version="4.4.0" targetFramework="net472" />
|
||||
<package id="System.Drawing.Primitives" version="4.3.0" targetFramework="net472" />
|
||||
<package id="System.Memory" version="4.5.3" targetFramework="net472" />
|
||||
@ -34,5 +34,5 @@
|
||||
<package id="System.ValueTuple" version="4.5.0" targetFramework="net472" />
|
||||
<package id="WebSocketSharpFork" version="1.0.4.0" targetFramework="net472" />
|
||||
<package id="WPFThemes.DarkBlend" version="1.0.8" targetFramework="net472" />
|
||||
<package id="YamlDotNet" version="7.0.0" targetFramework="net472" />
|
||||
<package id="YamlDotNet" version="8.0.0" targetFramework="net472" />
|
||||
</packages>
|
Loading…
Reference in New Issue
Block a user