https://github.com/picrap/propertylist
plist reader/writer made simple
https://github.com/picrap/propertylist
Last synced: 9 months ago
JSON representation
plist reader/writer made simple
- Host: GitHub
- URL: https://github.com/picrap/propertylist
- Owner: picrap
- License: mit
- Created: 2023-04-01T17:13:52.000Z (about 3 years ago)
- Default Branch: master
- Last Pushed: 2023-04-17T17:41:57.000Z (about 3 years ago)
- Last Synced: 2025-08-13T21:47:55.753Z (10 months ago)
- Language: C#
- Size: 99.6 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE.txt
Awesome Lists containing this project
README
# PropertyList
A plist (short term for “property list”) reader and writer.
## Package
Available as a [](https://www.nuget.org/packages/PropertyList) package.
## How to use it
### Supported types
The library handles the following entities:
| plist type | write | read |
|--|--|--|
| `dict` | `IDictionary`, `IReadOnlyDictionary` | `Dictionary` (where `object`s are any other type) |
| `array` | `ICollection`, `IEnumerable` | `List` (where `object`s 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.
```csharp
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
```csharp
var plist = new Dictionary
{
{"Label", "here"},
{"LaunchOnlyOnce", true},
};
using var writer = File.Create("/tmp/my.plist");
var plistWriter = new PlistWriter();
plistWriter.Write(plist, writer);
```