Add a bit of documentation

This commit is contained in:
jvyden 2021-10-06 11:27:44 -04:00
parent 57aadb4eff
commit edd11b4033
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278
7 changed files with 39 additions and 1 deletions

View file

@ -4,6 +4,10 @@ using System.Linq;
using System.Reflection; using System.Reflection;
namespace ProjectLighthouse.Serialization { namespace ProjectLighthouse.Serialization {
/// <summary>
/// LBP doesn't like the XML serializer by C# that much, and it cant be controlled that much (cant have two root elements),
/// so I wrote my own crappy one.
/// </summary>
public static class LbpSerializer { public static class LbpSerializer {
public static string BlankElement(string key) => $"<{key}></{key}>"; public static string BlankElement(string key) => $"<{key}></{key}>";

View file

@ -35,8 +35,11 @@ namespace ProjectLighthouse {
app.UseDeveloperExceptionPage(); app.UseDeveloperExceptionPage();
} }
// Logs every request and the response to it
// Example: "200: GET /LITTLEBIGPLANETPS3_XML/news"
// Example: "404: GET /asdasd"
app.Use(async (context, next) => { app.Use(async (context, next) => {
await next(); await next(); // Handle the request so we can get the status code from it
Console.WriteLine($"{context.Response.StatusCode}: {context.Request.Method} {context.Request.Path}"); Console.WriteLine($"{context.Response.StatusCode}: {context.Request.Method} {context.Request.Path}");
}); });

View file

@ -1,4 +1,7 @@
namespace ProjectLighthouse.Types { namespace ProjectLighthouse.Types {
/// <summary>
/// A series of tags that can be applied to a level
/// </summary>
public enum LevelTags { public enum LevelTags {
Brilliant, Brilliant,
Beautiful, Beautiful,

View file

@ -1,6 +1,9 @@
using ProjectLighthouse.Serialization; using ProjectLighthouse.Serialization;
namespace ProjectLighthouse.Types { namespace ProjectLighthouse.Types {
/// <summary>
/// The location of a slot on a planet.
/// </summary>
public class Location { public class Location {
public Location(int x, int y) { public Location(int x, int y) {
this.X = x; this.X = x;

View file

@ -2,6 +2,9 @@ using System.Collections.Generic;
using ProjectLighthouse.Serialization; using ProjectLighthouse.Serialization;
namespace ProjectLighthouse.Types { namespace ProjectLighthouse.Types {
/// <summary>
/// Response to POST /login
/// </summary>
public class LoginResult { public class LoginResult {
public string AuthTicket { get; set; } public string AuthTicket { get; set; }
public string LbpEnvVer { get; set; } public string LbpEnvVer { get; set; }

View file

@ -1,6 +1,9 @@
using ProjectLighthouse.Serialization; using ProjectLighthouse.Serialization;
namespace ProjectLighthouse.Types { namespace ProjectLighthouse.Types {
/// <summary>
/// Used on the info moon on LBP1. Broken for unknown reasons
/// </summary>
public class NewsEntry { public class NewsEntry {
public int Id { get; set; } public int Id { get; set; }
public string Title { get; set; } public string Title { get; set; }

View file

@ -10,12 +10,20 @@ namespace ProjectLighthouse.Types {
public int HeartCount { get; set; } public int HeartCount { get; set; }
public string YayHash { get; set; } public string YayHash { get; set; }
public string BooHash { get; set; } public string BooHash { get; set; }
/// <summary>
/// A user-customizable biography shown on the profile card
/// </summary>
public string Biography { get; set; } public string Biography { get; set; }
public int ReviewCount { get; set; } public int ReviewCount { get; set; }
public int CommentCount { get; set; } public int CommentCount { get; set; }
public int PhotosByMeCount { get; set; } public int PhotosByMeCount { get; set; }
public int PhotosWithMeCount { get; set; } public int PhotosWithMeCount { get; set; }
public bool CommentsEnabled { get; set; } public bool CommentsEnabled { get; set; }
/// <summary>
/// The location of the profile card on the user's earth
/// </summary>
public Location Location { get; set; } public Location Location { get; set; }
public int FavouriteSlotCount { get; set; } public int FavouriteSlotCount { get; set; }
public int FavouriteUserCount { get; set; } public int FavouriteUserCount { get; set; }
@ -28,8 +36,19 @@ namespace ProjectLighthouse.Types {
#region Slots #region Slots
/// <summary>
/// The maximum amount of slots allowed on the earth
/// </summary>
public static int EntitledSlots = 20; public static int EntitledSlots = 20;
/// <summary>
/// The number of used slots on the earth
/// </summary>
public int UsedSlots { get; set; } public int UsedSlots { get; set; }
/// <summary>
/// The number of slots remaining on the earth
/// </summary>
public int FreeSlots => EntitledSlots - this.UsedSlots; public int FreeSlots => EntitledSlots - this.UsedSlots;
private static string[] slotTypes = { private static string[] slotTypes = {