private static Project RecalculateVariables(Project openProject, string decryptionKey) { _logger.Trace("ProjectController.RecalculateVariables()"); openProject.IsNew = false; openProject.IsUnsaved = false; openProject.IsValid = true; // Decript Connection String openProject.Controller.ConnectionString = openProject.Controller.Encrypt ? StringEncryptorHelper.Decrypt(openProject.Controller.EncryptedConnectionString, decryptionKey) : openProject.Controller.EncryptedConnectionString; return(openProject); }
/// <summary> /// Saves the project to stream. /// </summary> /// <param name="project">The project.</param> /// <param name="projectStream">The project stream.</param> /// <param name="encryptionKey">The encryption key.</param> public static void SaveProjectToStream(Project project, Stream projectStream, string encryptionKey) { _logger.Trace("ProjectController.SaveProjectToStream()"); // Encrypt Connection String project.Controller.EncryptedConnectionString = project.Controller.Encrypt ? StringEncryptorHelper.Encrypt(project.Controller.ConnectionString, encryptionKey) : project.Controller.ConnectionString; using (StreamWriter streamWriter = new StreamWriter(projectStream, Encoding.UTF8)) { XmlSerializer serializer = new XmlSerializer(typeof(Project)); serializer.Serialize(streamWriter, project); } project.IsNew = false; project.IsUnsaved = false; }