using TeamHobby.HobbyProjectGenerator.DataAccess; namespace TeamHobby.HobbyProjectGenerator.Archive { public class ArchiveController { private IDataSource _conn; // Constructor to take in the connection. public ArchiveController(IDataSource dataSource) { _conn = dataSource; } // Create the folder where the compress file will be stored public bool CreateArchiveFolder(){ string curPath = Directory.GetCurrentDirectory(); //string temp = @ string archiveFolder = curPath + "\\HobbyArchive"; //Console.WriteLine("Creating a new folder at: {0}", archiveFolder); if (!Directory.Exists(archiveFolder)) { Console.WriteLine("Creating a new folder at: {0}", archiveFolder); Directory.CreateDirectory(archiveFolder); } return true; } // Return the name of the new output file with Path public string CreateOutFileName() { try { string path = Directory.GetCurrentDirectory() + "\\HobbyArchive"; Console.WriteLine("The current directory is {0}", path); string date = DateTime.Now.ToString("M_d_yyyy"); string fileName = date + "_archive.csv"; string filePath = System.IO.Path.Combine(path, fileName); Console.WriteLine("Date: {0}", date); Console.WriteLine("Filepath: {0}", filePath); return path; } catch { Console.WriteLine("ArchiveCon: Creating a file name failed. "); return ""; } } // put everything toget here public bool Controller(){ // Create the folder for Archiving CreateArchiveFolder(); // Create the file name for output CreateOutFileName(); return true; } } }