From 9367a302573c55e943bb4e1893b3425e5831d6ae Mon Sep 17 00:00:00 2001 From: Shravan Rajinikanth Date: Mon, 28 Aug 2017 09:59:33 -0500 Subject: [PATCH] Added multi-targeting for .NET 4.5 - The perviously targeted .NET Standard 1.0 should work almost everywhere. However, on the full .NET Framework, it included a lot of unnecessary packages under the .NET Standard Library, which is less than desirable. --- Gameloop.Vdf/Gameloop.Vdf.csproj | 22 ++++++++++++++-------- Gameloop.Vdf/Utilities/ReflectionUtils.cs | 3 +++ Gameloop.Vdf/Utilities/TypeExtensions.cs | 10 ++++++++++ 3 files changed, 27 insertions(+), 8 deletions(-) diff --git a/Gameloop.Vdf/Gameloop.Vdf.csproj b/Gameloop.Vdf/Gameloop.Vdf.csproj index 4aac2e7..61f9125 100644 --- a/Gameloop.Vdf/Gameloop.Vdf.csproj +++ b/Gameloop.Vdf/Gameloop.Vdf.csproj @@ -1,7 +1,7 @@  - netstandard1.0 + netstandard1.0;net45 A high-performance framework for the Valve Data Format, also called KeyValues. Copyright © Shravan Rajinikanth 2016 Gameloop @@ -20,19 +20,25 @@ git - - NETSTANDARD1_0 - - bin\Release\netstandard1.0\Gameloop.Vdf.xml - RELEASE;NETSTANDARD1_0 + RELEASE 1591;1701;1702;1705 true - - + + Vdf.NET + HAVE_FULL_REFLECTION + + + + Vdf.NET .NET Standard 1.0 + NETSTANDARD1_0;PORTABLE + + + + diff --git a/Gameloop.Vdf/Utilities/ReflectionUtils.cs b/Gameloop.Vdf/Utilities/ReflectionUtils.cs index ed4a1d5..8a377cb 100644 --- a/Gameloop.Vdf/Utilities/ReflectionUtils.cs +++ b/Gameloop.Vdf/Utilities/ReflectionUtils.cs @@ -25,9 +25,11 @@ using System; using System.Linq; +using System.Reflection; namespace Gameloop.Vdf.Utilities { +#if PORTABLE [Flags] internal enum BindingFlags { @@ -52,6 +54,7 @@ internal enum BindingFlags OptionalParamBinding = 262144, IgnoreReturn = 16777216 } +#endif internal static class ReflectionUtils { diff --git a/Gameloop.Vdf/Utilities/TypeExtensions.cs b/Gameloop.Vdf/Utilities/TypeExtensions.cs index 9a6945d..740f64c 100644 --- a/Gameloop.Vdf/Utilities/TypeExtensions.cs +++ b/Gameloop.Vdf/Utilities/TypeExtensions.cs @@ -31,13 +31,21 @@ namespace Gameloop.Vdf.Utilities { internal static class TypeExtensions { +#if DOTNET || PORTABLE +#if !DOTNET private const BindingFlags DefaultFlags = BindingFlags.Public | BindingFlags.Static | BindingFlags.Instance; +#endif +#endif +#if (DOTNET || PORTABLE) public static MethodInfo GetBaseDefinition(this MethodInfo method) { return method.GetRuntimeBaseDefinition(); } +#endif +#if (DOTNET || PORTABLE) +#if !DOTNET public static MethodInfo GetMethod(this Type type, string name) { return type.GetMethod(name, DefaultFlags); @@ -52,6 +60,8 @@ public static IEnumerable GetMethods(this Type type, BindingFlags bi { return type.GetTypeInfo().DeclaredMethods; } +#endif +#endif public static Type BaseType(this Type type) {