Permalink
Browse files

Added support for non-dictionary root nodes.

  • Loading branch information...
1 parent d43e381 commit 016fdbd7717433edf0acc47036fb81e641b13229 @animetrics committed Oct 18, 2011
Showing with 201 additions and 133 deletions.
  1. +0 −36 CSPlistParser/CSPlistParser.sln
  2. BIN CSPlistParser/CSPlistParser.suo
  3. BIN CSPlistParser/CSPlistParserTests/bin/Debug/CSPlistParser.dll
  4. BIN CSPlistParser/CSPlistParserTests/bin/Debug/CSPlistParser.pdb
  5. +0 −5 CSPlistParser/CSPlistParserTests/obj/Debug/CSPlistParser.csproj.FileListAbsolute.txt
  6. BIN CSPlistParser/CSPlistParserTests/obj/Debug/CSPlistParser.dll
  7. BIN CSPlistParser/CSPlistParserTests/obj/Debug/CSPlistParser.pdb
  8. +0 −5 CSPlistParser/CSPlistParserTests/obj/Debug/CSPlistParserTests.csproj.FileListAbsolute.txt
  9. +1 −1 {CSPlistParser → PlistCS}/Local.testsettings
  10. +30 −0 PlistCS/PlistCS.sln
  11. BIN PlistCS/PlistCS.suo
  12. +1 −1 CSPlistParser/CSPlistParser.vsmdi → PlistCS/PlistCS.vsmdi
  13. +4 −4 CSPlistParser/CSPlistParserTests/CSPlistParserTests.csproj → PlistCS/PlistCS/PlistCS.csproj
  14. +7 −0 PlistCS/PlistCS/PlistCS.csproj.user
  15. +13 −16 CSPlistParser/CSPlistParserTests/plistTests.cs → PlistCS/PlistCS/PlistTests.cs
  16. +3 −3 {CSPlistParser/CSPlistParserTests → PlistCS/PlistCS}/Properties/AssemblyInfo.cs
  17. BIN PlistCS/PlistCS/bin/Debug/PlistCS.dll
  18. BIN PlistCS/PlistCS/bin/Debug/PlistCS.pdb
  19. BIN ...er/CSPlistParserTests → PlistCS/PlistCS}/obj/Debug/DesignTimeResolveAssemblyReferencesInput.cache
  20. +5 −0 PlistCS/PlistCS/obj/Debug/PlistCS.csproj.FileListAbsolute.txt
  21. BIN PlistCS/PlistCS/obj/Debug/PlistCS.dll
  22. BIN PlistCS/PlistCS/obj/Debug/PlistCS.pdb
  23. BIN {CSPlistParser/CSPlistParserTests → PlistCS/PlistCS}/obj/Debug/ResolveAssemblyReference.cache
  24. +61 −0 PlistCS/README.txt
  25. +75 −61 {CSPlistParser/CSPlistParserTests → PlistCS/Src}/Plist.cs
  26. BIN {CSPlistParser → PlistCS}/TestDocuments/testBin.plist
  27. BIN {CSPlistParser → PlistCS}/TestDocuments/testImage.jpg
  28. 0 {CSPlistParser → PlistCS}/TestDocuments/testXml.plist
  29. +1 −1 {CSPlistParser → PlistCS}/TraceAndTestImpact.testsettings
@@ -1,36 +0,0 @@
-
-Microsoft Visual Studio Solution File, Format Version 11.00
-# Visual Studio 2010
-Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{0CB395A9-651B-4C08-95BB-2C56F0BB8B66}"
- ProjectSection(SolutionItems) = preProject
- CSPlistParser.vsmdi = CSPlistParser.vsmdi
- Local.testsettings = Local.testsettings
- TraceAndTestImpact.testsettings = TraceAndTestImpact.testsettings
- EndProjectSection
-EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CSPlistParserTests", "CSPlistParserTests\CSPlistParserTests.csproj", "{BAB6F201-D034-47B9-8F0F-57DAD6079BEA}"
-EndProject
-Global
- GlobalSection(TestCaseManagementSettings) = postSolution
- CategoryFile = CSPlistParser.vsmdi
- EndGlobalSection
- GlobalSection(SolutionConfigurationPlatforms) = preSolution
- Debug|Any CPU = Debug|Any CPU
- Debug|Mixed Platforms = Debug|Mixed Platforms
- Release|Any CPU = Release|Any CPU
- Release|Mixed Platforms = Release|Mixed Platforms
- EndGlobalSection
- GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {BAB6F201-D034-47B9-8F0F-57DAD6079BEA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {BAB6F201-D034-47B9-8F0F-57DAD6079BEA}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {BAB6F201-D034-47B9-8F0F-57DAD6079BEA}.Debug|Mixed Platforms.ActiveCfg = Debug|Any CPU
- {BAB6F201-D034-47B9-8F0F-57DAD6079BEA}.Debug|Mixed Platforms.Build.0 = Debug|Any CPU
- {BAB6F201-D034-47B9-8F0F-57DAD6079BEA}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {BAB6F201-D034-47B9-8F0F-57DAD6079BEA}.Release|Any CPU.Build.0 = Release|Any CPU
- {BAB6F201-D034-47B9-8F0F-57DAD6079BEA}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
- {BAB6F201-D034-47B9-8F0F-57DAD6079BEA}.Release|Mixed Platforms.Build.0 = Release|Any CPU
- EndGlobalSection
- GlobalSection(SolutionProperties) = preSolution
- HideSolutionNode = FALSE
- EndGlobalSection
-EndGlobal
Binary file not shown.
@@ -1,5 +0,0 @@
-C:\Users\mark\Programming\c#\CSPlistParser\CSPlistParser\obj\Debug\ResolveAssemblyReference.cache
-C:\Users\mark\Programming\c#\CSPlistParser\CSPlistParser\bin\Debug\CSPlistParser.dll
-C:\Users\mark\Programming\c#\CSPlistParser\CSPlistParser\bin\Debug\CSPlistParser.pdb
-C:\Users\mark\Programming\c#\CSPlistParser\CSPlistParser\obj\Debug\CSPlistParser.dll
-C:\Users\mark\Programming\c#\CSPlistParser\CSPlistParser\obj\Debug\CSPlistParser.pdb
@@ -1,5 +0,0 @@
-C:\Users\mark\Programming\c#\CSPlistParser\CSPlistParserTests\bin\Debug\CSPlistParser.dll
-C:\Users\mark\Programming\c#\CSPlistParser\CSPlistParserTests\bin\Debug\CSPlistParser.pdb
-C:\Users\mark\Programming\c#\CSPlistParser\CSPlistParserTests\obj\Debug\ResolveAssemblyReference.cache
-C:\Users\mark\Programming\c#\CSPlistParser\CSPlistParserTests\obj\Debug\CSPlistParser.dll
-C:\Users\mark\Programming\c#\CSPlistParser\CSPlistParserTests\obj\Debug\CSPlistParser.pdb
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
-<TestSettings name="Local" id="95649232-238f-49f1-bf67-e4454a94c3bb" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
+<TestSettings name="Local" id="a7d51227-d16f-41c2-bc4f-cf9684c810c7" xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
<Description>These are default test settings for a local test run.</Description>
<Deployment>
<DeploymentItem filename="TestDocuments\" />
View
@@ -0,0 +1,30 @@
+
+Microsoft Visual Studio Solution File, Format Version 11.00
+# Visual Studio 2010
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PlistCS", "PlistCS\PlistCS.csproj", "{E4362121-9BFA-4F11-A8CC-63382D4C2B52}"
+EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{42DFEF73-79F0-4B94-A9A5-4EF87CD5B96C}"
+ ProjectSection(SolutionItems) = preProject
+ Local.testsettings = Local.testsettings
+ PlistCS.vsmdi = PlistCS.vsmdi
+ TraceAndTestImpact.testsettings = TraceAndTestImpact.testsettings
+ EndProjectSection
+EndProject
+Global
+ GlobalSection(TestCaseManagementSettings) = postSolution
+ CategoryFile = PlistCS.vsmdi
+ EndGlobalSection
+ GlobalSection(SolutionConfigurationPlatforms) = preSolution
+ Debug|Any CPU = Debug|Any CPU
+ Release|Any CPU = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(ProjectConfigurationPlatforms) = postSolution
+ {E4362121-9BFA-4F11-A8CC-63382D4C2B52}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {E4362121-9BFA-4F11-A8CC-63382D4C2B52}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {E4362121-9BFA-4F11-A8CC-63382D4C2B52}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {E4362121-9BFA-4F11-A8CC-63382D4C2B52}.Release|Any CPU.Build.0 = Release|Any CPU
+ EndGlobalSection
+ GlobalSection(SolutionProperties) = preSolution
+ HideSolutionNode = FALSE
+ EndGlobalSection
+EndGlobal
View
Binary file not shown.
@@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<TestLists xmlns="http://microsoft.com/schemas/VisualStudio/TeamTest/2010">
<TestList name="Lists of Tests" id="8c43106b-9dc1-4907-a29f-aa66a61bf5b6">
- <RunConfiguration id="95649232-238f-49f1-bf67-e4454a94c3bb" name="Local" storage="local.testsettings" type="Microsoft.VisualStudio.TestTools.Common.TestRunConfiguration, Microsoft.VisualStudio.QualityTools.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
+ <RunConfiguration id="a7d51227-d16f-41c2-bc4f-cf9684c810c7" name="Local" storage="local.testsettings" type="Microsoft.VisualStudio.TestTools.Common.TestRunConfiguration, Microsoft.VisualStudio.QualityTools.Common, Version=10.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a" />
</TestList>
</TestLists>
@@ -6,11 +6,11 @@
<ProductVersion>
</ProductVersion>
<SchemaVersion>2.0</SchemaVersion>
- <ProjectGuid>{BAB6F201-D034-47B9-8F0F-57DAD6079BEA}</ProjectGuid>
+ <ProjectGuid>{E4362121-9BFA-4F11-A8CC-63382D4C2B52}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
- <RootNamespace>CSPlistParser</RootNamespace>
- <AssemblyName>CSPlistParser</AssemblyName>
+ <RootNamespace>PlistCS</RootNamespace>
+ <AssemblyName>PlistCS</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{3AC096D0-A1C2-E12C-1390-A8335801FDAB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
@@ -47,7 +47,7 @@
</ItemGroup>
<ItemGroup>
<Compile Include="Plist.cs" />
- <Compile Include="plistTests.cs" />
+ <Compile Include="PlistTests.cs" />
<Compile Include="Properties\AssemblyInfo.cs" />
</ItemGroup>
<Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" />
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <ReferencePath>
+ </ReferencePath>
+ </PropertyGroup>
+</Project>
@@ -1,10 +1,7 @@
-using System;
-using System.Text;
-using System.Collections.Generic;
-using System.Linq;
-using Microsoft.VisualStudio.TestTools.UnitTesting;
-using PlistParser;
+using System.Collections.Generic;
using System.IO;
+using Microsoft.VisualStudio.TestTools.UnitTesting;
+using PlistCS;
namespace Testing
{
@@ -68,36 +65,36 @@ private void CheckDictionary(Dictionary<string, object> dict)
CollectionAssert.AreEquivalent((Dictionary<string, object>)dict["testDictLarge"], (Dictionary<string, object>)actualDict["testDictLarge"], "Large dictionaries do not correspond.");
}
- [TestMethod()]
+ [TestMethod]
public void ReadBinary()
{
- CheckDictionary(Plist.readPlist(sourceBinPath));
+ CheckDictionary((Dictionary<string, object>)Plist.readPlist(sourceBinPath));
}
- [TestMethod()]
+ [TestMethod]
public void ReadXml()
{
- CheckDictionary(Plist.readPlist(sourceXmlPath));
+ CheckDictionary((Dictionary<string, object>)Plist.readPlist(sourceXmlPath));
}
- [TestMethod()]
+ [TestMethod]
public void WriteBinary()
{
Plist.writeBinary(CreateDictionary(), targetBinPath);
- CheckDictionary(Plist.readPlist(targetBinPath));
+ CheckDictionary((Dictionary<string, object>)Plist.readPlist(targetBinPath));
}
- [TestMethod()]
+ [TestMethod]
public void WriteXml()
{
Plist.writeXml(CreateDictionary(), targetXmlPath);
- CheckDictionary(Plist.readPlist(targetXmlPath));
+ CheckDictionary((Dictionary<string, object>)Plist.readPlist(targetXmlPath));
}
- [TestMethod()]
+ [TestMethod]
public void ReadWriteBinaryByteArray()
{
- CheckDictionary(Plist.readPlist(Plist.writeBinary(CreateDictionary())));
+ CheckDictionary((Dictionary<string, object>)Plist.readPlist(Plist.writeBinary(CreateDictionary())));
}
}
}
@@ -5,11 +5,11 @@
// General Information about an assembly is controlled through the following
// set of attributes. Change these attribute values to modify the information
// associated with an assembly.
-[assembly: AssemblyTitle("CSPlistParser")]
+[assembly: AssemblyTitle("PlistCS")]
[assembly: AssemblyDescription("")]
[assembly: AssemblyConfiguration("")]
[assembly: AssemblyCompany("Microsoft")]
-[assembly: AssemblyProduct("CSPlistParser")]
+[assembly: AssemblyProduct("PlistCS")]
[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
@@ -20,7 +20,7 @@
[assembly: ComVisible(false)]
// The following GUID is for the ID of the typelib if this project is exposed to COM
-[assembly: Guid("208cb280-817b-4fd2-8277-d4cdf6acbd94")]
+[assembly: Guid("bdb16bd8-9569-4514-9999-8b5c44d60a1f")]
// Version information for an assembly consists of the following four values:
//
Binary file not shown.
Binary file not shown.
@@ -0,0 +1,5 @@
+C:\Users\mark\Programming\c#\PlistCS\PlistCS\obj\Debug\ResolveAssemblyReference.cache
+C:\Users\mark\Programming\c#\PlistCS\PlistCS\bin\Debug\PlistCS.dll
+C:\Users\mark\Programming\c#\PlistCS\PlistCS\bin\Debug\PlistCS.pdb
+C:\Users\mark\Programming\c#\PlistCS\PlistCS\obj\Debug\PlistCS.dll
+C:\Users\mark\Programming\c#\PlistCS\PlistCS\obj\Debug\PlistCS.pdb
Binary file not shown.
Binary file not shown.
View
@@ -0,0 +1,61 @@
+-----------------
+DESCRIPTION
+-----------------
+
+This is a C# Property List (plist) serialization library (MIT license).
+It supports both XML and binary versions of the plist format.
+
+plist C#
+__________________________________________________________________________________
+
+string string
+integer short, int, long
+real double
+dictionary Dictionary<string, object>
+array List<object>
+date DateTime
+data List<byte>
+boolean bool
+
+-----------------
+USAGE
+-----------------
+
+See PlistCS/PlistCS/plistTests.cs for examples of reading and
+writing all types to both XML and binary. E.g. to read a plist from disk whose
+root node is a dictionary:
+
+ Dictionary<string, object> dict = (Dictionary<string, object>)Plist.readPlist("testBin.plist");
+
+The plist format (binary or XML) is automatically detected so call the same
+readPlist method for XML
+
+ Dictionary<string, object> dict = (Dictionary<string, object>)Plist.readPlist("testXml.plist");
+
+To write a plist, e.g. dictionary
+
+
+ Dictionary<string, object> dict = new Dictionary<string, object>
+ {
+ {"String Example", "Hello There"},
+ {"Integer Example", 1234}
+ };
+ Plist.writeXml(dict, "xmlTarget.plist");
+
+and for a binary plist
+
+ Dictionary<string, object> dict = new Dictionary<string, object>
+ {
+ {"String Example", "Hello There"},
+ {"Integer Example", 1234}
+ };
+ Plist.writeBinary(dict, "xmlTarget.plist");
+
+The other public methods allow for reading and writing from streams and byte
+arrays. Again, see the test suite code PlistCS/PlistCS/plistTests.cs
+for comprehensive examples.
+
+---------------
+AUTHOR
+---------------
+Mark Tilton, Animetrics Inc.
Oops, something went wrong.

0 comments on commit 016fdbd

Please sign in to comment.