public static ArtifactsList GetList(PatternsSessionData session) { var AllArtifacts = new ArtifactsList() { Session = session }; AllArtifacts.FillList(); Logger.WriteLogEntry(TraceEventType.Information, "Patterns Add On Manager, Artifacts List, Get List", "Created list of Artifacts"); Logger.WriteLogEntry(TraceEventType.Information, "Patterns Add On Manager, Artifacts List, Get List", "List size is " + AllArtifacts.Count.ToString()); return(AllArtifacts); }
public String GenerateGUID(int gestationalAge = 0) { if (Guid2SessionData.Count >= 100) { Logger.WriteLogEntry(TraceEventType.Warning, "Patterns Add On Manager, GUID Handler, Generate GUID", "A limit of 100 tokens reached on this machine"); return(String.Empty); } lock (s_lockObject) { var curGuid = Guid.NewGuid(); int cnt = 100; while (--cnt > 0) { if (curGuid.CompareTo(Guid.Empty) == 0) { continue; } var sameGUID = from c in Guid2SessionData.Keys where c.CompareTo(curGuid) == 0 select c; if (sameGUID == null || sameGUID.Count() == 0) { break; } curGuid = Guid.NewGuid(); } if (cnt <= 0) { return(String.Empty); } Logger.WriteLogEntry(TraceEventType.Verbose, "Patterns Add On Manager, GUID Handler, Generate GUID", "Generate new Token"); var session = new PatternsSessionData(curGuid.ToString()) { GestationalAge = gestationalAge }; if (session.Engine == null) { return(String.Empty); } Guid2SessionData[curGuid] = session; return(curGuid.ToString()); } }
public void AddToQueue(PatternsSessionData session, byte[] upPByte, byte[] hrByte) { lock (s_lockObject) { var item = new RetrospectiveQueueStructure() { FHRByte = hrByte, UPByte = upPByte, Session = session }; QueueList.Add(item); if (!QueueTimer.Enabled) { QueueTimer.Start(); Logger.WriteLogEntry(TraceEventType.Information, "Patterns Add On Manager, RetrospectiveQueue, Add To Queue", "QueueTimer started"); } Logger.WriteLogEntry(TraceEventType.Information, "Patterns Add On Manager, RetrospectiveQueue, Add To Queue", "AddToQueue finished"); } }
public List <Artifact> Convert(PatternsSessionData Session) { lock (Session.LockObject) { Logger.WriteLogEntry(TraceEventType.Information, "Patterns Add On Manager, Results Converter, Convert", "Result size is:" + Session.Results.Count.ToString()); Logger.WriteLogEntry(TraceEventType.Information, "Patterns Add On Manager, Results Converter, Convert", "Session Last Detected Artifact - " + Session.LastDetectedArtifact.ToString()); var toRet = new List <Artifact>(); var results = from c in Session.Results //where c.StartTime != Session.LastDetectedArtifact // - Oleg: No Chrono fix select c; Logger.WriteLogEntry(TraceEventType.Information, "Patterns Add On Manager, Results Converter, Convert", "Answering criteria results - " + results.Count().ToString()); if (results.Count() <= 0) { Logger.WriteLogEntry(TraceEventType.Information, "Patterns Add On Manager, Results Converter, Convert", "No artifacts to convert"); return(toRet); } foreach (var item in results) { var itemToAdd = new Artifact() { StartTime = item.StartTime.ToLocalTime(), EndTime = item.EndTime.ToLocalTime() }; Logger.WriteLogEntry(TraceEventType.Verbose, "Patterns Add On Manager, Results Converter, Convert", "LastDetectedArtifact at " + Session.LastDetectedArtifact.ToString()); switch (item.Category) { case ArtifactCategories.Acceleration: itemToAdd.ArtifactData = FillAccelerationData(item as PeriGen.Patterns.Engine.Data.Acceleration); itemToAdd.Category = Resource.IDS_ACCELERATION; Logger.WriteLogEntry(TraceEventType.Verbose, "Patterns Add On Manager, Results Converter, Convert", "Acceleration, started at " + itemToAdd.StartTime.ToString()); break; case ArtifactCategories.Baseline: itemToAdd.ArtifactData = FillBaselineData(item as PeriGen.Patterns.Engine.Data.Baseline); itemToAdd.Category = Resource.IDS_BASELINE; Logger.WriteLogEntry(TraceEventType.Verbose, "Patterns Add On Manager, Results Converter, Convert", "Baseline, started at " + itemToAdd.StartTime.ToString()); break; case ArtifactCategories.Contraction: itemToAdd.ArtifactData = FillContractionData(item as PeriGen.Patterns.Engine.Data.Contraction); itemToAdd.Category = Resource.IDS_CONTRACTION; Logger.WriteLogEntry(TraceEventType.Verbose, "Patterns Add On Manager, Results Converter, Convert", "Contraction, started at " + itemToAdd.StartTime.ToString()); break; case ArtifactCategories.Deceleration: itemToAdd.ArtifactData = FillDecelerationData(item as PeriGen.Patterns.Engine.Data.Deceleration); itemToAdd.Category = Resource.IDS_DECELERATION; Logger.WriteLogEntry(TraceEventType.Verbose, "Patterns Add On Manager, Results Converter, Convert", "Deceleration, started at " + itemToAdd.StartTime.ToString()); break; default: Logger.WriteLogEntry(TraceEventType.Verbose, "Patterns Add On Manager, Results Converter, Convert", "No Artifact Found Here!!!"); continue; } toRet.Add(itemToAdd); } return(toRet); } }