Exemple #1
0
        private string GetDescription(bool goToSettings)
        {
            if (goToSettings)
            {
                cg.GoToSettings();
            }

            cg.LeftClick(Points.SETTINGS_DESCRIPTION, 100);
            cg.SelectAll();
            Thread.Sleep(100);

            // Save the clipboard.
            string clipboardText = CustomGame.GetClipboard();

            // Copy the selected text into the clipboard.
            cg.Copy();
            Thread.Sleep(100);

            // The clipboard now has the description. Save the clipboard.
            string description = CustomGame.GetClipboard();

            // Reset the clipboard.
            if (!string.IsNullOrEmpty(clipboardText))
            {
                CustomGame.SetClipboard(clipboardText);
            }

            if (goToSettings)
            {
                cg.GoBack(1);
            }

            return(description);
        }
Exemple #2
0
        private bool PresetNameEquals(int presetIndex, string name, bool caseSensitive)
        {
            const int waitTime = 100;

            // Open the rename menu for the preset.
            Point presetLocation = GetPresetLocation(presetIndex); // Get the preset location.

            cg.RightClick(presetLocation, Timing.OPTION_MENU);     // Right click the preset to open the option menu.
            cg.KeyPress(Keys.Down, Keys.Enter);                    // Select the rename preset option.

            // Select all the text using CTRL+A.
            Thread.Sleep(waitTime);
            cg.SelectAll();
            Thread.Sleep(waitTime);

            // Save the clipboard.
            string clipboardText = CustomGame.GetClipboard();

            // Copy the selected text into the clipboard.
            cg.Copy();
            Thread.Sleep(waitTime);

            // The clipboard now has the preset name. Save the clipboard.
            string presetName = CustomGame.GetClipboard();

            // Reset the clipboard.
            if (!string.IsNullOrEmpty(clipboardText))
            {
                CustomGame.SetClipboard(clipboardText);
            }

            // Close the renaming menu.
            cg.LeftClick(508, 324, 100);

            // Check if they match.
            return((caseSensitive && presetName == name) || (!caseSensitive && presetName.ToLower() == name.ToLower()));
        }