/// <summary> /// Finds <see cref="ArchiveDataBlockPointer"/> that match the search criteria that is determined by member variables. /// </summary> private bool FindDataBlockPointer(ArchiveDataBlockPointer dataBlockPointer) { if (dataBlockPointer != null) // Note: The StartTime value of the pointer is ignored if m_searchStartTime = TimeTag.MinValue and // m_searchEndTime = TimeTag.MaxValue. In this case only the PointID value is compared. This // comes in handy when the first or last pointer is to be found from the list of pointers for // a point ID in addition to all the pointer for a point ID. return ((dataBlockPointer.HistorianID == m_searchHistorianID) && (m_searchStartTime == TimeTag.MinValue || dataBlockPointer.StartTime >= m_searchStartTime) && (m_searchEndTime == TimeTag.MaxValue || dataBlockPointer.StartTime <= m_searchEndTime)); else return false; }
/// <summary> /// Initializes <see cref="VariableTableRegion"/> by parsing the specified <paramref name="buffer"/> containing a binary image. /// </summary> /// <param name="buffer">Buffer containing binary image to parse.</param> /// <param name="startIndex">0-based starting index in the <paramref name="buffer"/> to start parsing.</param> /// <param name="length">Valid number of bytes within <paramref name="buffer"/> from <paramref name="startIndex"/>.</param> /// <returns>The number of bytes used for initialization in the <paramref name="buffer"/> (i.e., the number of bytes parsed).</returns> /// <exception cref="ArgumentNullException"><paramref name="buffer"/> is null.</exception> /// <exception cref="ArgumentOutOfRangeException"> /// <paramref name="startIndex"/> or <paramref name="length"/> is less than 0 -or- /// <paramref name="startIndex"/> and <paramref name="length"/> will exceed <paramref name="buffer"/> length. /// </exception> public int ParseBinaryImage(byte[] buffer, int startIndex, int length) { buffer.ValidateParameters(startIndex, length); ArchiveDataBlockPointer blockPointer; // Set parsing cursor beyond old-style visual basic array descriptor int index = startIndex + ArrayDescriptorLength; for (int i = 0; i < m_parent.m_dataBlockCount; i++) { blockPointer = new ArchiveDataBlockPointer(m_parent.m_parent, i); index += blockPointer.ParseBinaryImage(buffer, index, length - (index - startIndex)); m_parent.m_dataBlockPointers.Add(blockPointer); } return (index - startIndex); }