public ISet <TargetRelativePath> Run(IBuildContext context) { var targetDir = targetRoot.CreateDirectory(project.RelativeTargetPath); if (targetDir == null) { targetDir = targetRoot.CreateDirectory(project.RelativeTargetPath); } var sourceSet = project.GetSourceSet("scr"); var result = new HashSet <TargetRelativePath>(); foreach (var file in sourceSet.Files) { log.DebugFormat("Processing {0}", file); using (var reader = suiteRoot.ReadTextFile(file)) { var contents = reader.ReadToEnd(); var msg = String.Format("Hello {0}!!!", contents); var fileName = Path.GetFileName(file); using (var writer = targetDir.CreateTextFile(fileName + ".txt")) writer.WriteLine(msg); result.Add(new TargetRelativePath(project.RelativeTargetPath, fileName + ".txt")); } } return(result); }
public SimplePythonPostProcessorScript(SuiteRelativePath scriptPath, [SuiteRoot] IFileSystemDirectory suiteRoot) { name = Path.GetFileNameWithoutExtension(scriptPath); using (var reader = suiteRoot.ReadTextFile(scriptPath)) { script = reader.ReadToEnd(); } }
private bool IsDllDataC(SuiteRelativePath path) { // DllData.c is a special file generated by MIDL var fileName = Path.GetFileName(path); if (fileName != null && fileName.ToLowerInvariant() == "dlldata.c") { using (var reader = sourceSetRoot.ReadTextFile(GetSourceSetRelativePath(path))) { var contents = reader.ReadToEnd(); if (contents.StartsWith(dllDataCHeader)) { return(true); } } } return(false); }
private void InitializeFromCache() { if (cacheRoot.Exists("guids")) { using (var reader = cacheRoot.ReadTextFile("guids")) { string line = reader.ReadLine(); while (line != null) { string[] parts = line.Split('='); var project = FindProject(parts[0]); if (project != null) { map.Add(project, Guid.Parse(parts[1])); } line = reader.ReadLine(); } } } }
private TargetRelativePath GenerateAddonSupportFile(string solutionName) { string contents = AddonSupportData(); var path = new TargetRelativePath("", solutionName + ".yaml"); bool writeFile = true; if (targetRoot.Exists(path.RelativePath)) { using (var reader = targetRoot.ReadTextFile(path.RelativePath)) { string existingContents = reader.ReadToEnd(); writeFile = existingContents != contents; } } if (writeFile) { using (var writer = targetRoot.CreateTextFile(path.RelativePath)) writer.WriteLine(contents); } return(path); }