public static MD5Check GenFromFile(string path) { MD5Check check = new MD5Check(); string content = FileOpt.ReadTextFromFile(path); if (!string.IsNullOrEmpty(content)) { string[] items = content.Split('\n'); check.md5s.AddRange(items); } return(check); }
static void SaveMd5s(string md5Path, string protoDir) { MD5Check forSave = new MD5Check(); DirectoryInfo di = new DirectoryInfo(protoDir); FileInfo[] fis = di.GetFiles("*.proto"); foreach (FileInfo fi in fis) { string md5 = MD5Check.FileMD5(fi.FullName); forSave.md5s.Add(md5); } forSave.Save(md5Path); }
static List <string> GetChangedProtoPaths(string md5Path, string protoDir) { MD5Check check = MD5Check.GenFromFile(md5Path); MD5Check forSave = new MD5Check(); List <string> paths = new List <string>(); DirectoryInfo di = new DirectoryInfo(protoDir); FileInfo[] fis = di.GetFiles("*.proto"); foreach (FileInfo fi in fis) { string md5 = MD5Check.FileMD5(fi.FullName); if (!check.md5s.Contains(md5)) { paths.Add(fi.FullName); } forSave.md5s.Add(md5); } return(paths); }