public MyPicWithOriginalStream GetScreenShot(int screenId) { Bitmap b = ImageCapture.GetAll(); MyPicWithOriginalStream ret = new MyPicWithOriginalStream(b); return(ret); }
//public string GetTest() //{ // MS = new MemoryStream(); // addHeader("Test"); // addBodyTest(); // addFooter(); // return SB.ToString(); //} public void GetData(string request, out MemoryStream msOut, out string ContentType) { MS = new MemoryStream(); KnownFiles.eKnownFiles which; if (KnownFiles.IsKnown(request, out which)) { addHeader(KnownFiles.Get(which)); addBodyLinks(KnownFiles.GetAll()); addBodyFile(which); addFooter(); } else if (request == "Screen") { Bitmap bAll = ImageCapture.GetAll(); bAll.Save(MS, System.Drawing.Imaging.ImageFormat.Png); this.ContentType = "image/png"; } else if (request == "FullInfo") { this.ContentType = "text/plain"; TrayStatus full = Mem.GetValues(); if (DisplayTextController._globInstance != null) { full.AddRange(DisplayTextController._globInstance.GetStatus()); } MSAppendLine(full.ToString()); } else if (request == "FullInfoIM") { this.ContentType = "text/plain"; StringBuilder sb = new StringBuilder(); TrayStatus full = Mem.GetValues(); if (DisplayTextController._globInstance != null) { full.AddRange(DisplayTextController._globInstance.GetStatus()); } full.TheList.ForEach(i => i.ToIntermapperInfo(sb)); MSAppendLine(sb.ToString()); } else if (request == "Memory") { addHeader(request); addBodyLinks(KnownFiles.GetAll()); MSAppendLine("<pre>"); MSAppendLine(Mem.GetValues().ToString()); MSAppendLine("</pre>"); addFooter(); } else if (request == "DelPic") { addHeader(request); addBodyLinks(KnownFiles.GetAll()); foreach (BmpFileHandler.PathAndDate f1 in new BmpFileHandler(".").GetSortedList()) { if (f1.Path.Contains("zapi")) { File.Delete(f1.Path); MSAppendLine(f1.Path + "<br />"); } } addFooter(); } else if (request == "ListPic") { addHeader(request); addBodyLinks(KnownFiles.GetAll()); MSAppendLine("<pre>"); foreach (BmpFileHandler.PathAndDate f1 in new BmpFileHandler(".").GetSortedList()) { MSAppendLine(f1.LastWrite.ToString() + " " + f1.Path + "<br />"); } MSAppendLine("</pre>"); addFooter(); } else if (request.StartsWith("ShowPic_")) { try { int id = int.Parse(request.Substring("ShowPic_".Length)); addHeader(request); addBodyLinks(KnownFiles.GetAll()); MSAppendLine("<br>"); MSAppendLine("<br>"); foreach (BmpFileHandler.PathAndDate f1 in new BmpFileHandler(".").GetSortedList()) { MSAppendLine(f1.Path); MSAppendLine("<br>"); MSAppendLine(string.Format("<img src=\"Pic_{0}\" width=\"600\" height=\"500\" > ", f1.Path)); MSAppendLine("<hr>"); } addFooter(); } catch (Exception _) { } } else if (request.StartsWith("Pic_")) { string path = null; try { path = request.Substring("Pic_".Length).Replace("%20", " "); Bitmap bAll = new System.Drawing.Bitmap(path); bAll.Save(MS, System.Drawing.Imaging.ImageFormat.Png); this.ContentType = "image/png"; } catch (Exception _) { } } else if (request == "DelLog") { addHeader(request); addBodyLinks(KnownFiles.GetAll()); KnownFiles.ioDelete(KnownFiles.eKnownFiles.Log); addFooter(); } else if (request == "Step") { addHeader(request); addBodyLinks(KnownFiles.GetAll()); MSAppendLine("<pre>"); MSAppendLine("_6WhatsAppProcess_Real performs steps to send a whatsapp message:<br>"); MSAppendLine("Step 1: findSearchWindow and enter tel<br>"); MSAppendLine("Step 2: findAccount and Click it<br>"); MSAppendLine("Step 3: verify account string top rigth position<br>"); MSAppendLine("Step 4: find type-msg-here, and enter text<br>"); MSAppendLine("</pre>"); addFooter(); } else { addHeader("No selection"); addBodyLinks(KnownFiles.GetAll()); addFooter(); } msOut = this.MS; ContentType = this.ContentType; }
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); } } }