private void dgProjects_Drop(object sender, System.Windows.DragEventArgs e) { if (e.Data.GetDataPresent(System.Windows.DataFormats.FileDrop)) { Config.Projects.Clear(); string[] droppedFilePaths = e.Data.GetData(System.Windows.DataFormats.FileDrop, true) as string[]; foreach (string droppedFilePath in droppedFilePaths) { //only accept directories if folder if (Directory.Exists(@droppedFilePath)) { //scan for project type try { Project project = new Project() { Name=System.IO.Path.GetFileNameWithoutExtension(droppedFilePath), Path = droppedFilePath, ProjectType=getProjectType(droppedFilePath) }; Config.Projects.Add(project); } catch(Exception ex) { System.Windows.MessageBox.Show(ex.Message); } } if (Config != null) { if ((!String.IsNullOrEmpty(Config.SubmitPath)) && (Config.StopTime!=null) && (Config.Projects.Count > 0)) { IsSaveable = true; } else { IsSaveable = false; } } } } }
private void openProjectJava(Project project) { //cmd.StandardInput.WriteLine(@"""C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\devenv.exe"" ""C:\Users\tdh\Documents\Visual Studio 2010\Projects\TestSystem\TestSystem.sln"""); }
private void openProjectVS(Project project) { try { //find .sln string[] VSFiles = Directory.GetFiles(@project.Path, "*.sln", SearchOption.AllDirectories); if (VSFiles.Length > 0) { //open the sln in vs2010 //create the process Process process = new Process(); ProcessStartInfo startinfo = new ProcessStartInfo(); startinfo.FileName = VISUAL_STUDIO_PATH; startinfo.Arguments = @VSFiles[0]; process.StartInfo = startinfo; process.Start(); //add to process list processes.Add(process); } } catch (Exception ex) { MessageBox.Show("Error opening project, call the admin"); } }
private void copyProjects() { //create/clean temp test folder if (!Directory.Exists(localPath)) { //folder doesn't exist, so create Directory.CreateDirectory(localPath); } else { //for some reason folder already there, so delete everything in it.. //TODO create backup folder in case something goes wrong DirectoryInfo directory = new DirectoryInfo(localPath); foreach (System.IO.FileInfo file in directory.GetFiles()) file.Delete(); foreach (System.IO.DirectoryInfo subDirectory in directory.GetDirectories()) subDirectory.Delete(true); } //copy projects to new test folder for (int x = 0; x < RemoteProjects.Count; x++) { if (RemoteProjects[x].ProjectType == ProjectType.VS) { //create all of the subdirectores foreach (string dirPath in Directory.GetDirectories(RemoteProjects[x].Path, "*", SearchOption.AllDirectories)) Directory.CreateDirectory(dirPath.Replace(RemoteProjects[x].Path, System.IO.Path.Combine(localPath, RemoteProjects[x].Name))); //copy all the files foreach (string newPath in Directory.GetFiles(RemoteProjects[x].Path, "*.*", SearchOption.AllDirectories)) File.Copy(newPath, newPath.Replace(RemoteProjects[x].Path, System.IO.Path.Combine(localPath, RemoteProjects[x].Name))); } //create local project string remoteProjectDirectoryName = System.IO.Path.GetFileName(RemoteProjects[x].Path); string localProjectPath = System.IO.Path.Combine(localPath, remoteProjectDirectoryName); Project localProject = new Project() { Name = RemoteProjects[x].Name, Path = localProjectPath, ProjectType = RemoteProjects[x].ProjectType }; //add to list of local projects LocalProjects.Add(localProject); } }