Rename root namespace to LBPUnion.ProjectLighthouse

This commit is contained in:
jvyden 2021-10-20 21:41:58 -04:00
parent 20b35ec95f
commit 581e6bac2a
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278
58 changed files with 178 additions and 162 deletions

View file

@ -1,12 +1,12 @@
using LBPUnion.ProjectLighthouse.Types.Settings;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using ProjectLighthouse.Types.Settings;
using Xunit; using Xunit;
namespace ProjectLighthouse.Tests { namespace LBPUnion.ProjectLighthouse.Tests {
public sealed class DatabaseFact : FactAttribute { public sealed class DatabaseFact : FactAttribute {
public DatabaseFact() { public DatabaseFact() {
ServerSettings.DbConnectionString = "server=127.0.0.1;uid=root;pwd=lighthouse;database=lighthouse"; ServerSettings.DbConnectionString = "server=127.0.0.1;uid=root;pwd=lighthouse;database=lighthouse";
if(!ServerSettings.DbConnected) Skip = "Database not available"; if(!ServerSettings.DbConnected) this.Skip = "Database not available";
else { else {
using Database database = new(); using Database database = new();
database.Database.Migrate(); database.Database.Migrate();

View file

@ -3,12 +3,12 @@ using System.IO;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Xml.Serialization; using System.Xml.Serialization;
using LBPUnion.ProjectLighthouse.Serialization;
using LBPUnion.ProjectLighthouse.Types;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.TestHost; using Microsoft.AspNetCore.TestHost;
using ProjectLighthouse.Serialization;
using ProjectLighthouse.Types;
namespace ProjectLighthouse.Tests { namespace LBPUnion.ProjectLighthouse.Tests {
[SuppressMessage("ReSharper", "UnusedMember.Global")] [SuppressMessage("ReSharper", "UnusedMember.Global")]
public class LighthouseTest { public class LighthouseTest {
public readonly TestServer Server; public readonly TestServer Server;
@ -41,7 +41,7 @@ namespace ProjectLighthouse.Tests {
return (LoginResult)serializer.Deserialize(new StringReader(responseContent))!; return (LoginResult)serializer.Deserialize(new StringReader(responseContent))!;
} }
public Task<HttpResponseMessage> AuthenticatedRequest(string endpoint, string mmAuth) => AuthenticatedRequest(endpoint, mmAuth, HttpMethod.Get); public Task<HttpResponseMessage> AuthenticatedRequest(string endpoint, string mmAuth) => this.AuthenticatedRequest(endpoint, mmAuth, HttpMethod.Get);
public Task<HttpResponseMessage> AuthenticatedRequest(string endpoint, string mmAuth, HttpMethod method) { public Task<HttpResponseMessage> AuthenticatedRequest(string endpoint, string mmAuth, HttpMethod method) {
using var requestMessage = new HttpRequestMessage(method, endpoint); using var requestMessage = new HttpRequestMessage(method, endpoint);

View file

@ -6,6 +6,10 @@
<IsPackable>false</IsPackable> <IsPackable>false</IsPackable>
<TargetFrameworks>net5.0;net6.0</TargetFrameworks> <TargetFrameworks>net5.0;net6.0</TargetFrameworks>
<AssemblyName>LBPUnion.ProjectLighthouse.Tests</AssemblyName>
<RootNamespace>LBPUnion.ProjectLighthouse.Tests</RootNamespace>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View file

@ -1,11 +1,11 @@
using System.Net; using System.Net;
using System.Net.Http; using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
using ProjectLighthouse.Types; using LBPUnion.ProjectLighthouse.Types;
using ProjectLighthouse.Types.Settings; using LBPUnion.ProjectLighthouse.Types.Settings;
using Xunit; using Xunit;
namespace ProjectLighthouse.Tests { namespace LBPUnion.ProjectLighthouse.Tests {
public class AuthenticationTests : LighthouseTest { public class AuthenticationTests : LighthouseTest {
[Fact] [Fact]
public async Task ShouldReturnErrorOnNoPostData() { public async Task ShouldReturnErrorOnNoPostData() {
@ -43,7 +43,7 @@ namespace ProjectLighthouse.Tests {
public async Task CanUseToken() { public async Task CanUseToken() {
LoginResult loginResult = await this.Authenticate(); LoginResult loginResult = await this.Authenticate();
HttpResponseMessage response = await AuthenticatedRequest("/LITTLEBIGPLANETPS3_XML/eula", loginResult.AuthTicket); HttpResponseMessage response = await this.AuthenticatedRequest("/LITTLEBIGPLANETPS3_XML/eula", loginResult.AuthTicket);
string responseContent = await response.Content.ReadAsStringAsync(); string responseContent = await response.Content.ReadAsStringAsync();
Assert.True(response.IsSuccessStatusCode); Assert.True(response.IsSuccessStatusCode);

View file

@ -1,7 +1,7 @@
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace ProjectLighthouse.Tests { namespace LBPUnion.ProjectLighthouse.Tests {
public class DatabaseTests : LighthouseTest { public class DatabaseTests : LighthouseTest {
[DatabaseFact] [DatabaseFact]
public async Task CanCreateUserTwice() { public async Task CanCreateUserTwice() {

View file

@ -1,10 +1,10 @@
using System; using System;
using System.IO; using System.IO;
using System.Text; using System.Text;
using ProjectLighthouse.Types.Files; using LBPUnion.ProjectLighthouse.Types.Files;
using Xunit; using Xunit;
namespace ProjectLighthouse.Tests { namespace LBPUnion.ProjectLighthouse.Tests {
public class FileTypeTests { public class FileTypeTests {
[Fact] [Fact]
public void ShouldRecognizeLevel() { public void ShouldRecognizeLevel() {

View file

@ -2,10 +2,10 @@ using System;
using System.Net.Http; using System.Net.Http;
using System.Threading; using System.Threading;
using System.Threading.Tasks; using System.Threading.Tasks;
using ProjectLighthouse.Types; using LBPUnion.ProjectLighthouse.Types;
using Xunit; using Xunit;
namespace ProjectLighthouse.Tests { namespace LBPUnion.ProjectLighthouse.Tests {
public class MatchTests : LighthouseTest { public class MatchTests : LighthouseTest {
private static readonly SemaphoreSlim semaphore = new(1, 1); private static readonly SemaphoreSlim semaphore = new(1, 1);
@ -14,7 +14,7 @@ namespace ProjectLighthouse.Tests {
LoginResult loginResult = await this.Authenticate(); LoginResult loginResult = await this.Authenticate();
await semaphore.WaitAsync(); await semaphore.WaitAsync();
HttpResponseMessage result = await AuthenticatedUploadDataRequest("LITTLEBIGPLANETPS3_XML/match", Array.Empty<byte>(), loginResult.AuthTicket); HttpResponseMessage result = await this.AuthenticatedUploadDataRequest("LITTLEBIGPLANETPS3_XML/match", Array.Empty<byte>(), loginResult.AuthTicket);
Assert.True(result.IsSuccessStatusCode); Assert.True(result.IsSuccessStatusCode);
semaphore.Release(); semaphore.Release();
@ -29,7 +29,7 @@ namespace ProjectLighthouse.Tests {
int oldPlayerCount = await this.GetPlayerCount(); int oldPlayerCount = await this.GetPlayerCount();
HttpResponseMessage result = await AuthenticatedUploadDataRequest("LITTLEBIGPLANETPS3_XML/match", Array.Empty<byte>(), loginResult.AuthTicket); HttpResponseMessage result = await this.AuthenticatedUploadDataRequest("LITTLEBIGPLANETPS3_XML/match", Array.Empty<byte>(), loginResult.AuthTicket);
Assert.True(result.IsSuccessStatusCode); Assert.True(result.IsSuccessStatusCode);
int playerCount = await this.GetPlayerCount(); int playerCount = await this.GetPlayerCount();

View file

@ -1,8 +1,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using ProjectLighthouse.Serialization; using LBPUnion.ProjectLighthouse.Serialization;
using Xunit; using Xunit;
namespace ProjectLighthouse.Tests { namespace LBPUnion.ProjectLighthouse.Tests {
public class SerializerTests : LighthouseTest { public class SerializerTests : LighthouseTest {
[Fact] [Fact]
public void BlankElementWorks() { public void BlankElementWorks() {

View file

@ -1,10 +1,10 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using ProjectLighthouse.Types; using LBPUnion.ProjectLighthouse.Types;
using ProjectLighthouse.Types.Levels; using LBPUnion.ProjectLighthouse.Types.Levels;
using ProjectLighthouse.Types.Profiles; using LBPUnion.ProjectLighthouse.Types.Profiles;
using Xunit; using Xunit;
namespace ProjectLighthouse.Tests { namespace LBPUnion.ProjectLighthouse.Tests {
public class SlotTests : LighthouseTest { public class SlotTests : LighthouseTest {
[DatabaseFact] [DatabaseFact]
public async Task ShouldOnlyShowUsersLevels() { public async Task ShouldOnlyShowUsersLevels() {

View file

@ -4,7 +4,7 @@ using System.Net.Http;
using System.Threading.Tasks; using System.Threading.Tasks;
using Xunit; using Xunit;
namespace ProjectLighthouse.Tests { namespace LBPUnion.ProjectLighthouse.Tests {
public class UploadTests : LighthouseTest { public class UploadTests : LighthouseTest {
public UploadTests() { public UploadTests() {
string assetsDirectory = Path.Combine(Environment.CurrentDirectory, "r"); string assetsDirectory = Path.Combine(Environment.CurrentDirectory, "r");
@ -13,31 +13,31 @@ namespace ProjectLighthouse.Tests {
[Fact] [Fact]
public async Task ShouldNotAcceptScript() { public async Task ShouldNotAcceptScript() {
HttpResponseMessage response = await UploadFileRequest("/LITTLEBIGPLANETPS3_XML/upload/scriptTest", "ExampleFiles/TestScript.ff"); HttpResponseMessage response = await this.UploadFileRequest("/LITTLEBIGPLANETPS3_XML/upload/scriptTest", "ExampleFiles/TestScript.ff");
Assert.False(response.IsSuccessStatusCode); Assert.False(response.IsSuccessStatusCode);
} }
[Fact] [Fact]
public async Task ShouldNotAcceptFarc() { public async Task ShouldNotAcceptFarc() {
HttpResponseMessage response = await UploadFileRequest("/LITTLEBIGPLANETPS3_XML/upload/farcTest", "ExampleFiles/TestFarc.farc"); HttpResponseMessage response = await this.UploadFileRequest("/LITTLEBIGPLANETPS3_XML/upload/farcTest", "ExampleFiles/TestFarc.farc");
Assert.False(response.IsSuccessStatusCode); Assert.False(response.IsSuccessStatusCode);
} }
[Fact] [Fact]
public async Task ShouldNotAcceptGarbage() { public async Task ShouldNotAcceptGarbage() {
HttpResponseMessage response = await UploadFileRequest("/LITTLEBIGPLANETPS3_XML/upload/garbageTest", "ExampleFiles/TestGarbage.bin"); HttpResponseMessage response = await this.UploadFileRequest("/LITTLEBIGPLANETPS3_XML/upload/garbageTest", "ExampleFiles/TestGarbage.bin");
Assert.False(response.IsSuccessStatusCode); Assert.False(response.IsSuccessStatusCode);
} }
[Fact] [Fact]
public async Task ShouldAcceptTexture() { public async Task ShouldAcceptTexture() {
HttpResponseMessage response = await UploadFileRequest("/LITTLEBIGPLANETPS3_XML/upload/textureTest", "ExampleFiles/TestTexture.tex"); HttpResponseMessage response = await this.UploadFileRequest("/LITTLEBIGPLANETPS3_XML/upload/textureTest", "ExampleFiles/TestTexture.tex");
Assert.True(response.IsSuccessStatusCode); Assert.True(response.IsSuccessStatusCode);
} }
[Fact] [Fact]
public async Task ShouldAcceptLevel() { public async Task ShouldAcceptLevel() {
HttpResponseMessage response = await UploadFileRequest("/LITTLEBIGPLANETPS3_XML/upload/levelTest", "ExampleFiles/TestLevel.lvl"); HttpResponseMessage response = await this.UploadFileRequest("/LITTLEBIGPLANETPS3_XML/upload/levelTest", "ExampleFiles/TestLevel.lvl");
Assert.True(response.IsSuccessStatusCode); Assert.True(response.IsSuccessStatusCode);
} }
} }

View file

@ -1,8 +1,8 @@
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using LBPUnion.ProjectLighthouse.Types.Settings;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using ProjectLighthouse.Types.Settings;
namespace ProjectLighthouse.Controllers { namespace LBPUnion.ProjectLighthouse.Controllers {
[ApiController] [ApiController]
[Route("LITTLEBIGPLANETPS3_XML/")] [Route("LITTLEBIGPLANETPS3_XML/")]
[Produces("text/plain")] [Produces("text/plain")]

View file

@ -3,13 +3,13 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Xml.Serialization; using System.Xml.Serialization;
using LBPUnion.ProjectLighthouse.Serialization;
using LBPUnion.ProjectLighthouse.Types;
using LBPUnion.ProjectLighthouse.Types.Profiles;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using ProjectLighthouse.Serialization;
using ProjectLighthouse.Types;
using ProjectLighthouse.Types.Profiles;
namespace ProjectLighthouse.Controllers { namespace LBPUnion.ProjectLighthouse.Controllers {
[ApiController] [ApiController]
[Route("LITTLEBIGPLANETPS3_XML/")] [Route("LITTLEBIGPLANETPS3_XML/")]
[Produces("text/xml")] [Produces("text/xml")]
@ -21,7 +21,7 @@ namespace ProjectLighthouse.Controllers {
[HttpGet("userComments/{username}")] [HttpGet("userComments/{username}")]
public async Task<IActionResult> GetComments(string username) { public async Task<IActionResult> GetComments(string username) {
List<Comment> comments = await database.Comments List<Comment> comments = await this.database.Comments
.Include(c => c.Target) .Include(c => c.Target)
.Include(c => c.Poster) .Include(c => c.Poster)
.Where(c => c.Target.Username == username) .Where(c => c.Target.Username == username)
@ -33,25 +33,25 @@ namespace ProjectLighthouse.Controllers {
[HttpPost("postUserComment/{username}")] [HttpPost("postUserComment/{username}")]
public async Task<IActionResult> PostComment(string username) { public async Task<IActionResult> PostComment(string username) {
Request.Body.Position = 0; this.Request.Body.Position = 0;
string bodyString = await new StreamReader(Request.Body).ReadToEndAsync(); string bodyString = await new StreamReader(this.Request.Body).ReadToEndAsync();
XmlSerializer serializer = new(typeof(Comment)); XmlSerializer serializer = new(typeof(Comment));
Comment comment = (Comment)serializer.Deserialize(new StringReader(bodyString)); Comment comment = (Comment)serializer.Deserialize(new StringReader(bodyString));
User poster = await database.UserFromRequest(Request); User poster = await this.database.UserFromRequest(this.Request);
if(poster == null) return this.StatusCode(403, ""); if(poster == null) return this.StatusCode(403, "");
User target = await database.Users.FirstOrDefaultAsync(u => u.Username == username); User target = await this.database.Users.FirstOrDefaultAsync(u => u.Username == username);
if(comment == null || target == null) return this.BadRequest(); if(comment == null || target == null) return this.BadRequest();
comment.PosterUserId = poster.UserId; comment.PosterUserId = poster.UserId;
comment.TargetUserId = target.UserId; comment.TargetUserId = target.UserId;
database.Comments.Add(comment); this.database.Comments.Add(comment);
await database.SaveChangesAsync(); await this.database.SaveChangesAsync();
return this.Ok(); return this.Ok();
} }
} }

View file

@ -1,6 +1,6 @@
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
namespace ProjectLighthouse.Controllers { namespace LBPUnion.ProjectLighthouse.Controllers {
[ApiController] [ApiController]
[Route("LITTLEBIGPLANETPS3_XML/enterLevel")] [Route("LITTLEBIGPLANETPS3_XML/enterLevel")]
// [Produces("text/plain")] // [Produces("text/plain")]

View file

@ -2,13 +2,13 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using LBPUnion.ProjectLighthouse.Serialization;
using LBPUnion.ProjectLighthouse.Types;
using LBPUnion.ProjectLighthouse.Types.Levels;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using ProjectLighthouse.Serialization;
using ProjectLighthouse.Types;
using ProjectLighthouse.Types.Levels;
namespace ProjectLighthouse.Controllers { namespace LBPUnion.ProjectLighthouse.Controllers {
[ApiController] [ApiController]
[Route("LITTLEBIGPLANETPS3_XML/")] [Route("LITTLEBIGPLANETPS3_XML/")]
[Produces("text/xml")] [Produces("text/xml")]

View file

@ -1,8 +1,8 @@
using System; using System;
using LBPUnion.ProjectLighthouse.Types.Levels;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using ProjectLighthouse.Types.Levels;
namespace ProjectLighthouse.Controllers { namespace LBPUnion.ProjectLighthouse.Controllers {
[ApiController] [ApiController]
[Route("LITTLEBIGPLANETPS3_XML/tags")] [Route("LITTLEBIGPLANETPS3_XML/tags")]
[Produces("text/plain")] [Produces("text/plain")]

View file

@ -1,11 +1,11 @@
#nullable enable #nullable enable
using System.IO; using System.IO;
using System.Threading.Tasks; using System.Threading.Tasks;
using LBPUnion.ProjectLighthouse.Types;
using LBPUnion.ProjectLighthouse.Types.Settings;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using ProjectLighthouse.Types;
using ProjectLighthouse.Types.Settings;
namespace ProjectLighthouse.Controllers { namespace LBPUnion.ProjectLighthouse.Controllers {
[ApiController] [ApiController]
[Route("LITTLEBIGPLANETPS3_XML/login")] [Route("LITTLEBIGPLANETPS3_XML/login")]
[Produces("text/xml")] [Produces("text/xml")]
@ -18,7 +18,7 @@ namespace ProjectLighthouse.Controllers {
[HttpPost] [HttpPost]
public async Task<IActionResult> Login() { public async Task<IActionResult> Login() {
string body = await new StreamReader(Request.Body).ReadToEndAsync(); string body = await new StreamReader(this.Request.Body).ReadToEndAsync();
LoginData loginData; LoginData loginData;
try { try {
@ -28,7 +28,7 @@ namespace ProjectLighthouse.Controllers {
return this.BadRequest(); return this.BadRequest();
} }
Token? token = await database.AuthenticateUser(loginData); Token? token = await this.database.AuthenticateUser(loginData);
if(token == null) return this.StatusCode(403, ""); if(token == null) return this.StatusCode(403, "");

View file

@ -1,13 +1,13 @@
#nullable enable #nullable enable
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using LBPUnion.ProjectLighthouse.Helpers;
using LBPUnion.ProjectLighthouse.Types;
using LBPUnion.ProjectLighthouse.Types.Profiles;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using ProjectLighthouse.Helpers;
using ProjectLighthouse.Types;
using ProjectLighthouse.Types.Profiles;
namespace ProjectLighthouse.Controllers { namespace LBPUnion.ProjectLighthouse.Controllers {
[ApiController] [ApiController]
[Route("LITTLEBIGPLANETPS3_XML/")] [Route("LITTLEBIGPLANETPS3_XML/")]
[Produces("text/xml")] [Produces("text/xml")]

View file

@ -1,8 +1,8 @@
using System.Threading.Tasks; using System.Threading.Tasks;
using LBPUnion.ProjectLighthouse.Types;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using ProjectLighthouse.Types;
namespace ProjectLighthouse.Controllers { namespace LBPUnion.ProjectLighthouse.Controllers {
[ApiController] [ApiController]
[Route("LITTLEBIGPLANETPS3_XML/")] [Route("LITTLEBIGPLANETPS3_XML/")]
[Produces("text/plain")] [Produces("text/plain")]
@ -14,13 +14,13 @@ namespace ProjectLighthouse.Controllers {
[HttpGet("eula")] [HttpGet("eula")]
public async Task<IActionResult> Eula() { public async Task<IActionResult> Eula() {
User user = await this.database.UserFromRequest(Request); User user = await this.database.UserFromRequest(this.Request);
return user == null ? this.StatusCode(403, "") : this.Ok($"You are logged in as user {user.Username} (id {user.UserId})"); return user == null ? this.StatusCode(403, "") : this.Ok($"You are logged in as user {user.Username} (id {user.UserId})");
} }
[HttpGet("announce")] [HttpGet("announce")]
public IActionResult Announce() { public IActionResult Announce() {
return Ok(""); return this.Ok("");
} }
[HttpGet("notification")] [HttpGet("notification")]

View file

@ -1,8 +1,8 @@
using LBPUnion.ProjectLighthouse.Serialization;
using LBPUnion.ProjectLighthouse.Types.News;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using ProjectLighthouse.Serialization;
using ProjectLighthouse.Types.News;
namespace ProjectLighthouse.Controllers { namespace LBPUnion.ProjectLighthouse.Controllers {
[ApiController] [ApiController]
[Route("LITTLEBIGPLANETPS3_XML/news")] [Route("LITTLEBIGPLANETPS3_XML/news")]
[Produces("text/xml")] [Produces("text/xml")]

View file

@ -2,15 +2,15 @@ using System.IO;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Xml.Serialization; using System.Xml.Serialization;
using LBPUnion.ProjectLighthouse.Helpers;
using LBPUnion.ProjectLighthouse.Serialization;
using LBPUnion.ProjectLighthouse.Types;
using LBPUnion.ProjectLighthouse.Types.Levels;
using LBPUnion.ProjectLighthouse.Types.Profiles;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using ProjectLighthouse.Helpers;
using ProjectLighthouse.Serialization;
using ProjectLighthouse.Types;
using ProjectLighthouse.Types.Levels;
using ProjectLighthouse.Types.Profiles;
namespace ProjectLighthouse.Controllers { namespace LBPUnion.ProjectLighthouse.Controllers {
[ApiController] [ApiController]
[Route("LITTLEBIGPLANETPS3_XML/")] [Route("LITTLEBIGPLANETPS3_XML/")]
[Produces("text/xml")] [Produces("text/xml")]
@ -42,7 +42,7 @@ namespace ProjectLighthouse.Controllers {
/// </summary> /// </summary>
[HttpPost("publish")] [HttpPost("publish")]
public async Task<IActionResult> Publish() { public async Task<IActionResult> Publish() {
User user = await database.UserFromRequest(Request); User user = await this.database.UserFromRequest(this.Request);
if(user == null) return this.StatusCode(403, ""); if(user == null) return this.StatusCode(403, "");
Slot slot = await this.GetSlotFromBody(); Slot slot = await this.GetSlotFromBody();
@ -52,34 +52,34 @@ namespace ProjectLighthouse.Controllers {
X = 0, X = 0,
Y = 0, Y = 0,
}; };
database.Locations.Add(l); this.database.Locations.Add(l);
await database.SaveChangesAsync(); await this.database.SaveChangesAsync();
slot.LocationId = l.Id; slot.LocationId = l.Id;
slot.CreatorId = user.UserId; slot.CreatorId = user.UserId;
database.Slots.Add(slot); this.database.Slots.Add(slot);
await database.SaveChangesAsync(); await this.database.SaveChangesAsync();
return this.Ok(slot.Serialize()); return this.Ok(slot.Serialize());
} }
[HttpPost("unpublish/{id:int}")] [HttpPost("unpublish/{id:int}")]
public async Task<IActionResult> Unpublish(int id) { public async Task<IActionResult> Unpublish(int id) {
Slot slot = await database.Slots Slot slot = await this.database.Slots
.Include(s => s.Location) .Include(s => s.Location)
.FirstOrDefaultAsync(s => s.SlotId == id); .FirstOrDefaultAsync(s => s.SlotId == id);
database.Locations.Remove(slot.Location); this.database.Locations.Remove(slot.Location);
database.Slots.Remove(slot); this.database.Slots.Remove(slot);
await database.SaveChangesAsync(); await this.database.SaveChangesAsync();
return this.Ok(); return this.Ok();
} }
public async Task<Slot> GetSlotFromBody() { public async Task<Slot> GetSlotFromBody() {
Request.Body.Position = 0; this.Request.Body.Position = 0;
string bodyString = await new StreamReader(Request.Body).ReadToEndAsync(); string bodyString = await new StreamReader(this.Request.Body).ReadToEndAsync();
XmlSerializer serializer = new(typeof(Slot)); XmlSerializer serializer = new(typeof(Slot));
Slot slot = (Slot)serializer.Deserialize(new StringReader(bodyString)); Slot slot = (Slot)serializer.Deserialize(new StringReader(bodyString));

View file

@ -3,14 +3,14 @@ using System.Linq;
using System.Text; using System.Text;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Xml.Serialization; using System.Xml.Serialization;
using LBPUnion.ProjectLighthouse.Helpers;
using LBPUnion.ProjectLighthouse.Serialization;
using LBPUnion.ProjectLighthouse.Types;
using LBPUnion.ProjectLighthouse.Types.Files;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using ProjectLighthouse.Helpers;
using ProjectLighthouse.Serialization;
using ProjectLighthouse.Types;
using ProjectLighthouse.Types.Files;
using IOFile = System.IO.File; using IOFile = System.IO.File;
namespace ProjectLighthouse.Controllers { namespace LBPUnion.ProjectLighthouse.Controllers {
[ApiController] [ApiController]
[Route("LITTLEBIGPLANETPS3_XML/")] [Route("LITTLEBIGPLANETPS3_XML/")]
[Produces("text/xml")] [Produces("text/xml")]
@ -23,7 +23,7 @@ namespace ProjectLighthouse.Controllers {
[HttpPost("filterResources")] [HttpPost("filterResources")]
[HttpPost("showNotUploaded")] [HttpPost("showNotUploaded")]
public async Task<IActionResult> FilterResources() { public async Task<IActionResult> FilterResources() {
string bodyString = await new StreamReader(Request.Body).ReadToEndAsync(); string bodyString = await new StreamReader(this.Request.Body).ReadToEndAsync();
XmlSerializer serializer = new(typeof(ResourceList)); XmlSerializer serializer = new(typeof(ResourceList));
ResourceList resourceList = (ResourceList)serializer.Deserialize(new StringReader(bodyString)); ResourceList resourceList = (ResourceList)serializer.Deserialize(new StringReader(bodyString));
@ -57,7 +57,7 @@ namespace ProjectLighthouse.Controllers {
FileHelper.EnsureDirectoryCreated(assetsDirectory); FileHelper.EnsureDirectoryCreated(assetsDirectory);
if(FileHelper.ResourceExists(hash)) this.Ok(); // no reason to fail if it's already uploaded if(FileHelper.ResourceExists(hash)) this.Ok(); // no reason to fail if it's already uploaded
LbpFile file = new(Encoding.ASCII.GetBytes(await new StreamReader(Request.Body).ReadToEndAsync())); LbpFile file = new(Encoding.ASCII.GetBytes(await new StreamReader(this.Request.Body).ReadToEndAsync()));
if(!FileHelper.IsFileSafe(file)) return this.UnprocessableEntity(); if(!FileHelper.IsFileSafe(file)) return this.UnprocessableEntity();

View file

@ -1,12 +1,12 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using LBPUnion.ProjectLighthouse.Serialization;
using LBPUnion.ProjectLighthouse.Types.Levels;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using ProjectLighthouse.Serialization;
using ProjectLighthouse.Types.Levels;
namespace ProjectLighthouse.Controllers { namespace LBPUnion.ProjectLighthouse.Controllers {
[ApiController] [ApiController]
[Route("LITTLEBIGPLANETPS3_XML/")] [Route("LITTLEBIGPLANETPS3_XML/")]
[Produces("text/xml")] [Produces("text/xml")]

View file

@ -1,11 +1,11 @@
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using LBPUnion.ProjectLighthouse.Serialization;
using LBPUnion.ProjectLighthouse.Types.Levels;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using ProjectLighthouse.Serialization;
using ProjectLighthouse.Types.Levels;
namespace ProjectLighthouse.Controllers { namespace LBPUnion.ProjectLighthouse.Controllers {
[ApiController] [ApiController]
[Route("LITTLEBIGPLANETPS3_XML/")] [Route("LITTLEBIGPLANETPS3_XML/")]
[Produces("text/xml")] [Produces("text/xml")]
@ -18,7 +18,7 @@ namespace ProjectLighthouse.Controllers {
[HttpGet("slots/by")] [HttpGet("slots/by")]
public IActionResult SlotsBy([FromQuery] string u) { public IActionResult SlotsBy([FromQuery] string u) {
string response = Enumerable.Aggregate( string response = Enumerable.Aggregate(
database.Slots this.database.Slots
.Include(s => s.Creator) .Include(s => s.Creator)
.Include(s => s.Location) .Include(s => s.Location)
.Where(s => s.Creator.Username == u) .Where(s => s.Creator.Username == u)

View file

@ -3,12 +3,12 @@ using System.Collections.Generic;
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using System.Xml; using System.Xml;
using LBPUnion.ProjectLighthouse.Types;
using LBPUnion.ProjectLighthouse.Types.Profiles;
using Microsoft.AspNetCore.Mvc; using Microsoft.AspNetCore.Mvc;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using ProjectLighthouse.Types;
using ProjectLighthouse.Types.Profiles;
namespace ProjectLighthouse.Controllers { namespace LBPUnion.ProjectLighthouse.Controllers {
[ApiController] [ApiController]
[Route("LITTLEBIGPLANETPS3_XML/")] [Route("LITTLEBIGPLANETPS3_XML/")]
[Produces("text/xml")] [Produces("text/xml")]
@ -20,7 +20,7 @@ namespace ProjectLighthouse.Controllers {
[HttpGet("user/{username}")] [HttpGet("user/{username}")]
public async Task<IActionResult> GetUser(string username) { public async Task<IActionResult> GetUser(string username) {
User user = await database.Users User user = await this.database.Users
.Include(u => u.Location) .Include(u => u.Location)
.FirstOrDefaultAsync(u => u.Username == username); .FirstOrDefaultAsync(u => u.Username == username);
@ -36,7 +36,7 @@ namespace ProjectLighthouse.Controllers {
[HttpPost("updateUser")] [HttpPost("updateUser")]
public async Task<IActionResult> UpdateUser() { public async Task<IActionResult> UpdateUser() {
User user = await database.UserFromRequest(Request); User user = await this.database.UserFromRequest(this.Request);
if(user == null) return this.StatusCode(403, ""); if(user == null) return this.StatusCode(403, "");
@ -62,7 +62,7 @@ namespace ProjectLighthouse.Controllers {
// </updateUser> // </updateUser>
// //
// if you find a way to make it not stupid feel free to replace this // if you find a way to make it not stupid feel free to replace this
using(XmlReader reader = XmlReader.Create(Request.Body, settings)) { using(XmlReader reader = XmlReader.Create(this.Request.Body, settings)) {
List<string> path = new(); // you can think of this as a file path in the XML, like <updateUser> -> <location> -> <x> List<string> path = new(); // you can think of this as a file path in the XML, like <updateUser> -> <location> -> <x>
while(await reader.ReadAsync()) { while(await reader.ReadAsync()) {
// ReSharper disable once SwitchStatementMissingSomeEnumCasesNoDefault // ReSharper disable once SwitchStatementMissingSomeEnumCasesNoDefault
@ -105,7 +105,7 @@ namespace ProjectLighthouse.Controllers {
// the way location on a user card works is stupid and will not save with the way below as-is, so we do the following: // the way location on a user card works is stupid and will not save with the way below as-is, so we do the following:
if(locationChanged) { // only modify the database if we modify here if(locationChanged) { // only modify the database if we modify here
Location l = await database.Locations.Where(l => l.Id == user.LocationId).FirstOrDefaultAsync(); // find the location in the database again Location l = await this.database.Locations.Where(l => l.Id == user.LocationId).FirstOrDefaultAsync(); // find the location in the database again
// set the location in the database to the one we modified above // set the location in the database to the one we modified above
l.X = user.Location.X; l.X = user.Location.X;
@ -114,7 +114,7 @@ namespace ProjectLighthouse.Controllers {
// now both are in sync, and will update in the database. // now both are in sync, and will update in the database.
} }
if(database.ChangeTracker.HasChanges()) await database.SaveChangesAsync(); // save the user to the database if we changed anything if(this.database.ChangeTracker.HasChanges()) await this.database.SaveChangesAsync(); // save the user to the database if we changed anything
return this.Ok(); return this.Ok();
} }
} }

View file

@ -1,14 +1,14 @@
using System.Linq; using System.Linq;
using System.Threading.Tasks; using System.Threading.Tasks;
using LBPUnion.ProjectLighthouse.Helpers;
using LBPUnion.ProjectLighthouse.Types;
using LBPUnion.ProjectLighthouse.Types.Levels;
using LBPUnion.ProjectLighthouse.Types.Profiles;
using LBPUnion.ProjectLighthouse.Types.Settings;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using ProjectLighthouse.Helpers;
using ProjectLighthouse.Types;
using ProjectLighthouse.Types.Levels;
using ProjectLighthouse.Types.Profiles;
using ProjectLighthouse.Types.Settings;
namespace ProjectLighthouse { namespace LBPUnion.ProjectLighthouse {
public class Database : DbContext { public class Database : DbContext {
public DbSet<User> Users { get; set; } public DbSet<User> Users { get; set; }
public DbSet<Location> Locations { get; set; } public DbSet<Location> Locations { get; set; }
@ -27,7 +27,7 @@ namespace ProjectLighthouse {
public async Task<User> CreateUser(string username) { public async Task<User> CreateUser(string username) {
User user; User user;
if((user = await Users.Where(u => u.Username == username).FirstOrDefaultAsync()) != null) if((user = await this.Users.Where(u => u.Username == username).FirstOrDefaultAsync()) != null)
return user; return user;
Location l = new(); // store to get id after submitting Location l = new(); // store to get id after submitting
@ -64,9 +64,9 @@ namespace ProjectLighthouse {
} }
public async Task<User?> UserFromAuthToken(string authToken) { public async Task<User?> UserFromAuthToken(string authToken) {
Token? token = await Tokens.FirstOrDefaultAsync(t => t.UserToken == authToken); Token? token = await this.Tokens.FirstOrDefaultAsync(t => t.UserToken == authToken);
if(token == null) return null; if(token == null) return null;
return await Users return await this.Users
.Include(u => u.Location) .Include(u => u.Location)
.FirstOrDefaultAsync(u => u.UserId == token.UserId); .FirstOrDefaultAsync(u => u.UserId == token.UserId);
} }
@ -76,7 +76,7 @@ namespace ProjectLighthouse {
return null; return null;
} }
return await UserFromAuthToken(mmAuth); return await this.UserFromAuthToken(mmAuth);
} }
#nullable disable #nullable disable
} }

View file

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.IO; using System.IO;
using System.Text; using System.Text;
namespace ProjectLighthouse.Helpers { namespace LBPUnion.ProjectLighthouse.Helpers {
public static class BinaryHelper { public static class BinaryHelper {
public static string ReadString(BinaryReader reader) { public static string ReadString(BinaryReader reader) {
List<byte> readBytes = new(); List<byte> readBytes = new();

View file

@ -2,9 +2,9 @@ using System;
using System.IO; using System.IO;
using System.Linq; using System.Linq;
using System.Text; using System.Text;
using ProjectLighthouse.Types.Files; using LBPUnion.ProjectLighthouse.Types.Files;
namespace ProjectLighthouse.Helpers { namespace LBPUnion.ProjectLighthouse.Helpers {
public static class FileHelper { public static class FileHelper {
public static readonly string ResourcePath = Path.Combine(Environment.CurrentDirectory, "r"); public static readonly string ResourcePath = Path.Combine(Environment.CurrentDirectory, "r");

View file

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
using System.Security.Cryptography; using System.Security.Cryptography;
using System.Text; using System.Text;
namespace ProjectLighthouse.Helpers { namespace LBPUnion.ProjectLighthouse.Helpers {
[SuppressMessage("ReSharper", "UnusedMember.Global")] [SuppressMessage("ReSharper", "UnusedMember.Global")]
public static class HashHelper { public static class HashHelper {
// private static readonly SHA1 sha1 = SHA1.Create(); // private static readonly SHA1 sha1 = SHA1.Create();

View file

@ -1,6 +1,6 @@
using System; using System;
namespace ProjectLighthouse.Helpers { namespace LBPUnion.ProjectLighthouse.Helpers {
public static class TimestampHelper { public static class TimestampHelper {
public static long Timestamp => (long)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds; public static long Timestamp => (long)DateTime.UtcNow.Subtract(new DateTime(1970, 1, 1)).TotalSeconds;
} }

View file

@ -1,4 +1,6 @@
// <auto-generated /> // <auto-generated />
using LBPUnion.ProjectLighthouse;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;

View file

@ -1,4 +1,6 @@
// <auto-generated /> // <auto-generated />
using LBPUnion.ProjectLighthouse;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;

View file

@ -1,4 +1,6 @@
// <auto-generated /> // <auto-generated />
using LBPUnion.ProjectLighthouse;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;

View file

@ -1,4 +1,6 @@
// <auto-generated /> // <auto-generated />
using LBPUnion.ProjectLighthouse;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations; using Microsoft.EntityFrameworkCore.Migrations;

View file

@ -1,4 +1,6 @@
// <auto-generated /> // <auto-generated />
using LBPUnion.ProjectLighthouse;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion; using Microsoft.EntityFrameworkCore.Storage.ValueConversion;

View file

@ -1,11 +1,11 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using LBPUnion.ProjectLighthouse.Types.Settings;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using ProjectLighthouse.Types.Settings;
namespace ProjectLighthouse { namespace LBPUnion.ProjectLighthouse {
public static class Program { public static class Program {
public static void Main(string[] args) { public static void Main(string[] args) {
Stopwatch startupStopwatch = new(); Stopwatch startupStopwatch = new();

View file

@ -3,6 +3,8 @@
<PropertyGroup> <PropertyGroup>
<DockerDefaultTargetOS>Linux</DockerDefaultTargetOS> <DockerDefaultTargetOS>Linux</DockerDefaultTargetOS>
<TargetFrameworks>net5.0;net6.0</TargetFrameworks> <TargetFrameworks>net5.0;net6.0</TargetFrameworks>
<AssemblyName>LBPUnion.ProjectLighthouse</AssemblyName>
<RootNamespace>LBPUnion.ProjectLighthouse</RootNamespace>
</PropertyGroup> </PropertyGroup>
<ItemGroup> <ItemGroup>

View file

@ -2,7 +2,7 @@ using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
using System.Linq; using System.Linq;
namespace ProjectLighthouse.Serialization { namespace LBPUnion.ProjectLighthouse.Serialization {
/// <summary> /// <summary>
/// LBP doesn't like the XML serializer by C# that much, and it cant be controlled that much (cant have two root elements), /// 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. /// so I wrote my own crappy one.

View file

@ -1,10 +1,10 @@
using Microsoft.AspNetCore.Mvc.Formatters; using Microsoft.AspNetCore.Mvc.Formatters;
namespace ProjectLighthouse.Serialization { namespace LBPUnion.ProjectLighthouse.Serialization {
public class XmlOutputFormatter : StringOutputFormatter { public class XmlOutputFormatter : StringOutputFormatter {
public XmlOutputFormatter() { public XmlOutputFormatter() {
SupportedMediaTypes.Add("text/xml"); this.SupportedMediaTypes.Add("text/xml");
SupportedMediaTypes.Add("application/xml"); this.SupportedMediaTypes.Add("application/xml");
} }
} }
} }

View file

@ -1,18 +1,18 @@
using System; using System;
using System.Diagnostics; using System.Diagnostics;
using System.IO; using System.IO;
using LBPUnion.ProjectLighthouse.Serialization;
using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Builder;
using Microsoft.AspNetCore.Hosting; using Microsoft.AspNetCore.Hosting;
using Microsoft.AspNetCore.Http; using Microsoft.AspNetCore.Http;
using Microsoft.Extensions.Configuration; using Microsoft.Extensions.Configuration;
using Microsoft.Extensions.DependencyInjection; using Microsoft.Extensions.DependencyInjection;
using Microsoft.Extensions.Hosting; using Microsoft.Extensions.Hosting;
using ProjectLighthouse.Serialization;
namespace ProjectLighthouse { namespace LBPUnion.ProjectLighthouse {
public class Startup { public class Startup {
public Startup(IConfiguration configuration) { public Startup(IConfiguration configuration) {
Configuration = configuration; this.Configuration = configuration;
} }
public IConfiguration Configuration { get; } public IConfiguration Configuration { get; }

View file

@ -1,6 +1,6 @@
using ProjectLighthouse.Helpers; using LBPUnion.ProjectLighthouse.Helpers;
namespace ProjectLighthouse.Types.Files { namespace LBPUnion.ProjectLighthouse.Types.Files {
public class LbpFile { public class LbpFile {
public LbpFile(byte[] data) { public LbpFile(byte[] data) {
this.Data = data; this.Data = data;

View file

@ -1,4 +1,4 @@
namespace ProjectLighthouse.Types.Files { namespace LBPUnion.ProjectLighthouse.Types.Files {
public enum LbpFileType { public enum LbpFileType {
Script, // .ff, FSH Script, // .ff, FSH
Texture, // TEX Texture, // TEX

View file

@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace ProjectLighthouse.Types.Levels { namespace LBPUnion.ProjectLighthouse.Types.Levels {
public class HeartedLevel { public class HeartedLevel {
// ReSharper disable once UnusedMember.Global // ReSharper disable once UnusedMember.Global
[Key] public int HeartedLevelId { get; set; } [Key] public int HeartedLevelId { get; set; }

View file

@ -1,6 +1,6 @@
using System.Diagnostics.CodeAnalysis; using System.Diagnostics.CodeAnalysis;
namespace ProjectLighthouse.Types.Levels { namespace LBPUnion.ProjectLighthouse.Types.Levels {
/// <summary> /// <summary>
/// A series of tags that can be applied to a level /// A series of tags that can be applied to a level
/// </summary> /// </summary>

View file

@ -1,7 +1,7 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
namespace ProjectLighthouse.Types.Levels { namespace LBPUnion.ProjectLighthouse.Types.Levels {
public class QueuedLevel { public class QueuedLevel {
// ReSharper disable once UnusedMember.Global // ReSharper disable once UnusedMember.Global
[Key] public int QueuedLevelId { get; set; } [Key] public int QueuedLevelId { get; set; }

View file

@ -2,10 +2,10 @@ using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Linq; using System.Linq;
using System.Xml.Serialization; using System.Xml.Serialization;
using ProjectLighthouse.Serialization; using LBPUnion.ProjectLighthouse.Serialization;
using ProjectLighthouse.Types.Profiles; using LBPUnion.ProjectLighthouse.Types.Profiles;
namespace ProjectLighthouse.Types.Levels { namespace LBPUnion.ProjectLighthouse.Types.Levels {
/// <summary> /// <summary>
/// A LittleBigPlanet level. /// A LittleBigPlanet level.
/// </summary> /// </summary>

View file

@ -1,8 +1,8 @@
using System.IO; using System.IO;
using System.Text; using System.Text;
using ProjectLighthouse.Helpers; using LBPUnion.ProjectLighthouse.Helpers;
namespace ProjectLighthouse.Types { namespace LBPUnion.ProjectLighthouse.Types {
// This is all the information I can understand for now. More testing is required. // This is all the information I can understand for now. More testing is required.
// Example data: // Example data:
// - LBP2 digital, with the RPCN username `literally1984` // - LBP2 digital, with the RPCN username `literally1984`

View file

@ -1,8 +1,8 @@
using System.Collections.Generic; using System.Collections.Generic;
using System.Xml.Serialization; using System.Xml.Serialization;
using ProjectLighthouse.Serialization; using LBPUnion.ProjectLighthouse.Serialization;
namespace ProjectLighthouse.Types { namespace LBPUnion.ProjectLighthouse.Types {
/// <summary> /// <summary>
/// Response to POST /login /// Response to POST /login
/// </summary> /// </summary>

View file

@ -1,6 +1,6 @@
using ProjectLighthouse.Serialization; using LBPUnion.ProjectLighthouse.Serialization;
namespace ProjectLighthouse.Types.News { namespace LBPUnion.ProjectLighthouse.Types.News {
/// <summary> /// <summary>
/// Used on the info moon on LBP1. Broken for unknown reasons /// Used on the info moon on LBP1. Broken for unknown reasons
/// </summary> /// </summary>

View file

@ -1,6 +1,6 @@
using ProjectLighthouse.Serialization; using LBPUnion.ProjectLighthouse.Serialization;
namespace ProjectLighthouse.Types.News { namespace LBPUnion.ProjectLighthouse.Types.News {
public class NewsImage { public class NewsImage {
public string Hash { get; set; } public string Hash { get; set; }
public string Alignment { get; set; } public string Alignment { get; set; }

View file

@ -1,7 +1,7 @@
using LBPUnion.ProjectLighthouse.Serialization;
using Microsoft.EntityFrameworkCore; using Microsoft.EntityFrameworkCore;
using ProjectLighthouse.Serialization;
namespace ProjectLighthouse.Types.Profiles { namespace LBPUnion.ProjectLighthouse.Types.Profiles {
[Keyless] [Keyless]
public class ClientsConnected { public class ClientsConnected {
public bool Lbp1 { get; set; } public bool Lbp1 { get; set; }

View file

@ -1,9 +1,9 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using System.Xml.Serialization; using System.Xml.Serialization;
using ProjectLighthouse.Serialization; using LBPUnion.ProjectLighthouse.Serialization;
namespace ProjectLighthouse.Types.Profiles { namespace LBPUnion.ProjectLighthouse.Types.Profiles {
[XmlRoot("comment"), XmlType("comment")] [XmlRoot("comment"), XmlType("comment")]
public class Comment { public class Comment {
[Key] [Key]

View file

@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
namespace ProjectLighthouse.Types.Profiles { namespace LBPUnion.ProjectLighthouse.Types.Profiles {
public class LastMatch { public class LastMatch {
[Key] public int UserId { get; set; } [Key] public int UserId { get; set; }
public long Timestamp { get; set; } public long Timestamp { get; set; }

View file

@ -1,6 +1,6 @@
using ProjectLighthouse.Serialization; using LBPUnion.ProjectLighthouse.Serialization;
namespace ProjectLighthouse.Types.Profiles { namespace LBPUnion.ProjectLighthouse.Types.Profiles {
/// <summary> /// <summary>
/// The location of a slot on a planet. /// The location of a slot on a planet.
/// </summary> /// </summary>

View file

@ -1,6 +1,6 @@
using System.Xml.Serialization; using System.Xml.Serialization;
namespace ProjectLighthouse.Types { namespace LBPUnion.ProjectLighthouse.Types {
[XmlRoot("resource"), XmlType("resources")] [XmlRoot("resource"), XmlType("resources")]
public class ResourceList { public class ResourceList {
[XmlElement("resource")] [XmlElement("resource")]

View file

@ -1,6 +1,6 @@
using ProjectLighthouse.Serialization; using LBPUnion.ProjectLighthouse.Serialization;
namespace ProjectLighthouse.Types.Settings { namespace LBPUnion.ProjectLighthouse.Types.Settings {
public class PrivacySettings { public class PrivacySettings {
public string LevelVisibility { get; set; } public string LevelVisibility { get; set; }
public string ProfileVisibility { get; set; } public string ProfileVisibility { get; set; }

View file

@ -1,7 +1,7 @@
#nullable enable #nullable enable
using System; using System;
namespace ProjectLighthouse.Types.Settings { namespace LBPUnion.ProjectLighthouse.Types.Settings {
public static class ServerSettings { public static class ServerSettings {
/// <summary> /// <summary>
/// The maximum amount of slots allowed on users' earth /// The maximum amount of slots allowed on users' earth

View file

@ -1,6 +1,6 @@
using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations;
namespace ProjectLighthouse.Types { namespace LBPUnion.ProjectLighthouse.Types {
public class Token { public class Token {
// ReSharper disable once UnusedMember.Global // ReSharper disable once UnusedMember.Global
[Key] public int TokenId { get; set; } [Key] public int TokenId { get; set; }

View file

@ -1,9 +1,9 @@
using System.ComponentModel.DataAnnotations.Schema; using System.ComponentModel.DataAnnotations.Schema;
using ProjectLighthouse.Serialization; using LBPUnion.ProjectLighthouse.Serialization;
using ProjectLighthouse.Types.Profiles; using LBPUnion.ProjectLighthouse.Types.Profiles;
using ProjectLighthouse.Types.Settings; using LBPUnion.ProjectLighthouse.Types.Settings;
namespace ProjectLighthouse.Types { namespace LBPUnion.ProjectLighthouse.Types {
public class User { public class User {
public int UserId { get; set; } public int UserId { get; set; }
public string Username { get; set; } public string Username { get; set; }