ChecksumHelper 类
- 命名空间
- ClassIsland.Core.Helpers
- 程序集
- ClassIsland.Core.dll
校验和相关工具。
public static class ChecksumHelper
- 继承
-
ChecksumHelper
- 继承成员
方法
CheckChecksum(string, string)
检查文件是否符合指定的 MD5 校验和。如果校验通过,则返回 true。
public static bool CheckChecksum(string filePath, string checksum)
参数
返回
- bool
校验结果
ExtractHashInfo(string, string)
从发行日志中提取校验和。
可以被此方法提取的校验和信息字典(键为文件名,值为MD5校验和)包裹在以 CLASSISLAND_PKG_MD5 开头的注释标签中,并以 json 格式存储,例如:
<!-- CLASSISLAND_PKG_MD5 {"ClassIsland.zip":"5D413B24956724B004B1069C0AA6B3DE"} -->
public static string ExtractHashInfo(string releaseNote, string artifactKey)
参数
返回
- string
提取的MD5校验和(十六进制)
VerifyChecksum(string, string)
检查文件是否符合指定的 MD5 校验和。如果校验不通过,则抛出 ChecksumUnMatchException 异常。
public static void VerifyChecksum(string filePath, string checksum)
参数
异常
- ChecksumUnMatchException
校验和校验不通过时抛出此异常。