embed plugin loader directly into the launcher
This commit is contained in:
25
PluginLoader/Tools/PostHttpContent.cs
Normal file
25
PluginLoader/Tools/PostHttpContent.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using System.Net;
|
||||
|
||||
namespace PluginLoader.Tools;
|
||||
|
||||
public class PostHttpContent : HttpContent
|
||||
{
|
||||
private readonly byte[] content;
|
||||
|
||||
public PostHttpContent(string content)
|
||||
{
|
||||
this.content = content == null ? null : Tools.Utf8.GetBytes(content);
|
||||
}
|
||||
|
||||
protected override async Task SerializeToStreamAsync(Stream stream, TransportContext context)
|
||||
{
|
||||
if (content != null && content.Length > 0)
|
||||
await stream.WriteAsync(content, 0, content.Length);
|
||||
}
|
||||
|
||||
protected override bool TryComputeLength(out long length)
|
||||
{
|
||||
length = content.Length;
|
||||
return true;
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user