using System; using System.IO; using API.Entities.Enums; namespace API.Entities { /// /// Represents a wrapper to the underlying file. This provides information around file, like number of pages, format, etc. /// public class MangaFile { public int Id { get; set; } /// /// Absolute path to the archive file /// public string FilePath { get; set; } /// /// Number of pages for the given file /// public int Pages { get; set; } public MangaFormat Format { get; set; } /// /// Last time underlying file was modified /// /// This gets updated anytime the file is scanned public DateTime LastModified { get; set; } // Relationship Mapping public Chapter Chapter { get; set; } public int ChapterId { get; set; } /// /// Updates the Last Modified time of the underlying file to the LastWriteTime /// public void UpdateLastModified() { LastModified = File.GetLastWriteTime(FilePath); } } }