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 EncryptDecryptTextFromFile() { IList <string> data = PrepareData(); string sessionId = (200 + TimingHelper.GetCurrentTimestamp()).ToString(); CacheProcessor.SaveData(data, sessionId, false); CacheProcessor.EncryptData(sessionId); CacheProcessor.DeleteDecryptedData(sessionId); CacheProcessor.DecryptData(sessionId); CacheProcessor.DeleteEncryptedData(sessionId); IList <string> loadedData = CacheProcessor.LoadData(sessionId); Assert.IsTrue(loadedData.Count == data.Count); for (int i = 0; i < loadedData.Count; i++) { Assert.IsTrue(data[i].Equals(loadedData[i])); } CacheProcessor.DeleteAllSessions(); }