This project has moved and is read-only. For the latest updates, please go here.

Downloaded file validation

Mar 24, 2014 at 7:24 AM
I you need to validate the downloaded file do as following:
  1. Add a CRC field to your update definition XML file
  2. Fill CRC with checksum ( see below)
  3. In DownloadUpdateDialog.OnDownloadComplete check if downloaded file checksum fits the one defined in XML
private static string GetChecksum(string file)
        using (FileStream stream = File.OpenRead(file))

            SHA256Managed sha = new SHA256Managed();
            byte[] checksum = sha.ComputeHash(stream);
            return BitConverter.ToString(checksum).Replace("-", String.Empty);