Exemplo n.º 1
0
 private static void CheckConsoleComands()
 {
     while (true)
     {
         string input = Console.ReadLine().ToLower();
         AdminComand.IfComandExecute(input, "OWNER", wap);
         UserComand.IfComandExecute(input, "OWNER", wap);
     }
 }
Exemplo n.º 2
0
        public static void ReadMsgsUsingDataBase()
        {
            IList <IWebElement> messages = wap.GetMsgs();
            string group = wap.GetCurrentTargetName();
            // If the group exists in the data base check the last msg
            LastMsg lastConversationMsg = WhatsAppDataBase.GetLastMsgFromConversation(group);

            // If the group/user doesn't exist in the database, create it
            if (lastConversationMsg == null)
            {
                // Create it
                WhatsAppDataBase.CreateNewGroup(group, wap.GetMsgText(messages[messages.Count - 1]));
            }
            else
            {
                for (int i = messages.Count - 1; i >= 0; i--)
                {
                    string msgText = wap.GetMsgText(messages[i]);
                    string msgUser = wap.GetMsgSender(messages[i]);
                    // If the last msg from the group is identical we stop reading the chat
                    if (msgText == lastConversationMsg.text)
                    {
                        string lastMsgTextPula = wap.GetMsgText(messages[messages.Count - 1]);
                        WhatsAppDataBase.UpdateLastMsgInGroup(group, lastMsgTextPula);
                        return;
                    }
                    else
                    {
                        string lastMsgTextPizda = wap.GetMsgText(messages[messages.Count - 1]);
                        WhatsAppDataBase.UpdateLastMsgInGroup(group, lastMsgTextPizda);
                        UserComand.IfComandExecute(msgText, group, wap);
                    }
                }
                string lastMsgText = wap.GetMsgText(messages[messages.Count - 1]);
                WhatsAppDataBase.UpdateLastMsgInGroup(group, lastMsgText);
            }
        }