public async Task <string> GetFileText(string webRootPath) { var shellRobotsFile = System.IO.Path.Combine(webRootPath, "StaticRobots.txt"); if (!fileInfoHelper.FileExists(shellRobotsFile)) { return(string.Empty); } var shellRobotsText = await fileInfoHelper.ReadAllTextAsync(shellRobotsFile).ConfigureAwait(false); return(!string.IsNullOrWhiteSpace(shellRobotsText) ? shellRobotsText : string.Empty); }
private string GetFileHash(string file) { if (fileInfoHelper.FileExists(file)) { using (var md5 = MD5.Create()) { using (var stream = fileInfoHelper.GetStream(file)) { return(BitConverter.ToString(md5.ComputeHash(stream)) .Replace("-", string.Empty, StringComparison.OrdinalIgnoreCase)); } } } else { return(string.Empty); } }