diff --git a/ProjectLighthouse.Tests/DatabaseFact.cs b/ProjectLighthouse.Tests/DatabaseFact.cs index f1c9341f..f3538719 100644 --- a/ProjectLighthouse.Tests/DatabaseFact.cs +++ b/ProjectLighthouse.Tests/DatabaseFact.cs @@ -1,5 +1,6 @@ using Microsoft.EntityFrameworkCore; using ProjectLighthouse.Types; +using ProjectLighthouse.Types.Settings; using Xunit; namespace ProjectLighthouse.Tests { diff --git a/ProjectLighthouse.Tests/Tests/AuthenticationTests.cs b/ProjectLighthouse.Tests/Tests/AuthenticationTests.cs index e79bf903..9194b035 100644 --- a/ProjectLighthouse.Tests/Tests/AuthenticationTests.cs +++ b/ProjectLighthouse.Tests/Tests/AuthenticationTests.cs @@ -2,6 +2,7 @@ using System.Net; using System.Net.Http; using System.Threading.Tasks; using ProjectLighthouse.Types; +using ProjectLighthouse.Types.Settings; using Xunit; namespace ProjectLighthouse.Tests { diff --git a/ProjectLighthouse.Tests/Tests/SlotTests.cs b/ProjectLighthouse.Tests/Tests/SlotTests.cs index 8f284901..4b7317bd 100644 --- a/ProjectLighthouse.Tests/Tests/SlotTests.cs +++ b/ProjectLighthouse.Tests/Tests/SlotTests.cs @@ -1,5 +1,7 @@ using System.Threading.Tasks; using ProjectLighthouse.Types; +using ProjectLighthouse.Types.Levels; +using ProjectLighthouse.Types.Profiles; using Xunit; namespace ProjectLighthouse.Tests { diff --git a/ProjectLighthouse/Controllers/ClientConfigurationController.cs b/ProjectLighthouse/Controllers/ClientConfigurationController.cs index 7b4f949e..694a1105 100644 --- a/ProjectLighthouse/Controllers/ClientConfigurationController.cs +++ b/ProjectLighthouse/Controllers/ClientConfigurationController.cs @@ -1,6 +1,7 @@ using System.Diagnostics.CodeAnalysis; using Microsoft.AspNetCore.Mvc; using ProjectLighthouse.Types; +using ProjectLighthouse.Types.Settings; namespace ProjectLighthouse.Controllers { [ApiController] diff --git a/ProjectLighthouse/Controllers/CommentController.cs b/ProjectLighthouse/Controllers/CommentController.cs index a1f056fc..d24b05cb 100644 --- a/ProjectLighthouse/Controllers/CommentController.cs +++ b/ProjectLighthouse/Controllers/CommentController.cs @@ -7,6 +7,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using ProjectLighthouse.Serialization; using ProjectLighthouse.Types; +using ProjectLighthouse.Types.Profiles; namespace ProjectLighthouse.Controllers { [ApiController] diff --git a/ProjectLighthouse/Controllers/LevelListController.cs b/ProjectLighthouse/Controllers/LevelListController.cs index 80f17d7c..bab8a0f5 100644 --- a/ProjectLighthouse/Controllers/LevelListController.cs +++ b/ProjectLighthouse/Controllers/LevelListController.cs @@ -6,6 +6,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using ProjectLighthouse.Serialization; using ProjectLighthouse.Types; +using ProjectLighthouse.Types.Levels; namespace ProjectLighthouse.Controllers { [ApiController] diff --git a/ProjectLighthouse/Controllers/LevelTagsController.cs b/ProjectLighthouse/Controllers/LevelTagsController.cs index 3f4ededf..6c04ffbe 100644 --- a/ProjectLighthouse/Controllers/LevelTagsController.cs +++ b/ProjectLighthouse/Controllers/LevelTagsController.cs @@ -1,6 +1,7 @@ using System; using Microsoft.AspNetCore.Mvc; using ProjectLighthouse.Types; +using ProjectLighthouse.Types.Levels; namespace ProjectLighthouse.Controllers { [ApiController] diff --git a/ProjectLighthouse/Controllers/LoginController.cs b/ProjectLighthouse/Controllers/LoginController.cs index e26f56b8..4af51dae 100644 --- a/ProjectLighthouse/Controllers/LoginController.cs +++ b/ProjectLighthouse/Controllers/LoginController.cs @@ -3,6 +3,7 @@ using System.IO; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; using ProjectLighthouse.Types; +using ProjectLighthouse.Types.Settings; namespace ProjectLighthouse.Controllers { [ApiController] diff --git a/ProjectLighthouse/Controllers/MatchController.cs b/ProjectLighthouse/Controllers/MatchController.cs index def62efa..bd8073d6 100644 --- a/ProjectLighthouse/Controllers/MatchController.cs +++ b/ProjectLighthouse/Controllers/MatchController.cs @@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using ProjectLighthouse.Helpers; using ProjectLighthouse.Types; +using ProjectLighthouse.Types.Profiles; namespace ProjectLighthouse.Controllers { [ApiController] diff --git a/ProjectLighthouse/Controllers/NewsController.cs b/ProjectLighthouse/Controllers/NewsController.cs index c002f22a..3214d2d3 100644 --- a/ProjectLighthouse/Controllers/NewsController.cs +++ b/ProjectLighthouse/Controllers/NewsController.cs @@ -1,6 +1,7 @@ using Microsoft.AspNetCore.Mvc; using ProjectLighthouse.Serialization; using ProjectLighthouse.Types; +using ProjectLighthouse.Types.News; namespace ProjectLighthouse.Controllers { [ApiController] diff --git a/ProjectLighthouse/Controllers/PublishController.cs b/ProjectLighthouse/Controllers/PublishController.cs index 42ff9ba8..221ad610 100644 --- a/ProjectLighthouse/Controllers/PublishController.cs +++ b/ProjectLighthouse/Controllers/PublishController.cs @@ -7,6 +7,8 @@ using Microsoft.EntityFrameworkCore; using ProjectLighthouse.Helpers; using ProjectLighthouse.Serialization; using ProjectLighthouse.Types; +using ProjectLighthouse.Types.Levels; +using ProjectLighthouse.Types.Profiles; namespace ProjectLighthouse.Controllers { [ApiController] diff --git a/ProjectLighthouse/Controllers/SearchController.cs b/ProjectLighthouse/Controllers/SearchController.cs index 92240c26..8f6e3dba 100644 --- a/ProjectLighthouse/Controllers/SearchController.cs +++ b/ProjectLighthouse/Controllers/SearchController.cs @@ -5,6 +5,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using ProjectLighthouse.Serialization; using ProjectLighthouse.Types; +using ProjectLighthouse.Types.Levels; namespace ProjectLighthouse.Controllers { [ApiController] diff --git a/ProjectLighthouse/Controllers/SlotsController.cs b/ProjectLighthouse/Controllers/SlotsController.cs index c38fcaef..0992f36d 100644 --- a/ProjectLighthouse/Controllers/SlotsController.cs +++ b/ProjectLighthouse/Controllers/SlotsController.cs @@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using ProjectLighthouse.Serialization; using ProjectLighthouse.Types; +using ProjectLighthouse.Types.Levels; namespace ProjectLighthouse.Controllers { [ApiController] diff --git a/ProjectLighthouse/Controllers/UserController.cs b/ProjectLighthouse/Controllers/UserController.cs index 7808166d..260d0f04 100644 --- a/ProjectLighthouse/Controllers/UserController.cs +++ b/ProjectLighthouse/Controllers/UserController.cs @@ -6,6 +6,7 @@ using System.Xml; using Microsoft.AspNetCore.Mvc; using Microsoft.EntityFrameworkCore; using ProjectLighthouse.Types; +using ProjectLighthouse.Types.Profiles; namespace ProjectLighthouse.Controllers { [ApiController] diff --git a/ProjectLighthouse/Database.cs b/ProjectLighthouse/Database.cs index 80adc373..a0ac9900 100644 --- a/ProjectLighthouse/Database.cs +++ b/ProjectLighthouse/Database.cs @@ -4,6 +4,9 @@ using Microsoft.AspNetCore.Http; using Microsoft.EntityFrameworkCore; using ProjectLighthouse.Helpers; using ProjectLighthouse.Types; +using ProjectLighthouse.Types.Levels; +using ProjectLighthouse.Types.Profiles; +using ProjectLighthouse.Types.Settings; namespace ProjectLighthouse { public class Database : DbContext { diff --git a/ProjectLighthouse/Program.cs b/ProjectLighthouse/Program.cs index a15a54ac..c57dc8aa 100644 --- a/ProjectLighthouse/Program.cs +++ b/ProjectLighthouse/Program.cs @@ -4,6 +4,7 @@ using Microsoft.AspNetCore.Hosting; using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Hosting; using ProjectLighthouse.Types; +using ProjectLighthouse.Types.Settings; namespace ProjectLighthouse { public static class Program { diff --git a/ProjectLighthouse/Types/HeartedLevel.cs b/ProjectLighthouse/Types/Levels/HeartedLevel.cs similarity index 91% rename from ProjectLighthouse/Types/HeartedLevel.cs rename to ProjectLighthouse/Types/Levels/HeartedLevel.cs index a0d84ba7..3b3f540b 100644 --- a/ProjectLighthouse/Types/HeartedLevel.cs +++ b/ProjectLighthouse/Types/Levels/HeartedLevel.cs @@ -1,7 +1,7 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -namespace ProjectLighthouse.Types { +namespace ProjectLighthouse.Types.Levels { public class HeartedLevel { // ReSharper disable once UnusedMember.Global [Key] public int HeartedLevelId { get; set; } diff --git a/ProjectLighthouse/Types/LevelTags.cs b/ProjectLighthouse/Types/Levels/LevelTags.cs similarity index 97% rename from ProjectLighthouse/Types/LevelTags.cs rename to ProjectLighthouse/Types/Levels/LevelTags.cs index 4ef2787d..0ff16233 100644 --- a/ProjectLighthouse/Types/LevelTags.cs +++ b/ProjectLighthouse/Types/Levels/LevelTags.cs @@ -1,6 +1,6 @@ using System.Diagnostics.CodeAnalysis; -namespace ProjectLighthouse.Types { +namespace ProjectLighthouse.Types.Levels { /// /// A series of tags that can be applied to a level /// diff --git a/ProjectLighthouse/Types/QueuedLevel.cs b/ProjectLighthouse/Types/Levels/QueuedLevel.cs similarity index 92% rename from ProjectLighthouse/Types/QueuedLevel.cs rename to ProjectLighthouse/Types/Levels/QueuedLevel.cs index 7a712061..1e416f48 100644 --- a/ProjectLighthouse/Types/QueuedLevel.cs +++ b/ProjectLighthouse/Types/Levels/QueuedLevel.cs @@ -1,7 +1,7 @@ using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; -namespace ProjectLighthouse.Types { +namespace ProjectLighthouse.Types.Levels { public class QueuedLevel { // ReSharper disable once UnusedMember.Global [Key] public int QueuedLevelId { get; set; } diff --git a/ProjectLighthouse/Types/Slot.cs b/ProjectLighthouse/Types/Levels/Slot.cs similarity index 88% rename from ProjectLighthouse/Types/Slot.cs rename to ProjectLighthouse/Types/Levels/Slot.cs index 817381f5..8e7e198f 100644 --- a/ProjectLighthouse/Types/Slot.cs +++ b/ProjectLighthouse/Types/Levels/Slot.cs @@ -3,8 +3,9 @@ using System.ComponentModel.DataAnnotations.Schema; using System.Linq; using System.Xml.Serialization; using ProjectLighthouse.Serialization; +using ProjectLighthouse.Types.Profiles; -namespace ProjectLighthouse.Types { +namespace ProjectLighthouse.Types.Levels { /// /// A LittleBigPlanet level. /// @@ -90,23 +91,23 @@ namespace ProjectLighthouse.Types { } public string Serialize() { - string slotData = LbpSerializer.StringElement("name", Name) + - LbpSerializer.StringElement("id", SlotId) + + string slotData = LbpSerializer.StringElement("name", this.Name) + + LbpSerializer.StringElement("id", this.SlotId) + LbpSerializer.StringElement("game", 1) + - LbpSerializer.StringElement("npHandle", Creator.Username) + - LbpSerializer.StringElement("description", Description) + - LbpSerializer.StringElement("icon", IconHash) + - LbpSerializer.StringElement("rootLevel", RootLevel) + + LbpSerializer.StringElement("npHandle", this.Creator.Username) + + LbpSerializer.StringElement("description", this.Description) + + LbpSerializer.StringElement("icon", this.IconHash) + + LbpSerializer.StringElement("rootLevel", this.RootLevel) + this.SerializeResources() + - LbpSerializer.StringElement("location", Location.Serialize()) + - LbpSerializer.StringElement("initiallyLocked", InitiallyLocked) + - LbpSerializer.StringElement("isSubLevel", SubLevel) + - LbpSerializer.StringElement("isLBP1Only", Lbp1Only) + - LbpSerializer.StringElement("shareable", Shareable) + - LbpSerializer.StringElement("background", BackgroundHash) + - LbpSerializer.StringElement("minPlayers", MinimumPlayers) + - LbpSerializer.StringElement("maxPlayers", MaximumPlayers) + - LbpSerializer.StringElement("moveRequired", MoveRequired); + LbpSerializer.StringElement("location", this.Location.Serialize()) + + LbpSerializer.StringElement("initiallyLocked", this.InitiallyLocked) + + LbpSerializer.StringElement("isSubLevel", this.SubLevel) + + LbpSerializer.StringElement("isLBP1Only", this.Lbp1Only) + + LbpSerializer.StringElement("shareable", this.Shareable) + + LbpSerializer.StringElement("background", this.BackgroundHash) + + LbpSerializer.StringElement("minPlayers", this.MinimumPlayers) + + LbpSerializer.StringElement("maxPlayers", this.MaximumPlayers) + + LbpSerializer.StringElement("moveRequired", this.MoveRequired); return LbpSerializer.TaggedStringElement("slot", slotData, "type", "user"); } diff --git a/ProjectLighthouse/Types/NewsEntry.cs b/ProjectLighthouse/Types/News/NewsEntry.cs similarity index 95% rename from ProjectLighthouse/Types/NewsEntry.cs rename to ProjectLighthouse/Types/News/NewsEntry.cs index 35f9bcbf..4d1e5b41 100644 --- a/ProjectLighthouse/Types/NewsEntry.cs +++ b/ProjectLighthouse/Types/News/NewsEntry.cs @@ -1,6 +1,6 @@ using ProjectLighthouse.Serialization; -namespace ProjectLighthouse.Types { +namespace ProjectLighthouse.Types.News { /// /// Used on the info moon on LBP1. Broken for unknown reasons /// diff --git a/ProjectLighthouse/Types/NewsImage.cs b/ProjectLighthouse/Types/News/NewsImage.cs similarity index 90% rename from ProjectLighthouse/Types/NewsImage.cs rename to ProjectLighthouse/Types/News/NewsImage.cs index 4c6fd95a..8167c67e 100644 --- a/ProjectLighthouse/Types/NewsImage.cs +++ b/ProjectLighthouse/Types/News/NewsImage.cs @@ -1,6 +1,6 @@ using ProjectLighthouse.Serialization; -namespace ProjectLighthouse.Types { +namespace ProjectLighthouse.Types.News { public class NewsImage { public string Hash { get; set; } public string Alignment { get; set; } diff --git a/ProjectLighthouse/Types/ClientsConnected.cs b/ProjectLighthouse/Types/Profiles/ClientsConnected.cs similarity index 54% rename from ProjectLighthouse/Types/ClientsConnected.cs rename to ProjectLighthouse/Types/Profiles/ClientsConnected.cs index cdb4247e..57c58fe7 100644 --- a/ProjectLighthouse/Types/ClientsConnected.cs +++ b/ProjectLighthouse/Types/Profiles/ClientsConnected.cs @@ -1,7 +1,7 @@ using Microsoft.EntityFrameworkCore; using ProjectLighthouse.Serialization; -namespace ProjectLighthouse.Types { +namespace ProjectLighthouse.Types.Profiles { [Keyless] public class ClientsConnected { public bool Lbp1 { get; set; } @@ -12,11 +12,11 @@ namespace ProjectLighthouse.Types { public string Serialize() { return LbpSerializer.StringElement("clientsConnected", - LbpSerializer.StringElement("lbp1", Lbp1) + - LbpSerializer.StringElement("lbp2", Lbp2) + - LbpSerializer.StringElement("lbpme", LbpMe) + - LbpSerializer.StringElement("lbp3ps3", Lbp3Ps3) + - LbpSerializer.StringElement("lbp3ps4", Lbp3Ps4)); + LbpSerializer.StringElement("lbp1", this.Lbp1) + + LbpSerializer.StringElement("lbp2", this.Lbp2) + + LbpSerializer.StringElement("lbpme", this.LbpMe) + + LbpSerializer.StringElement("lbp3ps3", this.Lbp3Ps3) + + LbpSerializer.StringElement("lbp3ps4", this.Lbp3Ps4)); } } } \ No newline at end of file diff --git a/ProjectLighthouse/Types/Comment.cs b/ProjectLighthouse/Types/Profiles/Comment.cs similarity index 75% rename from ProjectLighthouse/Types/Comment.cs rename to ProjectLighthouse/Types/Profiles/Comment.cs index 85665237..7e50dac2 100644 --- a/ProjectLighthouse/Types/Comment.cs +++ b/ProjectLighthouse/Types/Profiles/Comment.cs @@ -3,7 +3,7 @@ using System.ComponentModel.DataAnnotations.Schema; using System.Xml.Serialization; using ProjectLighthouse.Serialization; -namespace ProjectLighthouse.Types { +namespace ProjectLighthouse.Types.Profiles { [XmlRoot("comment"), XmlType("comment")] public class Comment { [Key] @@ -28,12 +28,12 @@ namespace ProjectLighthouse.Types { public int ThumbsDown { get; set; } private string serialize() { - return LbpSerializer.StringElement("id", CommentId) + + return LbpSerializer.StringElement("id", this.CommentId) + LbpSerializer.StringElement("npHandle", this.Poster.Username) + - LbpSerializer.StringElement("timestamp", Timestamp) + - LbpSerializer.StringElement("message", Message) + - LbpSerializer.StringElement("thumbsup", ThumbsUp) + - LbpSerializer.StringElement("thumbsdown", ThumbsDown); + LbpSerializer.StringElement("timestamp", this.Timestamp) + + LbpSerializer.StringElement("message", this.Message) + + LbpSerializer.StringElement("thumbsup", this.ThumbsUp) + + LbpSerializer.StringElement("thumbsdown", this.ThumbsDown); } public string Serialize(int yourThumb) { diff --git a/ProjectLighthouse/Types/LastMatch.cs b/ProjectLighthouse/Types/Profiles/LastMatch.cs similarity index 79% rename from ProjectLighthouse/Types/LastMatch.cs rename to ProjectLighthouse/Types/Profiles/LastMatch.cs index 385ebafc..c7f73fd0 100644 --- a/ProjectLighthouse/Types/LastMatch.cs +++ b/ProjectLighthouse/Types/Profiles/LastMatch.cs @@ -1,6 +1,6 @@ using System.ComponentModel.DataAnnotations; -namespace ProjectLighthouse.Types { +namespace ProjectLighthouse.Types.Profiles { public class LastMatch { [Key] public int UserId { get; set; } public long Timestamp { get; set; } diff --git a/ProjectLighthouse/Types/Location.cs b/ProjectLighthouse/Types/Profiles/Location.cs similarity index 90% rename from ProjectLighthouse/Types/Location.cs rename to ProjectLighthouse/Types/Profiles/Location.cs index 9d50d346..5917feae 100644 --- a/ProjectLighthouse/Types/Location.cs +++ b/ProjectLighthouse/Types/Profiles/Location.cs @@ -1,6 +1,6 @@ using ProjectLighthouse.Serialization; -namespace ProjectLighthouse.Types { +namespace ProjectLighthouse.Types.Profiles { /// /// The location of a slot on a planet. /// diff --git a/ProjectLighthouse/Types/PrivacySettings.cs b/ProjectLighthouse/Types/Settings/PrivacySettings.cs similarity index 70% rename from ProjectLighthouse/Types/PrivacySettings.cs rename to ProjectLighthouse/Types/Settings/PrivacySettings.cs index 2c73c1b6..09e7e483 100644 --- a/ProjectLighthouse/Types/PrivacySettings.cs +++ b/ProjectLighthouse/Types/Settings/PrivacySettings.cs @@ -1,14 +1,14 @@ using ProjectLighthouse.Serialization; -namespace ProjectLighthouse.Types { +namespace ProjectLighthouse.Types.Settings { public class PrivacySettings { public string LevelVisibility { get; set; } public string ProfileVisibility { get; set; } public string Serialize() { return LbpSerializer.StringElement("privacySettings", - LbpSerializer.StringElement("levelVisibility", LevelVisibility) + - LbpSerializer.StringElement("profileVisibility", ProfileVisibility) + LbpSerializer.StringElement("levelVisibility", this.LevelVisibility) + + LbpSerializer.StringElement("profileVisibility", this.ProfileVisibility) ); } } diff --git a/ProjectLighthouse/Types/ServerSettings.cs b/ProjectLighthouse/Types/Settings/ServerSettings.cs similarity index 96% rename from ProjectLighthouse/Types/ServerSettings.cs rename to ProjectLighthouse/Types/Settings/ServerSettings.cs index d1e5f71f..238f6002 100644 --- a/ProjectLighthouse/Types/ServerSettings.cs +++ b/ProjectLighthouse/Types/Settings/ServerSettings.cs @@ -1,7 +1,7 @@ #nullable enable using System; -namespace ProjectLighthouse.Types { +namespace ProjectLighthouse.Types.Settings { public static class ServerSettings { /// /// The maximum amount of slots allowed on users' earth diff --git a/ProjectLighthouse/Types/User.cs b/ProjectLighthouse/Types/User.cs index 4851cfc5..4b202a00 100644 --- a/ProjectLighthouse/Types/User.cs +++ b/ProjectLighthouse/Types/User.cs @@ -1,5 +1,7 @@ using System.ComponentModel.DataAnnotations.Schema; using ProjectLighthouse.Serialization; +using ProjectLighthouse.Types.Profiles; +using ProjectLighthouse.Types.Settings; namespace ProjectLighthouse.Types { public class User {