private void SerializeDefaultObject() { //PMAInfo pmaInfo = new PMAInfo(); pmaInfo.MailingTime = DateTime.Now.ToString("d/M/yyyy HH:mm"); pmaInfo.ReportsIntervalHours = 12; pmaInfo.ClientName = System.Environment.MachineName; pmaInfo.DisposeLogFile = false; pmaInfo.TriggerSeed = 20; pmaInfo.UseFTP = true; pmaInfo.UseSMTP = false; // EMAIL INFO emailsInfo = new Emails(); emailsInfo.EmailTo = new List<string>(); emailsInfo.EmailTo.Add("*****@*****.**"); emailsInfo.EmailCC = new List<string>(); emailsInfo.EmailCC.Add("*****@*****.**"); emailsInfo.AttachmentPath = ""; emailsInfo.Subject = "Server Report"; emailsInfo.BodyContent = "Please Find the Report Attached"; // SMTP Info smtpInfo = new SmtpInfo(); smtpInfo.ProtectPassword = true; smtpInfo.UserName = "******"; smtpInfo.Password = "******"; smtpInfo.Port = 587; smtpInfo.SmtpServer = "smtp.gmail.com"; smtpInfo.SSL = true; smtpInfo.TimeOut = 100000; //FTP Info ftpInfo = new FTPInfo(); ftpInfo.FTPServer = "ftp://202.54.213.231"; ftpInfo.FTPServerFolder = "PerformanceReports"; ftpInfo.Password = "******"; ftpInfo.Port = 21; ftpInfo.ProtectPassword = true; ftpInfo.SSL = false; ftpInfo.TimeOut = 100000; ftpInfo.UserName = "******"; SerializedInfo(); }
//-------------------------------------------------------------------------------------------- /// <summary> /// Initilizes the PMA object. /// </summary> private void InitilizePMAObject() { if (PMAInfoObj == null) { if (File.Exists(Path.Combine(CurrentAppConfigDir, PMAInfo.PMA_INFO_FILE))) { PMAInfoObj = PMAInfo.Deserialize(File.ReadAllText(Path.Combine(CurrentAppConfigDir, PMAInfo.PMA_INFO_FILE))); } else { PMAInfoObj = new PMAInfo(); PMAInfoObj.MailingTime = DateTime.Now; PMAInfoObj.TriggerSeed = 1; PMAInfoObj.ReportsIntervalHours = 1; } } }
private void DeserilizeObjects() { try { pmaInfo = PMAInfo.Deserialize(File.ReadAllText(Path.Combine(configManager.CurrentAppConfigDir, PMAInfo.PMA_INFO_FILE))); emailsInfo = Emails.Deserialize(File.ReadAllText(Path.Combine(configManager.CurrentAppConfigDir, Emails.EMAILS_INFO_FILE))); smtpInfo = SmtpInfo.Deserialize(File.ReadAllText(Path.Combine(configManager.CurrentAppConfigDir, SmtpInfo.SMTP_INFO_FILE))); ftpInfo = FTPInfo.Deserialize(File.ReadAllText(Path.Combine(configManager.CurrentAppConfigDir, FTPInfo.FTP_INFO_FILE))); } catch(Exception ex) { throw ex; } }