From 143cbf3061cb51141a170c9d52a5583f9bd634f6 Mon Sep 17 00:00:00 2001 From: Scott Blomquist Date: Mon, 17 Mar 2014 11:46:32 -0700 Subject: [PATCH] Fix remaining broken normalize cases. --- JsonLD.Portable/JsonLD.Portable.csproj | 135 +++++++++++++++++++++ JsonLD.Portable/Properties/AssemblyInfo.cs | 30 +++++ JsonLD.Portable/packages.config | 4 + src/JsonLD/Core/NormalizeUtils.cs | 4 +- src/JsonLD/Util/JavaCompat.cs | 4 +- 5 files changed, 173 insertions(+), 4 deletions(-) create mode 100644 JsonLD.Portable/JsonLD.Portable.csproj create mode 100644 JsonLD.Portable/Properties/AssemblyInfo.cs create mode 100644 JsonLD.Portable/packages.config diff --git a/JsonLD.Portable/JsonLD.Portable.csproj b/JsonLD.Portable/JsonLD.Portable.csproj new file mode 100644 index 0000000..8d709c4 --- /dev/null +++ b/JsonLD.Portable/JsonLD.Portable.csproj @@ -0,0 +1,135 @@ + + + + + 11.0 + Debug + AnyCPU + {F119722F-5E6A-4479-A4CF-0CE00FF29737} + Library + Properties + JsonLD.Portable + JsonLD.Portable + v4.5 + Profile78 + 512 + {786C830F-07A1-408B-BD7F-6EE04809D6DB};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC} + ..\ + true + + + true + full + false + bin\Debug\ + TRACE;DEBUG;PORTABLE + prompt + 4 + + + pdbonly + true + bin\Release\ + TRACE;PORTABLE + prompt + 4 + + + + Context.cs + + + DocumentLoader.cs + + + IJSONLDTripleCallback.cs + + + IRDFParser.cs + + + JsonLdApi.cs + + + JSONLDConsts.cs + + + JsonLdError.cs + + + JsonLdOptions.cs + + + JsonLdProcessor.cs + + + JsonLdUtils.cs + + + NormalizeUtils.cs + + + RDFDataset.cs + + + RDFDatasetUtils.cs + + + Regex.cs + + + RemoteDocument.cs + + + UniqueNamer.cs + + + NQuadRDFParser.cs + + + NQuadTripleCallback.cs + + + TurtleRDFParser.cs + + + TurtleTripleCallback.cs + + + JavaCompat.cs + + + JSONUtils.cs + + + Obj.cs + + + URL.cs + + + + + + ..\packages\Newtonsoft.Json.6.0.1\lib\portable-net45+wp80+win8\Newtonsoft.Json.dll + + + + + + + + + + This project references NuGet package(s) that are missing on this computer. Enable NuGet Package Restore to download them. For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}. + + + + + \ No newline at end of file diff --git a/JsonLD.Portable/Properties/AssemblyInfo.cs b/JsonLD.Portable/Properties/AssemblyInfo.cs new file mode 100644 index 0000000..a6e8f22 --- /dev/null +++ b/JsonLD.Portable/Properties/AssemblyInfo.cs @@ -0,0 +1,30 @@ +using System.Resources; +using System.Reflection; +using System.Runtime.CompilerServices; +using System.Runtime.InteropServices; + +// 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("JsonLD.Portable")] +[assembly: AssemblyDescription("")] +[assembly: AssemblyConfiguration("")] +[assembly: AssemblyCompany("")] +[assembly: AssemblyProduct("JsonLD.Portable")] +[assembly: AssemblyCopyright("Copyright © 2014")] +[assembly: AssemblyTrademark("")] +[assembly: AssemblyCulture("")] +[assembly: NeutralResourcesLanguage("en")] + +// Version information for an assembly consists of the following four values: +// +// Major Version +// Minor Version +// Build Number +// Revision +// +// You can specify all the values or you can default the Build and Revision Numbers +// by using the '*' as shown below: +// [assembly: AssemblyVersion("1.0.*")] +[assembly: AssemblyVersion("1.0.0.0")] +[assembly: AssemblyFileVersion("1.0.0.0")] diff --git a/JsonLD.Portable/packages.config b/JsonLD.Portable/packages.config new file mode 100644 index 0000000..5626215 --- /dev/null +++ b/JsonLD.Portable/packages.config @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/src/JsonLD/Core/NormalizeUtils.cs b/src/JsonLD/Core/NormalizeUtils.cs index 472e454..45bf20c 100644 --- a/src/JsonLD/Core/NormalizeUtils.cs +++ b/src/JsonLD/Core/NormalizeUtils.cs @@ -472,7 +472,7 @@ private static NormalizeUtils.HashResult HashPaths(string id, IDictionary)name)["value"] : null, id)); } // sort serialized quads - nquads.SortInPlace(); + nquads.SortInPlace(StringComparer.Ordinal); // return hashed quads string hash = Sha1hash(nquads); ((IDictionary)bnodes[id])["hash"] = hash; @@ -529,7 +529,7 @@ private static string EncodeHex(byte[] data) /// the adjacent blank node name or null if none was found. private static string GetAdjacentBlankNodeName(IDictionary node, string id) { - return (string)node["type"] == "blank node" && (!node.ContainsKey("value") || (string)node["value"] == id) ? (string)node["value"] : null; + return (string)node["type"] == "blank node" && (!node.ContainsKey("value") || (string)node["value"] != id) ? (string)node["value"] : null; } private class Permutator diff --git a/src/JsonLD/Util/JavaCompat.cs b/src/JsonLD/Util/JavaCompat.cs index 95f83da..b74b23d 100644 --- a/src/JsonLD/Util/JavaCompat.cs +++ b/src/JsonLD/Util/JavaCompat.cs @@ -356,7 +356,7 @@ public bool Find() #if !PORTABLE internal class MessageDigest { - HMACSHA1 md; + SHA1 md; Stream stream; public static MessageDigest GetInstance(string algorithm) @@ -367,7 +367,7 @@ public static MessageDigest GetInstance(string algorithm) public MessageDigest() { - md = new HMACSHA1(); + md = new SHA1Managed(); stream = new MemoryStream(); }