mirror of
https://github.com/zoriya/octokit.net.git
synced 2025-12-21 14:45:11 +00:00
updated SimpleJson to 0.30.0
This commit is contained in:
@@ -1,6 +1,7 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Diagnostics.CodeAnalysis;
|
using System.Diagnostics.CodeAnalysis;
|
||||||
|
using Octokit.Reflection;
|
||||||
|
|
||||||
namespace Octokit.Internal
|
namespace Octokit.Internal
|
||||||
{
|
{
|
||||||
@@ -64,15 +65,6 @@ namespace Octokit.Internal
|
|||||||
var stringValue = value as string;
|
var stringValue = value as string;
|
||||||
if (stringValue != null)
|
if (stringValue != null)
|
||||||
{
|
{
|
||||||
if (ReflectionUtils.IsUri(type))
|
|
||||||
{
|
|
||||||
Uri result;
|
|
||||||
if (Uri.TryCreate(stringValue, UriKind.RelativeOrAbsolute, out result))
|
|
||||||
{
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (ReflectionUtils.GetTypeInfo(type).IsEnum)
|
if (ReflectionUtils.GetTypeInfo(type).IsEnum)
|
||||||
{
|
{
|
||||||
// remove '-' from values coming in to be able to enum utf-8
|
// remove '-' from values coming in to be able to enum utf-8
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
// <website>https://github.com/facebook-csharp-sdk/simple-json</website>
|
// <website>https://github.com/facebook-csharp-sdk/simple-json</website>
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
|
|
||||||
// VERSION: 0.28.0
|
// VERSION: 0.30.0
|
||||||
|
|
||||||
// NOTE: uncomment the following line to make SimpleJson class internal.
|
// NOTE: uncomment the following line to make SimpleJson class internal.
|
||||||
//#define SIMPLE_JSON_INTERNAL
|
//#define SIMPLE_JSON_INTERNAL
|
||||||
@@ -63,7 +63,7 @@ using System.Globalization;
|
|||||||
using System.Reflection;
|
using System.Reflection;
|
||||||
using System.Runtime.Serialization;
|
using System.Runtime.Serialization;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Octokit.Internal;
|
using Octokit.Reflection;
|
||||||
|
|
||||||
// ReSharper disable LoopCanBeConvertedToQuery
|
// ReSharper disable LoopCanBeConvertedToQuery
|
||||||
// ReSharper disable RedundantExplicitArrayCreation
|
// ReSharper disable RedundantExplicitArrayCreation
|
||||||
@@ -1308,6 +1308,14 @@ namespace Octokit
|
|||||||
return DateTimeOffset.ParseExact(str, Iso8601Format, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal | DateTimeStyles.AdjustToUniversal);
|
return DateTimeOffset.ParseExact(str, Iso8601Format, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal | DateTimeStyles.AdjustToUniversal);
|
||||||
if (type == typeof(Guid) || (ReflectionUtils.IsNullableType(type) && Nullable.GetUnderlyingType(type) == typeof(Guid)))
|
if (type == typeof(Guid) || (ReflectionUtils.IsNullableType(type) && Nullable.GetUnderlyingType(type) == typeof(Guid)))
|
||||||
return new Guid(str);
|
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;
|
return str;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -1539,7 +1547,7 @@ namespace Octokit
|
|||||||
|
|
||||||
#endif
|
#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
|
// 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.
|
// that might be in place in the target project.
|
||||||
@@ -1667,11 +1675,6 @@ namespace Octokit
|
|||||||
return GetTypeInfo(type).IsGenericType && type.GetGenericTypeDefinition() == typeof(Nullable<>);
|
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)
|
public static object ToNullableType(object obj, Type nullableType)
|
||||||
{
|
{
|
||||||
return obj == null ? null : Convert.ChangeType(obj, Nullable.GetUnderlyingType(nullableType), CultureInfo.InvariantCulture);
|
return obj == null ? null : Convert.ChangeType(obj, Nullable.GetUnderlyingType(nullableType), CultureInfo.InvariantCulture);
|
||||||
@@ -1723,41 +1726,12 @@ namespace Octokit
|
|||||||
public static IEnumerable<PropertyInfo> GetProperties(Type type)
|
public static IEnumerable<PropertyInfo> GetProperties(Type type)
|
||||||
{
|
{
|
||||||
#if SIMPLE_JSON_TYPEINFO
|
#if SIMPLE_JSON_TYPEINFO
|
||||||
var typeInfo = type.GetTypeInfo();
|
return type.GetTypeInfo().DeclaredProperties;
|
||||||
var properties = typeInfo.DeclaredProperties;
|
|
||||||
if(typeInfo.BaseType == null)
|
|
||||||
{
|
|
||||||
return properties;
|
|
||||||
}
|
|
||||||
|
|
||||||
var result = new List<PropertyInfo>();
|
|
||||||
foreach (var property in properties)
|
|
||||||
{
|
|
||||||
result.Add(property);
|
|
||||||
}
|
|
||||||
|
|
||||||
var baseProperties = GetProperties(typeInfo.BaseType);
|
|
||||||
foreach (var property in baseProperties)
|
|
||||||
{
|
|
||||||
result.Add(property);
|
|
||||||
}
|
|
||||||
|
|
||||||
return result;
|
|
||||||
#else
|
#else
|
||||||
return type.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
|
return type.GetProperties(BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
public static IList<PropertyInfo> Build(IEnumerable<PropertyInfo> properties)
|
|
||||||
{
|
|
||||||
var propertyList = new List<PropertyInfo>();
|
|
||||||
foreach (var property in properties)
|
|
||||||
{
|
|
||||||
propertyList.Add(property);
|
|
||||||
}
|
|
||||||
return propertyList;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static IEnumerable<FieldInfo> GetFields(Type type)
|
public static IEnumerable<FieldInfo> GetFields(Type type)
|
||||||
{
|
{
|
||||||
#if SIMPLE_JSON_TYPEINFO
|
#if SIMPLE_JSON_TYPEINFO
|
||||||
|
|||||||
@@ -5,5 +5,5 @@
|
|||||||
<package id="Rx-Linq" version="2.1.30214.0" targetFramework="net40" requireReinstallation="True" />
|
<package id="Rx-Linq" version="2.1.30214.0" targetFramework="net40" requireReinstallation="True" />
|
||||||
<package id="Rx-Main" version="2.1.30214.0" targetFramework="net40" />
|
<package id="Rx-Main" version="2.1.30214.0" targetFramework="net40" />
|
||||||
<package id="Rx-PlatformServices" version="2.1.30214.0" targetFramework="net40" requireReinstallation="True" />
|
<package id="Rx-PlatformServices" version="2.1.30214.0" targetFramework="net40" requireReinstallation="True" />
|
||||||
<package id="SimpleJson" version="0.28.0" targetFramework="net40" developmentDependency="true" />
|
<package id="SimpleJson" version="0.30.0" targetFramework="net45" developmentDependency="true" />
|
||||||
</packages>
|
</packages>
|
||||||
BIN
packages/SimpleJson.0.28.0/SimpleJson.0.28.0.nupkg
vendored
BIN
packages/SimpleJson.0.28.0/SimpleJson.0.28.0.nupkg
vendored
Binary file not shown.
BIN
packages/SimpleJson.0.30.0/SimpleJson.0.30.0.nupkg
vendored
Normal file
BIN
packages/SimpleJson.0.30.0/SimpleJson.0.30.0.nupkg
vendored
Normal file
Binary file not shown.
@@ -2,7 +2,7 @@
|
|||||||
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
<package xmlns="http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd">
|
||||||
<metadata>
|
<metadata>
|
||||||
<id>SimpleJson</id>
|
<id>SimpleJson</id>
|
||||||
<version>0.28.0</version>
|
<version>0.30.0</version>
|
||||||
<authors>Jim Zimmerman, Nathan Totten, Prabir Shrestha</authors>
|
<authors>Jim Zimmerman, Nathan Totten, Prabir Shrestha</authors>
|
||||||
<owners>Jim Zimmerman, Nathan Totten, Prabir Shrestha</owners>
|
<owners>Jim Zimmerman, Nathan Totten, Prabir Shrestha</owners>
|
||||||
<licenseUrl>https://raw.github.com/facebook-csharp-sdk/simple-json/master/LICENSE.txt</licenseUrl>
|
<licenseUrl>https://raw.github.com/facebook-csharp-sdk/simple-json/master/LICENSE.txt</licenseUrl>
|
||||||
@@ -1,6 +1,6 @@
|
|||||||
# SimpleJson https://github.com/facebook-csharp-sdk/simple-json
|
# SimpleJson https://github.com/facebook-csharp-sdk/simple-json
|
||||||
# License: MIT License
|
# License: MIT License
|
||||||
# Version: 0.28.0
|
# Version: 0.30.0
|
||||||
|
|
||||||
function ConvertFrom-Json
|
function ConvertFrom-Json
|
||||||
{
|
{
|
||||||
@@ -87,7 +87,7 @@ $source = @"
|
|||||||
// <website>https://github.com/facebook-csharp-sdk/simple-json</website>
|
// <website>https://github.com/facebook-csharp-sdk/simple-json</website>
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
|
|
||||||
// VERSION: 0.28.0
|
// VERSION: 0.30.0
|
||||||
|
|
||||||
// NOTE: uncomment the following line to make SimpleJson class internal.
|
// NOTE: uncomment the following line to make SimpleJson class internal.
|
||||||
//#define SIMPLE_JSON_INTERNAL
|
//#define SIMPLE_JSON_INTERNAL
|
||||||
@@ -1378,6 +1378,14 @@ namespace SimpleJson
|
|||||||
return DateTimeOffset.ParseExact(str, Iso8601Format, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal | DateTimeStyles.AdjustToUniversal);
|
return DateTimeOffset.ParseExact(str, Iso8601Format, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal | DateTimeStyles.AdjustToUniversal);
|
||||||
if (type == typeof(Guid) || (ReflectionUtils.IsNullableType(type) && Nullable.GetUnderlyingType(type) == typeof(Guid)))
|
if (type == typeof(Guid) || (ReflectionUtils.IsNullableType(type) && Nullable.GetUnderlyingType(type) == typeof(Guid)))
|
||||||
return new Guid(str);
|
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;
|
return str;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
// <website>https://github.com/facebook-csharp-sdk/simple-json</website>
|
// <website>https://github.com/facebook-csharp-sdk/simple-json</website>
|
||||||
//-----------------------------------------------------------------------
|
//-----------------------------------------------------------------------
|
||||||
|
|
||||||
// VERSION: 0.28.0
|
// VERSION: 0.30.0
|
||||||
|
|
||||||
// NOTE: uncomment the following line to make SimpleJson class internal.
|
// NOTE: uncomment the following line to make SimpleJson class internal.
|
||||||
//#define SIMPLE_JSON_INTERNAL
|
//#define SIMPLE_JSON_INTERNAL
|
||||||
@@ -1308,6 +1308,14 @@ namespace $rootnamespace$
|
|||||||
return DateTimeOffset.ParseExact(str, Iso8601Format, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal | DateTimeStyles.AdjustToUniversal);
|
return DateTimeOffset.ParseExact(str, Iso8601Format, CultureInfo.InvariantCulture, DateTimeStyles.AssumeUniversal | DateTimeStyles.AdjustToUniversal);
|
||||||
if (type == typeof(Guid) || (ReflectionUtils.IsNullableType(type) && Nullable.GetUnderlyingType(type) == typeof(Guid)))
|
if (type == typeof(Guid) || (ReflectionUtils.IsNullableType(type) && Nullable.GetUnderlyingType(type) == typeof(Guid)))
|
||||||
return new Guid(str);
|
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;
|
return str;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
Reference in New Issue
Block a user