/// <summary> /// TODO: Comment /// </summary> public Connector() { active = false; Message = new EventMessage(); config = Config.Deserialize(); queue = Queues.Deserialize(); mailboxes = Mailboxes.Deserialize(); // Load the log level from teh config. LogLevel = config.Defaults.LogLevel; // Inilize polling clock, used for retrieving email from POP and IMAP servers. tick = new System.Timers.Timer(); tick.Interval = config.Settings.TickInterval * 1000; //tick.Interval = 500; tick.Elapsed += onTickElapsed; // Initialize system clock, used for sending ActivityLogs, ErrorLogs, and Notifications to mail administrators. tock = new System.Timers.Timer(); tock.Interval = config.Settings.TockInterval * 1000; tock.Elapsed += onTockElapsed; }
public static Mailboxes Deserialize() { string mailboxFile = @"c:\ProgramData\MailLink\mailbox.xml"; if (!File.Exists(mailboxFile)) { Mailboxes m = new Mailboxes(); m.Create(); m.Serialize(); return(m); } else { using (FileStream fs = new FileStream(mailboxFile, FileMode.Open)) { XmlSerializer xml = new XmlSerializer(typeof(Mailboxes)); Mailboxes m = (Mailboxes)xml.Deserialize(fs); fs.Close(); return(m); } } }