Skip to content

picrap/PropertyList

Repository files navigation

PropertyList

A plist (short term for “property list”) reader and writer.

Package

Available as a NuGet package.

How to use it

Supported types

The library handles the following entities:

plist type write read
dict IDictionary<string,object>, IReadOnlyDictionary<string,object> Dictionary<string,object> (where objects are any other type)
array ICollection, IEnumerable<object> List<object> (where objects are any other type)
string string string
real float, double, decimal decimal
integer byte, sbyte, int, uint, long, ulong long
date DateTimeOffset
true/false bool

Reading

The library currently reads xml and binary plists.

using var reader = File.Open("/tmp/my.plist");
var plistReader = new PlistReader();
var plist = plistReader.Read(reader);
var label = (string)plist["Label"];
var programArguments = (IList)plist["ProgramArguments"];

Writing

Only xml writing is supported

var plist = new Dictionary<string, object>
{
    {"Label", "here"},
    {"LaunchOnlyOnce", true},
};
using var writer = File.Create("/tmp/my.plist");
var plistWriter = new PlistWriter();
plistWriter.Write(plist, writer);

About

plist reader/writer made simple

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages