Merge pull request #48 from quamotion/fixes/serialization-primitives

Update list of serialization primitives
This commit is contained in:
2018-06-26 20:38:03 +01:00
committed by GitHub
5 changed files with 44 additions and 1 deletions

View File

@@ -37,5 +37,37 @@ namespace plistcil.test
writer.Write(root);
}
}
[Fact]
public void Roundtrip3Test()
{
byte[] data = File.ReadAllBytes("test-files/plist3.bin");
NSObject root = PropertyListParser.Parse(data);
using (MemoryStream actualOutput = new MemoryStream())
using (Stream expectedOutput = File.OpenRead("test-files/plist3.bin"))
using (ValidatingStream validatingStream = new ValidatingStream(actualOutput, expectedOutput))
{
BinaryPropertyListWriter writer = new BinaryPropertyListWriter(validatingStream);
writer.ReuseObjectIds = false;
writer.Write(root);
}
}
[Fact]
public void Roundtrip4Test()
{
byte[] data = File.ReadAllBytes("test-files/plist4.bin");
NSObject root = PropertyListParser.Parse(data);
using (MemoryStream actualOutput = new MemoryStream())
using (Stream expectedOutput = File.OpenRead("test-files/plist4.bin"))
using (ValidatingStream validatingStream = new ValidatingStream(actualOutput, expectedOutput))
{
BinaryPropertyListWriter writer = new BinaryPropertyListWriter(validatingStream);
writer.ReuseObjectIds = false;
writer.Write(root);
}
}
}
}

View File

@@ -119,6 +119,12 @@
<None Update="test-files\plist2.bin">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="test-files\plist3.bin">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="test-files\plist4.bin">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>
<None Update="test-files\RoundtripBinaryIndentation.plist">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</None>

Binary file not shown.

Binary file not shown.

View File

@@ -422,13 +422,18 @@ namespace Claunia.PropertyList
|| content == "$classname"
|| content == "NS.objects"
|| content == "NS.keys"
|| content == "NS.base"
|| content == "NS.relative"
|| content == "NS.string"
|| content == "NSURL"
|| content == "NSDictionary"
|| content == "NSObject"
|| content == "NSMutableDictionary"
|| content == "NSMutableArray"
|| content == "NSArray"
|| content == "NSUUID";
|| content == "NSUUID"
|| content == "NSKeyedArchiver"
|| content == "NSMutableString";
}
internal static bool IsSerializationPrimitive(NSNumber n)