Exemplo n.º 1
0
        public static IntPtr Load(string filename, ref int x, ref int y, ref int n, int req_comp)
        {
            switch (Environment.OSVersion.Platform)
            {
            case PlatformID.Win32Windows:
            case PlatformID.Win32NT:
            case PlatformID.Win32S:
                if (Environment.Is64BitProcess)
                {
                    return(Win64.stbi_load(filename, ref x, ref y, ref n, req_comp));
                }
                else
                {
                    return(Win32.stbi_load(filename, ref x, ref y, ref n, req_comp));
                }

            default:
                if (Directory.Exists("/Library") &&
                    Directory.Exists("/System"))
                {
                    return(OSX.stbi_load(filename, ref x, ref y, ref n, req_comp));
                }
                if (Environment.Is64BitProcess)
                {
                    return(Linux64.stbi_load(filename, ref x, ref y, ref n, req_comp));
                }
                else
                {
                    return(Linux32.stbi_load(filename, ref x, ref y, ref n, req_comp));
                }
            }
        }
Exemplo n.º 2
0
 internal static uint gss_init_sec_context(
     out uint minorStatus,
     IntPtr claimantCredHandle,
     ref IntPtr contextHandle,
     IntPtr targetName,
     ref GssOidDesc mechType,
     uint reqFlags,
     uint timeReq,
     IntPtr inputChanBindings,
     ref GssBufferStruct inputToken,
     IntPtr actualMechType,
     out GssBufferStruct outputToken,
     IntPtr retFlags,
     IntPtr timeRec)
 {
     return(RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
         ? Environment.Is64BitProcess
             ? Win64.gss_init_sec_context(out minorStatus, claimantCredHandle, ref contextHandle, targetName,
                                          ref mechType, reqFlags, timeReq, inputChanBindings, ref inputToken, actualMechType,
                                          out outputToken, retFlags, timeRec)
             : Win32.gss_init_sec_context(out minorStatus, claimantCredHandle, ref contextHandle, targetName,
                                          ref mechType, reqFlags, timeReq, inputChanBindings, ref inputToken, actualMechType,
                                          out outputToken, retFlags, timeRec)
         : Linux.gss_init_sec_context(out minorStatus, claimantCredHandle, ref contextHandle, targetName,
                                      ref mechType, reqFlags, timeReq, inputChanBindings, ref inputToken, actualMechType,
                                      out outputToken, retFlags, timeRec));
 }
Exemplo n.º 3
0
 internal static uint gss_accept_sec_context(
     out uint minorStatus,
     ref IntPtr contextHandle,
     IntPtr acceptorCredHandle,
     ref GssBufferStruct inputToken,
     IntPtr channelBindings,
     out IntPtr sourceName,
     IntPtr mechType,
     out GssBufferStruct outputToken,
     out uint retFlags,
     out uint timeRec,
     IntPtr delegated)
 {
     return(RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
         ? Environment.Is64BitProcess
             ? Win64.gss_accept_sec_context(out minorStatus, ref contextHandle, acceptorCredHandle,
                                            ref inputToken, channelBindings, out sourceName, mechType, out outputToken, out retFlags,
                                            out timeRec, delegated)
             : Win32.gss_accept_sec_context(out minorStatus, ref contextHandle, acceptorCredHandle,
                                            ref inputToken, channelBindings, out sourceName, mechType, out outputToken, out retFlags,
                                            out timeRec, delegated)
         : Linux.gss_accept_sec_context(out minorStatus, ref contextHandle, acceptorCredHandle,
                                        ref inputToken, channelBindings, out sourceName, mechType, out outputToken, out retFlags,
                                        out timeRec, delegated));
 }
Exemplo n.º 4
0
        public static void Free(IntPtr data)
        {
            switch (Environment.OSVersion.Platform)
            {
            case PlatformID.Win32Windows:
            case PlatformID.Win32NT:
            case PlatformID.Win32S:
                if (Environment.Is64BitProcess)
                {
                    Win64.stbi_image_free(data);
                }
                else
                {
                    Win32.stbi_image_free(data);
                }
                break;

            default:
                if (Directory.Exists("/Library") &&
                    Directory.Exists("/System"))
                {
                    OSX.stbi_image_free(data);
                }
                else if (Environment.Is64BitProcess)
                {
                    Linux64.stbi_image_free(data);
                }
                else
                {
                    Linux32.stbi_image_free(data);
                }
                break;
            }
        }
Exemplo n.º 5
0
 internal static uint gss_release_buffer(
     out uint minorStatus,
     ref GssBufferStruct buffer)
 {
     return(RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
         ? Environment.Is64BitProcess
             ? Win64.gss_release_buffer(out minorStatus, ref buffer)
             : Win32.gss_release_buffer(out minorStatus, ref buffer)
         : Linux.gss_release_buffer(out minorStatus, ref buffer));
 }
Exemplo n.º 6
0
 internal static uint gss_release_name(
     out uint minorStatus,
     ref IntPtr inputName)
 {
     return(RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
         ? Environment.Is64BitProcess
             ? Win64.gss_release_name(out minorStatus, ref inputName)
             : Win32.gss_release_name(out minorStatus, ref inputName)
         : Linux.gss_release_name(out minorStatus, ref inputName));
 }
Exemplo n.º 7
0
 internal static uint gss_delete_sec_context(
     out uint minorStatus,
     ref IntPtr contextHandle)
 {
     return(RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
    ? Environment.Is64BitProcess
        ? Win64.gss_delete_sec_context(out minorStatus, ref contextHandle, GSS_C_NO_BUFFER)
        : Win32.gss_delete_sec_context(out minorStatus, ref contextHandle, GSS_C_NO_BUFFER)
    : Linux.gss_delete_sec_context(out minorStatus, ref contextHandle, GSS_C_NO_BUFFER));
 }
Exemplo n.º 8
0
 internal static uint gss_release_cred(
     out uint minorStatus,
     ref IntPtr credentialHandle)
 {
     return(RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
         ? Environment.Is64BitProcess
             ? Win64.gss_release_cred(out minorStatus, ref credentialHandle)
             : Win32.gss_release_cred(out minorStatus, ref credentialHandle)
         : Linux.gss_release_cred(out minorStatus, ref credentialHandle));
 }
Exemplo n.º 9
0
 internal static uint gss_display_name(
     out uint minorStatus,
     IntPtr inputName,
     out GssBufferStruct NameBuffer,
     out GssOidDesc nameType)
 {
     return(RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
         ? Environment.Is64BitProcess
             ? Win64.gss_display_name(out minorStatus, inputName, out NameBuffer, out nameType)
             : Win32.gss_display_name(out minorStatus, inputName, out NameBuffer, out nameType)
         : Linux.gss_display_name(out minorStatus, inputName, out NameBuffer, out nameType));
 }
Exemplo n.º 10
0
 internal static uint gss_import_name(
     out uint minorStatus,
     ref GssBufferStruct inputNameBuffer,
     ref GssOidDesc inputNameType,
     out IntPtr outputName)
 {
     return(RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
         ? Environment.Is64BitProcess
             ? Win64.gss_import_name(out minorStatus, ref inputNameBuffer, ref inputNameType, out outputName)
             : Win32.gss_import_name(out minorStatus, ref inputNameBuffer, ref inputNameType, out outputName)
         : Linux.gss_import_name(out minorStatus, ref inputNameBuffer, ref inputNameType, out outputName));
 }
Exemplo n.º 11
0
 internal static uint gss_inquire_name(
     out uint minorStatus,
     IntPtr name,
     out int mechName,
     out GssOidSet oids,
     out IntPtr attrs)
 {
     return(RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
         ? Environment.Is64BitProcess
             ? Win64.gss_inquire_name(out minorStatus, name, out mechName, out oids, out attrs)
             : Win32.gss_inquire_name(out minorStatus, name, out mechName, out oids, out attrs)
         : Linux.gss_inquire_name(out minorStatus, name, out mechName, out oids, out attrs));
 }
 static internal bool GameServer_Init(uint unIP, ushort usPort, ushort usGamePort, ushort usQueryPort, int eServerMode, string pchVersionString)
 {
     if (Config.Os == OsType.Windows)
     {
         return(Win64.SteamInternal_GameServer_Init(unIP, usPort, usGamePort, usQueryPort, eServerMode, pchVersionString));
     }
     else if (Config.Os == OsType.Posix)
     {
         return(Posix.SteamInternal_GameServer_Init(unIP, usPort, usGamePort, usQueryPort, eServerMode, pchVersionString));
     }
     else
     {
         throw new System.Exception("this platform isn't supported");
     }
 }
Exemplo n.º 13
0
 static internal bool Init()
 {
     if (Config.Os == OsType.Windows)
     {
         return(Win64.SteamAPI_Init());
     }
     else if (Config.Os == OsType.Posix)
     {
         return(Posix.SteamAPI_Init());
     }
     else
     {
         throw new System.Exception("this platform isn't supported");
     }
 }
Exemplo n.º 14
0
 static internal void RunCallbacks()
 {
     if (Config.Os == OsType.Windows)
     {
         Win64.SteamAPI_RunCallbacks();
     }
     else if (Config.Os == OsType.Posix)
     {
         Posix.SteamAPI_RunCallbacks();
     }
     else
     {
         throw new System.Exception("this platform isn't supported");
     }
 }
 static internal void Shutdown()
 {
     if (Config.Os == OsType.Windows)
     {
         Win64.SteamGameServer_Shutdown();
     }
     else if (Config.Os == OsType.Posix)
     {
         Posix.SteamGameServer_Shutdown();
     }
     else
     {
         throw new System.Exception("this platform isn't supported");
     }
 }
 static internal HSteamPipe GetHSteamPipe()
 {
     if (Config.Os == OsType.Windows)
     {
         return(Win64.SteamGameServer_GetHSteamPipe());
     }
     else if (Config.Os == OsType.Posix)
     {
         return(Posix.SteamGameServer_GetHSteamPipe());
     }
     else
     {
         throw new System.Exception("this platform isn't supported");
     }
 }
Exemplo n.º 17
0
 static internal bool RestartAppIfNecessary(uint unOwnAppID)
 {
     if (Config.Os == OsType.Windows)
     {
         return(Win64.SteamAPI_RestartAppIfNecessary(unOwnAppID));
     }
     else if (Config.Os == OsType.Posix)
     {
         return(Posix.SteamAPI_RestartAppIfNecessary(unOwnAppID));
     }
     else
     {
         throw new System.Exception("this platform isn't supported");
     }
 }
 static internal IntPtr FindOrCreateGameServerInterface(int steamuser, string versionname)
 {
     if (Config.Os == OsType.Windows)
     {
         return(Win64.SteamInternal_FindOrCreateGameServerInterface(steamuser, versionname));
     }
     else if (Config.Os == OsType.Posix)
     {
         return(Posix.SteamInternal_FindOrCreateGameServerInterface(steamuser, versionname));
     }
     else
     {
         throw new System.Exception("this platform isn't supported");
     }
 }
Exemplo n.º 19
0
 static internal bool GameServer_Init(uint unIP, ushort usPort, ushort usGamePort, ushort usQueryPort, int eServerMode, [MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string pchVersionString)
 {
     if (Config.Os == OsType.Windows)
     {
         return(Win64.SteamInternal_GameServer_Init(unIP, usPort, usGamePort, usQueryPort, eServerMode, pchVersionString));
     }
     else if (Config.Os == OsType.Posix)
     {
         return(Posix.SteamInternal_GameServer_Init(unIP, usPort, usGamePort, usQueryPort, eServerMode, pchVersionString));
     }
     else
     {
         throw new System.Exception("this platform isn't supported");
     }
 }
Exemplo n.º 20
0
 static internal IntPtr CreateInterface([MarshalAs(UnmanagedType.CustomMarshaler, MarshalTypeRef = typeof(Utf8StringToNative))] string version)
 {
     if (Config.Os == OsType.Windows)
     {
         return(Win64.SteamInternal_CreateInterface(version));
     }
     else if (Config.Os == OsType.Posix)
     {
         return(Posix.SteamInternal_CreateInterface(version));
     }
     else
     {
         throw new System.Exception("this platform isn't supported");
     }
 }
 static internal IntPtr CreateInterface(string version)
 {
     if (Config.Os == OsType.Windows)
     {
         return(Win64.SteamInternal_CreateInterface(version));
     }
     else if (Config.Os == OsType.Posix)
     {
         return(Posix.SteamInternal_CreateInterface(version));
     }
     else
     {
         throw new System.Exception("this platform isn't supported");
     }
 }
Exemplo n.º 22
0
 static internal void UnregisterCallResult(IntPtr pCallback, SteamAPICall_t callback)
 {
     if (Config.Os == OsType.Windows)
     {
         Win64.SteamAPI_UnregisterCallResult(pCallback, callback);
     }
     else if (Config.Os == OsType.Posix)
     {
         Posix.SteamAPI_UnregisterCallResult(pCallback, callback);
     }
     else
     {
         throw new System.Exception("this platform isn't supported");
     }
 }
Exemplo n.º 23
0
 internal static uint gss_display_status(
     out uint minorStatus,
     uint status,
     int statusType,
     ref GssOidDesc mechType,
     ref IntPtr messageContext,
     ref GssBufferStruct statusString)
 {
     return(RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
         ? Environment.Is64BitProcess
             ? Win64.gss_display_status(out minorStatus, status, statusType, ref mechType, ref messageContext,
                                        ref statusString)
             : Win32.gss_display_status(out minorStatus, status, statusType, ref mechType, ref messageContext,
                                        ref statusString)
         : Linux.gss_display_status(out minorStatus, status, statusType, ref mechType, ref messageContext,
                                    ref statusString));
 }
Exemplo n.º 24
0
 internal static uint gss_acquire_cred(
     out uint minorStatus,
     IntPtr desiredName,
     uint timeRequired,
     ref GssOidSet desiredMechanisms,
     int credentialUsage,
     ref IntPtr credentialHandle,
     IntPtr actualMech,
     out uint expiryTime)
 {
     return(RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
         ? Environment.Is64BitProcess
             ? Win64.gss_acquire_cred(out minorStatus, desiredName, timeRequired, ref desiredMechanisms,
                                      credentialUsage, ref credentialHandle, actualMech, out expiryTime)
             : Win32.gss_acquire_cred(out minorStatus, desiredName, timeRequired, ref desiredMechanisms,
                                      credentialUsage, ref credentialHandle, actualMech, out expiryTime)
         : Linux.gss_acquire_cred(out minorStatus, desiredName, timeRequired, ref desiredMechanisms,
                                  credentialUsage, ref credentialHandle, actualMech, out expiryTime));
 }
Exemplo n.º 25
0
 internal static uint gss_get_name_attribute(
     out uint minorStatus,
     IntPtr name,
     ref GssBufferStruct attribute,
     out int authenticated,
     out int complete,
     out GssBufferStruct value,
     out GssBufferStruct displayValue,
     ref int more)
 {
     return(RuntimeInformation.IsOSPlatform(OSPlatform.Windows)
         ? Environment.Is64BitProcess
             ? Win64.gss_get_name_attribute(out minorStatus, name, ref attribute, out authenticated,
                                            out complete, out value, out displayValue, ref more)
             : Win32.gss_get_name_attribute(out minorStatus, name, ref attribute, out authenticated,
                                            out complete, out value, out displayValue, ref more)
         : Linux.gss_get_name_attribute(out minorStatus, name, ref attribute, out authenticated, out complete,
                                        out value, out displayValue, ref more));
 }