public void Prepare(CancellationToken token) { Debug.Assert(this.SolutionFullPath != null, "Expected to be initialized"); foreach (var keyValue in this.bindingConfigInformationMap) { if (token.IsCancellationRequested) { return; } var info = keyValue.Value; sourceControlledFileSystem.QueueFileWrites(info.SolutionLevelFilePaths, () => { foreach (var solutionItem in info.SolutionLevelFilePaths) { var ruleSetDirectoryPath = Path.GetDirectoryName(solutionItem); fileSystem.Directory.CreateDirectory(ruleSetDirectoryPath); // will no-op if exists } info.Save(); return(true); }); Debug.Assert(sourceControlledFileSystem.FilesExistOrQueuedToBeWritten(info.SolutionLevelFilePaths), "Expected solution items to be queued for writing"); } foreach (var project in projects) { if (token.IsCancellationRequested) { return; } var languageForProject = ProjectToLanguageMapper.GetLanguageForProject(project); var bindingConfigFile = GetBindingConfig(languageForProject); var projectBinder = projectBinderFactory.Get(project); var bindAction = projectBinder.GetBindAction(bindingConfigFile, project, token); projectBinders.Add(bindAction); } }
/// <summary> /// Queues a write operation for a file path. New or edit is evaluated at the time of this method execution. /// </summary> /// <param name="filePath">File path that want to write to</param> /// <param name="fileWriteOperation">The actual write operation, return false if failed</param> public static void QueueFileWrite(this ISourceControlledFileSystem sourceControlledFile, string filePath, Func <bool> fileWriteOperation) { sourceControlledFile.QueueFileWrites(new List <string> { filePath }, fileWriteOperation); }