コード例 #1
0
        private void KeyPressed(object sender, PropertyChangedEventArgs e)
        {
            if (CurrentConfig.EnableHotkeys)
            {
                string Modifier = ((Keys)Hooker.Modifier).ToString();
                string KeyCode  = ((Keys)Hooker.CurrentKey).ToString();
                foreach (Hotkey HotK in CurrentConfig.Hotkeys)
                {
                    if (HotK.Modifier == Modifier && HotK.KeyCode == KeyCode && HotK.Enabled == true)
                    {
                        switch (HotK.Name)
                        {
                        case "ExportSave":
                            ExportSave();
                            break;

                        case "ImportSave":
                            ImportCurrentSave();
                            break;

                        case "ToggleReadOnly":
                            FileInfo SelectedSave = new FileInfo(CurrentConfig.GetPath(ComboBoxSelectGame.Text));
                            SetReadOnly(CurrentConfig.GetPath(ComboBoxSelectGame.Text), !SelectedSave.IsReadOnly);
                            break;

                        case "Quicksave":
                            if (ComboBoxSelectGame.Text == "Dark Souls")
                            {
                                dsHooker.QuitToMenuDoThingsThenLoadSaveMenu(CreateQuickSave);
                            }
                            else
                            {
                                ActionCenter.Toast("That only works for Dark Souls 1, oops :/", StartPoint(), 1);
                            }
                            break;

                        case "Quickload":
                            if (ComboBoxSelectGame.Text == "Dark Souls")
                            {
                                dsHooker.QuitToMenuDoThingsThenLoadSaveMenu(LoadQuicksave);
                            }
                            else
                            {
                                ActionCenter.Toast("That only works for Dark Souls 1, oops :/", StartPoint(), 1);
                            }
                            break;

                        case "Warp":
                            if (ComboBoxSelectGame.Text == "Dark Souls")
                            {
                                dsHooker.WarpToStart();
                            }
                            else
                            {
                                ActionCenter.Toast("That only works for Dark Souls 1, oops :/", StartPoint(), 1);
                            }
                            break;

                        case "ToggleNoClip":
                            if (ComboBoxSelectGame.Text == "Dark Souls")
                            {
                                dsHooker.ToggleNoClip();
                            }
                            else
                            {
                                ActionCenter.Toast("That only works for Dark Souls 1, oops :/", StartPoint(), 1);
                            }
                            break;

                        case "ToggleDamage":
                            if (ComboBoxSelectGame.Text == "Dark Souls")
                            {
                                dsHooker.ToggleDamage();
                            }
                            else
                            {
                                ActionCenter.Toast("That only works for Dark Souls 1, oops :/", StartPoint(), 1);
                            }
                            break;

                        case "ToggleAI":
                            if (ComboBoxSelectGame.Text == "Dark Souls")
                            {
                                dsHooker.ToggleAI();
                            }
                            else
                            {
                                ActionCenter.Toast("That only works for Dark Souls 1, oops :/", StartPoint(), 1);
                            }
                            break;
                        }
                    }
                }
            }
        }