Пример #1
0
 void DownloadAndInstallCommunityPatch(IronFrontInfo spec, string patchFile)
 {
     using (new TmpDirectory(spec.TempPath)) {
         Status(patchFile, spec.Status,
                status => DownloadAndInstallCommunityPatchInternal(patchFile, spec.TempPath, status, spec.GamePath));
     }
 }
Пример #2
0
        void PatchFrom3(IronFrontInfo ifaSpec)
        {
            var esd = !ConfirmChecksum(ifaSpec.IronFrontExePath, OfficialGameInfo.Disk3ExeSha);

            InstallOfficialPatch3To4(ifaSpec, esd);
            InstallOfficialPatch4To5(ifaSpec, esd);
        }
Пример #3
0
 void ApplyLatestPatches(IronFrontInfo spec)
 {
     if (!GetGameLatestPatchedStatus(spec))
     {
         HandleGameCommunityPatches(spec);
     }
     if (GetDlcInstalledStatus(spec) && !GetDlcLatestPatchedStatus(spec))
     {
         HandleDlcCommunityPatches(spec);
     }
 }
Пример #4
0
        public bool ConfirmPatchedToLatestVersion(IronFrontInfo spec)
        {
            var gamePatched = GetGameLatestPatchedStatus(spec);

            if (!GetDlcInstalledStatus(spec))
            {
                return(gamePatched);
            }

            return(gamePatched && GetDlcLatestPatchedStatus(spec));
        }
Пример #5
0
        bool ProcessDlc(IronFrontInfo spec)
        {
            var dlcInstalled = GetDlcInstalledStatus(spec);

            if (dlcInstalled)
            {
                Status("dlc conversion", spec.Status,
                       status => ProcessIFDirectory(spec.IFDlcSourcePath, spec.GameIFDlcPath, spec.TempPath, status),
                       RepoStatus.Processing);
            }
            return(dlcInstalled);
        }
Пример #6
0
        void CleanInstall(IronFrontInfo info)
        {
            InstallOfficialPatches(info);

            ProcessMainIF(info);
            var dlcProcessed = ProcessDlc(info);

            ProcessCommunityGamePatches(info);

            if (dlcProcessed)
            {
                ProcessCommunityDlcPatches(info.IFDlcSourcePath, info);
            }
        }
Пример #7
0
        void ProcessCommunityGamePatches(IronFrontInfo spec)
        {
            string lastVersion = null;

            foreach (var gamePatch in communityGamePatches)
            {
                if ((lastVersion != null) && (gamePatch.From.Version != lastVersion))
                {
                    continue;
                }
                DownloadAndInstallCommunityPatch(spec, gamePatch.GetFileName(spec.Game));
                lastVersion = gamePatch.To.Version;
            }
        }
Пример #8
0
        // TODO: The actionHandler concept should be refactored out of this domain service...
        public void Install(IronFrontInfo info, Action <StatusRepo, string, Action> actionHandler)
        {
            Confirmations(info);

            if (info.IsInstalled())
            {
                if (!ConfirmPatchedToLatestVersion(info))
                {
                    actionHandler(info.Status, "IFA Patching", () => ApplyLatestPatches(info));
                }
                return;
            }

            actionHandler(info.Status, "IFA Conversion", () => CleanInstall(info));
        }
Пример #9
0
        void Confirmations(IronFrontInfo message)
        {
            if (!ConfirmTempSpaceAvailable(message))
            {
                throw new TemporaryDriveFullException("Drive Full", RequiredTempFreeSpace,
                                                      GetDrive(message.TempPath).AvailableFreeSpace, message.TempPath);
            }

            if (!ConfirmDestinationSpaceAvailable(message))
            {
                throw new DestinationDriveFullException("Drive Full", RequiredFreeSpace,
                                                        GetDrive(message.GamePath).AvailableFreeSpace, message.GamePath);
            }

            if (Tools.UacHelper.CheckUac())
            {
                throw new ElevationRequiredException();
            }
        }
Пример #10
0
        void ProcessCommunityDlcPatches(IAbsoluteDirectoryPath dlcPath, IronFrontInfo spec)
        {
            if (!dlcPath.Exists)
            {
                return;
            }
            var    dlcEdition  = GetDlcType(spec.IFDlcSourcePath);
            string lastVersion = null;

            foreach (var dlcPatch in communityDlcPatches)
            {
                if ((lastVersion != null) && (dlcPatch.From.Version != lastVersion))
                {
                    continue;
                }
                DownloadAndInstallCommunityPatch(spec, dlcPatch.GetFileName(spec.Game, dlcEdition));
                lastVersion = dlcPatch.To.Version;
            }
        }
Пример #11
0
        void InstallOfficialPatches(IronFrontInfo ifaSpec)
        {
            if (!ifaSpec.IronFrontExePath.Exists)
            {
                throw new UnsupportedIFAVersionException("exe not found");
            }

            var exeVersion = GetExeVersion(ifaSpec.IronFrontExePath);

            if (IsRequiredVersion(exeVersion))
            {
                return;
            }

            if (exeVersion.Major != 1)
            {
                throw new UnsupportedIFAVersionException(exeVersion.ToString());
            }

            switch (exeVersion.Minor)
            {
            case 60:
                PatchFrom0(ifaSpec);
                break;

            case 63:
                PatchFrom3(ifaSpec);
                break;

            case 64:
                PatchFrom4(ifaSpec);
                break;

            default:
                throw new UnsupportedIFAVersionException(exeVersion.ToString());
            }

            exeVersion = GetExeVersion(ifaSpec.IronFrontExePath);
            if (exeVersion < requiredVersion)
            {
                throw new UnsupportedIFAVersionException(exeVersion.ToString());
            }
        }
Пример #12
0
        void HandleGameCommunityPatches(IronFrontInfo spec)
        {
            var first = GetFirstRequiredGamePatch(spec);

            if (first == null)
            {
                throw new UnrecognizedIFVersionException("Unrecognized IF version");
            }

            string lastVersion = null;

            foreach (var gamePatch in communityGamePatches.Skip(communityGamePatches.IndexOf(first)))
            {
                if ((lastVersion != null) && (gamePatch.From.Version != lastVersion))
                {
                    continue;
                }
                DownloadAndInstallCommunityPatch(spec, gamePatch.GetFileName(spec.Game));
                lastVersion = gamePatch.To.Version;
            }
        }
Пример #13
0
        void HandleDlcCommunityPatches(IronFrontInfo spec)
        {
            var dlcEdition = GetDlcType(spec.IFDlcSourcePath);
            var first      = GetFirstRequiredDlcPatch(spec, dlcEdition);

            if (first == null)
            {
                throw new UnrecognizedIFVersionException("Unsupported IFDLC version");
            }

            string lastVersion = null;

            foreach (var dlcPatch in communityDlcPatches.Skip(communityDlcPatches.IndexOf(first)))
            {
                if ((lastVersion != null) && (dlcPatch.From.Version != lastVersion))
                {
                    continue;
                }
                DownloadAndInstallCommunityPatch(spec, dlcPatch.GetFileName(spec.Game, dlcEdition));
                lastVersion = dlcPatch.To.Version;
            }
        }
Пример #14
0
 static bool GetPatchStatus(IronFrontInfo spec, string file, string sha)
 => ConfirmChecksum(spec.GamePath.GetChildFileWithName(file), sha);
 void ProcessMainIF(IronFrontInfo spec) {
     Status("main conversion", spec.Status,
         status => ProcessIFDirectory(spec.IFSourcePath, spec.GameIFPath, spec.TempPath, status),
         RepoStatus.Processing);
 }
 static bool GetGameLatestPatchedStatus(IronFrontInfo spec) {
     var latestGamePatch = communityGamePatches.Last();
     return GetPatchStatus(spec, latestGamePatch.ChecksumFile, latestGamePatch.To.Checksum);
 }
 static GamePatch GetFirstRequiredGamePatch(IronFrontInfo spec) => communityGamePatches.LastOrDefault(
     gamePatch => GetPatchStatus(spec, gamePatch.ChecksumFile, gamePatch.From.Checksum));
 static DlcPatch GetFirstRequiredDlcPatch(IronFrontInfo spec, DlcEdition edition)
     => communityDlcPatches.LastOrDefault(
         dlcPatch => GetPatchStatus(spec, dlcPatch.ChecksumFile, dlcPatch.GetFromChecksum(edition)));
 void ApplyLatestPatches(IronFrontInfo spec) {
     if (!GetGameLatestPatchedStatus(spec))
         HandleGameCommunityPatches(spec);
     if (GetDlcInstalledStatus(spec) && !GetDlcLatestPatchedStatus(spec))
         HandleDlcCommunityPatches(spec);
 }
Пример #20
0
 static bool GetDlcInstalledStatus(IronFrontInfo spec) => spec.IFDlcSourcePath.Exists;
Пример #21
0
 static DlcPatch GetFirstRequiredDlcPatch(IronFrontInfo spec, DlcEdition edition)
 => communityDlcPatches.LastOrDefault(
     dlcPatch => GetPatchStatus(spec, dlcPatch.ChecksumFile, dlcPatch.GetFromChecksum(edition)));
Пример #22
0
 void ProcessMainIF(IronFrontInfo spec)
 {
     Status("main conversion", spec.Status,
            status => ProcessIFDirectory(spec.IFSourcePath, spec.GameIFPath, spec.TempPath, status),
            RepoStatus.Processing);
 }
Пример #23
0
        static bool GetGameLatestPatchedStatus(IronFrontInfo spec)
        {
            var latestGamePatch = communityGamePatches.Last();

            return(GetPatchStatus(spec, latestGamePatch.ChecksumFile, latestGamePatch.To.Checksum));
        }
        void Confirmations(IronFrontInfo message) {
            if (!ConfirmTempSpaceAvailable(message)) {
                throw new TemporaryDriveFullException("Drive Full", RequiredTempFreeSpace,
                    GetDrive(message.TempPath).AvailableFreeSpace, message.TempPath);
            }

            if (!ConfirmDestinationSpaceAvailable(message)) {
                throw new DestinationDriveFullException("Drive Full", RequiredFreeSpace,
                    GetDrive(message.GamePath).AvailableFreeSpace, message.GamePath);
            }

            if (Tools.UacHelper.CheckUac())
                throw new ElevationRequiredException();
        }
        public bool ConfirmPatchedToLatestVersion(IronFrontInfo spec) {
            var gamePatched = GetGameLatestPatchedStatus(spec);
            if (!GetDlcInstalledStatus(spec))
                return gamePatched;

            return gamePatched && GetDlcLatestPatchedStatus(spec);
        }
 static bool GetDlcInstalledStatus(IronFrontInfo spec) => spec.IFDlcSourcePath.Exists;
        void HandleDlcCommunityPatches(IronFrontInfo spec) {
            var dlcEdition = GetDlcType(spec.IFDlcSourcePath);
            var first = GetFirstRequiredDlcPatch(spec, dlcEdition);
            if (first == null)
                throw new UnrecognizedIFVersionException("Unsupported IFDLC version");

            string lastVersion = null;
            foreach (var dlcPatch in communityDlcPatches.Skip(communityDlcPatches.IndexOf(first))) {
                if ((lastVersion != null) && (dlcPatch.From.Version != lastVersion))
                    continue;
                DownloadAndInstallCommunityPatch(spec, dlcPatch.GetFileName(spec.Game, dlcEdition));
                lastVersion = dlcPatch.To.Version;
            }
        }
 void DownloadAndInstallCommunityPatch(IronFrontInfo spec, string patchFile) {
     using (new TmpDirectory(spec.TempPath)) {
         Status(patchFile, spec.Status,
             status => DownloadAndInstallCommunityPatchInternal(patchFile, spec.TempPath, status, spec.GamePath));
     }
 }
        void HandleGameCommunityPatches(IronFrontInfo spec) {
            var first = GetFirstRequiredGamePatch(spec);
            if (first == null)
                throw new UnrecognizedIFVersionException("Unrecognized IF version");

            string lastVersion = null;
            foreach (var gamePatch in communityGamePatches.Skip(communityGamePatches.IndexOf(first))) {
                if ((lastVersion != null) && (gamePatch.From.Version != lastVersion))
                    continue;
                DownloadAndInstallCommunityPatch(spec, gamePatch.GetFileName(spec.Game));
                lastVersion = gamePatch.To.Version;
            }
        }
 void PatchFrom4(IronFrontInfo ifaSpec) {
     var esd = !ConfirmChecksum(ifaSpec.IronFrontExePath, OfficialGameInfo.Disk4ExeSha);
     InstallOfficialPatch4To5(ifaSpec, esd);
 }
 static bool GetPatchStatus(IronFrontInfo spec, string file, string sha)
     => ConfirmChecksum(spec.GamePath.GetChildFileWithName(file), sha);
 bool ConfirmSpaceAvailable(IronFrontInfo ifaSpec)
     => ConfirmTempSpaceAvailable(ifaSpec) && ConfirmDestinationSpaceAvailable(ifaSpec);
 void ProcessCommunityGamePatches(IronFrontInfo spec) {
     string lastVersion = null;
     foreach (var gamePatch in communityGamePatches) {
         if ((lastVersion != null) && (gamePatch.From.Version != lastVersion))
             continue;
         DownloadAndInstallCommunityPatch(spec, gamePatch.GetFileName(spec.Game));
         lastVersion = gamePatch.To.Version;
     }
 }
 bool ConfirmDestinationSpaceAvailable(IronFrontInfo ifaspec)
     => GetDrive(ifaspec.GamePath).AvailableFreeSpace > RequiredFreeSpace;
 bool ProcessDlc(IronFrontInfo spec) {
     var dlcInstalled = GetDlcInstalledStatus(spec);
     if (dlcInstalled) {
         Status("dlc conversion", spec.Status,
             status => ProcessIFDirectory(spec.IFDlcSourcePath, spec.GameIFDlcPath, spec.TempPath, status),
             RepoStatus.Processing);
     }
     return dlcInstalled;
 }
Пример #36
0
 static GamePatch GetFirstRequiredGamePatch(IronFrontInfo spec) => communityGamePatches.LastOrDefault(
     gamePatch => GetPatchStatus(spec, gamePatch.ChecksumFile, gamePatch.From.Checksum));
 void ProcessCommunityDlcPatches(IAbsoluteDirectoryPath dlcPath, IronFrontInfo spec) {
     if (!dlcPath.Exists)
         return;
     var dlcEdition = GetDlcType(spec.IFDlcSourcePath);
     string lastVersion = null;
     foreach (var dlcPatch in communityDlcPatches) {
         if ((lastVersion != null) && (dlcPatch.From.Version != lastVersion))
             continue;
         DownloadAndInstallCommunityPatch(spec, dlcPatch.GetFileName(spec.Game, dlcEdition));
         lastVersion = dlcPatch.To.Version;
     }
 }
Пример #38
0
 void InstallOfficialPatch4To5(IronFrontInfo ifaSpec, bool esd)
 {
     InstallOfficialPatch(esd ? OfficialGameInfo.Patch4To5Esd : OfficialGameInfo.Patch4To5, ifaSpec.TempPath,
                          ifaSpec.Status);
 }
        void InstallOfficialPatches(IronFrontInfo ifaSpec) {
            if (!ifaSpec.IronFrontExePath.Exists)
                throw new UnsupportedIFAVersionException("exe not found");

            var exeVersion = GetExeVersion(ifaSpec.IronFrontExePath);
            if (IsRequiredVersion(exeVersion))
                return;

            if (exeVersion.Major != 1)
                throw new UnsupportedIFAVersionException(exeVersion.ToString());

            switch (exeVersion.Minor) {
            case 60:
                PatchFrom0(ifaSpec);
                break;
            case 63:
                PatchFrom3(ifaSpec);
                break;
            case 64:
                PatchFrom4(ifaSpec);
                break;
            default:
                throw new UnsupportedIFAVersionException(exeVersion.ToString());
            }

            exeVersion = GetExeVersion(ifaSpec.IronFrontExePath);
            if (exeVersion < requiredVersion)
                throw new UnsupportedIFAVersionException(exeVersion.ToString());
        }
Пример #40
0
 bool ConfirmSpaceAvailable(IronFrontInfo ifaSpec)
 => ConfirmTempSpaceAvailable(ifaSpec) && ConfirmDestinationSpaceAvailable(ifaSpec);
 void InstallOfficialPatch4To5(IronFrontInfo ifaSpec, bool esd) {
     InstallOfficialPatch(esd ? OfficialGameInfo.Patch4To5Esd : OfficialGameInfo.Patch4To5, ifaSpec.TempPath,
         ifaSpec.Status);
 }
Пример #42
0
 bool ConfirmTempSpaceAvailable(IronFrontInfo ifaSpec)
 => GetDrive(ifaSpec.TempPath).AvailableFreeSpace > RequiredTempFreeSpace;
 bool ConfirmTempSpaceAvailable(IronFrontInfo ifaSpec)
     => GetDrive(ifaSpec.TempPath).AvailableFreeSpace > RequiredTempFreeSpace;
Пример #44
0
 bool ConfirmDestinationSpaceAvailable(IronFrontInfo ifaspec)
 => GetDrive(ifaspec.GamePath).AvailableFreeSpace > RequiredFreeSpace;
        // TODO: The actionHandler concept should be refactored out of this domain service...
        public void Install(IronFrontInfo info, Action<StatusRepo, string, Action> actionHandler) {
            Confirmations(info);

            if (info.IsInstalled()) {
                if (!ConfirmPatchedToLatestVersion(info))
                    actionHandler(info.Status, "IFA Patching", () => ApplyLatestPatches(info));
                return;
            }

            actionHandler(info.Status, "IFA Conversion", () => CleanInstall(info));
        }
        void CleanInstall(IronFrontInfo info) {
            InstallOfficialPatches(info);

            ProcessMainIF(info);
            var dlcProcessed = ProcessDlc(info);
            ProcessCommunityGamePatches(info);

            if (dlcProcessed)
                ProcessCommunityDlcPatches(info.IFDlcSourcePath, info);
        }