Esempio n. 1
0
        public async void StartInstallWatcher()
        {
            watcherToken = new CancellationTokenSource();

            while (true)
            {
                if (watcherToken.IsCancellationRequested)
                {
                    return;
                }

                var installed = EpicLauncher.GetInstalledAppList();
                var app       = installed?.FirstOrDefault(a => a.AppName == Game.GameId);
                if (app != null)
                {
                    var installInfo = new GameInfo
                    {
                        InstallDirectory = app.InstallLocation,
                        PlayAction       = new GameAction()
                        {
                            Type = GameActionType.URL,
                            Path = string.Format(EpicLauncher.GameLaunchUrlMask, app.AppName),
                            IsHandledByPlugin = true
                        }
                    };

                    OnInstalled(this, new GameInstalledEventArgs(installInfo, this, 0));
                    return;
                }
                ;

                await Task.Delay(5000);
            }
        }
Esempio n. 2
0
        internal Dictionary <string, Game> GetInstalledGames()
        {
            var games = new Dictionary <string, Game>();

            foreach (var app in EpicLauncher.GetInstalledAppList())
            {
                if (app.AppName.StartsWith("UE_"))
                {
                    continue;
                }

                var game = new Game()
                {
                    PluginId         = Id,
                    GameId           = app.AppName,
                    Name             = Path.GetFileName(app.InstallLocation),
                    InstallDirectory = app.InstallLocation,
                    IsInstalled      = true,
                    PlayAction       = new GameAction()
                    {
                        Type = GameActionType.URL,
                        Path = string.Format(EpicLauncher.GameLaunchUrlMask, app.AppName),
                        IsHandledByPlugin = true
                    }
                };

                games.Add(game.GameId, game);
            }

            return(games);
        }
Esempio n. 3
0
        internal Dictionary <string, GameInfo> GetInstalledGames()
        {
            var games     = new Dictionary <string, GameInfo>();
            var appList   = EpicLauncher.GetInstalledAppList();
            var manifests = EpicLauncher.GetInstalledManifests();

            foreach (var app in appList)
            {
                if (app.AppName.StartsWith("UE_"))
                {
                    continue;
                }

                var manifest = manifests.FirstOrDefault(a => a.AppName == app.AppName);
                var game     = new GameInfo()
                {
                    Source           = "Epic",
                    GameId           = app.AppName,
                    Name             = manifest?.DisplayName ?? Path.GetFileName(app.InstallLocation),
                    InstallDirectory = manifest?.InstallLocation ?? app.InstallLocation,
                    IsInstalled      = true,
                    PlayAction       = new GameAction()
                    {
                        Type = GameActionType.URL,
                        Path = string.Format(EpicLauncher.GameLaunchUrlMask, app.AppName),
                        IsHandledByPlugin = true
                    }
                };

                games.Add(game.GameId, game);
            }

            return(games);
        }
Esempio n. 4
0
        internal Dictionary <string, GameInfo> GetInstalledGames()
        {
            var games     = new Dictionary <string, GameInfo>();
            var appList   = EpicLauncher.GetInstalledAppList();
            var manifests = EpicLauncher.GetInstalledManifests();

            foreach (var app in appList)
            {
                if (app.AppName.StartsWith("UE_"))
                {
                    continue;
                }

                var manifest = manifests.FirstOrDefault(a => a.AppName == app.AppName);

                // DLC
                if (manifest.AppName != manifest.MainGameAppName)
                {
                    continue;
                }

                // UE plugins
                if (manifest.AppCategories?.Any(a => a == "plugins" || a == "plugins/engine") == true)
                {
                    continue;
                }

                var game = new GameInfo()
                {
                    Source           = "Epic",
                    GameId           = app.AppName,
                    Name             = manifest?.DisplayName ?? Path.GetFileName(app.InstallLocation),
                    InstallDirectory = manifest?.InstallLocation ?? app.InstallLocation,
                    IsInstalled      = true,
                    PlayAction       = new GameAction()
                    {
                        Type = GameActionType.URL,
                        Path = string.Format(EpicLauncher.GameLaunchUrlMask, app.AppName),
                        IsHandledByPlugin = true
                    },
                    Platform = "PC"
                };

                game.Name = game.Name.RemoveTrademarks();
                games.Add(game.GameId, game);
            }

            return(games);
        }
Esempio n. 5
0
        public async void StartUninstallWatcher()
        {
            watcherToken = new CancellationTokenSource();

            while (true)
            {
                if (watcherToken.IsCancellationRequested)
                {
                    return;
                }

                var installed = EpicLauncher.GetInstalledAppList();
                var app       = installed?.FirstOrDefault(a => a.AppName == Game.GameId);
                if (app == null)
                {
                    OnUninstalled(this, new GameControllerEventArgs(this, 0));
                    return;
                }

                await Task.Delay(2000);
            }
        }