using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace Wabbajack.Common { public class RawSourceFile { public string AbsolutePath; public string Path; private string _hash; public string Hash { get { if (_hash != null) return _hash; _hash = AbsolutePath.FileSHA256(); return _hash; } set { _hash = value; } } public T EvolveTo() where T : Directive, new() { var v = new T(); v.To = Path; return v; } } public class ModList { /// /// Name of the ModList /// public string Name; /// /// Author of the Mod List /// public string Author; /// /// Version of this Mod List /// public string Version; /// /// Install directives /// public List Directives; /// /// Archives required by this modlist /// public List Archives; } public class Directive { /// /// location the file will be copied to, relative to the install path. /// public string To; } public class IgnoredDirectly : Directive { public string Reason; } public class NoMatch : IgnoredDirectly { } public class InlineFile : Directive { /// /// Data that will be written as-is to the destination location; /// public string SourceData; } public class FromArchive : Directive { /// /// MurMur3 hash of the archive this file comes from /// public string ArchiveHash; /// /// The relative path of the file in the archive /// public string From; } 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; } } public class PatchedFromArchive : FromArchive { /// /// The file to apply to the source file to patch it /// public string Patch; } 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 class NexusMod : Archive { public string GameName; public string ModID; public string FileID; } public class GoogleDriveMod : Archive { public string Id; } /// /// URL that can be downloaded directly without any additional options /// public class DirectURLArchive : Archive { public string URL; [JsonProperty(NullValueHandling = NullValueHandling.Ignore)] public List Headers; } /// /// An archive that requires additional HTTP headers. /// public class DirectURLArchiveEx : DirectURLArchive { public Dictionary Headers; } /// /// Archive that comes from MEGA /// public class MEGAArchive : DirectURLArchive { } /// /// Archive that comes from MODDB /// public class MODDBArchive : DirectURLArchive { } /// /// Archive that comes from MediaFire /// public class MediaFireArchive : DirectURLArchive { } /// /// The indexed contents of an archive /// public class IndexedArchiveCache { public string Hash; public List Entries; } public class IndexedArchive : IndexedArchiveCache { public dynamic IniData; public string Name; public string Meta; public string AbsolutePath; } /// /// A archive entry /// 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; } /// /// Data found inside a BSA file in an archive /// public class BSAIndexedEntry : IndexedEntry { /// /// MurMur3 hash of the BSA this file comes from /// public string BSAHash; } }