private static GameDetection FindGamesFromExecutingPath() { var currentPath = Directory.GetCurrentDirectory(); var focExe = new FileInfo(Path.Combine(currentPath, "swfoc.exe")); if (!focExe.Exists) { return(GameDetection.NotInstalled); } var regPath = FocRegistryHelper.Instance.ExePath; if (!string.IsNullOrEmpty(regPath) && Path.GetFullPath(currentPath) == Path.GetFullPath(regPath !)) { var eawRegPath = EaWRegistryHelper.Instance.ExePath; return(new GameDetection(new FileInfo(eawRegPath !), focExe)); } var gameType = GameTypeHelper.GetGameType(focExe); if (!Eaw.FindInstallationRelativeToFoc(focExe, gameType, out var eawPath)) { var eawRegPath = EaWRegistryHelper.Instance.ExePath; return(new GameDetection(new FileInfo(eawRegPath !), focExe)); } return(new GameDetection(eawPath !, focExe)); }
public GameDetection(FileInfo eawExe, FileInfo focExe) { Requires.NotNull(eawExe, nameof(eawExe)); Requires.NotNull(focExe, nameof(focExe)); Result = DetectionResult.Installed; EawExe = eawExe; FocExe = focExe; FocType = GameTypeHelper.GetGameType(this); // TODO: Don't assume eaw type is the same as foc type EawType = FocType; }