/// <summary> /// Get list of files for a particular commit /// </summary> /// <param name="repoDirPath"></param> /// <param name="gitHubForkName"></param> /// <param name="gitHubRepoName"></param> /// <param name="refCommit"></param> /// <returns></returns> public IEnumerable <String> GetDownloadUrlForFilesUnderDirectory(String repoDirPath, String gitHubForkName, String gitHubRepoName, String refCommit) { try { return(OctoClient.Repository.Content.GetAllContentsByRef(gitHubForkName, gitHubRepoName, repoDirPath, refCommit).Result.Select(item => item.DownloadUrl)); } catch (Exception ex) { UtilLogger.LogException(ex); throw; } }
public string GetTempDirPath(string seedDirPath = "", string GIT_DIR_POSTFIX = "") { string newDir = "FSUtil"; int tempDirCount = 0; string initialTempDirPath = string.Empty; if (!string.IsNullOrWhiteSpace(seedDirPath)) { if (Directory.Exists(seedDirPath)) { initialTempDirPath = seedDirPath; } } if (string.IsNullOrWhiteSpace(initialTempDirPath)) { initialTempDirPath = Path.GetTempPath(); initialTempDirPath = Path.Combine(initialTempDirPath, newDir); } string tempFileName = Path.GetFileNameWithoutExtension(Path.GetTempFileName()); tempFileName = string.Concat(tempFileName, GIT_DIR_POSTFIX); string tempDir = Path.Combine(initialTempDirPath, tempFileName); while (DirFileExists(tempDir) && tempDirCount < TEMP_DIR_COUNT) { tempFileName = string.Concat(Path.GetFileNameWithoutExtension(Path.GetTempFileName()), GIT_DIR_POSTFIX); tempDir = Path.Combine(Path.GetTempFileName(), tempFileName); tempDirCount++; } if (tempDirCount >= TEMP_DIR_COUNT) { ApplicationException appEx = new ApplicationException(string.Format("Cleanup temp directory. More than '{0}' directories detected with similar naming pattern: '{1}", TEMP_DIR_COUNT.ToString(), tempDir)); UtilLogger.LogException(appEx); } if (!Directory.Exists(tempDir)) { Directory.CreateDirectory(tempDir); } return(tempDir); }