Exemplo n.º 1
0
 private static void AddListenersToMessagesExport()
 {
     // Save in files
     ExportToOtherApps.AddListener(ThrowMessageToListeners);
     // Launch server from the chat
     ////ExportToOtherApps.AddListener(LaunchStreaming);
     // Stop server from the chat
     //ExportToOtherApps.AddListener(StopStreaming);
     //// Debug incoming message
     ExportToOtherApps.AddListener(ConsoleCommunication.DisplayMessage);
 }
Exemplo n.º 2
0
        private static void UseMockUData()
        {
            int count = 0;

            while (m_thread != null)
            {
                RestreamChatMessage chatMessage = FakeChatMessageGenerator.CreateFakeMessage("Fake User", "I am a message test " + count++, ChatPlatform.Mockup);
                ExportToOtherApps.ThrowMessages(chatMessage);
                Thread.Sleep(1000);
            }
        }
Exemplo n.º 3
0
        private static void CheckForNewMessages()
        {
            string        htmlCode = "";
            List <string> messagesAsHtml;
            List <RestreamChatMessage> foundMessageInPage = new List <RestreamChatMessage>();
            List <RestreamChatMessage> newMessageInPage   = new List <RestreamChatMessage>();
            long tick = 0;

            while (m_instanceRunning != null && m_instanceRunning.IsAllowToRun())
            {
                if (!m_instanceRunning.m_selenium.IsNavigatorOpen())
                {
                    m_instanceRunning.StopRunning();
                    Environment.Exit(0);
                }
                else
                {
                    Console.Out.WriteLine("\n\nTick:\n" + tick);
                    // Console.Out.WriteLine("HTML:\n" + htmlCode);

                    htmlCode = m_instanceRunning.m_selenium.GetRestreamHtmlPageInformation();
                    HTML2Messages.GetMessagesInHTML(htmlCode, out messagesAsHtml, out foundMessageInPage);

                    if (foundMessageInPage.Count > 0)
                    {
                        m_instanceRunning.m_messagesInMemory.AddMessagesAndRecovertNewInList(ref foundMessageInPage, out newMessageInPage);
                        // m_instanceRunning.m_messagesInMemory.Add(newMessageInPage);
                        ExportToOtherApps.Push(newMessageInPage);
                    }
                    Console.Out.WriteLine(
                        string.Format("In Page: {0}html - {1}msg - {2}new ", messagesAsHtml.Count, foundMessageInPage.Count, newMessageInPage.Count));
                }
                Thread.Sleep(m_instanceRunning.GetDelayBetweenFrame());
                tick++;
            }
        }