public DiffContentFetcher(PullRequestLocator pullRequestLocator, IFileContentPersist fileContentPersist, IGitHubClient client, IPatchService patchService) { _pullRequestLocator = pullRequestLocator; _fileContentPersist = fileContentPersist; _client = client; _patchService = patchService; }
public DiffContentFetcher(PullRequestLocator pullRequestLocator, IFileContentPersist fileContentPersist, IPatchService patchService, IFileContentRetriever fileContentRetriever) { _pullRequestLocator = pullRequestLocator; _fileContentPersist = fileContentPersist; _patchService = patchService; _fileContentRetriever = fileContentRetriever; }
public static string GetPullRequestDir(PullRequestLocator prInfo) { var prDir = Path.Combine(Path.GetTempPath(), "PR" + prInfo.PullRequestNumber); if (!Directory.Exists(prDir)) { Directory.CreateDirectory(prDir); } return(prDir); }
private static string GetFilePath(PullRequestLocator prInfo, string fileName) { var prDir = GetPullRequestDir(prInfo); var filePath = Path.Combine(prDir, fileName); var fileDir = Path.GetDirectoryName(filePath); if (!Directory.Exists(fileDir)) { Directory.CreateDirectory(fileDir); } return(filePath); }
public async Task <string> SaveContent(PullRequestLocator prInfo, string fileName, string content) { try { var filePath = GetFilePath(prInfo, fileName); using (var stream = new FileStream(filePath, FileMode.Create)) { using (var streamWriter = new StreamWriter(stream)) { await streamWriter.WriteAsync(content); } } return(filePath); } catch (Exception ex) { throw new FailedToSaveContent(ex); } }
public string GetCachedFilePath(PullRequestLocator prInfo, string fileName) { var filePath = GetFilePath(prInfo, fileName); return(filePath); }
public bool ExistsInCached(PullRequestLocator prInfo, string fileName) { return(false); }