public static bool VerifyFileIntegrity(NPath file, string hash) { if (!file.IsInitialized || !file.FileExists()) { return(false); } string actual = null; if (hash.Length == 32) { actual = file.ToMD5(); } else { actual = file.ToSha256(); } return(hash.Equals(actual, StringComparison.InvariantCultureIgnoreCase)); }