Ejemplo n.º 1
0
 public Ix(
     I2_InfoDisplay iDsp,
     I4_GetScreen iScreen,
     I5_MouseAndKeyboard iMouse,
     I6_WhatsAppProcess iWhatsApp,
     I8_UpdateCommunicator iUpdater,
     I9_CPUSlowdown iSlowdown
     )
 {
     this.iDsp      = iDsp;
     this.iScreen   = iScreen;
     this.iMouse    = iMouse;
     this.iWhatsApp = iWhatsApp;
     this.iUpdater  = iUpdater;
     this.iSlowdown = iSlowdown;
 }
Ejemplo n.º 2
0
        public void Start()
        {
            m_wantToStop   = new ManualResetEvent(false);
            m_workerThread = new Thread(new ThreadStart(internalThread));
            List <string> dspWarning = new List <string>();
            StringBuilder logInfo    = new StringBuilder();

            // I2
            Console.WriteLine("I2...");
            string sI2 = ConfigurationManager.AppSettings["_2InfoDisplay"];

            logInfo.Append(" _2InfoDisplay:" + sI2);
            switch (sI2)
            {
            case "DebugOut":
                m_2iInfoDisplay = new _2InfoDisplay_DebugOut(this.m_wantToStop);
                dspWarning.Add("_2InfoDisplay.DebugOut");
                break;

            case "DataLogger":
                m_2iInfoDisplay = new _2InfoDisplay_DataLogger();
                dspWarning.Add("_2InfoDisplay.DataLogger");
                break;

            case "FromApp":
                m_2iInfoDisplay = new _2InfoDisplay_FromApp(this.m_wantToStop);
                break;

            default:
                throw new ArgumentException("Config I2");
            }

            // I3
            Console.WriteLine("I3...");
            string sI3 = ConfigurationManager.AppSettings["_3GetData"];

            logInfo.Append(" _3GetData:" + sI3);
            switch (sI3)
            {
            case "DebugHardcoded":
                m_3iGetData = new _3GetData_DebugHardcoded();
                dspWarning.Add("_3GetData.DebugHardcoded");
                break;

            case "Server":
                m_3iGetData = new _3GetData_Server(MyUrls.trayASPURL_LiveNoSSL);
                break;

            case "None":
                m_3iGetData = new _3GetData_None(MyUrls.trayASPURL_LiveNoSSL);
                dspWarning.Add("_3GetData.None");
                break;

            default:
                throw new ArgumentException("Config I3");
            }

            // I4
            Console.WriteLine("I4...");
            string sI4 = ConfigurationManager.AppSettings["_4GetScreen"];

            logInfo.Append(" _4GetScreen:" + sI4);
            switch (sI4)
            {
            case "DebugReadTemplateFile":
                m_4Screen = new _4GetScreen_DebugReadTemplateFile(
                    ConfigurationManager.AppSettings["_4GetScreen_DebugReadTemplateFile_Path"]);
                dspWarning.Add("_4GetScreen.DebugReadTemplateFile");
                break;

            case "Real":
                m_4Screen = new _4GetScreen_Real();
                break;

            default:
                throw new ArgumentException("Config I4");
            }

            // I5
            Console.WriteLine("I5...");
            string sI5 = ConfigurationManager.AppSettings["_5MouseAndKeyboard"];

            logInfo.Append(" _5MouseAndKeyboard:" + sI5);
            switch (sI5)
            {
            case "Dummy":
                m_5Mouse = new _5MouseAndKeyboard_Dummy();
                dspWarning.Add("_5MouseAndKeyboard.Dummy");
                break;

            case "Real":
                m_5Mouse = new _5MouseAndKeyboard_Real(m_2iInfoDisplay);
                break;

            default:
                throw new ArgumentException("Config I5");
            }

            // I6
            // test s
            //_2InfoDisplay_FromApp d = new _2InfoDisplay_FromApp(new ManualResetEvent(false));
            //d.Start();
            //_5MouseAndKeyboard_Real m = new _5MouseAndKeyboard_Real(d);
            //Ix i13 = new Ix();
            //i13.iMouse = m;
            //List<int> xx = new List<int> { 0xf0, 0x9f, 0x8d, 0x8e };
            //string s = "";
            //foreach (var xxx in xx)
            //{
            //    s += (char)xxx;
            //}
            //_6WhatsAppProcess_Real.EnterTextAndCheckForMouseMove(s, true, i13, null);
            // test e
            Console.WriteLine("I6...");
            string sI6 = ConfigurationManager.AppSettings["_6WhatsAppProcessTree"];

            logInfo.Append(" _6WhatsAppProcessTree:" + sI6);
            string[]           sI6Parts       = sI6.Split(new char[] { ',' });
            I6_WhatsAppProcess currentI6Child = null;

            for (int i6Id = 0; i6Id < sI6Parts.Length; i6Id++)
            {
                string             next   = sI6Parts[sI6Parts.Length - i6Id - 1];
                I6_WhatsAppProcess nextI6 = null;
                switch (next)
                {
                case "Real":
                    nextI6 = new _6WhatsAppProcess_Real();
                    break;

                case "Simulator":
                    nextI6 = new _6WhatsAppProcess_Simulator();
                    dspWarning.Add("_6WhatsAppProcess.Simulator");
                    break;

                case "PreTelControll":
                    nextI6 = new _6WhatsAppProcess_Pre_TelControll(this.m_wantToStop);
                    break;

                case "PreDeleteBmps":
                    nextI6 = new _6WhatsAppProcess_Pre_DeleteBmps();
                    break;

                case "PreFoxStarter":
                    nextI6 = new _6WhatsAppProcess_Pre_FoxStarter();
                    break;

                case "PreFocusFox":
                    nextI6 = new _6WhatsAppProcess_Pre_FocusFox();
                    break;

                default:
                    throw new ArgumentException("Config I6");
                } // end switch
                nextI6.SetUp(currentI6Child);
                currentI6Child = nextI6;
            }
            m_6Process = currentI6Child;

            // I7 was firefox

            // I8
            Console.WriteLine("I8...");
            string sI8 = ConfigurationManager.AppSettings["_8UpdateCommunicator"];

            logInfo.Append(" _8UpdateCommunicator:" + sI8);
            switch (sI8)
            {
            case "Real":
                m_8Updater = new _8UpdateCommunicator_Real();
                break;

            case "Dummy":
                m_8Updater = new _8UpdateCommunicator_Dummy();
                dspWarning.Add("_8UpdateCommunicator.Dummy");
                break;

            default:
                throw new ArgumentException("Config I8");
            }
            /////////////////////////////////////////
            Console.WriteLine("m_2iInfoDisplay...");
            m_2iInfoDisplay.Start();
            m_2iInfoDisplay.FileLog_Info(logInfo.ToString());

            foreach (String line in dspWarning)
            {
                m_2iInfoDisplay.AddLine("*** " + line);
                m_2iInfoDisplay.FileLog_Info("*** " + line);
            }

            Console.WriteLine("http...");
            HttpServer http = new HttpServer();

            http.GoAndReturn();
            Thread.Sleep(1000);
            m_2iInfoDisplay.FileLog_Info("HTTP: " + http.Result.ToString());

            if ("HTTP.OnlyServer".IsConfiguredAndTRUE())
            {
                while (true)
                {
                    Thread.Sleep(1000);
                }
            }
            else
            {
                m_workerThread.Start();
            }
        }