@@ -22,6 +22,7 @@ public static IEnumerable<EpicGame> GetGames(ILauncher launcher, CancellationTok
22
22
. Select ( DeserializeManifest )
23
23
. Where ( game => game is not null )
24
24
. Select ( game => AddLauncherId ( launcher , game ! ) )
25
+ . Select ( game => AddExecutables ( launcher , game ! ) )
25
26
. ToList ( ) ! ;
26
27
}
27
28
@@ -34,6 +35,22 @@ private static EpicGame AddLauncherId(ILauncher launcher, EpicGame game)
34
35
return game ;
35
36
}
36
37
38
+ /// <summary>
39
+ /// Find executables within the install directory
40
+ /// </summary>
41
+ private static EpicGame AddExecutables ( ILauncher launcher , EpicGame game )
42
+ {
43
+ if ( launcher . LauncherOptions . SearchExecutables )
44
+ {
45
+ var executables = PathUtil . GetExecutables ( game . InstallDir ) ;
46
+
47
+ executables . AddRange ( game . Executables ) ;
48
+ game . Executables = executables . Distinct ( StringComparer . OrdinalIgnoreCase ) . ToList ( ) ;
49
+ }
50
+
51
+ return game ;
52
+ }
53
+
37
54
/// <summary>
38
55
/// Get the meta data directory from registry; if not found try to locate in Common Application data
39
56
/// </summary>
@@ -81,9 +98,29 @@ private static EpicGame AddLauncherId(ILauncher launcher, EpicGame game)
81
98
}
82
99
catch { return null ; }
83
100
84
- var game = deserializedEpicGame . EpicGameBuilder ( ) ;
101
+ var game = new EpicGame ( )
102
+ {
103
+ Id = deserializedEpicGame . AppName ,
104
+ Name = deserializedEpicGame . DisplayName ,
105
+ InstallDir = PathUtil . Sanitize ( deserializedEpicGame . InstallLocation ) ?? string . Empty ,
106
+ WorkingDir = deserializedEpicGame . InstallLocation ,
107
+ InstallSize = deserializedEpicGame . InstallSize ,
108
+ Version = deserializedEpicGame . AppVersionString ,
109
+ } ;
110
+
111
+ if ( PathUtil . IsExecutable ( deserializedEpicGame . MainWindowProcessName ) )
112
+ {
113
+ game . Executable = Path . Combine ( game . InstallDir , deserializedEpicGame . MainWindowProcessName ) ;
114
+ if ( PathUtil . IsExecutable ( deserializedEpicGame . MainWindowProcessName ) )
115
+ {
116
+ game . Executables = new List < string > ( ) { Path . Combine ( game . InstallDir , deserializedEpicGame . LaunchExecutable ) } ;
117
+ }
118
+ }
119
+ else if ( PathUtil . IsExecutable ( deserializedEpicGame . LaunchExecutable ) )
120
+ {
121
+ game . Executable = Path . Combine ( game . InstallDir , deserializedEpicGame . LaunchExecutable ) ;
122
+ }
85
123
86
- game . Executable = Path . Combine ( PathUtil . Sanitize ( game . InstallDir ) ! , game . Executable ) ;
87
124
game . LaunchString = $ "com.epicgames.launcher://apps/{ game . Id } ?action=launch&silent=true";
88
125
game . InstallDate = PathUtil . GetCreationTime ( game . InstallDir ) ?? DateTime . MinValue ;
89
126
0 commit comments