diff --git a/Octokit/Http/SimpleJsonSerializer.cs b/Octokit/Http/SimpleJsonSerializer.cs
index 56e119af..081383d7 100644
--- a/Octokit/Http/SimpleJsonSerializer.cs
+++ b/Octokit/Http/SimpleJsonSerializer.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
+using Octokit.Reflection;
namespace Octokit.Internal
{
@@ -64,15 +65,6 @@ namespace Octokit.Internal
var stringValue = value as string;
if (stringValue != null)
{
- if (ReflectionUtils.IsUri(type))
- {
- Uri result;
- if (Uri.TryCreate(stringValue, UriKind.RelativeOrAbsolute, out result))
- {
- return result;
- }
- }
-
if (ReflectionUtils.GetTypeInfo(type).IsEnum)
{
// remove '-' from values coming in to be able to enum utf-8
diff --git a/Octokit/SimpleJson.cs b/Octokit/SimpleJson.cs
index 7588a721..9e772159 100644
--- a/Octokit/SimpleJson.cs
+++ b/Octokit/SimpleJson.cs
@@ -17,7 +17,7 @@
// https://github.com/facebook-csharp-sdk/simple-json
//-----------------------------------------------------------------------
-// VERSION: 0.28.0
+// VERSION: 0.30.0
// NOTE: uncomment the following line to make SimpleJson class internal.
//#define SIMPLE_JSON_INTERNAL
@@ -63,7 +63,7 @@ using System.Globalization;
using System.Reflection;
using System.Runtime.Serialization;
using System.Text;
-using Octokit.Internal;
+using Octokit.Reflection;
// ReSharper disable LoopCanBeConvertedToQuery
// ReSharper disable RedundantExplicitArrayCreation
@@ -1308,6 +1308,14 @@ namespace Octokit
return DateTimeOffset.ParseExact(str, Iso8601Format, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal | DateTimeStyles.AdjustToUniversal);
if (type == typeof(Guid) || (ReflectionUtils.IsNullableType(type) && Nullable.GetUnderlyingType(type) == typeof(Guid)))
return new Guid(str);
+ if (type == typeof(Uri))
+ {
+ bool isValid = Uri.IsWellFormedUriString(str, UriKind.RelativeOrAbsolute);
+
+ Uri result;
+ if (isValid && Uri.TryCreate(str, UriKind.RelativeOrAbsolute, out result))
+ return result;
+ }
return str;
}
else
@@ -1539,7 +1547,7 @@ namespace Octokit
#endif
- namespace Internal
+ namespace Reflection
{
// This class is meant to be copied into other libraries. So we want to exclude it from Code Analysis rules
// that might be in place in the target project.
@@ -1667,11 +1675,6 @@ namespace Octokit
return GetTypeInfo(type).IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>);
}
- public static bool IsUri(Type type)
- {
- return GetTypeInfo(type) == GetTypeInfo(typeof(Uri));
- }
-
public static object ToNullableType(object obj, Type nullableType)
{
return obj == null ? null : Convert.ChangeType(obj, Nullable.GetUnderlyingType(nullableType), CultureInfo.InvariantCulture);
@@ -1723,41 +1726,12 @@ namespace Octokit
public static IEnumerable GetProperties(Type type)
{
#if SIMPLE_JSON_TYPEINFO
- var typeInfo = type.GetTypeInfo();
- var properties = typeInfo.DeclaredProperties;
- if(typeInfo.BaseType == null)
- {
- return properties;
- }
-
- var result = new List();
- foreach (var property in properties)
- {
- result.Add(property);
- }
-
- var baseProperties = GetProperties(typeInfo.BaseType);
- foreach (var property in baseProperties)
- {
- result.Add(property);
- }
-
- return result;
+ return type.GetTypeInfo().DeclaredProperties;
#else
return type.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
#endif
}
- public static IList Build(IEnumerable properties)
- {
- var propertyList = new List();
- foreach (var property in properties)
- {
- propertyList.Add(property);
- }
- return propertyList;
- }
-
public static IEnumerable GetFields(Type type)
{
#if SIMPLE_JSON_TYPEINFO
diff --git a/Octokit/packages.config b/Octokit/packages.config
index 199fb8f7..202fac72 100644
--- a/Octokit/packages.config
+++ b/Octokit/packages.config
@@ -5,5 +5,5 @@
-
+
\ No newline at end of file
diff --git a/packages/SimpleJson.0.28.0/SimpleJson.0.28.0.nupkg b/packages/SimpleJson.0.28.0/SimpleJson.0.28.0.nupkg
deleted file mode 100644
index c67db4ea..00000000
Binary files a/packages/SimpleJson.0.28.0/SimpleJson.0.28.0.nupkg and /dev/null differ
diff --git a/packages/SimpleJson.0.30.0/SimpleJson.0.30.0.nupkg b/packages/SimpleJson.0.30.0/SimpleJson.0.30.0.nupkg
new file mode 100644
index 00000000..b35a0dda
Binary files /dev/null and b/packages/SimpleJson.0.30.0/SimpleJson.0.30.0.nupkg differ
diff --git a/packages/SimpleJson.0.28.0/SimpleJson.0.28.0.nuspec b/packages/SimpleJson.0.30.0/SimpleJson.0.30.0.nuspec
similarity index 96%
rename from packages/SimpleJson.0.28.0/SimpleJson.0.28.0.nuspec
rename to packages/SimpleJson.0.30.0/SimpleJson.0.30.0.nuspec
index 7c6d1d4a..bfc5f00d 100644
--- a/packages/SimpleJson.0.28.0/SimpleJson.0.28.0.nuspec
+++ b/packages/SimpleJson.0.30.0/SimpleJson.0.30.0.nuspec
@@ -2,7 +2,7 @@
SimpleJson
- 0.28.0
+ 0.30.0
Jim Zimmerman, Nathan Totten, Prabir Shrestha
Jim Zimmerman, Nathan Totten, Prabir Shrestha
https://raw.github.com/facebook-csharp-sdk/simple-json/master/LICENSE.txt
diff --git a/packages/SimpleJson.0.28.0/SimpleJson.psm1 b/packages/SimpleJson.0.30.0/SimpleJson.psm1
similarity index 99%
rename from packages/SimpleJson.0.28.0/SimpleJson.psm1
rename to packages/SimpleJson.0.30.0/SimpleJson.psm1
index bcf6d01e..d34066dd 100644
--- a/packages/SimpleJson.0.28.0/SimpleJson.psm1
+++ b/packages/SimpleJson.0.30.0/SimpleJson.psm1
@@ -1,6 +1,6 @@
# SimpleJson https://github.com/facebook-csharp-sdk/simple-json
# License: MIT License
-# Version: 0.28.0
+# Version: 0.30.0
function ConvertFrom-Json
{
@@ -87,7 +87,7 @@ $source = @"
// https://github.com/facebook-csharp-sdk/simple-json
//-----------------------------------------------------------------------
-// VERSION: 0.28.0
+// VERSION: 0.30.0
// NOTE: uncomment the following line to make SimpleJson class internal.
//#define SIMPLE_JSON_INTERNAL
@@ -1378,6 +1378,14 @@ namespace SimpleJson
return DateTimeOffset.ParseExact(str, Iso8601Format, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal | DateTimeStyles.AdjustToUniversal);
if (type == typeof(Guid) || (ReflectionUtils.IsNullableType(type) && Nullable.GetUnderlyingType(type) == typeof(Guid)))
return new Guid(str);
+ if (type == typeof(Uri))
+ {
+ bool isValid = Uri.IsWellFormedUriString(str, UriKind.RelativeOrAbsolute);
+
+ Uri result;
+ if (isValid && Uri.TryCreate(str, UriKind.RelativeOrAbsolute, out result))
+ return result;
+ }
return str;
}
else
diff --git a/packages/SimpleJson.0.28.0/content/SimpleJson.cs.pp b/packages/SimpleJson.0.30.0/content/SimpleJson.cs.pp
similarity index 99%
rename from packages/SimpleJson.0.28.0/content/SimpleJson.cs.pp
rename to packages/SimpleJson.0.30.0/content/SimpleJson.cs.pp
index ddf08298..47dbe189 100644
--- a/packages/SimpleJson.0.28.0/content/SimpleJson.cs.pp
+++ b/packages/SimpleJson.0.30.0/content/SimpleJson.cs.pp
@@ -17,7 +17,7 @@
// https://github.com/facebook-csharp-sdk/simple-json
//-----------------------------------------------------------------------
-// VERSION: 0.28.0
+// VERSION: 0.30.0
// NOTE: uncomment the following line to make SimpleJson class internal.
//#define SIMPLE_JSON_INTERNAL
@@ -1308,6 +1308,14 @@ namespace $rootnamespace$
return DateTimeOffset.ParseExact(str, Iso8601Format, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal | DateTimeStyles.AdjustToUniversal);
if (type == typeof(Guid) || (ReflectionUtils.IsNullableType(type) && Nullable.GetUnderlyingType(type) == typeof(Guid)))
return new Guid(str);
+ if (type == typeof(Uri))
+ {
+ bool isValid = Uri.IsWellFormedUriString(str, UriKind.RelativeOrAbsolute);
+
+ Uri result;
+ if (isValid && Uri.TryCreate(str, UriKind.RelativeOrAbsolute, out result))
+ return result;
+ }
return str;
}
else