MRTSharp 1.0.0
See the version list below for details.
dotnet add package MRTSharp --version 1.0.0
NuGet\Install-Package MRTSharp -Version 1.0.0
<PackageReference Include="MRTSharp" Version="1.0.0" />
paket add MRTSharp --version 1.0.0
#r "nuget: MRTSharp, 1.0.0"
// Install MRTSharp as a Cake Addin #addin nuget:?package=MRTSharp&version=1.0.0 // Install MRTSharp as a Cake Tool #tool nuget:?package=MRTSharp&version=1.0.0
MRT#
MRT# is a fast multi-threaded MRT parser library written in C#.
Example Usage
The entrypoint of the parser is the Run
static method of the MRTParser
class.
using MRTSharp;
using System.IO;
class Program
{
static void Main()
{
FileInfo file = new FileInfo(@"path-to-mrt-file");
MRTParser.Run(file, (mrtEntry) =>
{
// Do something with the mrtEntry
});
}
}
Other options
Input file options
MRTParser.Run
method has different signatures. It accepts FileInfo
, IEnumerable<FileInfo>
or DirectoryInfo
as parameter.
Using the DirectoryInfo
version, all files contained in the specified directory are processed, ignoring subdirectories and their files.
Processing options
All the MRTParser.Run
methods that accept more than one file (IEnumerable<FileInfo>
or DirectoryInfo
) have an optional boolean parameter multithreaded
(default=true) that can be used to disable the multithreaded parsing.
Output options
MRTParser.Run
method has two signatures.
The first one, only takes a single parameter (FileInfo
, IEnumerable<FileInfo>
or DirectoryInfo
) and returns a List
.
The second one, takes two parameters: FileInfo
/IEnumerable<FileInfo>
/DirectoryInfo
, and a callback (like in the above example) that enables the user to further process MRT records.
Moreover, both the one and two parameter versions of the method can be invoked with the diamond operator <T>
. Using <T>
, it is possible to specify the type of the returned objects. All the objects that cannot be downcasted to T
are automatically discarded.
T
can be one of the following: MRTEntry
(default, if not specified), TableDumpRIBRecord
, BGP4MPEntry
, BGP4MPMessage
, or BGP4MPStateChange
.
Logging
MRT# logs on the DEBUG
channel if an MRT file is corrupted or some fields cannot be parsed.
You can connect your own logger, that MUST be an instance of a Microsoft.Extensions.Logging.ILogger
implementation, using the SetLogger
static method of MRTParser
before calling the Run
method.
MRTParser.SetLogger(yourILoggerVariable);
MRTParser.Run(...);
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. |
-
net5.0
- Microsoft.Extensions.Logging.Abstractions (>= 5.0.0)
- SharpZipLib (>= 1.3.1)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.