Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions PlistCS/PlistCS.sln
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio 2013
VisualStudioVersion = 12.0.31101.0
MinimumVisualStudioVersion = 10.0.40219.1
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}"
Expand All @@ -11,9 +13,6 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
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
Expand All @@ -27,4 +26,7 @@ Global
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(TestCaseManagementSettings) = postSolution
CategoryFile = PlistCS.vsmdi
EndGlobalSection
EndGlobal
Binary file added PlistCS/PlistCS.v12.suo
Binary file not shown.
Binary file not shown.
21 changes: 16 additions & 5 deletions PlistCS/Src/Plist.cs
Original file line number Diff line number Diff line change
Expand Up @@ -319,9 +319,16 @@ private static object parse(XmlNode node)
case "string":
return node.InnerText;
case "integer":
// int result;
//int.TryParse(node.InnerText, System.Globalization.NumberFormatInfo.InvariantInfo, out result);
return Convert.ToInt32(node.InnerText, System.Globalization.NumberFormatInfo.InvariantInfo);
int result;
bool isInt32 = Int32.TryParse(node.InnerText, out result);
if(isInt32)
{
return result;
}
else
{
return Convert.ToInt64(node.InnerText, System.Globalization.NumberFormatInfo.InvariantInfo);
}
case "real":
return Convert.ToDouble(node.InnerText,System.Globalization.NumberFormatInfo.InvariantInfo);
case "false":
Expand All @@ -346,9 +353,13 @@ private static void compose(object value, XmlWriter writer)
{
writer.WriteElementString("string", value as string);
}
else if (value is int || value is long)
else if (value is int)
{
writer.WriteElementString("integer", ((Int32)value).ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
}
else if (value is long)
{
writer.WriteElementString("integer", ((int)value).ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
writer.WriteElementString("integer", ((Int64)value).ToString(System.Globalization.NumberFormatInfo.InvariantInfo));
}
else if (value is System.Collections.Generic.Dictionary<string, object> ||
value.GetType().ToString().StartsWith("System.Collections.Generic.Dictionary`2[System.String"))
Expand Down