mirror of
https://github.com/claunia/plist-cil.git
synced 2025-12-16 19:14:26 +00:00
General refactor and clean-up.
This commit is contained in:
51
README.md
51
README.md
@@ -7,15 +7,16 @@ It is mostly based on [dd-plist for Java](https://github.com/3breadt/dd-plist).
|
||||
And as it, this is licensed under the terms of the MIT license.
|
||||
|
||||
Property lists are files used to store user settings and serialized objects.
|
||||
They originate from the NeXTSTEP programming environment and are now a basic part of thhe Cocoa framework (macOS and iOS) as well as the GNUstep framework.
|
||||
They originate from the NeXTSTEP programming environment and are now a basic part of thhe Cocoa framework (macOS and
|
||||
iOS) as well as the GNUstep framework.
|
||||
|
||||
## Features
|
||||
|
||||
* Read / write property lists from / to files, streams or byte arrays
|
||||
* Convert between property lists formats
|
||||
* Property list contents are provided as objects from the NeXTSTEP environment (NSDictionary, NSArray, NSString, etc.)
|
||||
* Serialize native .NET data structures to property list objects
|
||||
* Deserialize from property list objects to native .NET data structures
|
||||
* Read / write property lists from / to files, streams or byte arrays
|
||||
* Convert between property lists formats
|
||||
* Property list contents are provided as objects from the NeXTSTEP environment (NSDictionary, NSArray, NSString, etc.)
|
||||
* Serialize native .NET data structures to property list objects
|
||||
* Deserialize from property list objects to native .NET data structures
|
||||
|
||||
## Supported formats
|
||||
|
||||
@@ -24,6 +25,7 @@ They originate from the NeXTSTEP programming environment and are now a basic par
|
||||
* Cocoa / NeXTSTEP / GNUstep ASCII
|
||||
|
||||
## Requirements
|
||||
|
||||
plist-cil targets:
|
||||
|
||||
- .NET Framework 4.5,
|
||||
@@ -32,16 +34,20 @@ plist-cil targets:
|
||||
- .NET Core 3.1.
|
||||
- .NET 5.0
|
||||
|
||||
This means it should be compatible with Mono, Xamarin.iOS, Xamarin.Mac, UWP, etc. If you find an incompatibility, please create an issue.
|
||||
This means it should be compatible with Mono, Xamarin.iOS, Xamarin.Mac, UWP, etc. If you find an incompatibility, please
|
||||
create an issue.
|
||||
|
||||
## Download
|
||||
|
||||
The latest releases can be downloaded [here](https://github.com/claunia/plist-cil/releases).
|
||||
|
||||
## NuGet support
|
||||
You can download the NuGet package directly from the [release](https://github.com/claunia/plist-cil/releases) page or from the [NuGet Gallery](https://www.nuget.org/) or from [here](https://www.nuget.org/packages/plist-cil/).
|
||||
|
||||
You can download the NuGet package directly from the [release](https://github.com/claunia/plist-cil/releases) page or
|
||||
from the [NuGet Gallery](https://www.nuget.org/) or from [here](https://www.nuget.org/packages/plist-cil/).
|
||||
|
||||
## Help
|
||||
|
||||
The API documentation is included in the download.
|
||||
|
||||
When you encounter a bug please report it by on the [issue tracker](https://github.com/claunia/plist-cil/issues).
|
||||
@@ -50,28 +56,39 @@ When you encounter a bug please report it by on the [issue tracker](https://gith
|
||||
|
||||
### Reading
|
||||
|
||||
Parsing can be done with the PropertyListParser class. You can feed the `PropertyListParser` with a `FileInfo`, a `Stream` or a `byte` array.
|
||||
The `Parse` method of the `PropertyListParser` will parse the input and give you a `NSObject` as result. Generally this is a `NSDictionary` but it can also be a `NSArray`.
|
||||
Parsing can be done with the PropertyListParser class. You can feed the `PropertyListParser` with a `FileInfo`, a
|
||||
`Stream` or a `byte` array.
|
||||
The `Parse` method of the `PropertyListParser` will parse the input and give you a `NSObject` as result. Generally this
|
||||
is a `NSDictionary` but it can also be a `NSArray`.
|
||||
|
||||
_Note: Property lists created by `NSKeyedArchiver` are not yet supported._
|
||||
|
||||
You can then navigate the contents of the property lists using the various classes extending `NSObject`. These are modeled in such a way as to closely resemble the respective Cocoa classes.
|
||||
You can then navigate the contents of the property lists using the various classes extending `NSObject`. These are
|
||||
modeled in such a way as to closely resemble the respective Cocoa classes.
|
||||
|
||||
You can also directly convert the contained `NSObject` objects into native .NET Objects with the `NSOBject.ToObject()` method. Using this method you can avoid working with `NSObject` instances altogether.
|
||||
You can also directly convert the contained `NSObject` objects into native .NET Objects with the `NSOBject.ToObject()`
|
||||
method. Using this method you can avoid working with `NSObject` instances altogether.
|
||||
|
||||
### Writing
|
||||
|
||||
You can create your own property list using the various constructors of the different `NSObject` classes. Or you can wrap existing native .NET structures with the method `NSObject.Wrap(Object o)`. Just make sure that the root object of the property list is either a `NSDictionary` (can be created from objects of the type `Dictionary<string, Object>`) or a `NSArray` (can be created from object arrays).
|
||||
You can create your own property list using the various constructors of the different `NSObject` classes. Or you can
|
||||
wrap existing native .NET structures with the method `NSObject.Wrap(Object o)`. Just make sure that the root object of
|
||||
the property list is either a `NSDictionary` (can be created from objects of the type `Dictionary<string, Object>`) or a
|
||||
`NSArray` (can be created from object arrays).
|
||||
|
||||
For building a XML property list you can then call the `ToXml` method on the root object of your property list. It will give you an UTF-8 `string` containing the property list in XML format.
|
||||
For building a XML property list you can then call the `ToXml` method on the root object of your property list. It will
|
||||
give you an UTF-8 `string` containing the property list in XML format.
|
||||
|
||||
If you want to have the property list in binary format use the `BinaryPropertyListWriter` class. It can write the binary property list directly to a file or to a `Stream`.
|
||||
If you want to have the property list in binary format use the `BinaryPropertyListWriter` class. It can write the binary
|
||||
property list directly to a file or to a `Stream`.
|
||||
|
||||
When you directly want to save your property list to a file, you can also use the `SaveAsXml` or `SaveAsBinary` methods of the `PropertyListParser` class.
|
||||
When you directly want to save your property list to a file, you can also use the `SaveAsXml` or `SaveAsBinary` methods
|
||||
of the `PropertyListParser` class.
|
||||
|
||||
### Converting
|
||||
|
||||
For converting a file into another format there exist convenience methods in the `PropertyListParser` class: `ConvertToXml`, `ConvertToBinary`, `ConvertToASCII` and `ConvertToGnuStepASCII`.
|
||||
For converting a file into another format there exist convenience methods in the `PropertyListParser` class:
|
||||
`ConvertToXml`, `ConvertToBinary`, `ConvertToASCII` and `ConvertToGnuStepASCII`.
|
||||
|
||||
## Code snippets
|
||||
|
||||
|
||||
Reference in New Issue
Block a user