public eI6Error Process(string destMobile, string msg, Ix iAll) { using (var x = new LogPreText("Real", iAll)) { return(processPreLogDone(destMobile, msg, iAll)); } }
public override eI6Error Process(string destMobile, string msg, Ix iAll) { using (var x = new LogPreText("FoxS", iAll)) { eI6Error stateThisTime = Process_NoLog(destMobile, msg, iAll); return(stateThisTime); } }
TimeSpan CheckInterval = new TimeSpan(0, 10, 0); //once every 10 minutes public override eI6Error Process(string destMobile, string msg, Ix iAll) { using (var x = new LogPreText("DelLog", iAll)) { if (DateTime.UtcNow > (LastCheck + CheckInterval)) { LastCheck = DateTime.UtcNow; long maxSize; if (long.TryParse("_6WhatsAppProcess_Pre_DeleteLogFile.MaxSize".GetConfig(), out maxSize)) { long currentSize = KnownFiles.ioSize(KnownFiles.eKnownFiles.Log); if (currentSize > maxSize) { KnownFiles.ioDelete(KnownFiles.eKnownFiles.Log); } } } return(Child.Process(destMobile, msg, iAll)); } }
TimeSpan CheckInterval = new TimeSpan(0, 10, 0); //once every 10 minutes public override eI6Error Process(string destMobile, string msg, Ix iAll) { using (var x = new LogPreText("DelB", iAll)) { if (DateTime.UtcNow > (LastCheck + CheckInterval)) { LastCheck = DateTime.UtcNow; int maxFiles = int.Parse("_6WhatsAppProcess_Pre_DeleteBmps.MaxFiles".GetConfig()); BmpFileHandler.PathAndDate[] files = new BmpFileHandler(".").GetSortedList(); iAll.iDsp.FileLog_Info(String.Format("{0} files on disk", files.Length)); if (files.Length > maxFiles) { int toDelete = files.Length - maxFiles; iAll.iDsp.FileLog_Info(String.Format("deleting {0} files", toDelete)); for (int i = 0; i < toDelete; i++) { try { if (files[i].Path.Contains("zapi_")) { File.Delete(files[i].Path); } else { iAll.iDsp.FileLog_Debug("Not deleting as it does not contain the zapi text"); } } catch (SystemException) { } } } } return(Child.Process(destMobile, msg, iAll)); } }
public override eI6Error Process(string destMobile, string msg, Ix iAll) { using (var x = new LogPreText("FocusFox", iAll)) { try { IDictionary <IntPtr, string> wins = win32DLL_native._GetOpenWindows(); string active = win32DLL_native._GetActiveWindowTitle(); if (LogActiveWindowTitle) { iAll.iDsp.FileLog_Info($"Active: {active}"); } if (LogAllWindows) { iAll.iDsp.FileLog_Info($"Wins.Count: {wins.Count}"); foreach (KeyValuePair <IntPtr, string> win in wins) { iAll.iDsp.FileLog_Info($"Wins: {win.Value}"); } } if (!active.EndsWith("- Mozilla Firefox")) { iAll.iDsp.FileLog_Info($"Bad - Needs refocue"); KeyValuePair <IntPtr, string> fox = wins.FirstOrDefault(w => w.Value.EndsWith("- Mozilla Firefox")); iAll.iDsp.FileLog_Info($"Bad - Refocus {fox.Value}"); win32DLL_native.user32_SetForegroundWindow(fox.Key); } else { iAll.iDsp.FileLog_Info("Ok"); } } catch { } return(Child.Process(destMobile, msg, iAll)); } }
public eI6Error Process(string destMobile, string msg, Ix iAll) { using (var x = new LogPreText("Simu", iAll)) { iAll.iDsp.FileLog_Debug(destMobile); eI6Error ret = eI6Error.Success; Console.Clear(); if (iAll.TypeOfProcess == Ix.eTypeOfProcess.TelNumberChecking) { Console.WriteLine("TelNumberChecking"); } Console.WriteLine(destMobile); Console.WriteLine(msg); Console.WriteLine(); Question q = new Question(); q.Add(new QuestionOption("Success", delegate(IMyLog log, QuestionOption it) { ret = eI6Error.Success; })); q.Add(new QuestionOption("TelNotActive", delegate(IMyLog log, QuestionOption it) { ret = eI6Error.FailedButNoLettingHostKnow_TelNotActive; })); q.Add(new QuestionOption("Step2Failed", delegate(IMyLog log, QuestionOption it) { ret = eI6Error.Step2Failed; })); q.AskAndAct("Action: ", null); return(ret); } }
public override eI6Error Process(string destMobile, string msg, Ix iAll) { using (var x = new LogPreText("TelC", iAll)) { // pre, initialise IFace if (IxFaces == null) { using (var _lock = TheInfoList.GetLock()) { IxFaces = iAll; } } // pre, wait for the backgrount task to be up if (BackgroundRunning.WaitOne(1, false) == false) { iAll.iDsp.AddLine("Waiting for background ..."); BackgroundRunning.WaitOne(); iAll.iDsp.AddLine("Waiting for background. Now up&running"); } // 1) Check if tel is on android string telWithPlus = destMobile.Replace("zapi_", ""); TelListController.OneTelEntry theTelEntry = null; using (var _lock = TheInfoList.GetLock()) { theTelEntry = _lock.Locked.GetEntry(telWithPlus); } if ((theTelEntry == null) || (!theTelEntry.IsOnAndroid)) // First round { iAll.iDsp.AddLine("Tel not on Android ..."); iAll.iDsp.FileLog_Info("Tel not on Android"); // It seems this tel no is not on android, // s1 ) refresh List <string> retOnAndroid = null; try { using (var com = IxFaces.iUpdater.Android()) { retOnAndroid = com.GetCommand(iAll.iDsp); } using (var _lock = TheInfoList.GetLock()) { _lock.Locked.Merge(null, retOnAndroid, false); _lock.Locked.Verify(); // update e1 theTelEntry = _lock.Locked.GetEntry(telWithPlus); } iAll.iDsp.AddLine2(new DetailedData_AndroidCommunication(true)); } catch (SocketException se) { } TelControllerReportToFile(TheInfoList.LastVerifyResult.GetFullReport()); } if ((theTelEntry == null) || (!theTelEntry.IsOnAndroid)) // secound round { iAll.iDsp.AddLine("Adding # to Android"); iAll.iDsp.FileLog_Info("Adding # to Android"); try { using (var com = IxFaces.iUpdater.Android()) { com.SetCommand(telWithPlus, IxFaces.iDsp); } using (var _lock = TheInfoList.GetLock()) { _lock.Locked.AddOneAndroid(telWithPlus); _lock.Locked.AddOneServer(telWithPlus); _lock.Locked.Verify(); // update e1 theTelEntry = _lock.Locked.GetEntry(telWithPlus); } iAll.iDsp.AddLine2(new DetailedData_AndroidCommunication(true)); } catch (SocketException) { } TelControllerReportToFile(TheInfoList.LastVerifyResult.GetFullReport()); } if (theTelEntry == null) { // could not add the number to android, so the android is down iAll.iDsp.FileLog_Debug("*************** BAD ERROR: ANDROID IS DOWN ************* "); iAll.iDsp.AddLine2(new DetailedData_AndroidCommunication(false)); return(eI6Error.FailedButNoLettingHostKnow_TelNotActive); } eI6Error childResult = Child.Process(destMobile, msg, iAll); if (childResult == eI6Error.Step2Failed) { // change the error code on recent added tel numbers, so we retry rather than fail string why = null; if ((theTelEntry == null) || (theTelEntry.RecentAddedToAndroid(out why))) { iAll.iDsp.FileLog_Debug("Deescalateing Step2Failed to TelNotActive"); childResult = eI6Error.FailedButNoLettingHostKnow_TelNotActive; } iAll.iDsp.FileLog_Debug("Why: " + why); } return(childResult); } }