Example #1
0
        public void PlaceTruckSimulatorPlugin(string path, string game)
        {
            if (string.IsNullOrEmpty(path))
            {
                return;
            }

            // Ensure the selected directory exists
            if (!Directory.Exists(path))
            {
                _dialogService.ShowErrorMessageBox($"Directory '{path}' not found.");
                return;
            }
            // Ensure it's the proper directory by looking for the executable
            if (!File.Exists(path + "/" + game))
            {
                if (game == "eurotrucks2.exe")
                {
                    _dialogService.ShowErrorMessageBox("Please select a valid Eurotruck Simulator 2 directory\n\n" +
                                                       @"By default ETS2 is in \SteamApps\common\Euro Truck Simulator 2\bin\win_x64");
                }
                else
                {
                    _dialogService.ShowErrorMessageBox("Please select a valid American Truck Simulator directory\n\n" +
                                                       @"By default ATS is in \SteamApps\common\American Truck Simulator\bin\win_x64");
                }
                return;
            }

            // Create the plugins folder if it's not already there
            Directory.CreateDirectory(path + "/plugins");

            // Place either the 64-bits or 32-bits DLL
            try
            {
                if (path.Contains("win_x64"))
                {
                    File.WriteAllBytes(path + "/plugins/ets2-telemetry-server.dll", Resources.ets2_telemetry_server_x64);
                }
                else
                {
                    File.WriteAllBytes(path + "/plugins/ets2-telemetry-server.dll", Resources.ets2_telemetry_server_x86);
                }

                Logger?.Debug("Installed Truck Simulator plugin in {0}", path);
            }
            catch (Exception e)
            {
                Logger?.Error(e, "Failed to install Truck Simulator plugin in {0}", path);
                throw;
            }
        }
        public void PlaceFiles()
        {
            var gameSettings = (UnrealTournamentSettings)Settings;
            var path         = gameSettings.GameDirectory;

            if (!File.Exists(path + @"\Engine\Binaries\Win64\UE4-Win64-Shipping.exe"))
            {
                _dialogService.ShowErrorMessageBox("Please select a valid Unreal Tournament directory\n\n" +
                                                   @"By default Unreal Tournament is in C:\Program Files\Epic Games\UnrealTournament");

                gameSettings.GameDirectory = string.Empty;
                gameSettings.Save();

                Logger?.Warn("Failed to install Unreal Tournament plugin in '{0}' (path not found)", path);
                return;
            }

            // Load the ZIP from resources
            using (var stream = new MemoryStream(Resources.ut_plugin))
            {
                var archive = new ZipArchive(stream);

                try
                {
                    Directory.CreateDirectory(path + @"\UnrealTournament\Plugins\Artemis");
                    archive.ExtractToDirectory(path + @"\UnrealTournament\Plugins\Artemis", true);
                }
                catch (Exception e)
                {
                    Logger?.Error(e, "Failed to install Unreal Tournament plugin in '{0}'", path);
                    return;
                }
            }
            Logger?.Info("Installed Unreal Tournament plugin in '{0}'", path);
        }
Example #3
0
        public void PlaceConfigFile()
        {
            var gameSettings = (Dota2Settings)Settings;

            if (gameSettings.GameDirectory == string.Empty)
            {
                return;
            }
            if (Directory.Exists(gameSettings.GameDirectory + "/game/dota/cfg"))
            {
                var cfgFile = Resources.dotaGamestateConfiguration.Replace("{{port}}",
                                                                           _gameStateWebServer.Port.ToString());
                try
                {
                    File.WriteAllText(gameSettings.GameDirectory +
                                      "/game/dota/cfg/gamestate_integration/gamestate_integration_artemis.cfg", cfgFile);
                }
                catch (DirectoryNotFoundException)
                {
                    Directory.CreateDirectory(gameSettings.GameDirectory + "/game/dota/cfg/gamestate_integration/");
                    File.WriteAllText(gameSettings.GameDirectory +
                                      "/game/dota/cfg/gamestate_integration/gamestate_integration_artemis.cfg",
                                      cfgFile);
                }

                return;
            }

            _dialogService.ShowErrorMessageBox("Please select a valid Dota 2 directory\n\n" +
                                               @"By default Dota 2 is in \SteamApps\common\dota 2 beta");
            gameSettings.GameDirectory = string.Empty;
            gameSettings.Save();
        }
        public void PlaceConfigFile()
        {
            var gameSettings = (CounterStrikeSettings)Settings;

            if (gameSettings.GameDirectory == string.Empty)
            {
                return;
            }

            var path = gameSettings.GameDirectory;

            if (Directory.Exists(path + "/csgo/cfg"))
            {
                var cfgFile = Resources.csgoGamestateConfiguration.Replace("{{port}}",
                                                                           _gameStateWebServer.Port.ToString());
                File.WriteAllText(path + "/csgo/cfg/gamestate_integration_artemis.cfg", cfgFile);

                return;
            }

            _dialogService.ShowErrorMessageBox("Please select a valid CS:GO directory\n\n" +
                                               @"By default CS:GO is in \SteamApps\common\Counter-Strike Global Offensive");

            gameSettings.GameDirectory = string.Empty;
            gameSettings.Save();
        }
Example #5
0
        public void ChangeDirectory(string directory, bool checkExe)
        {
            var settings = (WoWSettings)Settings;

            if (checkExe && !File.Exists(directory + @"\Wow.exe"))
            {
                _dialogService.ShowErrorMessageBox("Please select a valid WoW directory\n\n" +
                                                   @"By default WoW is in C:\Program Files (x86)\World of Warcraft");

                settings.GameDirectory = string.Empty;
                settings.Save();
                return;
            }
            settings.GameDirectory = directory;
            settings.Save();
        }
Example #6
0
        public void PlaceDll()
        {
            var settings = (OverwatchSettings)Settings;
            var path     = settings.GameDirectory;

            if (!File.Exists(path + @"\Overwatch.exe"))
            {
                _dialogService.ShowErrorMessageBox("Please select a valid Overwatch directory\n\n" +
                                                   @"By default Overwatch is in C:\Program Files (x86)\Overwatch");

                settings.GameDirectory = string.Empty;
                settings.Save();
                return;
            }

            DllManager.PlaceRazerDll(path);
        }