public static BackupConfig GetBackupConfig() { if (File.Exists(Helper.AppConstants.UiConfigSavedPath + Helper.AppConstants.BackupConfigFileName)) { var EncryptedXml = File.ReadAllText(Helper.AppConstants.UiConfigSavedPath + Helper.AppConstants.BackupConfigFileName); var DecryptedXml = CipherUtil.Decrypt(EncryptedXml, Helper.AppConstants.CipherKey); var ObjBackConfig = Helper.XmlStringToObject <BackupConfig>(DecryptedXml); return(ObjBackConfig); } else { return(new BackupConfig()); } }
public static void DatabaseBackupLog(BackupSuccessLog objBackupSuccessLog) { try { var CurrentDirectory = Helper.AppConstants.ServiceConfigSavedPath + DateTime.Now.ToString("MMMM") + "\\"; if (!Directory.Exists(CurrentDirectory)) { Directory.CreateDirectory(CurrentDirectory); } var XmlString = Helper.ToXml(objBackupSuccessLog); var EncryptedXml = CipherUtil.Encrypt(XmlString, Helper.AppConstants.CipherKey); File.WriteAllText(CurrentDirectory + Helper.TimeStamp + ".dat", EncryptedXml); } catch (Exception ex) { log.Error(ex); } }
public static MailConfig GetMailConfig() { var MailConfigPath = Helper.GetMailConfigPathForService; if (File.Exists(MailConfigPath)) { if (File.Exists(MailConfigPath)) { var EncryptedXml = File.ReadAllText(MailConfigPath); var DecryptedXml = CipherUtil.Decrypt(EncryptedXml, Helper.AppConstants.CipherKey); var ObjBackConfig = Helper.XmlStringToObject <MailConfig>(DecryptedXml); return(ObjBackConfig); } else { return(new MailConfig()); } } else { Log.Error("Mail config file does not exist or corrupted."); return(new MailConfig()); } }