コード例 #1
0
ファイル: Log.cs プロジェクト: onesimoh/Andamio
        /// <summary>
        /// Loads the content of the Log from Sqlite.
        /// </summary>
        /// <param name="xmlReader">The XmlReader instance containing the data.</param>
        public void LoadSqlite(string filePath)
        {
            if (filePath.IsNullOrBlank()) throw new ArgumentNullException("filePath");
            if (!File.Exists(filePath)) throw new FileNotFoundException(String.Format("Specified File '{0}' not found.", filePath), filePath);

            using (SqliteDataContext context = new SqliteDataContext(filePath))
            {
                LogEvents logEvents = new LogEvents(context.LogEvents);
                Entries.AddRange(logEvents.Select(logEvent => (LogEntry) logEvent));
            }
        }