using Newtonsoft.Json; using System; using System.Collections.Generic; using Compression.BSA; using VFS; using Wabbajack.Common; using Wabbajack.Downloaders; 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; public AbstractDownloadState State { get; set; } } [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; } }