mirror of
https://github.com/LBPUnion/ProjectLighthouse.git
synced 2025-08-08 04:48:44 +00:00
Fix test failures
This commit is contained in:
parent
e5a1ccb9e3
commit
cd19afc577
3 changed files with 11 additions and 7 deletions
|
@ -49,7 +49,7 @@ namespace LBPUnion.ProjectLighthouse.Tests
|
|||
{
|
||||
LoginResult loginResult = await this.Authenticate();
|
||||
|
||||
HttpResponseMessage response = await this.AuthenticatedRequest("/LITTLEBIGPLANETPS3_XML/eula", loginResult.AuthTicket);
|
||||
HttpResponseMessage response = await this.AuthenticatedRequest("/LITTLEBIGPLANETPS3_XML/announce", loginResult.AuthTicket);
|
||||
string responseContent = await response.Content.ReadAsStringAsync();
|
||||
|
||||
Assert.True(response.IsSuccessStatusCode);
|
||||
|
|
|
@ -45,7 +45,7 @@ namespace LBPUnion.ProjectLighthouse.Controllers
|
|||
"[{\"StatusCode\":200},{\"Players\":[{\"PlayerId\":\"literally1984\",\"matching_res\":0},{\"PlayerId\":\"jvyden\",\"matching_res\":1}],\"Slots\":[[5,0]],\"RoomState\":\"E_ROOM_IN_POD\",\"HostMood\":\"E_MOOD_EVERYONE\",\"LevelCompletionEstimate\":0,\"PassedNoJoinPoint\":0,\"MoveConnected\":false,\"Location\":[\"127.0.0.1\"],\"BuildVersion\":289,\"Language\":1,\"FirstSeenTimestamp\":1427331263756,\"LastSeenTimestamp\":1635112546000,\"GameId\":1,\"NatType\":2,\"Friends\":[],\"Blocked\":[],\"RecentlyLeft\":[],\"FailedJoin\":[]}]"
|
||||
);
|
||||
|
||||
if (bodyString[0] != '[') return this.BadRequest();
|
||||
if (bodyString.Length == 0 || bodyString[0] != '[') return this.BadRequest();
|
||||
|
||||
IMatchData? matchData;
|
||||
try
|
||||
|
|
|
@ -37,9 +37,17 @@ namespace LBPUnion.ProjectLighthouse.Helpers
|
|||
|
||||
public static LbpFileType DetermineFileType(byte[] data)
|
||||
{
|
||||
if (data.Length == 0) return LbpFileType.Unknown; // Can't be anything if theres no data.
|
||||
|
||||
using MemoryStream ms = new(data);
|
||||
using BinaryReader reader = new(ms);
|
||||
|
||||
// Determine if file is a FARC (File Archive).
|
||||
// Needs to be done before anything else that determines the type by the header
|
||||
// because this determines the type by the footer.
|
||||
string footer = Encoding.ASCII.GetString(BinaryHelper.ReadLastBytes(reader, 4));
|
||||
if (footer == "FARC") return LbpFileType.FileArchive;
|
||||
|
||||
byte[] header = reader.ReadBytes(3);
|
||||
|
||||
return Encoding.ASCII.GetString(header) switch
|
||||
|
@ -57,11 +65,7 @@ namespace LBPUnion.ProjectLighthouse.Helpers
|
|||
private static LbpFileType determineFileTypePartTwoWeirdName(BinaryReader reader)
|
||||
{
|
||||
reader.BaseStream.Position = 0;
|
||||
|
||||
// Determine if file is FARC
|
||||
string footer = Encoding.ASCII.GetString(BinaryHelper.ReadLastBytes(reader, 4));
|
||||
if (footer == "FARC") return LbpFileType.FileArchive;
|
||||
|
||||
|
||||
// Determine if file is JPEG
|
||||
byte[] header = reader.ReadBytes(9);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue