mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-07-19 03:31:29 +00:00
Add slots type, allow user to *start* publishing a level
This commit is contained in:
parent
af5871c135
commit
ed3d67d105
5 changed files with 105 additions and 1 deletions
26
ProjectLighthouse/Controllers/PublishController.cs
Normal file
26
ProjectLighthouse/Controllers/PublishController.cs
Normal 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();
|
||||
}
|
||||
}
|
||||
}
|
15
ProjectLighthouse/Controllers/SlotsController.cs
Normal file
15
ProjectLighthouse/Controllers/SlotsController.cs
Normal 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"));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -11,4 +11,8 @@
|
|||
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Remove="Types\SlotXsd.cs" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
60
ProjectLighthouse/Types/Slot.cs
Normal file
60
ProjectLighthouse/Types/Slot.cs
Normal 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; }
|
||||
|
||||
}
|
||||
}
|
|
@ -1,4 +1,3 @@
|
|||
using System.ComponentModel.DataAnnotations.Schema;
|
||||
using System.Linq;
|
||||
using ProjectLighthouse.Serialization;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue