public void ImportFile(string inputPath) { if (!File.Exists(inputPath)) { throw new ArgumentException("Path does not exist", inputPath); } List <string> data = null; string nextLine = string.Empty; bool result = true; MailboxLogEntry entry = null; using (StreamReader reader = new StreamReader(inputPath)) { while (!reader.EndOfStream) { result = TryReadNextLogEntry(reader, nextLine, out data, out nextLine); if (!result && this.LogEntries.Count == 0) { return; } if (MailboxLogEntry.Initialize(this, data.ToArray(), out entry)) { if (!IsLogEntryInCollection(entry)) { this.LogEntries.Add(entry); } } } } }
private bool IsLogEntryInCollection(MailboxLogEntry newEntry) { var match = from entry in this.LogEntries where entry.Identifier == newEntry.Identifier select entry; return(match.Count <MailboxLogEntry>() > 0); }
public static bool Initialize(MailboxLog parent, string[] lines, out MailboxLogEntry entry) { entry = new MailboxLogEntry(parent); entry.InitializeReally(lines); return(true); }