diff --git a/ProjectLighthouse/Controllers/PublishController.cs b/ProjectLighthouse/Controllers/PublishController.cs new file mode 100644 index 00000000..4dc97f29 --- /dev/null +++ b/ProjectLighthouse/Controllers/PublishController.cs @@ -0,0 +1,26 @@ +using System; +using System.IO; +using System.Threading.Tasks; +using System.Xml.Serialization; +using Microsoft.AspNetCore.Mvc; +using ProjectLighthouse.Types; + +namespace ProjectLighthouse.Controllers { + [ApiController] + [Route("LITTLEBIGPLANETPS3_XML/")] + [Produces("text/plain")] + public class PublishController : ControllerBase { + [HttpPost("startPublish")] + public async Task StartPublish() { + 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(); + } + } +} \ No newline at end of file diff --git a/ProjectLighthouse/Controllers/SlotsController.cs b/ProjectLighthouse/Controllers/SlotsController.cs new file mode 100644 index 00000000..02ecc817 --- /dev/null +++ b/ProjectLighthouse/Controllers/SlotsController.cs @@ -0,0 +1,15 @@ +using System.Threading.Tasks; +using Microsoft.AspNetCore.Mvc; +using ProjectLighthouse.Serialization; + +namespace ProjectLighthouse.Controllers { + [ApiController] + [Route("LITTLEBIGPLANETPS3_XML/slots")] + [Produces("text/xml")] + public class SlotsController : ControllerBase { + [HttpGet("by")] + public IActionResult SlotsBy() { + return this.Ok(LbpSerializer.BlankElement("slots")); + } + } +} \ No newline at end of file diff --git a/ProjectLighthouse/ProjectLighthouse.csproj b/ProjectLighthouse/ProjectLighthouse.csproj index e2d21a43..b8632c07 100644 --- a/ProjectLighthouse/ProjectLighthouse.csproj +++ b/ProjectLighthouse/ProjectLighthouse.csproj @@ -11,4 +11,8 @@ + + + + diff --git a/ProjectLighthouse/Types/Slot.cs b/ProjectLighthouse/Types/Slot.cs new file mode 100644 index 00000000..c6358407 --- /dev/null +++ b/ProjectLighthouse/Types/Slot.cs @@ -0,0 +1,60 @@ +using System.ComponentModel.DataAnnotations.Schema; +using System.Xml.Serialization; + +namespace ProjectLighthouse.Types { + /// + /// A LittleBigPlanet level. + /// + [XmlRoot("slot"), XmlType("slot")] + public class Slot { + [XmlAttribute("type")] + [NotMapped] + public string Type { get; set; } + + [XmlElement("name")] + public string Name { get; set; } + + [XmlElement("description")] + public string Description { get; set; } + + [XmlElement("icon")] + public string IconHash { get; set; } + + [XmlElement("rootLevel")] + public string RootLevel { get; set; } + + [XmlElement("resource")] + public string Resource { get; set; } + + [XmlElement("location")] + public Location Location { get; set; } + + [XmlElement("initiallyLocked")] + public bool InitiallyLocked { get; set; } + + [XmlElement("isSubLevel")] + public bool SubLevel { get; set; } + + [XmlElement("isLBP1Only")] + public bool Lbp1Only { get; set; } + + [XmlElement("shareable")] + public int Shareable { get; set; } + + [XmlElement("authorLabels")] + public string AuthorLabels { get; set; } + + [XmlElement("background")] + public string BackgroundHash { get; set; } + + [XmlElement("minPlayers")] + public int MinimumPlayers { get; set; } + + [XmlElement("maxPlayers")] + public int MaximumPlayers { get; set; } + + [XmlElement("moveRequired")] + public bool MoveRequired { get; set; } + + } +} \ No newline at end of file diff --git a/ProjectLighthouse/Types/User.cs b/ProjectLighthouse/Types/User.cs index c269268e..f6c12e83 100644 --- a/ProjectLighthouse/Types/User.cs +++ b/ProjectLighthouse/Types/User.cs @@ -1,4 +1,3 @@ -using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using ProjectLighthouse.Serialization;