1
0
Fork 0
mirror of https://github.com/beefytech/Beef.git synced 2025-06-30 05:15:59 +02:00

Allowing HTTP requests for source servers

This commit is contained in:
Brian Fiete 2019-09-20 09:19:38 -07:00
parent cb84684517
commit c2d086fe8e
7 changed files with 110 additions and 31 deletions

View file

@ -0,0 +1,41 @@
using System;
namespace Beefy2D.utils
{
class HTTPRequest
{
public enum HTTPResult
{
NotDone = -1,
Failed = 0,
Success = 1
}
void* mNativeNetRequest;
[StdCall, CLink]
static extern void* HTTP_GetFile(char8* url, char8* destPath);
[StdCall, CLink]
static extern int32 HTTP_GetResult(void* netRequest, int32 waitMS);
[StdCall, CLink]
static extern void HTTP_Delete(void* netRequest);
public ~this()
{
if (mNativeNetRequest != null)
HTTP_Delete(mNativeNetRequest);
}
public void GetFile(StringView url, StringView destPath)
{
mNativeNetRequest = HTTP_GetFile(url.ToScopeCStr!(), destPath.ToScopeCStr!());
}
public HTTPResult GetResult()
{
return (HTTPResult)HTTP_GetResult(mNativeNetRequest, 0);
}
}
}