diff --git a/ProjectLighthouse/Controllers/NetworkSettingsController.cs b/ProjectLighthouse/Controllers/NetworkSettingsController.cs new file mode 100644 index 00000000..0cb8e39c --- /dev/null +++ b/ProjectLighthouse/Controllers/NetworkSettingsController.cs @@ -0,0 +1,14 @@ +using Microsoft.AspNetCore.Mvc; +using ProjectLighthouse.Serialization; + +namespace ProjectLighthouse.Controllers { + [ApiController] + [Route("LITTLEBIGPLANETPS3_XML/network_settings.nws")] + [Produces("text/xml")] + public class NetworkSettingsController : ControllerBase { + [HttpGet] + public IActionResult Get() { + return this.Ok(LbpSerializer.GetBlankElement("networkSettings")); + } + } +} \ No newline at end of file diff --git a/ProjectLighthouse/Controllers/NewsController.cs b/ProjectLighthouse/Controllers/NewsController.cs new file mode 100644 index 00000000..665d574f --- /dev/null +++ b/ProjectLighthouse/Controllers/NewsController.cs @@ -0,0 +1,27 @@ +using Microsoft.AspNetCore.Mvc; +using ProjectLighthouse.Serialization; + +namespace ProjectLighthouse.Controllers { + [ApiController] + [Route("LITTLEBIGPLANETPS3_XML/news")] + [Produces("text/xml")] + public class NewsController : ControllerBase { + [HttpGet] + public IActionResult Get() { + string newsEntry = LbpSerializer.GetStringElement("item", new NewsEntry { + Category = "no_category", + Summary = "test summary", + Image = new NewsImage { + Hash = "4947269c5f7061b27225611ee58a9a91a8031bbe", + Alignment = "right" + }, + Id = 1, + Title = "Test Title", + Text = "Test Text", + Date = 1348755214000 + }.Serialize()); + + return this.Ok(LbpSerializer.GetStringElement("news", newsEntry)); + } + } +} \ No newline at end of file diff --git a/ProjectLighthouse/Startup.cs b/ProjectLighthouse/Startup.cs index f6f22387..dd9fb902 100644 --- a/ProjectLighthouse/Startup.cs +++ b/ProjectLighthouse/Startup.cs @@ -37,9 +37,7 @@ namespace ProjectLighthouse { app.Use(async (context, next) => { await next(); - if(context.Response.StatusCode == 404) { - Console.WriteLine($"404: {context.Request.Method} {context.Request.Path}"); - } + Console.WriteLine($"{context.Response.StatusCode}: {context.Request.Method} {context.Request.Path}"); }); app.UseRouting(); diff --git a/ProjectLighthouse/LevelTags.cs b/ProjectLighthouse/Types/LevelTags.cs similarity index 100% rename from ProjectLighthouse/LevelTags.cs rename to ProjectLighthouse/Types/LevelTags.cs diff --git a/ProjectLighthouse/LoginResult.cs b/ProjectLighthouse/Types/LoginResult.cs similarity index 100% rename from ProjectLighthouse/LoginResult.cs rename to ProjectLighthouse/Types/LoginResult.cs diff --git a/ProjectLighthouse/Types/NewsEntry.cs b/ProjectLighthouse/Types/NewsEntry.cs new file mode 100644 index 00000000..f5db1b04 --- /dev/null +++ b/ProjectLighthouse/Types/NewsEntry.cs @@ -0,0 +1,23 @@ +using ProjectLighthouse.Serialization; + +namespace ProjectLighthouse { + public class NewsEntry { + public int Id { get; set; } + public string Title { get; set; } + public string Summary { get; set; } + public string Text { get; set; } + public NewsImage Image { get; set; } + public string Category { get; set; } + public long Date { get; set; } + + public string Serialize() { + return LbpSerializer.GetStringElement("id", Id) + + LbpSerializer.GetStringElement("title", Title) + + LbpSerializer.GetStringElement("summary", Summary) + + LbpSerializer.GetStringElement("text", Text) + + LbpSerializer.GetStringElement("date", Date) + + Image.Serialize() + + LbpSerializer.GetStringElement("category", Category); + } + } +} \ No newline at end of file diff --git a/ProjectLighthouse/Types/NewsImage.cs b/ProjectLighthouse/Types/NewsImage.cs new file mode 100644 index 00000000..63f38ffb --- /dev/null +++ b/ProjectLighthouse/Types/NewsImage.cs @@ -0,0 +1,14 @@ +using ProjectLighthouse.Serialization; + +namespace ProjectLighthouse { + public class NewsImage { + public string Hash { get; set; } + public string Alignment { get; set; } + + public string Serialize() { + return LbpSerializer.GetStringElement("image", + LbpSerializer.GetStringElement("hash", Hash) + + LbpSerializer.GetStringElement("alignment", Alignment)); + } + } +} \ No newline at end of file