Skip to content

Commit

Permalink
We do have access to .NET Standard 1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Saalvage committed Nov 25, 2024
1 parent 154db6c commit defaa95
Show file tree
Hide file tree
Showing 3 changed files with 0 additions and 78 deletions.
18 changes: 0 additions & 18 deletions AssimpNet/MemoryHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -382,11 +382,7 @@ public static void MarshalStructure<T>(IntPtr ptr, out T value) where T : struct
return;
}

#if NETSTANDARD1_3
value = Marshal.PtrToStructure<T>(ptr);
#else
value = (T) Marshal.PtrToStructure(ptr, type);
#endif
}

/// <summary>
Expand All @@ -407,11 +403,7 @@ public static T MarshalStructure<T>(IntPtr ptr) where T : struct
if (HasNativeCustomMarshaler(type, out marshaler))
return (T) marshaler.MarshalNativeToManaged(ptr);

#if NETSTANDARD1_3
return Marshal.PtrToStructure<T>(ptr);
#else
return (T) Marshal.PtrToStructure(ptr, type);
#endif
}

/// <summary>
Expand All @@ -433,11 +425,7 @@ public static void MarshalPointer<T>(in T value, IntPtr ptr) where T : struct
return;
}

#if NETSTANDARD1_3
Marshal.StructureToPtr<T>(value, ptr, true);
#else
Marshal.StructureToPtr((object)value, ptr, true);
#endif
}

/// <summary>
Expand All @@ -454,11 +442,7 @@ public static unsafe int MarshalSizeOf<T>() where T : struct
if (HasNativeCustomMarshaler(type, out marshaler))
return marshaler.NativeDataSize;

#if NETSTANDARD1_3
return Marshal.SizeOf<T>();
#else
return Marshal.SizeOf(type);
#endif
}

/// <summary>
Expand Down Expand Up @@ -836,11 +820,9 @@ public static int Count<T>(IEnumerable<T> source)
if(otherColl != null)
return otherColl.Count;

#if NETSTANDARD1_3
IReadOnlyCollection<T> roColl = source as IReadOnlyCollection<T>;
if(roColl != null)
return roColl.Count;
#endif

int count = 0;
using(IEnumerator<T> enumerator = source.GetEnumerator())
Expand Down
42 changes: 0 additions & 42 deletions AssimpNet/Unmanaged/PlatformHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -26,48 +26,6 @@

namespace Assimp.Unmanaged
{
/*
#if !NETSTANDARD1_3
internal enum OSPlatform
{
Windows = 0,
Linux = 1,
OSX = 2
}
internal static class RuntimeInformation
{
private static OSPlatform s_platform;
static RuntimeInformation()
{
switch (Environment.OSVersion.Platform)
{
case PlatformID.Unix:
if (Directory.Exists("/Applications") && Directory.Exists("/System") && Directory.Exists("/Users") && Directory.Exists("/Volumes"))
s_platform = OSPlatform.OSX;
else
s_platform = OSPlatform.Linux;
break;
case PlatformID.MacOSX:
s_platform = OSPlatform.OSX;
break;
default:
s_platform = OSPlatform.Windows;
break;
}
}
public static bool IsOSPlatform(OSPlatform osPlat)
{
return s_platform == osPlat;
}
// Non-net standard will be windows only
public static string OSDescription { get { return "Microsoft Windows"; } }
}
#endif
*/
//Helper class for making it easier to access certain reflection methods on types between .Net framework and .Net standard (pre-netstandard 2.0)
internal class PlatformHelper
{
Expand Down
18 changes: 0 additions & 18 deletions AssimpNet/Unmanaged/UnmanagedStructures.cs
Original file line number Diff line number Diff line change
Expand Up @@ -399,25 +399,7 @@ public static string GetFormatHint(in AiTexture aiTex)
{
fixed (sbyte* charPtr = aiTex.FormatHint)
{
#if !NETSTANDARD1_3
return new string(charPtr);
#else
//Determine how many actual characters there are...
int maxLen = s_nullFormat.Length;
int nonTerminatorCount = 0;
for(int i = 0; i < maxLen; i++)
{
if(aiTex.FormatHint[i] == '\0')
break;

nonTerminatorCount++;
}

if(nonTerminatorCount == 0)
return String.Empty;

return Encoding.ASCII.GetString((byte*) charPtr, nonTerminatorCount);
#endif
}
}
}
Expand Down

0 comments on commit defaa95

Please sign in to comment.