using Newtonsoft.Json; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; 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; } } 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 CleanedESM : InlineFile { public string SourceESMHash; } /// /// A file that has the game and MO2 folders remapped on installation /// public class RemappedInlineFile : InlineFile { } public class FromArchive : Directive { /// /// MurMur3 hash of the archive this file comes from /// public string[] ArchiveHashPath; [JsonIgnore] public VirtualFile FromFile; private string _fullPath = null; [JsonIgnore] public string FullPath { get { if (_fullPath == null) { _fullPath = String.Join("|", ArchiveHashPath); } return _fullPath; } } } 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 string Version; } 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; } /// /// A URL that cannot be downloaded automatically and has to be downloaded by hand /// public class ManualURLArchive : Archive { public string URL; } /// /// 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 { } public class IndexedArchive { public dynamic IniData; public string Name; public string Meta; public VirtualFile File { get; internal set; } } /// /// 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; } public class IndexedArchiveEntry : IndexedEntry { public string[] HashPath; } /// /// 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; } }