public bool CalculateSingleBatchStatistics() { bool result = false; // Calculate single batch statistics //// Get the last marked and unmarked batches and add them to the graph //int lastBatchId = 0; ProcessCapturePackets pcp = new ProcessCapturePackets(); //lastBatchId = pcp.GetLastCaptureBatchId(); CurrentCaptureFile captureFile = new CurrentCaptureFile(); CaptureFileData cfd = new CaptureFileData(); //captureFile = cfd.GetLastCaptureBatchRecord(); captureFile = cfd.GetCurrentCaptureFile(_CaptureFileName); // Set the global variable _CaptureState = captureFile.CaptureState; BindingList<BatchIntervalMarked> batchIntervals = new BindingList<BatchIntervalMarked>(); // Calculate probabilities batchIntervals = pcp.GetMarkedBatchIntervals(captureFile.CaptureBatchId); int histogramBinSize = Convert.ToInt32(_HistogramBinSize); SortedDictionary<int, decimal> probabilities = new CalculateProbability(batchIntervals).GetProbabilityByPacketRange(_TrimZeroPacketIntervals, histogramBinSize); BatchStatistics markedSingleStats = new BatchStatistics(); BatchStatistics unmarkedSingleStats = new BatchStatistics(); // Add the results to the DisplayStatistics table DisplayStatisticsData dsd = new DisplayStatisticsData(); if(captureFile.CaptureState == CaptureState.Marked) { markedSingleStats = CalculateBatchStatistics(batchIntervals, CaptureState.Marked, BatchType.Single); } else { unmarkedSingleStats = CalculateBatchStatistics(batchIntervals, CaptureState.Unmarked, BatchType.Single); } return result; }
public CurrentCaptureFile GetCurrentCaptureFile(string fileName) { CurrentCaptureFile ccf = null; try { CaptureFileData cfd = new CaptureFileData(); ccf = cfd.GetCurrentCaptureFile(fileName); return ccf; } catch (Exception ex) { throw new Exception("Error retrieving current capture file information: " + ex.Message); } }