Library

The Pnyx library contains everything needed to quickly build software for processing files. It is a stand-alone library (no dependences) with a fluent API. The API is simple to use and easily extended. All of the software is open-source and can be viewed on GitHub: pnyx.net.

To begin using in your project, install the library by downloading from Nuget.org, or open Package Manager and type:
Install-Package pnyx.net

Hello World

To access the Fluent API, use the Pnyx class. It is a state-based builder for creating sequences of filtering and transforms. The following is a simple line-transform and line-filter example:
using (Pnyx p = new Pnyx())
{
    p.readString("Hello World.");
    p.sed("World", "World, with love from Pnyx..");     // transforms each line
    p.grep("world", caseSensitive: false);    // filters each line
    p.writeStdout();
    p.compile();         // Builds processors and wires filters together
    p.process();         // Runs processors (All IO is done here)
}                        
// outputs: Hello World, with love from Pnyx...
Pnyx class requires at least one input and one output before compiling. Filters (grep) and transforms (sed) are optional. The compile and process steps are required. However, by default, when Pnyx is disposed, it will automatically run the compile and process steps. Here is an example of the minimum required calls:
using (Pnyx p = new Pnyx())
{
    p.readString("Minimum");
    p.writeStdout();
}
// outputs: Minimum
    
For the remainder for this documentation, all of example will omit the compile and process steps. For some use-cases it may to desirable to require an explicit call to process. In those cases, set processOnDispose to false and the disposing will not automatically process. See Settings for more information.

Next

Suggested next steps:
  • Basics, learn the basics of filters and transforms
  • State Machine, review the internal state machine for Pnyx