Exemple #1
0
        private void mChecksumWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            AdlerHelper.OnUpdate += new UpdateStatusHandler(AdlerHelper_OnUpdate);

            GrfFile grf;

            byte[] buf;

            // reset progress
            mChecksumWorker.ReportProgress(0);

            // check data.grf
            try {
                grf          = new GrfFile("data.grf");
                buf          = grf.FiletableUncompressed;
                ChecksumData = AdlerHelper.Build(buf);
            } catch (Exception ex) {
                MessageBox.Show(ex.ToString(), "Client check error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                ChecksumData = 0;
            }

            // reset progress
            mChecksumWorker.ReportProgress(0);

            // cleanup
            buf = null;
            grf = null;

            // check insane.grf
            try {
                grf            = new GrfFile("rdata.grf");
                buf            = grf.FiletableUncompressed;
                ChecksumInsane = AdlerHelper.Build(buf);
            } catch (Exception ex) {
                MessageBox.Show(ex.ToString(), "Client check error", MessageBoxButtons.OK, MessageBoxIcon.Error);
                ChecksumInsane = 0;
            }

            // cleanup
            buf = null;
            grf = null;
        }
Exemple #2
0
        private void mWorker_DoWork(object sender, DoWorkEventArgs e)
        {
            string filepath  = e.Argument.ToString();
            string extension = Path.GetExtension(filepath).ToLower();

            // GRF? only check filetable
            if (extension == ".grf" || extension == ".gpf")
            {
                using (GrfFile grf = new GrfFile()) {
                    grf.ReadGrf(filepath);                     // skip files!
                    byte[] buf = grf.FiletableUncompressed;
                    AdlerHelper.Build(buf);

                    // cleanup asap
                    buf = null;
                }
            }
            else
            {
                // other file? check full path
                AdlerHelper.Build(filepath);
            }
        }