public static void Download(string baseDir, Config config, Credentials credentials) { Console.WriteLine("Downloading {0}.tar.gz", config.CourseRun); Download(config.Hostname, config.Port, credentials.Email, credentials.GetPassword(), config.Organization, config.CourseNumber, config.CourseRun, config.CourseRun + ".tar.gz"); ArchiveManager.ExtractTar(config.CourseRun + ".tar.gz", "."); Utils.DeleteFileIfExists(config.CourseRun + ".tar.gz"); Utils.DeleteDirectoryIfExists(baseDir + "/olx"); Directory.Move(config.CourseRun, baseDir + "/olx"); }
public static void Upload(string baseDir, string courseName, Config config, Credentials credentials) { Environment.CurrentDirectory = baseDir; Utils.DeleteDirectoryIfExists("temp"); if (Directory.Exists(courseName)) Directory.Move(courseName, "temp"); Utils.DirectoryCopy("olx", courseName, true); Utils.DeleteFileIfExists(courseName + ".tar.gz"); Console.WriteLine("Creating {0}.tar.gz...", courseName); ArchiveManager.CreateTar(courseName + ".tar.gz", courseName); Utils.DeleteDirectoryIfExists(courseName); if (Directory.Exists("temp")) Directory.Move("temp", courseName); Console.WriteLine("Uploading {0}.tar.gz...", courseName); Upload(config.Hostname, config.Port, credentials.Email, credentials.GetPassword(), config.Organization, config.CourseNumber, config.CourseRun, courseName + ".tar.gz"); Utils.DeleteFileIfExists(courseName + ".tar.gz"); }