public string GetInsult(CChatMaster chatMaster)
 {
     Random r = new Random();
     return chatMaster.GetInsults().List1[r.Next(1, chatMaster.GetInsults().List1.Count - 1)] + " " +
         chatMaster.GetInsults().List2[r.Next(1, chatMaster.GetInsults().List2.Count - 1)] + " " +
         chatMaster.GetInsults().List3[r.Next(1, chatMaster.GetInsults().List3.Count - 1)] + "!";
 }
        public CWindow(CChatMaster _master, CWhitelist _wlist, IWebElement _base)
        {
            this.chatMaster = _master;
            this.elemWindowBase = _base;
            this.whitelist = _wlist;
            this.permaData = new CPermaData();

            IWebElement elemTitlebar = elemWindowBase.FindElement(By.ClassName("titlebarText"));
            while (true) {
                GetName(elemTitlebar);
                if (!string.IsNullOrWhiteSpace(sChatName)) {
                    break;
                }
            }

            GetProfileLink(elemTitlebar);
            GetTextArea();

            this.bShouldStop = false;
            this.thrWatcher = new Thread(() => WatchChat());
            this.thrWatcher.Start();
        }
 public virtual void Reply(CChatMaster chatMaster, CWindow window, CMessage message)
 {
 }
 public override void Reply(CChatMaster chatMaster, CWindow window, CMessage message)
 {
     chatMaster.SendMessageToWindow(window, GetInsult());
     base.Reply(chatMaster, window, message);
 }
 public override void Reply(CChatMaster chatMaster, CWindow window, CMessage message)
 {
     chatMaster.SendMessageToWindowNoSend(window, "AAA");
     base.Reply(chatMaster, window, message);
 }
        public override void Reply(CChatMaster chatMaster, CWindow window, CMessage message)
        {
            string msg = message.Message.ToLower().Trim();
            RPS _r = RPS.Paper;

            if (msg.StartsWith("rock")) {
                _r = RPS.Rock;
            } else if (msg.StartsWith("paper")) {
                _r = RPS.Paper;
            } else if (msg.StartsWith("scissors")) {
                _r = RPS.Scissors;
            } else {
                chatMaster.SendMessageToWindow(window, "Hi, " + window.ChatName + ". I'm not available right now; but how about some rock, paper scissors? You can go first!");
                return;
            }

            Random r = new Random();
            RPS r1 = (RPS)r.Next(0, 2);
            chatMaster.SendMessageToWindow(window, "I chose " + r1.ToString());

            int iWinner = Logic(_r, r1);
            switch (iWinner) {
                case -1:
                    chatMaster.SendMessageToWindow(window, "Looks like that was a draw!");
                    break;

                case 0:
                    chatMaster.SendMessageToWindow(window, "Looks like I won that one!!! :D");
                    break;

                case 1:
                    chatMaster.SendMessageToWindow(window, "Ok, you won that one. :/");
                    break;
            }

            base.Reply(chatMaster, window, message);
        }
        public override void Reply(CChatMaster chatMaster, CWindow window, CMessage message)
        {
            char[] strArray = message.Message.ToArray();
            Array.Reverse(strArray);

            string strReversed = new string(strArray);
            chatMaster.SendMessageToWindow(window, strReversed);
            base.Reply(chatMaster, window, message);
        }
        private void _StartWorking()
        {
            try {
                CDebug.Print("Creating a new firefox instance...", ConsoleColor.DarkGray);
                this.driver = new FirefoxDriver();

                CDebug.Print("Navigating to http://www.facebook.com...", ConsoleColor.DarkGray);
                this.driver.Navigate().GoToUrl("http://www.facebook.com");

                CDebug.Print("Logging in account " + loginInfo.sEmailAddress + "...", ConsoleColor.DarkYellow);
                Login();

                if (!CheckLogin()) {

                    if (ServiceShutdown != null) {
                        ServiceShutdown("Incorrect login details!");
                    }

                    StopAutoReplier();
                    return;
                }

                this.chatMaster = new CChatMaster(this, driver);
                Console.ReadLine();
            } catch (Exception e) {
                CDebug.Error(e);
                Console.ReadLine();
            }
        }
 public override void Reply(CChatMaster chatMaster, CWindow window, CMessage message)
 {
     chatMaster.ParentReplyMode.Reply(chatMaster, window, message);
     base.Reply(chatMaster, window, message);
 }
        private void _StartWorking()
        {
            try {
                CDebug.Print("Creating a new firefox instance...", ConsoleColor.DarkGray);
                Status("Starting a firefox browser...", Color.DarkGray);
                this.driver = new FirefoxDriver();

                CDebug.Print("Navigating to http://www.facebook.com...", ConsoleColor.DarkGray);
                Status("Navigating to https://www.facebook.com...", Color.DarkGray);
                this.driver.Navigate().GoToUrl("http://www.facebook.com");

                Status("Logging in account " + loginInfo.sEmailAddress + "...", Color.DarkOrange);
                CDebug.Print("Logging in account " + loginInfo.sEmailAddress + "...", ConsoleColor.DarkYellow);
                Login();

                if (LoginFailed()) {
                    ServiceShutdown_(0, "Incorrect login details!");
                    return;
                }

                this.chatMaster = new CChatMaster(this, driver);
                if (this.ServiceStarted != null) {
                    this.ServiceStarted();
                }
            } catch (Exception e) {
                CDebug.Error(e);
                Console.ReadLine();
            }
        }