using System.Collections.Generic; using Newtonsoft.Json; namespace Ubisoft.Hotel.Cache { public static class Constants { internal const string MetadataFileExtension = ".cache"; internal const string SystemMetadataFile = "system" + MetadataFileExtension; internal const string GlobalMetadataFile = "_" + MetadataFileExtension; } public class CacheSettings { [JsonProperty("enabled")] public bool IsEnabled { get; set; } [JsonProperty("offline")] public bool IsOffline { get; set; } [JsonProperty("gameVersionSensitive")] public bool IsGameVersionSensitive { get; set; } [JsonProperty("invalidate")] public bool MustInvalidate { get; set; } public CacheSettings() { } public CacheSettings(bool isEnabled, bool isOffline, bool isGameVersionSensitive, bool mustInvalidate) { IsEnabled = isEnabled; IsOffline = isOffline; IsGameVersionSensitive = isGameVersionSensitive; MustInvalidate = mustInvalidate; } public override string ToString() { return $"Enabled: {IsEnabled} - Offline: {IsOffline} - GameVersionSensitive: {IsGameVersionSensitive} - MustInvalidate: {MustInvalidate}"; } } // Stores the contents of SystemMetadataFile (global information handled by Cache Manager) public class CacheSystemMetadata { public ListOfString RootSubfolders { get; set; } } public class ListOfString : List { } // Stores the contents of GlobalMetadataFile (information affecting a cache subsystem) public class CacheGlobalMetadata { public bool Invalidated { get; set; } // When CacheSettings.MustInvalidate=true, this flag indicates whether the cache has already been invalidated public string GameVersion { get; set; } // Game Version of the most recent file in a cache subsystem } // Stores the contents of .cache (metadata linked to a specific cached file) public class CacheFileMetadata { public int NumSlots { get; set; } public int ActiveSlot { get; set; } public string Crc { get; set; } public bool IsEncrypted { get; set; } public bool IsCompressed { get; set; } public long Timestamp { get; set; } } }