/// <inheritdoc/> public async Task <IPullRequestSessionFile> GetFile( string relativePath, IEditorContentSource contentSource) { await getFilesLock.WaitAsync(); try { PullRequestSessionFile file; relativePath = relativePath.Replace("\\", "/"); if (!fileIndex.TryGetValue(relativePath, out file)) { // TODO: Check for binary files. file = await CreateFile(relativePath, contentSource); fileIndex.Add(relativePath, file); } else if (contentSource != null && file.ContentSource != contentSource) { file.ContentSource = contentSource; await UpdateEditorContent(relativePath); } return(file); } finally { getFilesLock.Release(); } }
async Task <PullRequestSessionFile> CreateFile( string relativePath, IEditorContentSource contentSource) { var file = new PullRequestSessionFile(relativePath); file.ContentSource = contentSource; await UpdateFile(file); return(file); }