コード例 #1
0
        private static bool IsValidMd5(string path)
        {
            if (path.EndsWith(".md5"))
            {
                return(true);
            }

            var md5File = path + ".md5";

            if (!File.Exists(md5File))
            {
                throw new InvalidOperationException($"No MD5 file was found for {path}");
            }

            var fileMd5     = File.ReadAllText(md5File);
            var computedMd5 = FileHasher.CalculateMd5(path);

            return(fileMd5 == computedMd5);
        }