/// <summary> /// Checks the free space. /// </summary> /// <param name="repoUrl">The repo URL.</param> /// <param name="outDir">The out dir.</param> private static void CheckFreeSpace(string repoUrl, string outDir) { Logger.LogInfo("Checking free space...", false); int ourSize = (Properties.Resources.docfx.Length + Properties.Resources.mstemplate.Length) * 4 / 1024; int repoSize = 0; try { repoSize = GithubHelper.GetSizeOfRepo(repoUrl); } catch (Exception) { // ignored } DriveInfo dest = new DriveInfo(Directory.GetDirectoryRoot(outDir)); if (ourSize + repoSize > dest.AvailableFreeSpace / 1024) { Logger.LogError(Error, false); Logger.LogError(String.Format(FreeSpaceError, Path.GetPathRoot(outDir), (ourSize + repoSize) / 1024)); Exit(ExitCodeEnum.Error); } string tempPath = Path.GetTempPath(); DriveInfo system = new DriveInfo(Path.GetPathRoot(tempPath)); if (ourSize > system.AvailableFreeSpace / 1024) { Logger.LogError(Error, false); Logger.LogError(String.Format(FreeSpaceError, Path.GetPathRoot(tempPath), (ourSize / 1024))); Exit(ExitCodeEnum.Error); } Logger.LogInfo(Completed); }