private void AnalizePostResponse(string response, string sessionId, NameValueCollection postData) { if (string.IsNullOrEmpty(response) || response.Equals("EMPTY_FOLDER")) { return; } if (!_ServerApiProvider.AnalizePostSessionResponse(response)) { LogController.GetInstance().LogData(LogController. GetInstance().LogFormat.GetNetworkLine("Upload Fail")); CacheProcessor.CreateEncryptedImages(sessionId); CacheProcessor.DeleteDecryptedImages(sessionId); if (postData != null) { IList <string> data = new List <string>(); for (int i = 0; i < postData.Count; i++) { string key = postData.GetKey(i); string value = postData[key]; data.Add(string.Format("{0}={1}", key, value)); } CacheProcessor.SaveData(data, sessionId, true); } else { CacheProcessor.EncryptData(sessionId); } CacheProcessor.DeleteDecryptedData(sessionId); CurrentContext.GetInstance().Session.KeyboardTimes.Clear(); CurrentContext.GetInstance().Session.MouseTimes.Clear(); // Ahmed CurrentContext.GetInstance().Session.ActiveAppTitles.Clear(); } else { LogController.GetInstance().LogData(LogController. GetInstance().LogFormat.GetNetworkLine("Upload Success")); CurrentContext.GetInstance().Session.KeyboardTimes.Clear(); CurrentContext.GetInstance().Session.MouseTimes.Clear(); CurrentContext.GetInstance().Session.ActiveAppTitles.Clear(); // Ahmed CacheProcessor.DeleteAllImages(sessionId); CacheProcessor.DeleteEncryptedData(sessionId); CacheProcessor.DeleteDecryptedData(sessionId); CacheProcessor.DeleteSessionFolder(sessionId); } }
public void SaveEncryptDecryptImageTest() { Image img = ActivityProcessor.GetInstance().MakeScreenshot(); string sessionId = (200 + TimingHelper.GetCurrentTimestamp()).ToString(); CacheProcessor.SaveImage(img, "300", sessionId, false); CacheProcessor.CreateEncryptedImages(sessionId); CacheProcessor.DeleteDecryptedImages(sessionId); CacheProcessor.CreateDecryptedImages(sessionId); CacheProcessor.DeleteEncryptedImages(sessionId); string[] imgPaths = CacheProcessor.GetDecryptedImagePaths(sessionId); Assert.IsTrue(imgPaths.Length == 1); Assert.IsTrue(imgPaths[0].Contains("300.jpg")); }