public static int Main(string[] args)
    {
        if (args.Length != 2)
        {
            Console.WriteLine(" Usage:  addRenderInformation <input file> <output file> \n" +
                              "      Adds a render information object to the input file");
            return(1);
        }


        string inputFile  = args[0];
        string outputFile = args[1];

        SBMLDocument doc       = libsbml.readSBMLFromFile(inputFile);
        long         numErrors = doc.getNumErrors(libsbml.LIBSBML_SEV_ERROR);

        if (numErrors > 0)
        {
            Console.WriteLine("Encountered errors while reading the file. ");
            Console.WriteLine("Please correct the following errors and try again.");
            doc.printErrors();
            return(2);
        }

        Model model = doc.getModel();

        LayoutModelPlugin plugin = (LayoutModelPlugin)model.getPlugin("layout");

        if (plugin == null || plugin.getNumLayouts() == 0)
        {
            Console.WriteLine("The loaded model contains no layout information, please add these first.");
            return(3);
        }

        RenderListOfLayoutsPlugin lolPlugin = (RenderListOfLayoutsPlugin)plugin.getListOfLayouts().getPlugin("render");

        if (lolPlugin != null && lolPlugin.getNumGlobalRenderInformationObjects() > 0)
        {
            Console.WriteLine("The loaded model contains global Render information. ");
        }

        // add render information to the first layout
        Layout layout = plugin.getLayout(0);

        RenderLayoutPlugin rPlugin = (RenderLayoutPlugin)layout.getPlugin("render");

        if (rPlugin != null && rPlugin.getNumLocalRenderInformationObjects() > 0)
        {
            Console.WriteLine("The loaded model contains local Render information. ");
        }
        else
        {
            string uri = doc.getLevel() == 2 ? RenderExtension.getXmlnsL2() : RenderExtension.getXmlnsL3V1V1();

            // enable render package
            doc.enablePackage(uri, "render", true);
            doc.setPackageRequired("render", false);

            rPlugin = (RenderLayoutPlugin)layout.getPlugin("render");

            addRenderInformation(rPlugin);

            libsbml.writeSBMLToFile(doc, outputFile);
        }
        return(0);
    }
    public static int Main(string[] args)
    {
        if (args.Length != 1)
        {
            Console.WriteLine(" Usage:  printRenderInformation <input file> \n" +
                              "      prints a summary of the render information object.");
            return(1);
        }


        string inputFile = args[0];

        SBMLDocument doc = libsbml.readSBMLFromFile(inputFile);

        Console.WriteLine("Using libSBML: {0} supporting packages for:", libsbml.getLibSBMLDottedVersion());
        for (int i = 0; i < SBMLExtensionRegistry.getNumRegisteredPackages(); ++i)
        {
            Console.WriteLine("\t {0}", SBMLExtensionRegistry.getRegisteredPackageName(i));
        }

        Console.WriteLine("\nThe document is: level {0}, version {1}", doc.getLevel(), doc.getVersion());
        for (int i = 0; i < doc.getNumPlugins(); ++i)
        {
            Console.WriteLine("  doc uses package: {0}", doc.getPlugin(i).getElementNamespace());
        }

        Console.WriteLine("\n");

        long numErrors = doc.getNumErrors(libsbml.LIBSBML_SEV_ERROR);

        if (numErrors > 0)
        {
            Console.WriteLine("Encountered errors while reading the file. ");
            Console.WriteLine("Please correct the following errors and try again.");
            doc.printErrors();
            return(2);
        }

        Model model = doc.getModel();

        LayoutModelPlugin plugin = (LayoutModelPlugin)model.getPlugin("layout");

        if (plugin == null || plugin.getNumLayouts() == 0)
        {
            Console.WriteLine("The loaded model contains no layout information, please add these first.");
            return(3);
        }

        RenderListOfLayoutsPlugin lolPlugin = (RenderListOfLayoutsPlugin)plugin.getListOfLayouts().getPlugin("render");

        if (lolPlugin != null && lolPlugin.getNumGlobalRenderInformationObjects() > 0)
        {
            Console.WriteLine("The loaded model contains global Render information: ");

            for (int i = 0; i < lolPlugin.getNumGlobalRenderInformationObjects(); ++i)
            {
                GlobalRenderInformation info = lolPlugin.getRenderInformation(i);
                print_render_info(info);
            }
        }

        Layout layout = plugin.getLayout(0);

        RenderLayoutPlugin rPlugin = (RenderLayoutPlugin)layout.getPlugin("render");

        if (rPlugin != null && rPlugin.getNumLocalRenderInformationObjects() > 0)
        {
            Console.WriteLine("The loaded model contains local Render information. ");
            // here we would do the same as above for the local render information ...
            for (int i = 0; i < rPlugin.getNumLocalRenderInformationObjects(); ++i)
            {
                LocalRenderInformation info = rPlugin.getRenderInformation(i);
                print_render_info(info);
            }
        }

        return(0);
    }