Ejemplo n.º 1
0
 public void KeyBoardKeyAndWait(char c, int delayPos, I2_InfoDisplay i2)
 {
     i2.Delay(delayPos);
 }
Ejemplo n.º 2
0
        void internalThread()
        {
            m_2iInfoDisplay.FileLog_Debug("internalThread start");
            m_2iInfoDisplay.FileLog_Debug(Assembly.GetAssembly(typeof(IMyLog)).WriteAssemblyVersion());

            m_2iInfoDisplay.ReturnWhenReady();

            Ix iAll = new Ix(m_2iInfoDisplay, m_4Screen, m_5Mouse, m_6Process, m_8Updater, new C9_CPUSlowdown());

            iAll.iSlowdown.Slowdown(iAll);

            processEmptyWakeUpTrigger(iAll);

            while (m_wantToStop.WaitOne(10, false) == false)
            {
                try
                {
                    iAll.iSlowdown.Slowdown(iAll);
                    m_2iInfoDisplay.LoopStart();
                    m_3iGetData.ExchangeDataWithServer(m_2iInfoDisplay, m_6Process);
                    List <ASPTrayBase> serverFiles = m_3iGetData.GetServerFiles(iAll);
                    if (serverFiles.Count == 0)
                    {
                        processEmptyWakeUpTrigger(iAll);
                    }
                    else
                    {
                        foreach (ASPTrayBase f1 in serverFiles)
                        {
                            m_2iInfoDisplay.FileLog_Info("".PadRight(50, '*'));
                            m_2iInfoDisplay.FileLog_Info("processing start : " + f1.GetFileName());
                            iAll.iSlowdown.Slowdown(iAll);
                            ASPTrayBase.eASPtrayType f1e = f1.GetEnumType();
                            switch (f1e)
                            {
                            case ASPTrayBase.eASPtrayType.ScreenShotRequest:
                            {
                                Data_Net__02ScreenshotRequest _02 = (Data_Net__02ScreenshotRequest)f1;
                                m_2iInfoDisplay.FileLog_Info("processing screenshot start: " + _02.MsgTicks.ToString());
                                Bitmap bAll = ImageCapture.GetAll();

                                m_3iGetData.AddResultFile(
                                    new Data_Net__03ScreenshotResult(
                                        bAll.BmpToB64_Png(),
                                        _02.GetFileName()));
                                m_2iInfoDisplay.FileLog_Info("processing done screenshot: " + _02.MsgTicks.ToString());
                            }
                            break;

                            case ASPTrayBase.eASPtrayType.NormalMessage:
                            {
                                Data_Net__00NormalMessage _00 = (Data_Net__00NormalMessage)f1;
                                m_2iInfoDisplay.AddLine(_00.DestMobile);
                                m_2iInfoDisplay.FileLog_Info(_00.DestMobile);
                                if (_00.FailedCounter != 0)
                                {
                                    m_2iInfoDisplay.FileLog_Info(String.Format("FailedCounter: {0} / {1}", _00.FailedCounter, _00.DisposeAfterNFailed));
                                }
                                m_2iInfoDisplay.FileLog_Info("MSG: " + _00.Msg.MsgForLogFile());
                                int  processId;
                                bool use;
                                m_3iGetData.Debug_GetProcessIdOfFile(f1, out processId, out use);
                                if (use)
                                {
                                    m_6Process.Debug_AmendProcessId(processId);
                                }

                                iAll.TypeOfProcess = Ix.eTypeOfProcess.Normal;
                                eI6Error whatsAppRes = m_6Process.Process(
                                    _00.DestMobile,
                                    _00.Msg,
                                    iAll);
                                m_2iInfoDisplay.AddLine(whatsAppRes.ToString());
                                switch (whatsAppRes)
                                {
                                case eI6Error.Success:
                                    m_3iGetData.AddResultFile(new Data_Net__01NormalMessageResult(
                                                                  _00.GetFileName(),
                                                                  true));
                                    m_2iInfoDisplay.FileLog_Debug("processing done: " + _00.UniqueId());
                                    break;

                                case eI6Error.FailedButNoLettingHostKnow_TelNotActive:
                                    m_2iInfoDisplay.AddLine("No Tel in Android yet");
                                    m_2iInfoDisplay.FileLog_Info("No Tel in Android yet");
                                    break;

                                default:
                                    // failed
                                    m_3iGetData.AddResultFile(new Data_Net__01NormalMessageResult(
                                                                  _00.GetFileName(),
                                                                  false));
                                    m_2iInfoDisplay.FileLog_Debug("processing failed (interaction): " + _00.UniqueId() + " " + whatsAppRes.ToString());
                                    break;
                                }
                            }
                            break;

                            case ASPTrayBase.eASPtrayType.CheckTelNumbers:
                            {
                                Data_Net__04CheckTelNumbers _04 = (Data_Net__04CheckTelNumbers)f1;
                                m_2iInfoDisplay.AddLine("CheckTelNumbers:" + _04.GetFileName());
                                MobileNoHandler handleOk          = new MobileNoHandler(_04.TelListChecked);
                                MobileNoHandler handleRetryPlease = new MobileNoHandler("");
                                MobileNoHandler handleNotWorking  = new MobileNoHandler("");
                                foreach (string toBeCheckedNoZap in new MobileNoHandler(_04.TelList).MobileNumberArray)
                                {
                                    string toBeChecked = toBeCheckedNoZap.Zapi_Add();
                                    m_2iInfoDisplay.AddLine("Checking " + toBeChecked);
                                    m_2iInfoDisplay.FileLog_Info("Checking " + toBeChecked);

                                    int  processId;
                                    bool use;
                                    m_3iGetData.Debug_GetProcessIdOfFile(f1, out processId, out use);
                                    if (use)
                                    {
                                        m_6Process.Debug_AmendProcessId(processId);
                                    }
                                    iAll.TypeOfProcess = Ix.eTypeOfProcess.TelNumberChecking;
                                    eI6Error whatsAppRes = m_6Process.Process(
                                        toBeChecked, null, iAll);
                                    m_2iInfoDisplay.AddLine(whatsAppRes.ToString());
                                    switch (whatsAppRes)
                                    {
                                    case eI6Error.Success:
                                        handleOk.Add(toBeCheckedNoZap);
                                        break;

                                    case eI6Error.FailedButNoLettingHostKnow_TelNotActive:
                                        handleRetryPlease.Add(toBeCheckedNoZap);
                                        break;

                                    default:
                                        // failed
                                        handleNotWorking.Add(toBeCheckedNoZap);
                                        break;
                                    }
                                }
                                m_3iGetData.AddResultFile(
                                    new Data_Net__05CheckTelNumbersResult(
                                        _04.GetFileName(),
                                        handleOk.getVal,
                                        handleRetryPlease.getVal,
                                        handleNotWorking.getVal));
                            }
                            break;

                            default:
                                m_2iInfoDisplay.AddLine("UNKOWN FILE TYPE");
                                m_2iInfoDisplay.FileLog_Error("UNKOWN FILE TYPE");
                                break;
                            }
                        }
                    }

                    // delay
                    if (m_3iGetData.DoWeHaveDataToSend())
                    {
                        // we have data to send, so dont wait too long
                        m_2iInfoDisplay.Delay(500);
                    }
                    else
                    {
                        m_2iInfoDisplay.Delay(2 * 1000);
                    }
                }
                catch (SystemException se)
                {
                    m_2iInfoDisplay.AddLine("SystemException");
                    m_2iInfoDisplay.AddLine(se.Message);
                    m_2iInfoDisplay.AddLine(se.ToString());
                    if (!se.ToString().Contains("System.Net.WebException: The operation has timed out"))
                    {
                        m_2iInfoDisplay.FileLog_Error(se.Message + " - " + se.ToString());
                    }
                    m_3iGetData.Reset_toASP();
                    m_2iInfoDisplay.Delay(5 * 1000);
                }
            }
        }