public void ScreenshotActionFired(Image img, int timestamp) { _LastScreenshotTime = timestamp; _NotificationHandler.ScreenshotTaken(); int delta = TimingHelper.CalcTimestampDelta(CurrentContext .GetInstance().Session.StartTimestamp, timestamp); CacheProcessor.SaveImage(img, delta.ToString(), CurrentContext.GetInstance().Session.StartTimestamp.ToString(), false); CurrentContext.GetInstance().Session.PostTime = delta; CurrentContext.GetInstance().Session.StopTime = -1; // AHMED TODO add app titles instead of TEST Process[] processes = Process.GetProcesses(); var sb = new System.Text.StringBuilder(); foreach (Process p in processes) { if (!String.IsNullOrEmpty(p.MainWindowTitle)) { sb.Append(p.MainWindowTitle.ToString() + "***"); } } string outputSb = sb.ToString().Replace(",", " - "); if (!CurrentContext.GetInstance().Session.ActiveAppTitles.Contains(outputSb)) { CurrentContext.GetInstance().Session.ActiveAppTitles.Add(outputSb); } // Ahmed END script /*LogController.GetInstance().LogData(LogController. * GetInstance().LogFormat.GetSessionLine("ScreenshotActionFired() -- mode 1: IsSessionDataLocked: " + * CurrentContext.GetInstance().IsSessionDataLocked.ToString()));*/ // while (CurrentContext.GetInstance().IsSessionDataLocked) // Thread.Sleep(1000); /*LogController.GetInstance().LogData(LogController. * GetInstance().LogFormat.GetSessionLine("ScreenshotActionFired() -- mode 2: IsSessionDataLocked: " + * CurrentContext.GetInstance().IsSessionDataLocked.ToString()));*/ //CurrentContext.GetInstance().IsSessionDataLocked = true; CacheStrategyExecutor.GetInstance().CacheStrategy.PostCurrentSession(CurrentContext .GetInstance().Session.StartTimestamp.ToString()); CacheStrategyExecutor.GetInstance().CacheStrategy.PostOldSessions(CurrentContext .GetInstance().Session.StartTimestamp.ToString()); // CurrentContext.GetInstance().IsSessionDataLocked = false; /*LogController.GetInstance().LogData(LogController. * GetInstance().LogFormat.GetSessionLine("ScreenshotActionFired() -- mode 3: IsSessionDataLocked: " + * CurrentContext.GetInstance().IsSessionDataLocked.ToString()));*/ }
public void DecryptedImageSaveTest() { Image img = ActivityProcessor.GetInstance().MakeScreenshot(); string sessionId = (200 + TimingHelper.GetCurrentTimestamp()).ToString(); CacheProcessor.SaveImage(img, "300", sessionId, false); string[] imgPaths = CacheProcessor.GetDecryptedImagePaths(sessionId); Assert.IsTrue(imgPaths.Length == 1); Assert.IsTrue(imgPaths[0].Contains("300.jpg")); CacheProcessor.DeleteAllSessions(); }