/// <summary> /// Create messageReader accroding to file extension /// </summary> /// <param name="CaptureFile">Capture file path</param> /// <returns></returns> IMessageReader CreateMessageReader(string CaptureFile) { IMessageReader reader = null; //Create and Initialize Message Meta data loader catalog MessageMetadataLoaderCatalog messageMetadataLoaderCatalog = new MessageMetadataLoaderCatalog(); messageMetadataLoaderCatalog.Initialize(monitor.Settings.ExtensionLoadPath); if (PersistUtils.IsUnparsedProjectFile(CaptureFile)) { //If capture file is an uncompressed project file reader = FileMessageReader.CreateReaderFromProjectFile(CaptureFile, messageMetadataLoaderCatalog); } else if (PersistUtils.IsCompressedUnparsedProjectFile(CaptureFile) || PersistUtils.IsCompressedProjectFile(CaptureFile)) { //If capture file is a compressed project file reader = FileMessageReader.CreateReaderFromCompressedFile(CaptureFile, messageMetadataLoaderCatalog); } else { //other file type, such as netmon capture file FileReaderCatalog fileReaderCatalog = new FileReaderCatalog(); fileReaderCatalog.Initialize(monitor.Settings.ExtensionLoadPath); IFileLoader fileLoader = fileReaderCatalog.GetRegisteredFileLoaders(CaptureFile).First(); reader = fileLoader.OpenFile(CaptureFile, fileLoader.CreateDefaultConfig(null)); } return(reader); }