protected override void ProcessRecord() { var currentProject = _solutionManager.DefaultProject; var workingDirectory = Path.Combine(Path.GetDirectoryName(currentProject.FullName), "Content"); var compassBridge = new CompassRuntime(); var text = compassBridge.ExecuteCommandLine(workingDirectory, Command); var project = new VisualStudioProjectFacade(currentProject); foreach (var line in text) { if (line.Trim().StartsWith("directory")) { var directory = "Content/" + line.Split(' ')[1]; if (!project.Includes(directory)) { project.IncludeDirectory(directory); } } else if (line.Trim().StartsWith("create")) { var filePath = "Content/" + line.Trim().Split(' ')[1]; if (!project.Includes(filePath)) { project.IncludeFile(filePath); } } else if (line.Trim().StartsWith("identical")) { var filePath = "Content/" + line.Trim().Split(' ')[1]; if (Path.HasExtension(filePath)) { if (!project.Includes(filePath)) { project.IncludeFile(filePath); } } else { if (!project.Includes(filePath)) { project.IncludeDirectory(filePath); } } } } WriteObject(text); }
protected override void ProcessRecord() { var currentProject = _solutionManager.DefaultProject; var workingDirectory = Path.Combine(Path.GetDirectoryName(currentProject.FullName), "Content"); var compassBridge = new CompassRuntime(); var text = compassBridge.ExecuteCommandLine(workingDirectory, Command); var project = new VisualStudioProjectFacade(currentProject); foreach (var line in text) { if (line.Trim().StartsWith("directory")) { var directory = "Content/" + line.Split(' ')[1]; if (!project.Includes(directory)) { project.IncludeDirectory( directory); } } else if (line.Trim().StartsWith("create")) { var filePath = "Content/" + line.Trim().Split(' ')[1]; if(!project.Includes(filePath)) { project.IncludeFile( filePath); } } else if (line.Trim().StartsWith("identical")) { var filePath = "Content/" + line.Trim().Split(' ')[1]; if (Path.HasExtension(filePath)) { if (!project.Includes(filePath)) { project.IncludeFile( filePath); } } else { if (!project.Includes(filePath)) { project.IncludeDirectory(filePath); } } } } WriteObject(text); }