using Newtonsoft.Json; using System; using System.Collections.Generic; using Compression.BSA; using VFS; using Wabbajack.Common; namespace Wabbajack { public class RawSourceFile { public string Path; public RawSourceFile(VirtualFile file) { File = file; } public string AbsolutePath => File.StagedPath; public VirtualFile File { get; } public string Hash => File.Hash; public T EvolveTo() where T : Directive, new() { var v = new T(); v.To = Path; v.Hash = Hash; v.Size = File.Size; return v; } } [Serializable] public class ModList { /// /// Archives required by this modlist /// public List Archives; /// /// The game variant to which this game applies /// public Game GameType; /// /// Install directives /// public List Directives; /// /// Name of the ModList /// public string Name; /// /// Author of the ModList /// public string Author; /// /// Description of the ModList /// public string Description; /// /// Hash of the banner-image /// public string Image; /// /// Website of the ModList /// public string Website; /// /// Hash of the readme /// public string Readme; /// /// 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; public long Size; public string Hash; } [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 SourceDataID; } public enum PropertyType { Banner, Readme } /// /// File meant to be extracted before the installation /// [Serializable] public class PropertyFile : InlineFile { public PropertyType Type; } [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 { private string _fullPath; /// /// MurMur3 hash of the archive this file comes from /// public string[] ArchiveHashPath; [JsonIgnore] [NonSerialized] public VirtualFile FromFile; [JsonIgnore] public string FullPath { get { if (_fullPath == null) _fullPath = string.Join("|", ArchiveHashPath); return _fullPath; } } } [Serializable] public class CreateBSA : Directive { public string TempID; public uint Type; public ArchiveStateObject State { get; set; } public List FileStates { get; set; } } [Serializable] public class PatchedFromArchive : FromArchive { public string Hash; /// /// The file to apply to the source file to patch it /// public String PatchID; } [Serializable] public class SourcePatch { public string RelativePath; public string Hash; } [Serializable] public class MergedPatch : Directive { public List Sources; public string Hash; public string PatchID; } [Serializable] public class Archive { /// /// MurMur3 Hash of the archive /// public string Hash; /// Meta INI for the downloaded archive /// public string Meta; /// /// Human friendly name of this archive /// public string Name; public long Size; } [Serializable] public class NexusMod : Archive { public string Author; public string FileID; public string GameName; public string ModID; public string UploadedBy; public string UploaderProfile; public string Version; public string SlideShowPic; public string ModName; public string NexusURL; public string Summary; public bool Adult; } [Serializable] public class ManualArchive : Archive { public string URL; public string Notes; } [Serializable] public class GoogleDriveMod : Archive { public string Id; } /// /// URL that can be downloaded directly without any additional options /// [Serializable] public class DirectURLArchive : Archive { [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public List Headers; 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 Meta; public string Name; public VirtualFile File { get; internal set; } } /// /// A archive entry /// [Serializable] public class IndexedEntry { /// /// MurMur3 hash of this file /// public string Hash; /// /// Path in the archive to this file /// public string Path; /// /// 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; } }