2019-09-14 04:35:42 +00:00
|
|
|
|
using System;
|
2019-07-21 04:40:54 +00:00
|
|
|
|
using System.Collections.Generic;
|
2019-09-14 04:35:42 +00:00
|
|
|
|
using Newtonsoft.Json;
|
2019-08-20 04:57:08 +00:00
|
|
|
|
using VFS;
|
2019-09-29 04:41:47 +00:00
|
|
|
|
using Wabbajack.Common;
|
2019-07-21 04:40:54 +00:00
|
|
|
|
|
2019-08-20 04:57:08 +00:00
|
|
|
|
namespace Wabbajack
|
2019-07-21 04:40:54 +00:00
|
|
|
|
{
|
2019-09-14 04:35:42 +00:00
|
|
|
|
public class RawSourceFile
|
2019-07-21 04:40:54 +00:00
|
|
|
|
{
|
2019-09-14 04:35:42 +00:00
|
|
|
|
public string Path;
|
|
|
|
|
|
2019-08-20 04:57:08 +00:00
|
|
|
|
public RawSourceFile(VirtualFile file)
|
|
|
|
|
{
|
|
|
|
|
File = file;
|
|
|
|
|
}
|
2019-07-21 04:40:54 +00:00
|
|
|
|
|
2019-09-14 04:35:42 +00:00
|
|
|
|
public string AbsolutePath => File.StagedPath;
|
2019-08-20 04:57:08 +00:00
|
|
|
|
|
2019-09-14 04:35:42 +00:00
|
|
|
|
public VirtualFile File { get; }
|
2019-08-20 04:57:08 +00:00
|
|
|
|
|
2019-09-14 04:35:42 +00:00
|
|
|
|
public string Hash => File.Hash;
|
2019-07-21 04:40:54 +00:00
|
|
|
|
|
|
|
|
|
public T EvolveTo<T>() where T : Directive, new()
|
|
|
|
|
{
|
|
|
|
|
var v = new T();
|
|
|
|
|
v.To = Path;
|
2019-09-18 21:33:23 +00:00
|
|
|
|
v.Hash = Hash;
|
|
|
|
|
v.Size = File.Size;
|
2019-07-21 04:40:54 +00:00
|
|
|
|
return v;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-12 23:44:35 +00:00
|
|
|
|
[Serializable]
|
2019-07-21 04:40:54 +00:00
|
|
|
|
public class ModList
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
2019-09-14 04:35:42 +00:00
|
|
|
|
/// Archives required by this modlist
|
2019-07-21 04:40:54 +00:00
|
|
|
|
/// </summary>
|
2019-09-14 04:35:42 +00:00
|
|
|
|
public List<Archive> Archives;
|
2019-07-21 04:40:54 +00:00
|
|
|
|
|
2019-09-29 04:41:47 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// The game variant to which this game applies
|
|
|
|
|
/// </summary>
|
|
|
|
|
public Game GameType;
|
|
|
|
|
|
2019-07-21 04:40:54 +00:00
|
|
|
|
/// <summary>
|
2019-09-14 04:35:42 +00:00
|
|
|
|
/// Install directives
|
2019-07-21 04:40:54 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
public List<Directive> Directives;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2019-09-14 04:35:42 +00:00
|
|
|
|
/// Name of the ModList
|
2019-07-21 04:40:54 +00:00
|
|
|
|
/// </summary>
|
2019-09-14 04:35:42 +00:00
|
|
|
|
public string Name;
|
2019-08-30 23:57:56 +00:00
|
|
|
|
|
2019-10-07 14:43:46 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Author of the ModList
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string Author;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Description of the ModList
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string Description;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Image of the ModList
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string Image;
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
|
|
|
|
/// Website of the ModList
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string Website;
|
|
|
|
|
|
2019-08-30 23:57:56 +00:00
|
|
|
|
/// <summary>
|
2019-09-14 04:35:42 +00:00
|
|
|
|
/// Content Report in HTML form
|
2019-08-30 23:57:56 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
public string ReportHTML;
|
2019-07-21 04:40:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-09-12 23:44:35 +00:00
|
|
|
|
[Serializable]
|
2019-07-21 04:40:54 +00:00
|
|
|
|
public class Directive
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
2019-09-14 04:35:42 +00:00
|
|
|
|
/// location the file will be copied to, relative to the install path.
|
2019-07-21 04:40:54 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
public string To;
|
2019-09-18 21:33:23 +00:00
|
|
|
|
public long Size;
|
|
|
|
|
public string Hash;
|
2019-07-21 04:40:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-09-12 23:44:35 +00:00
|
|
|
|
[Serializable]
|
2019-07-21 04:40:54 +00:00
|
|
|
|
public class IgnoredDirectly : Directive
|
|
|
|
|
{
|
|
|
|
|
public string Reason;
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-12 23:44:35 +00:00
|
|
|
|
[Serializable]
|
2019-07-21 04:40:54 +00:00
|
|
|
|
public class NoMatch : IgnoredDirectly
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-12 23:44:35 +00:00
|
|
|
|
[Serializable]
|
2019-07-21 04:40:54 +00:00
|
|
|
|
public class InlineFile : Directive
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
2019-09-14 04:35:42 +00:00
|
|
|
|
/// Data that will be written as-is to the destination location;
|
2019-07-21 04:40:54 +00:00
|
|
|
|
/// </summary>
|
2019-10-01 22:39:25 +00:00
|
|
|
|
public string SourceDataID;
|
2019-07-21 04:40:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-09-12 23:44:35 +00:00
|
|
|
|
[Serializable]
|
2019-08-25 03:46:32 +00:00
|
|
|
|
public class CleanedESM : InlineFile
|
|
|
|
|
{
|
|
|
|
|
public string SourceESMHash;
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-24 23:20:54 +00:00
|
|
|
|
/// <summary>
|
2019-09-14 04:35:42 +00:00
|
|
|
|
/// A file that has the game and MO2 folders remapped on installation
|
2019-08-24 23:20:54 +00:00
|
|
|
|
/// </summary>
|
2019-09-12 23:44:35 +00:00
|
|
|
|
[Serializable]
|
2019-08-24 23:20:54 +00:00
|
|
|
|
public class RemappedInlineFile : InlineFile
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-12 23:44:35 +00:00
|
|
|
|
[Serializable]
|
2019-07-21 04:40:54 +00:00
|
|
|
|
public class FromArchive : Directive
|
|
|
|
|
{
|
2019-09-14 04:35:42 +00:00
|
|
|
|
private string _fullPath;
|
|
|
|
|
|
2019-07-21 04:40:54 +00:00
|
|
|
|
/// <summary>
|
2019-09-14 04:35:42 +00:00
|
|
|
|
/// MurMur3 hash of the archive this file comes from
|
2019-07-21 04:40:54 +00:00
|
|
|
|
/// </summary>
|
2019-08-09 04:07:23 +00:00
|
|
|
|
public string[] ArchiveHashPath;
|
2019-08-20 04:57:08 +00:00
|
|
|
|
|
2019-09-14 04:35:42 +00:00
|
|
|
|
[JsonIgnore] [NonSerialized] public VirtualFile FromFile;
|
2019-09-12 23:44:35 +00:00
|
|
|
|
|
2019-08-09 04:07:23 +00:00
|
|
|
|
[JsonIgnore]
|
|
|
|
|
public string FullPath
|
|
|
|
|
{
|
|
|
|
|
get
|
|
|
|
|
{
|
2019-09-14 04:35:42 +00:00
|
|
|
|
if (_fullPath == null) _fullPath = string.Join("|", ArchiveHashPath);
|
2019-08-09 04:07:23 +00:00
|
|
|
|
return _fullPath;
|
|
|
|
|
}
|
|
|
|
|
}
|
2019-07-21 04:40:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-09-12 23:44:35 +00:00
|
|
|
|
[Serializable]
|
2019-07-26 20:59:14 +00:00
|
|
|
|
public class CreateBSA : Directive
|
|
|
|
|
{
|
|
|
|
|
public string IsCompressed;
|
2019-07-28 23:04:23 +00:00
|
|
|
|
public bool ShareData;
|
2019-09-14 04:35:42 +00:00
|
|
|
|
public string TempID;
|
|
|
|
|
public uint Type;
|
|
|
|
|
public uint Version;
|
2019-07-26 20:59:14 +00:00
|
|
|
|
|
|
|
|
|
public uint FileFlags { get; set; }
|
|
|
|
|
public bool Compress { get; set; }
|
2019-07-28 23:04:23 +00:00
|
|
|
|
public uint ArchiveFlags { get; set; }
|
2019-07-26 20:59:14 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-09-12 23:44:35 +00:00
|
|
|
|
[Serializable]
|
2019-07-21 22:47:17 +00:00
|
|
|
|
public class PatchedFromArchive : FromArchive
|
2019-07-21 04:40:54 +00:00
|
|
|
|
{
|
2019-09-14 04:35:42 +00:00
|
|
|
|
public string Hash;
|
|
|
|
|
|
2019-07-21 04:40:54 +00:00
|
|
|
|
/// <summary>
|
2019-09-14 04:35:42 +00:00
|
|
|
|
/// The file to apply to the source file to patch it
|
2019-07-21 04:40:54 +00:00
|
|
|
|
/// </summary>
|
2019-10-01 22:39:25 +00:00
|
|
|
|
public String PatchID;
|
2019-07-21 04:40:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-09-23 21:37:10 +00:00
|
|
|
|
[Serializable]
|
|
|
|
|
public class SourcePatch
|
|
|
|
|
{
|
|
|
|
|
public string RelativePath;
|
|
|
|
|
public string Hash;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
[Serializable]
|
|
|
|
|
public class MergedPatch : Directive
|
|
|
|
|
{
|
|
|
|
|
public List<SourcePatch> Sources;
|
|
|
|
|
public string Hash;
|
2019-10-01 22:39:25 +00:00
|
|
|
|
public string PatchID;
|
2019-09-23 21:37:10 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-09-12 23:44:35 +00:00
|
|
|
|
[Serializable]
|
2019-07-21 04:40:54 +00:00
|
|
|
|
public class Archive
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
2019-09-14 04:35:42 +00:00
|
|
|
|
/// MurMur3 Hash of the archive
|
2019-07-21 04:40:54 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
public string Hash;
|
2019-07-21 22:47:17 +00:00
|
|
|
|
|
|
|
|
|
/// Meta INI for the downloaded archive
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string Meta;
|
2019-09-10 13:02:25 +00:00
|
|
|
|
|
2019-09-14 04:35:42 +00:00
|
|
|
|
/// <summary>
|
|
|
|
|
/// Human friendly name of this archive
|
|
|
|
|
/// </summary>
|
|
|
|
|
public string Name;
|
|
|
|
|
|
2019-09-10 13:02:25 +00:00
|
|
|
|
public long Size;
|
2019-07-21 22:47:17 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-09-12 23:44:35 +00:00
|
|
|
|
[Serializable]
|
2019-07-21 22:47:17 +00:00
|
|
|
|
public class NexusMod : Archive
|
|
|
|
|
{
|
2019-09-14 04:35:42 +00:00
|
|
|
|
public string Author;
|
|
|
|
|
public string FileID;
|
2019-07-21 22:47:17 +00:00
|
|
|
|
public string GameName;
|
|
|
|
|
public string ModID;
|
2019-08-30 23:57:56 +00:00
|
|
|
|
public string UploadedBy;
|
2019-09-14 04:35:42 +00:00
|
|
|
|
public string UploaderProfile;
|
|
|
|
|
public string Version;
|
2019-09-26 03:18:36 +00:00
|
|
|
|
public string SlideShowPic;
|
|
|
|
|
public string ModName;
|
|
|
|
|
public string NexusURL;
|
|
|
|
|
public string Summary;
|
2019-10-07 15:45:32 +00:00
|
|
|
|
public bool Adult;
|
2019-07-21 04:40:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-09-24 04:20:24 +00:00
|
|
|
|
[Serializable]
|
|
|
|
|
public class ManualArchive : Archive
|
|
|
|
|
{
|
|
|
|
|
public string URL;
|
|
|
|
|
public string Notes;
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-12 23:44:35 +00:00
|
|
|
|
[Serializable]
|
2019-07-26 20:59:14 +00:00
|
|
|
|
public class GoogleDriveMod : Archive
|
|
|
|
|
{
|
|
|
|
|
public string Id;
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-21 04:40:54 +00:00
|
|
|
|
/// <summary>
|
2019-09-14 04:35:42 +00:00
|
|
|
|
/// URL that can be downloaded directly without any additional options
|
2019-07-21 04:40:54 +00:00
|
|
|
|
/// </summary>
|
2019-09-12 23:44:35 +00:00
|
|
|
|
[Serializable]
|
2019-07-21 04:40:54 +00:00
|
|
|
|
public class DirectURLArchive : Archive
|
|
|
|
|
{
|
2019-08-02 22:31:13 +00:00
|
|
|
|
[JsonProperty(NullValueHandling = NullValueHandling.Ignore)]
|
|
|
|
|
public List<string> Headers;
|
2019-09-14 04:35:42 +00:00
|
|
|
|
|
|
|
|
|
public string URL;
|
2019-07-21 04:40:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
2019-08-15 04:30:37 +00:00
|
|
|
|
/// <summary>
|
2019-09-14 04:35:42 +00:00
|
|
|
|
/// An archive that requires additional HTTP headers.
|
2019-07-21 04:40:54 +00:00
|
|
|
|
/// </summary>
|
2019-09-12 23:44:35 +00:00
|
|
|
|
[Serializable]
|
2019-07-21 04:40:54 +00:00
|
|
|
|
public class DirectURLArchiveEx : DirectURLArchive
|
|
|
|
|
{
|
|
|
|
|
public Dictionary<string, string> Headers;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2019-09-14 04:35:42 +00:00
|
|
|
|
/// Archive that comes from MEGA
|
2019-07-21 04:40:54 +00:00
|
|
|
|
/// </summary>
|
2019-09-12 23:44:35 +00:00
|
|
|
|
[Serializable]
|
2019-07-21 04:40:54 +00:00
|
|
|
|
public class MEGAArchive : DirectURLArchive
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2019-09-14 04:35:42 +00:00
|
|
|
|
/// Archive that comes from MODDB
|
2019-07-21 04:40:54 +00:00
|
|
|
|
/// </summary>
|
2019-09-12 23:44:35 +00:00
|
|
|
|
[Serializable]
|
2019-07-21 04:40:54 +00:00
|
|
|
|
public class MODDBArchive : DirectURLArchive
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2019-08-02 22:31:13 +00:00
|
|
|
|
/// <summary>
|
2019-09-14 04:35:42 +00:00
|
|
|
|
/// Archive that comes from MediaFire
|
2019-08-02 22:31:13 +00:00
|
|
|
|
/// </summary>
|
2019-09-12 23:44:35 +00:00
|
|
|
|
[Serializable]
|
2019-08-02 22:31:13 +00:00
|
|
|
|
public class MediaFireArchive : DirectURLArchive
|
|
|
|
|
{
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-12 23:44:35 +00:00
|
|
|
|
[Serializable]
|
2019-08-20 04:57:08 +00:00
|
|
|
|
public class IndexedArchive
|
2019-07-21 04:40:54 +00:00
|
|
|
|
{
|
|
|
|
|
public dynamic IniData;
|
2019-07-21 22:47:17 +00:00
|
|
|
|
public string Meta;
|
2019-09-14 04:35:42 +00:00
|
|
|
|
public string Name;
|
2019-08-20 04:57:08 +00:00
|
|
|
|
public VirtualFile File { get; internal set; }
|
2019-07-21 04:40:54 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
/// <summary>
|
2019-09-14 04:35:42 +00:00
|
|
|
|
/// A archive entry
|
2019-07-21 04:40:54 +00:00
|
|
|
|
/// </summary>
|
2019-09-12 23:44:35 +00:00
|
|
|
|
[Serializable]
|
2019-07-21 04:40:54 +00:00
|
|
|
|
public class IndexedEntry
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
2019-09-14 04:35:42 +00:00
|
|
|
|
/// MurMur3 hash of this file
|
2019-07-21 04:40:54 +00:00
|
|
|
|
/// </summary>
|
2019-09-14 04:35:42 +00:00
|
|
|
|
public string Hash;
|
|
|
|
|
|
2019-07-21 04:40:54 +00:00
|
|
|
|
/// <summary>
|
2019-09-14 04:35:42 +00:00
|
|
|
|
/// Path in the archive to this file
|
2019-07-21 04:40:54 +00:00
|
|
|
|
/// </summary>
|
2019-09-14 04:35:42 +00:00
|
|
|
|
public string Path;
|
|
|
|
|
|
2019-07-21 04:40:54 +00:00
|
|
|
|
/// <summary>
|
2019-09-14 04:35:42 +00:00
|
|
|
|
/// Size of the file (uncompressed)
|
2019-07-21 04:40:54 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
public long Size;
|
|
|
|
|
}
|
|
|
|
|
|
2019-09-12 23:44:35 +00:00
|
|
|
|
[Serializable]
|
2019-08-09 04:07:23 +00:00
|
|
|
|
public class IndexedArchiveEntry : IndexedEntry
|
|
|
|
|
{
|
|
|
|
|
public string[] HashPath;
|
|
|
|
|
}
|
|
|
|
|
|
2019-07-21 04:40:54 +00:00
|
|
|
|
/// <summary>
|
2019-09-14 04:35:42 +00:00
|
|
|
|
/// Data found inside a BSA file in an archive
|
2019-07-21 04:40:54 +00:00
|
|
|
|
/// </summary>
|
2019-09-12 23:44:35 +00:00
|
|
|
|
[Serializable]
|
2019-07-21 04:40:54 +00:00
|
|
|
|
public class BSAIndexedEntry : IndexedEntry
|
|
|
|
|
{
|
|
|
|
|
/// <summary>
|
2019-09-14 04:35:42 +00:00
|
|
|
|
/// MurMur3 hash of the BSA this file comes from
|
2019-07-21 04:40:54 +00:00
|
|
|
|
/// </summary>
|
|
|
|
|
public string BSAHash;
|
|
|
|
|
}
|
2019-09-14 04:35:42 +00:00
|
|
|
|
}
|