using Newtonsoft.Json; using System; using System.Collections.Generic; using VFS; namespace Wabbajack { public class RawSourceFile { public RawSourceFile(VirtualFile file) { File = file; } public string AbsolutePath { get { return File.StagedPath; } } public string Path; public VirtualFile File { get; private set; } public string Hash { get { return File.Hash; } } public T EvolveTo() where T : Directive, new() { var v = new T(); v.To = Path; return v; } } [Serializable] public class ModList { /// /// Name of the ModList /// public string Name; /// /// Install directives /// public List Directives; /// /// Archives required by this modlist /// public List Archives; /// /// Content Report in HTML form /// public string ReportHTML; } [Serializable] public class Directive { /// /// location the file will be copied to, relative to the install path. /// public string To; } [Serializable] public class IgnoredDirectly : Directive { public string Reason; } [Serializable] public class NoMatch : IgnoredDirectly { } [Serializable] public class InlineFile : Directive { /// /// Data that will be written as-is to the destination location; /// public string SourceData; } [Serializable] public class CleanedESM : InlineFile { public string SourceESMHash; } /// /// A file that has the game and MO2 folders remapped on installation /// [Serializable] public class RemappedInlineFile : InlineFile { } [Serializable] public class FromArchive : Directive { /// /// MurMur3 hash of the archive this file comes from /// public string[] ArchiveHashPath; [JsonIgnore] [NonSerialized] public VirtualFile FromFile; private string _fullPath = null; [JsonIgnore] public string FullPath { get { if (_fullPath == null) { _fullPath = String.Join("|", ArchiveHashPath); } return _fullPath; } } } [Serializable] public class CreateBSA : Directive { public string TempID; public string IsCompressed; public uint Version; public uint Type; public bool ShareData; public uint FileFlags { get; set; } public bool Compress { get; set; } public uint ArchiveFlags { get; set; } } [Serializable] public class PatchedFromArchive : FromArchive { /// /// The file to apply to the source file to patch it /// public byte[] Patch; public string Hash; } [Serializable] public class Archive { /// /// MurMur3 Hash of the archive /// public string Hash; /// /// Human friendly name of this archive /// public string Name; /// Meta INI for the downloaded archive /// public string Meta; public long Size; } [Serializable] public class NexusMod : Archive { public string GameName; public string ModID; public string FileID; public string Version; public string UploaderProfile; public string UploadedBy; public string Author; } [Serializable] public class GoogleDriveMod : Archive { public string Id; } /// /// URL that can be downloaded directly without any additional options /// [Serializable] public class DirectURLArchive : Archive { public string URL; [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public List Headers; } /// /// A URL that cannot be downloaded automatically and has to be downloaded by hand /// [Serializable] public class ManualURLArchive : Archive { public string URL; } /// /// An archive that requires additional HTTP headers. /// [Serializable] public class DirectURLArchiveEx : DirectURLArchive { public Dictionary Headers; } /// /// Archive that comes from MEGA /// [Serializable] public class MEGAArchive : DirectURLArchive { } /// /// Archive that comes from MODDB /// [Serializable] public class MODDBArchive : DirectURLArchive { } /// /// Archive that comes from MediaFire /// [Serializable] public class MediaFireArchive : DirectURLArchive { } [Serializable] public class IndexedArchive { public dynamic IniData; public string Name; public string Meta; public VirtualFile File { get; internal set; } } /// /// A archive entry /// [Serializable] public class IndexedEntry { /// /// Path in the archive to this file /// public string Path; /// /// MurMur3 hash of this file /// public string Hash; /// /// Size of the file (uncompressed) /// public long Size; } [Serializable] public class IndexedArchiveEntry : IndexedEntry { public string[] HashPath; } /// /// Data found inside a BSA file in an archive /// [Serializable] public class BSAIndexedEntry : IndexedEntry { /// /// MurMur3 hash of the BSA this file comes from /// public string BSAHash; } }