private string GetOutput(Manifest manifest) { if (_printManifest) { string result = manifest.ToString(); if (_printDigest) { result += Environment.NewLine + manifest.CalculateDigest(); } return(result); } else { return(manifest.CalculateDigest()); } }
private string GetOutput(Manifest manifest) { if (_printManifest) { string result = manifest.ToString().TrimEnd('\n'); if (_printDigest) { result += "\n" + manifest.CalculateDigest(); } return(result); } else { return(manifest.CalculateDigest()); } }
/// <summary> /// Checks whether a <see cref="Manifest"/> matches the expected digest. /// Returns the original manifest or one with backwards-compatability modifications applied if it matches. /// </summary> /// <param name="manifest">The manifest to check.</param> /// <param name="expectedDigest">The expected digest.</param> /// <returns>The <see cref="Manifest"/> if it matches; <c>null</c> otherwise.</returns> internal static Manifest?Verify(Manifest manifest, string expectedDigest) { if (manifest.CalculateDigest() == expectedDigest) { return(manifest); } for (var offset = TimeSpan.FromHours(-27); offset <= TimeSpan.FromHours(27); offset += TimeSpan.FromMinutes(15)) { Log.Debug($"Attempting to correct digest mismatch by shifting timestamps by {offset} and rounding."); var offsetManifest = manifest.WithOffset(offset); if (offsetManifest.CalculateDigest() == expectedDigest) { Log.Info($"Expected digest {expectedDigest} but got mismatch. Fixed by shifting timestamps by {offset} and rounding."); return(offsetManifest); } } return(null); }
private string GetOutput(Manifest manifest) { if (_printManifest) { string result = manifest.ToString().TrimEnd('\n'); if (_printDigest) result += "\n" + manifest.CalculateDigest(); return result; } else return manifest.CalculateDigest(); }
private string GetOutput(Manifest manifest) { if (_printManifest) { string result = manifest.ToString(); if (_printDigest) result += Environment.NewLine + manifest.CalculateDigest(); return result; } else return manifest.CalculateDigest(); }