mirror of
https://github.com/claunia/plist-cil.git
synced 2025-12-16 19:14:26 +00:00
Minor fixes in how property lists are serialized to XML, to maintain compatibility with the Apple format:
- NSNumber of "0/real" is serialized as "0.0" - Data values are not indented - Newline at the end of the file - Always use \r as newline
This commit is contained in:
@@ -138,6 +138,16 @@ namespace plistcil.test
|
||||
Assert.IsInstanceOf<double>(weight);
|
||||
Assert.AreEqual(10d, (double)weight);
|
||||
}
|
||||
|
||||
[Test]
|
||||
public static void RoundtripTest()
|
||||
{
|
||||
var expected = File.ReadAllText(@"test-files\Roundtrip.plist");
|
||||
var value = XmlPropertyListParser.Parse(new FileInfo(@"test-files\Roundtrip.plist"));
|
||||
var actual = value.ToXmlPropertyList();
|
||||
|
||||
Assert.AreEqual(expected, actual);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -118,6 +118,9 @@
|
||||
<None Include="test-files\ResourceRules.plist">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
<None Include="test-files\Roundtrip.plist">
|
||||
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
|
||||
</None>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\plist-cil\plist-cil.csproj">
|
||||
|
||||
80
plist-cil.test/test-files/Roundtrip.plist
Normal file
80
plist-cil.test/test-files/Roundtrip.plist
Normal file
@@ -0,0 +1,80 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
||||
<plist version="1.0">
|
||||
<dict>
|
||||
<key>files</key>
|
||||
<dict>
|
||||
<key>PkgInfo</key>
|
||||
<data>
|
||||
n57qDP4tZfLD1rCS43W0B4LQjzE=
|
||||
</data>
|
||||
<key>icon.png</key>
|
||||
<data>
|
||||
EUOeOW/HpmiAZeEGzJm8j3hE6vo=
|
||||
</data>
|
||||
</dict>
|
||||
<key>files2</key>
|
||||
<dict>
|
||||
<key>PkgInfo</key>
|
||||
<data>
|
||||
n57qDP4tZfLD1rCS43W0B4LQjzE=
|
||||
</data>
|
||||
<key>icon.png</key>
|
||||
<data>
|
||||
EUOeOW/HpmiAZeEGzJm8j3hE6vo=
|
||||
</data>
|
||||
</dict>
|
||||
<key>rules</key>
|
||||
<dict>
|
||||
<key>.*</key>
|
||||
<true/>
|
||||
<key>Info.plist</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>10</real>
|
||||
</dict>
|
||||
<key>ResourceRules.plist</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>100</real>
|
||||
</dict>
|
||||
</dict>
|
||||
<key>rules2</key>
|
||||
<dict>
|
||||
<key>.*</key>
|
||||
<true/>
|
||||
<key>Info.plist</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>10</real>
|
||||
</dict>
|
||||
<key>ResourceRules.plist</key>
|
||||
<dict>
|
||||
<key>omit</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>100</real>
|
||||
</dict>
|
||||
<key>^(Frameworks|SharedFrameworks|Plugins|Plug-ins|XPCServices|Helpers|MacOS)/</key>
|
||||
<dict>
|
||||
<key>nested</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>0.0</real>
|
||||
</dict>
|
||||
<key>^[^/]+$</key>
|
||||
<dict>
|
||||
<key>top</key>
|
||||
<true/>
|
||||
<key>weight</key>
|
||||
<real>0.0</real>
|
||||
</dict>
|
||||
</dict>
|
||||
</dict>
|
||||
</plist>
|
||||
Reference in New Issue
Block a user