コード例 #1
0
        private bool ValidateAndImportLoLPath()
        {
            while (!LoLPathUtil.IsValidLeagueOfLegendsDirectory(Properties.Settings.Default.LoLDirectory))
            {
                string errMsg = "Your League of Legends path seems invalid.\n";
                errMsg += "Please set a valid path before proceeding.";

                DialogResult result = ShowWarningMessageBox("Invalid PLeague of Legends Path", errMsg);

                if (result == System.Windows.Forms.DialogResult.OK || result == System.Windows.Forms.DialogResult.Yes)
                {
                    bool importCompleted = AskUserToImportLoLPath();
                    if (!importCompleted)
                    {
                        return(false);
                    }
                }
                else
                {
                    return(false);
                }
            }

            return(true);
        }
コード例 #2
0
        private bool AskUserToImportLoLPath()
        {
            // Ask user to browse League of Legends directory
            var folderBrowserDialog = new FolderBrowserDialog();

            DialogResult result = folderBrowserDialog.ShowDialog();

            bool hasContent = result == System.Windows.Forms.DialogResult.OK &&
                              !string.IsNullOrWhiteSpace(folderBrowserDialog.SelectedPath);

            if (hasContent)
            {
                string path = folderBrowserDialog.SelectedPath;
                txtLoLDirectory.Text = path;

                // Validate path
                bool isValidDirectory = LoLPathUtil.IsValidLeagueOfLegendsDirectory(path);
                Properties.Settings.Default.LoLDirectory = path;

                if (isValidDirectory)
                {
                    ChangeLoLStatusToFound();
                }
                else
                {
                    ChangeLoLStatusToNotFound();
                }

                Properties.Settings.Default.Save();
                return(true);
            }

            // Cancelled or invalid
            return(false);
        }
コード例 #3
0
        private void FillFormsWithUserSettings()
        {
            string lolDirectory = Properties.Settings.Default.LoLDirectory;

            txtLoLDirectory.Text = lolDirectory;

            // Check if LoL directory is valid
            if (LoLPathUtil.IsValidLeagueOfLegendsDirectory(lolDirectory))
            {
                ChangeLoLStatusToFound();
            }
            else
            {
                ChangeLoLStatusToNotFound();
            }
        }