Пример #1
0
        static void Main(string[] args)
        {
            Mixer chat = new Mixer();

            chat.OnMessageReceived += Chat_OnMessageReceived;
            chat.OnUserJoined      += Chat_OnUserJoined;
            chat.OnUserLeft        += Chat_OnUserLeft;
            chat.OnError           += Chat_OnError;
            chat.Connect("SmiteGame");
            Console.ReadLine();
        }
Пример #2
0
        static async Task Main(string[] args)
        {
            // MIDI input name hard-coded as I think the chances of anyone else running this are slim...
            await using (var controller = await PlatformMXController.ConnectAsync("Platform M+ V2.15"))
            {
                Console.WriteLine("Connected to controller");

                using (var mixer = new Mixer())
                {
                    // IP address hard-coded as I think the chances of anyone else running this are slim...
                    mixer.Connect("192.168.1.41", 10024);
                    mixer.RegisterHandler("/info", (sender, message) => Console.WriteLine($"Mixer info response: {string.Join("/", message)}"));
                    await mixer.SendInfoAsync();

                    using (var connector = new MixerConnector(controller, mixer))
                    {
                        await connector.StartAsync();

                        await Task.Delay(Timeout.Infinite);
                    }
                }
            }
        }
Пример #3
0
        /// <summary>
        /// Callback for when the main form has loaded.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void MainForm_Load(object sender, EventArgs e)
        {
            if (useDarkTheme)
            {
                metroStyleManager.Theme = MetroThemeStyle.Dark;
                ManualControlColours(System.Drawing.Color.DarkGray);
                metroComboBox_Theme.SelectedIndex = 1;
            }
            else
            {
                metroStyleManager.Theme = MetroThemeStyle.Light;
                ManualControlColours(System.Drawing.Color.White);
                metroComboBox_Theme.SelectedIndex = 0;
            }

            this.StyleManager             = metroStyleManager;
            metroTabControl1.StyleManager = metroStyleManager;

            listView_ActiveCodes.StyleManager  = metroStyleManager;
            listView_ExpiredCodes.StyleManager = metroStyleManager;

            metroContextMenu_listViewRightClick.StyleManager = metroStyleManager;

            metroTabPage_Active.StyleManager    = metroStyleManager;
            metroTabPage_Blacklist.StyleManager = metroStyleManager;
            metroTabPage_Whitelist.StyleManager = metroStyleManager;
            metroTabPage_Expired.StyleManager   = metroStyleManager;
            metroTabPage_Logs.StyleManager      = metroStyleManager;
            metroTabPage_Help.StyleManager      = metroStyleManager;
            metroTabPage_Settings.StyleManager  = metroStyleManager;

            metroPanel1.StyleManager = metroStyleManager;
            metroPanel2.StyleManager = metroStyleManager;
            metroPanel3.StyleManager = metroStyleManager;
            metroPanel4.StyleManager = metroStyleManager;
            metroPanel5.StyleManager = metroStyleManager;

            trackbar_RedeemDelay.StyleManager        = metroStyleManager;
            metroTrackBar_minWordLength.StyleManager = metroStyleManager;
            metroTrackBar_maxWordLength.StyleManager = metroStyleManager;

            metroLabel2.StyleManager           = metroStyleManager;
            metroLabel3.StyleManager           = metroStyleManager;
            metroLabel4.StyleManager           = metroStyleManager;
            metroLabel5.StyleManager           = metroStyleManager;
            metroLabel7.StyleManager           = metroStyleManager;
            metroLabel87.StyleManager          = metroStyleManager;
            metroLabel9.StyleManager           = metroStyleManager;
            metroLabel10.StyleManager          = metroStyleManager;
            metroLink_KeyCodeHelp.StyleManager = metroStyleManager;

            label_ksNote.StyleManager             = metroStyleManager;
            label_SmiteClientVersion.StyleManager = metroStyleManager;
            label_redeemDelay.StyleManager        = metroStyleManager;
            label_minWordLength.StyleManager      = metroStyleManager;

            metroLabel_AFKMode.StyleManager       = metroStyleManager;
            metroLabel_maxWordLength.StyleManager = metroStyleManager;
            metroLabel_MinimiseSmiteAfterRedeeming.StyleManager = metroStyleManager;

            checkbox_NotificationSound.StyleManager      = metroStyleManager;
            checkbox_showNotifications.StyleManager      = metroStyleManager;
            checkbox_AFKMode.StyleManager                = metroStyleManager;
            checkBox_disableKillswitch.StyleManager      = metroStyleManager;
            checkbox_MinimiseAfterRedeeming.StyleManager = metroStyleManager;


            // set whether to catch calls on the wrong thread that access a control's handle property when an application is being debugged
            CheckForIllegalCrossThreadCalls = false;

            foreach (var key in Enum.GetNames(typeof(VirtualKeyStates)))
            {
                if (key != "VK_CONTROL" &&
                    key != "VK_LCONTROL" &&
                    key != "VK_RCONTROL" &&
                    key != "VK_ESCAPE" &&
                    key != "VK_RETURN" &&
                    key != "VK_KEY_C" &&
                    key != "VK_KEY_V")
                {
                    comboBox_vKeys.Items.Add(key);
                }
            }

            // override the console to output console.writeline to our custom console log
            Console.SetOut(new LogWriter(logbox));

            // load up all saved properties
            //
            // textboxes
            textbox_whitelistedUsernames.Lines = whitelistedUsernames.Cast <string>().ToArray();
            textbox_BlacklistedWords.Lines     = blacklistedWords.Cast <string>().ToArray();
            textbox_NotificationSound.Text     = notificationSoundFilePath;
            // checkboxes
            checkbox_NotificationSound.Checked      = notificationSound;
            checkbox_showNotifications.Checked      = notificationSetting;
            checkbox_MinimiseAfterRedeeming.Checked = minimiseAfterRedeeming;
            checkBox_disableKillswitch.Checked      = killswitchEnabled;
            // combo box
            comboBox_vKeys.SelectedItem = killswitchKeyString;
            // label
            label_ksNote.Text             = $"Note: Press {killswitchKeyString} to stop automation script.";
            label_redeemDelay.Text        = redeemDelay + " Minutes.";
            label_minWordLength.Text      = minWordLength + " Characters.";
            metroLabel_maxWordLength.Text = maxWordLength + " Characters.";
            // trackbar
            trackbar_RedeemDelay.Value        = redeemDelay;
            metroTrackBar_minWordLength.Value = minWordLength;

            // write the meta info to the console
            Console.Write(MetaInfo.GetMetaInfoConsole());

            // hook up the mixer API callbacks
            Mixer chat = new Mixer();

            chat.OnMessageReceived += Chat_OnMessageReceived;
            // connect to the smite mixer chat (currently not using the connected boolean...)
            var connected = chat.Connect("SmiteGame");

            // create and spin up our threads
            //
            // killswitch thread (listens for F5 key and stops automation)
            Thread killswitch = new Thread(new ThreadStart(CheckForTerminationKey));

            killswitch.SetApartmentState(ApartmentState.STA);
            killswitch.IsBackground = true;
            killswitch.Start();
            // AFK mode thread (does afk mode stuff)
            Thread AFKModeThread = new Thread(new ThreadStart(AFKModeLoop));

            AFKModeThread.SetApartmentState(ApartmentState.STA);
            AFKModeThread.IsBackground = true;
            AFKModeThread.Start();
            // Thread to monitor whether smite process exists
            Thread CheckSmiteExists = new Thread(new ThreadStart(CheckSmiteIsOpenLoop));

            CheckSmiteExists.SetApartmentState(ApartmentState.STA);
            CheckSmiteExists.IsBackground = true;
            CheckSmiteExists.Start();

            // set is running to true by default for the AFK mode to function
            IsRunning = true;
        }