public LeagueRADSInstallation(string managerInstallationFolder, string gameFolder, LeagueRADSDeployRules deployRules) : base(managerInstallationFolder, gameFolder)
 {
     if (!Directory.Exists(gameFolder + "/RADS"))
     {
         throw new InvalidRADSInstallationException("RADS folder doesn't exist.");
     }
     else if (!Directory.Exists(gameFolder + "/RADS/projects"))
     {
         throw new InvalidRADSInstallationException("projects folder doesn't exist.");
     }
     this.LoadProjects();
     this.DeployRules = deployRules;
 }
        public void InstallFile(string gamePath, string filePath, LeagueRADSDeployRules deployRules)
        {
            FileInfo fileToInstall = new FileInfo(filePath);

            // Getting the matching file entry (null if new file)
            ReleaseManifestFileEntry fileEntry = this.GameManifest.GetFile(gamePath, false);

            // File is already installed, don't install it again
            byte[] fileMD5 = LeagueInstallation.CalculateMD5(filePath);
            if (fileEntry != null && fileEntry.MD5.SequenceEqual(fileMD5))
            {
                return;
            }

            // Finding the deploy mode to use
            ReleaseManifestFile.DeployMode deployMode = deployRules.GetTargetDeployMode(this.Project.Name, fileEntry);

            // Installing file
            string installPath = Project.GetFileInstallationPath(gamePath, deployMode, LeagueRADSInstallation.FantomeFilesVersion);

            Directory.CreateDirectory(Path.GetDirectoryName(installPath));
            if (fileEntry != null && (deployMode == ReleaseManifestFile.DeployMode.Deployed4 || deployMode == ReleaseManifestFile.DeployMode.Deployed0))
            {
                // Backup deployed file
                BackupFile(fileEntry, installPath);
            }

            File.Copy(filePath, installPath, true);

            // Setting manifest values
            if (fileEntry == null)
            {
                fileEntry = this.GameManifest.GetFile(gamePath, true);
            }
            fileEntry.MD5            = fileMD5;
            fileEntry.DeployMode     = deployMode;
            fileEntry.SizeRaw        = (int)fileToInstall.Length;
            fileEntry.SizeCompressed = fileEntry.SizeRaw;
            fileEntry.Version        = LeagueRADSInstallation.FantomeFilesVersion;
            this.HasChanged          = true;
        }