private static void CopyFiles(Assignment assignment, Submit submit, string teamSubmitDirName, SystemSettings systemSettings) { MoCS.BuildService.Business.FileSystemWrapper fileSystem = new Business.FileSystemWrapper(); // Copy nunit.framework.dll to this directory fileSystem.FileCopy(Path.Combine(systemSettings.NunitAssemblyPath, "nunit.framework.dll"), Path.Combine(teamSubmitDirName, "nunit.framework.dll"), true); //copy the file to this directory using (Stream target = fileSystem.FileOpenWrite(Path.Combine(teamSubmitDirName, submit.FileName))) { try { target.Write(submit.Data, 0, submit.Data.Length); } finally { target.Flush(); } } // Copy the interface file //delete the file if it existed already AssignmentFile interfaceFile = assignment.AssignmentFiles.Find(af => af.Name == "InterfaceFile"); fileSystem.DeleteFileIfExists(Path.Combine(teamSubmitDirName, interfaceFile.FileName)); fileSystem.FileCopy(Path.Combine(assignment.Path, interfaceFile.FileName), Path.Combine(teamSubmitDirName, interfaceFile.FileName)); //copy the server testfile //delete the file if it existed already AssignmentFile serverTestFile = assignment.AssignmentFiles.Find(af => af.Name == "NunitTestFileServer"); fileSystem.DeleteFileIfExists(Path.Combine(teamSubmitDirName, serverTestFile.FileName)); fileSystem.FileCopy(Path.Combine(assignment.Path, serverTestFile.FileName), Path.Combine(teamSubmitDirName, serverTestFile.FileName)); //copy additional serverfiles List <AssignmentFile> serverFilesToCopy = assignment.AssignmentFiles.FindAll(af => af.Name == "ServerFileToCopy"); foreach (AssignmentFile serverFileToCopy in serverFilesToCopy) { fileSystem.DeleteFileIfExists(Path.Combine(teamSubmitDirName, serverFileToCopy.FileName)); fileSystem.FileCopy(Path.Combine(assignment.Path, serverFileToCopy.FileName), Path.Combine(teamSubmitDirName, serverFileToCopy.FileName)); } //copy the client testfile AssignmentFile clientTestFile = assignment.AssignmentFiles.Find(af => af.Name == "NunitTestFileClient"); //delete the file if it existed already fileSystem.DeleteFileIfExists(Path.Combine(teamSubmitDirName, clientTestFile.FileName)); fileSystem.FileCopy(Path.Combine(assignment.Path, clientTestFile.FileName), Path.Combine(teamSubmitDirName, clientTestFile.FileName)); }
private static string CreateTeamDirectory(SystemSettings sysSettings, string teamName, Assignment assignment) { MoCS.BuildService.Business.FileSystemWrapper fileSystem = new Business.FileSystemWrapper(); string resultBasePath = ConfigurationManager.AppSettings["ResultBasePath"]; if (!resultBasePath.EndsWith(@"\")) { resultBasePath += @"\"; } //prepare processing //create a new directory for the basepath fileSystem.CreateDirectoryIfNotExists(resultBasePath); //create a directory for the assignment fileSystem.CreateDirectoryIfNotExists(resultBasePath + assignment.Name); string teamDirName = teamName + "_" + DateTime.Now.ToString("ddMMyyyy_HHmmss"); string teamSubmitDirName = resultBasePath + assignment.Name + @"\" + teamDirName; //create a new directory for the teamsubmit fileSystem.CreateDirectory(teamSubmitDirName); return(teamSubmitDirName); }
private static void CleanupFiles(string teamSubmitDirName) { MoCS.BuildService.Business.FileSystemWrapper fileSystem = new Business.FileSystemWrapper(); fileSystem.FileDelete(Path.Combine(teamSubmitDirName, "nunit.framework.dll")); }
private static void CopyFiles(Assignment assignment, Submit submit, string teamSubmitDirName, SystemSettings systemSettings) { MoCS.BuildService.Business.FileSystemWrapper fileSystem = new Business.FileSystemWrapper(); // Copy nunit.framework.dll to this directory fileSystem.FileCopy(Path.Combine(systemSettings.NunitAssemblyPath, "nunit.framework.dll"), Path.Combine(teamSubmitDirName, "nunit.framework.dll"), true); //copy the file to this directory using (Stream target = fileSystem.FileOpenWrite(Path.Combine(teamSubmitDirName, submit.FileName))) { try { target.Write(submit.Data, 0, submit.Data.Length); } finally { target.Flush(); } } // Copy the interface file //delete the file if it existed already AssignmentFile interfaceFile = assignment.AssignmentFiles.Find(af => af.Name == "InterfaceFile"); fileSystem.DeleteFileIfExists(Path.Combine(teamSubmitDirName, interfaceFile.FileName)); fileSystem.FileCopy(Path.Combine(assignment.Path, interfaceFile.FileName), Path.Combine(teamSubmitDirName, interfaceFile.FileName)); //copy the server testfile //delete the file if it existed already AssignmentFile serverTestFile = assignment.AssignmentFiles.Find(af => af.Name == "NunitTestFileServer"); fileSystem.DeleteFileIfExists(Path.Combine(teamSubmitDirName, serverTestFile.FileName)); fileSystem.FileCopy(Path.Combine(assignment.Path, serverTestFile.FileName), Path.Combine(teamSubmitDirName, serverTestFile.FileName)); //copy additional serverfiles List<AssignmentFile> serverFilesToCopy = assignment.AssignmentFiles.FindAll(af => af.Name == "ServerFileToCopy"); foreach (AssignmentFile serverFileToCopy in serverFilesToCopy) { fileSystem.DeleteFileIfExists(Path.Combine(teamSubmitDirName, serverFileToCopy.FileName)); fileSystem.FileCopy(Path.Combine(assignment.Path, serverFileToCopy.FileName), Path.Combine(teamSubmitDirName, serverFileToCopy.FileName)); } //copy the client testfile AssignmentFile clientTestFile = assignment.AssignmentFiles.Find(af => af.Name == "NunitTestFileClient"); //delete the file if it existed already fileSystem.DeleteFileIfExists(Path.Combine(teamSubmitDirName, clientTestFile.FileName)); fileSystem.FileCopy(Path.Combine(assignment.Path, clientTestFile.FileName), Path.Combine(teamSubmitDirName, clientTestFile.FileName)); }
private static string CreateTeamDirectory(SystemSettings sysSettings, string teamName, Assignment assignment) { MoCS.BuildService.Business.FileSystemWrapper fileSystem = new Business.FileSystemWrapper(); string resultBasePath = ConfigurationManager.AppSettings["ResultBasePath"]; if (!resultBasePath.EndsWith(@"\")) { resultBasePath += @"\"; } //prepare processing //create a new directory for the basepath fileSystem.CreateDirectoryIfNotExists(resultBasePath); //create a directory for the assignment fileSystem.CreateDirectoryIfNotExists(resultBasePath + assignment.Name); string teamDirName = teamName + "_" + DateTime.Now.ToString("ddMMyyyy_HHmmss"); string teamSubmitDirName = resultBasePath + assignment.Name + @"\" + teamDirName; //create a new directory for the teamsubmit fileSystem.CreateDirectory(teamSubmitDirName); return teamSubmitDirName; }