/// <summary>
        /// Causes the <see cref="StatisticsReader"/> to open the archive file and retrieve the statistics.
        /// </summary>
        public void Open()
        {
            m_archiveReader = new ArchiveReader();
            m_archiveReader.Open(ArchiveFilePath);

            m_metadataRecords = m_archiveReader.MetadataFile.Read()
                .Where(record => !string.IsNullOrEmpty(record.Name))
                .ToList();
        }
        /// <summary>
        /// Attempts to connect to this <see cref="LocalInputAdapter"/>.
        /// </summary>
        protected override void AttemptConnection()
        {
            // This adapter is only engaged for history, so we don't process any data unless a temporal constraint is defined
            if (this.TemporalConstraintIsDefined())
            {
                // Turn off read timer if it's active
                m_readTimer.Enabled = false;

                // Attempt to open historian files
                if (Directory.Exists(m_archiveLocation))
                {
                    // Specified directory is a valid one.
                    string[] matches = Directory.GetFiles(m_archiveLocation, "*_archive*.d");

                    if (matches.Length > 0)
                    {
                        // Capture the instance name
                        string fileName = matches[0].Remove(matches[0].IndexOf("_archive", StringComparison.OrdinalIgnoreCase)) + "_archive.d";

                        // Setup historian reader
                        m_archiveReader = new ArchiveReader();
                        m_archiveReader.HistoricFileListBuildStart += m_archiveReader_HistoricFileListBuildStart;
                        m_archiveReader.HistoricFileListBuildComplete += m_archiveReader_HistoricFileListBuildComplete;
                        m_archiveReader.HistoricFileListBuildException += m_archiveReader_HistoricFileListBuildException;
                        m_archiveReader.DataReadException += m_archiveReader_DataReadException;

                        // Open the active archive
                        m_archiveReader.Open(fileName, m_archiveLocation);

                        try
                        {
                            // Start the data reader on its own thread so connection attempt can complete in a timely fashion...
                            ThreadPool.QueueUserWorkItem(StartDataReader);
                        }
                        catch (Exception ex)
                        {
                            // Process exception for logging
                            OnProcessException(MessageLevel.Warning, new InvalidOperationException("Failed to start data reader due to exception: " + ex.Message, ex));
                        }
                    }
                }
                else
                {
                    OnProcessException(MessageLevel.Warning, new InvalidOperationException("Cannot open historian files, directory does not exist: " + m_archiveLocation));
                }
            }
        }