예제 #1
0
        private void GeneralInstallBrowseButton_Click(object sender, EventArgs e)
        {
            var dialog = new OpenFileDialog();

            dialog.Filter      = "LeagueClient.exe (*.exe)|*.exe";
            dialog.Multiselect = false;
            dialog.Title       = "Select League of Legends client";
            while (dialog.ShowDialog() == DialogResult.OK)
            {
                var filepath = dialog.FileName;
                if (string.IsNullOrEmpty(filepath))
                {
                    return;
                }

                try
                {
                    var path = GameLocator.FindLeagueExecutable(Path.GetDirectoryName(filepath));
                    RoflSettings.Default.LoLExecLocation = path;
                    this.GeneralGameTextBox.Text         = path;
                    return;
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Could not find League of Legends executable, please try again\n\n" + ex.Message, "Error finding game executable", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
예제 #2
0
        private void GeneralGameBrowseButton_Click(object sender, EventArgs e)
        {
            var dialog = new OpenFileDialog();

            dialog.Filter      = "League of Legends.exe (*.exe)|*.exe";
            dialog.Multiselect = false;
            dialog.Title       = "Select League of Legends executable";
            while (dialog.ShowDialog() == DialogResult.OK)
            {
                var filepath = dialog.FileName;
                if (string.IsNullOrEmpty(filepath))
                {
                    return;
                }

                if (GameLocator.CheckLeagueExecutable(filepath))
                {
                    this.GeneralGameTextBox.Text = filepath;
                    return;
                }
                else
                {
                    MessageBox.Show("Invalid League executable", "Invalid File", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
        }
예제 #3
0
        private void SettingsForm_Load(object sender, EventArgs e)
        {
            if (string.IsNullOrEmpty(RoflSettings.Default.LoLExecLocation) || !File.Exists(RoflSettings.Default.LoLExecLocation))
            {
                if (GameLocator.FindLeagueInstallPath(out string path))
                {
                    try
                    {
                        var execPath = GameLocator.FindLeagueExecutable(path);
                        RoflSettings.Default.LoLExecLocation = path;
                        this.GeneralGameTextBox.Text         = execPath;

                        MessageBox.Show("Automatically detected League of Legends install!", "Information", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Could not find League of Legends executable, please select the game executable (League of Legends.exe)\n\n" + ex.Message, "Error finding game executable", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        GeneralGameBrowseButton_Click(this, new EventArgs());
                    }
                }
                else
                {
                    MessageBox.Show("Could not find League of Legends install location, please select the game launcher (LeagueClient.exe)\n\n" + path + ".", "Error finding install path", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    GeneralInstallBrowseButton_Click(this, new EventArgs());
                }
            }
            else
            {
                this.GeneralGameTextBox.Text = RoflSettings.Default.LoLExecLocation;
            }

            this.GeneralLaunchComboBox.SelectedItem = this.GeneralLaunchComboBox.Items[RoflSettings.Default.StartupMode];
            this.GeneralRegionComboBox.SelectedItem = RoflSettings.Default.Region;
            this.GeneralUsernameTextBox.Text        = RoflSettings.Default.Username;
        }
예제 #4
0
        private async Task OnGetDataCommand()
        {
            _logger.Info("Getting supported games");

            if (Games == null)
            {
                Games = new ObservableCollection <GameModule>();
            }

            var supportedGames = _gameModuleCatalog.GameModules;

            foreach (var game in supportedGames)
            {
                if (Games.Any(x => x.Module == game.Module))
                {
                    continue;
                }

                game.InstalledLocation = await GameLocator.Find(game.Title);

                game.PropertyChanged += Game_PropertyChanged;
                Games.Add(game);
            }

            RaisePropertyChanged(nameof(Games));
            ContinueCommand.RaiseCanExecuteChanged();
        }
예제 #5
0
        /// <summary>
        /// Displays browse dialog for user to select LeagueClient.exe
        /// Returns "INVALID" if user selected a bad directory and pressed OK
        /// Returns null if user presses cancel
        /// </summary>
        /// <returns></returns>
        private string BrowseDialog()
        {
            var dialog = new OpenFileDialog
            {
                Filter      = "LeagueClient.exe (*.exe)|*.exe",
                Multiselect = false,
                Title       = "Select League of Legends client",
                FileName    = "LeagueClient.exe"
            };

            if (dialog.ShowDialog() == DialogResult.OK)
            {
                var filepath = dialog.FileName;
                if (string.IsNullOrEmpty(filepath))
                {
                    return("INVALID");
                }

                try
                {
                    var path = GameLocator.FindLeagueExecutable(Path.GetDirectoryName(filepath));
                    //RoflSettings.Default.LoLExecLocation = path;
                    if (!string.IsNullOrEmpty(path))
                    {
                        return(Path.GetDirectoryName(filepath));
                    }
                }
                catch (Exception ex)
                {
                    MessageBox.Show("Could not find League of Legends executable, please try again\n\nReason: " + ex.Message, "Error finding game executable", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    return("INVALID");
                }
            }

            return(null);
        }
예제 #6
0
        private void ExecBrowseButton_Click(object sender, EventArgs e)
        {
            var dialog = new OpenFileDialog
            {
                // Filter out only exes
                Filter = "LeagueClient.exe or League of Legends.exe (*.exe)|*.exe",
                // Show only files starting with "League"
                FileName = "League*",
                // Only allow one file to be selected
                Multiselect = false,
                // Set title of dialog
                Title = "Select League of Legends client"
            };

            // Wait for user to press ok
            while (dialog.ShowDialog() == DialogResult.OK)
            {
                var filepath = dialog.FileName;
                // They didn't select anything, do nothing
                if (string.IsNullOrEmpty(filepath) || filepath.Equals("League*"))
                {
                    return;
                }

                string gamePath = "";
                // Now did they select leagueclient or league of legends?
                switch (Path.GetFileName(filepath))
                {
                case "LeagueClient.exe":
                {
                    // Enable update checkbox if ever disabled
                    ExecUpdateCheckbox.Enabled = true;
                    try
                    {
                        // Find the league of legends.exe using game locator
                        gamePath = GameLocator.FindLeagueExecutable(Path.GetDirectoryName(filepath));
                    }
                    catch (Exception ex)
                    {
                        MessageBox.Show("Could not find League of Legends executable, please try again\n\n" + ex.Message, "Error finding game executable", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        return;
                    }
                    break;
                }

                case "League of Legends.exe":
                {
                    // Disable update checkbox, could cause big problems
                    ExecUpdateCheckbox.Checked = false;
                    ExecUpdateCheckbox.Enabled = false;
                    gamePath = filepath;
                    break;
                }

                default:
                {
                    MessageBox.Show("Selected file is not LeagueClient.exe or League of Legends.exe", "Invalid executable", MessageBoxButtons.OK, MessageBoxIcon.Error);
                    continue;
                }
                }


                var fileInfo = FileVersionInfo.GetVersionInfo(gamePath);

                NewLeagueExec.TargetPath   = gamePath;
                NewLeagueExec.StartFolder  = Path.GetDirectoryName(filepath);
                NewLeagueExec.PatchVersion = fileInfo.FileVersion;
                NewLeagueExec.ModifiedDate = File.GetLastWriteTime(gamePath);

                this.ExecTargetTextBox.Text    = gamePath;
                this.ExecStartTextBox.Text     = Path.GetDirectoryName(filepath);
                this.GBoxExecNameTextBox.Text  = Path.GetFileName(gamePath);
                this.GBoxPatchVersTextBox.Text = fileInfo.FileVersion;
                this.GBoxFileDescTextBox.Text  = fileInfo.FileDescription;
                this.GBoxLastModifTextBox.Text = NewLeagueExec.ModifiedDate.ToString("yyyy/dd/MM");

                return;
            }
        }