protected virtual void GetResults() { var session = new PatternsSessionData(); List <Artifact> Results = new List <Artifact>(); int nClrTmp = 20; int nResInd = 0; var token = PatternsAddOnTestClient.Instance.CurrentToken; var client = new RestClient(PatternsAddOnTestClient.Instance.CurrentHost); var request = new RestRequest("Sessions/" + token + "/Artifacts", Method.GET) { Timeout = 6000, RequestFormat = DataFormat.Xml }; var response = client.Execute(request); var content = response.Content; // raw content as string if (content.Equals(String.Empty)) { return; } var sr = new StringReader(content); var contentElement = XElement.Load(sr); contentElement = XMLHelper.RemoveAllNamespaces(contentElement); AppendResultsArtifacts(contentElement); var newResults = from c in contentElement.Elements() select c; if (newResults.Count() > 0) { var newDeserializedResults = ArtifactsHelper.DeserializeResults(newResults); AppendResults(Results, newDeserializedResults); if (CheckBoxFlush.Checked) { if (CheckBoxArcive.Checked || TextBoxResult.Text.ToLower().IndexOf(".dat") > 0) { AppendResultsDAT(Results); } if (TextBoxResult.Text.ToLower().IndexOf(".xml") > 0) { AppendResultsXML(Results); } } AppendToGrid(Results, nResInd); nResInd = Results.Count; LastDetected = UpdateLastDetectedTime(Results); } if (--nClrTmp < 0) { nClrTmp = 20; Results.Clear(); } }
public void SetAbsoluteStart(String dataStr) { var sr = new StringReader(dataStr); var contentElement = XElement.Load(sr); contentElement = XMLHelper.RemoveAllNamespaces(contentElement); var startTime = contentElement.Element("StartTime").Value; getResultsCtrl1.AbsoluteStart = ArtifactsHelper.GetDateTime(startTime); AbsolutStartSet = true; }
public void AppendTracings(String dataStr) { var sr = new StringReader(dataStr); var contentElement = XElement.Load(sr); contentElement = XMLHelper.RemoveAllNamespaces(contentElement); var fhr = contentElement.Element("Fhr").Value; var fhrTempList = new List <byte>(Convert.FromBase64String(fhr)); var up = contentElement.Element("Up").Value; var upTempList = new List <byte>(Convert.FromBase64String(up)); var startTime = contentElement.Element("StartTime").Value; DateTime start = ArtifactsHelper.GetDateTime(startTime); var diff = start - LastTimeStamp; if (LastTimeStamp == DateTime.MinValue) { LastTimeStamp = start.AddSeconds(-1); } else if (diff.TotalSeconds > 1) // GAP { int secondsToFill = ((int)Math.Floor(diff.TotalSeconds)) - 1; for (int i = 0; i < secondsToFill; i++) { FhrList.Add(255); FhrList.Add(255); FhrList.Add(255); FhrList.Add(255); UpsList.Add(255); } LastTimeStamp = LastTimeStamp.AddSeconds(secondsToFill); } else if (diff.TotalSeconds <= 0) // OVERLAP { int secondsToRemove = (Math.Abs((int)Math.Floor(diff.TotalSeconds))) + 1; upTempList.RemoveRange(0, secondsToRemove); fhrTempList.RemoveRange(0, secondsToRemove * 4); } FhrList.AddRange(fhrTempList); UpsList.AddRange(upTempList); LastTimeStamp = LastTimeStamp.AddSeconds(upTempList.Count); }