Exemplo n.º 1
0
        private void ProcessFile(string path)
        {
            byte[] data = System.IO.File.ReadAllBytes(path);

            var temp = Files.Where(x => x.Path == path).FirstOrDefault();

            if (temp != null)
            {
                Files.Where(x => x.Path == path).FirstOrDefault().CRC = CRCFactory.GetCRC32(data);
            }
            else
            {
                Files.Add(new Models.File()
                {
                    Path = path,
                    CRC  = CRCFactory.GetCRC32(data),
                    Hash = MD5Hash.calculate(data)
                });
            }
        }