Add slots type, allow user to *start* publishing a level

This commit is contained in:
jvyden 2021-10-06 18:23:29 -04:00
parent af5871c135
commit ed3d67d105
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278
5 changed files with 105 additions and 1 deletions

View file

@ -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<IActionResult> 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();
}
}
}

View file

@ -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"));
}
}
}

View file

@ -11,4 +11,8 @@
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
</ItemGroup>
<ItemGroup>
<Compile Remove="Types\SlotXsd.cs" />
</ItemGroup>
</Project>

View file

@ -0,0 +1,60 @@
using System.ComponentModel.DataAnnotations.Schema;
using System.Xml.Serialization;
namespace ProjectLighthouse.Types {
/// <summary>
/// A LittleBigPlanet level.
/// </summary>
[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; }
}
}

View file

@ -1,4 +1,3 @@
using System.ComponentModel.DataAnnotations.Schema;
using System.Linq;
using ProjectLighthouse.Serialization;