Skip to content

PxTools/PCAxis.Serializers

Repository files navigation

PCAxis.Serializers

This repository contains the serialization components required for serializing PCAxis data represented in PAXIOM from .px-files or CNNM-enabled databases. It enables the conversion from PAXIOM to various formats.

Supported Formats

Getting Started

Prerequisites

  • .NET Core 3.1 or later.

Installation

dotnet add package PCAxis.Serializers 

Example Usage

using System;
using System.IO;
using PCAxis.Paxiom;
using PCAxis.Serializers;

namespace MyPxConverter
{
    class Program
    {
        static void Main(string[] args)
        {
            if (args.Length == 0)
            {
                Console.WriteLine("Please provide the PX filename as an argument.");
                return;
            }

            string pxFileName = args[0];
            string baseFileName = Path.GetFileNameWithoutExtension(pxFileName);
            string outputFileName = $"{baseFileName}.parquet";

            try
            {
                // Initialize and build the PX file model
                var builder = new PXFileBuilder(pxFileName);
                var selection = Selection.SelectAll(builder.Model.Meta);
                builder.BuildForPresentation(selection);

                // Serialize to Parquet
                using (var stream = new FileStream(outputFileName, FileMode.Create))
                {
                    var parquetSer = new ParquetSerializer();
                    parquetSer.Serialize(builder.Model, stream);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }
        }
    }
}

Contributing

We welcome contributions to this project. Please see CONTRIBUTING.md for details.

License

This project is licensed under the Apache-2.0 License - see the LICENSE file for details.

Support and Feedback

For support, feature requests, and bug reporting, please open an issue on the GitHub project page.

See Also