using LiteDB; using System; using System.Collections.Generic; using System.IO; using System.Linq; using System.Text; using System.Threading.Tasks; namespace mdfinder { /// A database helper class. public class DBHelper { #region Members /// The default database file name. private const string DEFAULT_DB_FILE_NAME = "mdfinder.db"; #endregion #region Properties /// Gets or sets the database. /// The database. private LiteDatabase Database { get; set; } /// Gets the file records. /// The file records. public LiteCollection FileRecords { get { return this.Database.GetCollection("FileRecords"); } } #endregion #region Constructors /// Default constructor. public DBHelper() { this.Database = new LiteDatabase(DEFAULT_DB_FILE_NAME); } /// Constructor. /// The database. public DBHelper(string database) { this.Database = new LiteDatabase(database); } #endregion #region Methods /// Inserts a file record. /// Full pathname of the file. /// The size. /// The hash. /// The hash provider. public void InsertFileRecord(string path, long size, string hash, string hashProvider) { this.FileRecords.Insert(new FileRecord() { Path = path, Size = size, Hash = hash, HashProvider = hashProvider }); } #endregion } }