diff --git a/ProjectLighthouse/Controllers/PublishController.cs b/ProjectLighthouse/Controllers/PublishController.cs index 4dc97f29..6536f45b 100644 --- a/ProjectLighthouse/Controllers/PublishController.cs +++ b/ProjectLighthouse/Controllers/PublishController.cs @@ -3,24 +3,35 @@ using System.IO; using System.Threading.Tasks; using System.Xml.Serialization; using Microsoft.AspNetCore.Mvc; +using ProjectLighthouse.Serialization; using ProjectLighthouse.Types; namespace ProjectLighthouse.Controllers { [ApiController] [Route("LITTLEBIGPLANETPS3_XML/")] - [Produces("text/plain")] + [Produces("text/xml")] public class PublishController : ControllerBase { [HttpPost("startPublish")] public async Task StartPublish() { + Slot slot = await this.GetSlotFromBody(); + + return this.Ok(LbpSerializer.TaggedStringElement("slot", "", "type", "user")); + } + + [HttpPost("publish")] + public async Task Publish() { + string bodyString = await new StreamReader(Request.Body).ReadToEndAsync(); + return this.Ok(LbpSerializer.TaggedStringElement("slot", bodyString, "type", "user")); + } + + public async Task GetSlotFromBody() { Request.Body.Position = 0; string bodyString = await new StreamReader(Request.Body).ReadToEndAsync(); - + XmlSerializer serializer = new(typeof(Slot)); Slot slot = (Slot)serializer.Deserialize(new StringReader(bodyString)); - - Console.WriteLine(slot); - return this.Ok(); + return slot; } } } \ No newline at end of file