diff --git a/plist-cil/BinaryPropertyListParser.cs b/plist-cil/BinaryPropertyListParser.cs
index b700ab8..4793d46 100644
--- a/plist-cil/BinaryPropertyListParser.cs
+++ b/plist-cil/BinaryPropertyListParser.cs
@@ -118,7 +118,7 @@ namespace Claunia.PropertyList
/// The root object of the property list. This is usually a NSDictionary but can also be a NSArray.
/// The binary property list's data.
/// When the property list's format could not be parsed.
- NSObject DoParse(ReadOnlySpan bytes)
+ protected NSObject DoParse(ReadOnlySpan bytes)
{
if(bytes.Length < 8 || bytes[0] != 'b' || bytes[1] != 'p' || bytes[2] != 'l' || bytes[3] != 'i' ||
bytes[4] != 's' || bytes[5] != 't')
@@ -194,6 +194,11 @@ namespace Claunia.PropertyList
return Parse(f.OpenRead());
}
+ protected int GetOffset(int obj)
+ {
+ return this.offsetTable[obj];
+ }
+
///
/// Parses an object inside the currently parsed binary property list.
/// For the format specification check
@@ -205,7 +210,7 @@ namespace Claunia.PropertyList
/// The parsed object.
/// The object ID.
/// When the property list's format could not be parsed.
- NSObject ParseObject(ReadOnlySpan bytes, int obj)
+ protected virtual NSObject ParseObject(ReadOnlySpan bytes, int obj)
{
int offset = offsetTable[obj];
byte type = bytes[offset];
diff --git a/plist-cil/BinaryPropertyListWriter.cs b/plist-cil/BinaryPropertyListWriter.cs
index 8651e23..17dd1a7 100644
--- a/plist-cil/BinaryPropertyListWriter.cs
+++ b/plist-cil/BinaryPropertyListWriter.cs
@@ -62,13 +62,13 @@ namespace Claunia.PropertyList
public const int VERSION_20 = 20;
// map from object to its ID
- readonly Dictionary idDict = new Dictionary(new AddObjectEqualityComparer());
- readonly Dictionary idDict2 = new Dictionary(new GetObjectEqualityComparer());
+ protected readonly Dictionary idDict = new Dictionary(new AddObjectEqualityComparer());
+ protected readonly Dictionary idDict2 = new Dictionary(new GetObjectEqualityComparer());
// # of bytes written so far
- long count;
- int currentId;
- int idSizeInBytes;
+ private long count;
+ protected int currentId;
+ private int idSizeInBytes;
// raw output stream to result file
Stream outStream;
@@ -91,6 +91,14 @@ namespace Claunia.PropertyList
outStream = outStr;
}
+ public BinaryPropertyListWriter(Stream outStr, int version, IEqualityComparer addObjectEqualityComparer, IEqualityComparer getObjectEqualityComparer)
+ {
+ this.version = version;
+ outStream = outStr;
+ idDict = new Dictionary(addObjectEqualityComparer);
+ idDict2 = new Dictionary(getObjectEqualityComparer);
+ }
+
///
/// Gets or sets a value indicating whether two equivalent objects should be serialized once in the binary property
/// list file, or whether
@@ -273,7 +281,7 @@ namespace Claunia.PropertyList
outStream.Flush();
}
- internal void AssignID(NSObject obj)
+ protected internal virtual void AssignID(NSObject obj)
{
if(ReuseObjectIds)
{