Exemplo n.º 1
0
        private void VerifyIntegrity()
        {
            Log.Info("Verifying game integrity...");

            List <string> queue = new List <string>();

            foreach (string filePath in Directory.GetFileSystemEntries(Launcher.Instance.GtaPath))
            {
                string file = Path.GetFileName(filePath);
                if (GameScanner.CanFileBeVerified(file))
                {
                    queue.Add(file);
                }
            }

            if (queue.Count == GameScanner.CheckableFileCount)
            {
                this.SetBarMaximum(queue.Count);

                Log.Info("Verifying integrity of " + queue.Count + " files...");

                this.integrityVerified = true;

                foreach (string file in queue)
                {
                    Log.Info("Verifying integrity of " + file + "...");
                    this.SetState(file);

                    if (GameScanner.CalculateFileHash(file) != GameScanner.GetVanillaFileHash(file))
                    {
                        this.integrityVerified = false;
                        break;
                    }

                    this.IncrBarValue();
                }
            }
            else
            {
                Log.Info("Found " + queue.Count + " checkable files instead of " + GameScanner.CheckableFileCount + '.');
                this.integrityVerified = false;
            }

            this.Conclude();
        }