Exemplo n.º 1
0
        /// <summary>
        /// Actions for edit exec button, also called on double click action
        /// </summary>
        private void ExecEditButton_Click(object sender, EventArgs e)
        {
            // Get exec that is selected
            var selectedName = (string)this.ExecItemsList.SelectedItem;

            LeagueExecutable exec = _exeManager.GetExecutable(selectedName);

            // Check is gotten exec
            if (exec == null)
            {
                // This happens when nothing is selected
                //MessageBox.Show("Specified entry does not exist. Delete and re-add", "Error reading entry", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
            else
            {
                // Start add form, but in edit mode
                var editForm   = new ExecAddForm(exec);
                var formResult = editForm.ShowDialog();

                // if form exited with ok
                if (formResult == DialogResult.OK)
                {
                    // Get edited exec
                    var newExec = editForm.NewLeagueExec;

                    // Save exec file
                    if (!newExec.IsDefault)
                    {
                        _exeManager.DeleteExecutable(selectedName);
                        _exeManager.AddExecutable(newExec);
                    }
                    else
                    {
                        _exeManager.ReplaceDefaultExecutable(newExec);
                    }

                    // Refresh list of execs
                    RefreshExecListBox();

                    // Clear info box
                    this.GBoxExecNameTextBox.Text       = "";
                    this.GBoxTargetLocationTextBox.Text = "";
                    this.GBoxPatchVersTextBox.Text      = "";
                    this.GBoxLastModifTextBox.Text      = "";

                    // disable context buttons
                    ExecDeleteButton.Enabled = false;
                    ExecEditButton.Enabled   = false;
                }
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Actions for add exec button
        /// </summary>
        private void ExecAddButton_Click(object sender, EventArgs e)
        {
            // Start add exec form
            var addForm    = new ExecAddForm(_exeManager.ExeTools);
            var formResult = addForm.ShowDialog();

            // If form exited with ok
            if (formResult == DialogResult.OK)
            {
                // Get new exec
                var newExec = addForm.NewLeagueExec;

                // Save execinfo file
                _exeManager.AddExecutable(newExec);

                // Add to exec items list
                RefreshExecListBox();
            }
        }
Exemplo n.º 3
0
        [STAThread] // This is required for system dialogs
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            Scribe logger = new Scribe();

            //*/
            try
            {
                ExeManager exeManager = null;
                try
                {
                    exeManager = new ExeManager();
                }
                catch (Exception ex)
                {
                    MessageBox.Show("ROFLPlayer was not able to find League of Legends. Please add it now.", "First time setup", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    logger.Info(_className, $"First time setup kicked off by exception:\n{ex.ToString()}");
                    // Start add exec form
                    var addForm    = new ExecAddForm(new ExeTools());
                    var formResult = addForm.ShowDialog();

                    // If form exited with ok
                    if (formResult == DialogResult.OK)
                    {
                        // Get new exec
                        LeagueExecutable newExec = addForm.NewLeagueExec;
                        newExec.IsDefault = true;

                        // Save execinfo file
                        exeManager = new ExeManager(newExec);
                        exeManager.Save();
                    }
                    else
                    {
                        // Exit if form exited any other way
                        Environment.Exit(1);
                    }

                    addForm.Dispose();
                }

                ReplayPlayer replayPlayer = new ReplayPlayer(exeManager);

                if (args.Length == 0)
                {
                    // Update default exec
                    Application.Run(new UpdateSplashForm(exeManager));
                    Application.Run(new SettingsForm(exeManager));
                }
                else
                {
                    // StartupMode, 1  = show detailed information, 0 = launch replay immediately
                    if (RoflSettings.Default.StartupMode == 0)
                    {
                        StartReplay(args[0], exeManager, replayPlayer);
                    }
                    else
                    {
                        var replayFile = Task.Run(() => SetupReplayFileAsync(args[0]));

                        replayFile.Wait();

                        RequestManager requestManager = new RequestManager();

                        Application.Run(new DetailForm(replayFile.Result, requestManager, exeManager, replayPlayer, logger));
                    }
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(@"ROFLPlayer encountered an unhandled exception, please record this message and report it here https://github.com/andrew1421lee/ROFL-Player/issues" + "\n\n" + ex.ToString(), "Critical Exception", MessageBoxButtons.OK, MessageBoxIcon.Error);
                logger.Error(_className, "Unhandled exception: " + ex.ToString());
                Environment.Exit(1);
            }
            //*/
        }