Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions Refresh.Common/Refresh.Common.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<ItemGroup>
Expand Down
5 changes: 0 additions & 5 deletions Refresh.Database/GameDatabaseProvider.cs
Original file line number Diff line number Diff line change
Expand Up @@ -841,9 +841,4 @@ protected override void Migrate(Migration migration, ulong oldVersion)
// }
}
#endif

public void Dispose()
{
GC.SuppressFinalize(this);
}
}
9 changes: 6 additions & 3 deletions Refresh.Database/Models/Assets/GameAssetType.cs
Original file line number Diff line number Diff line change
Expand Up @@ -410,7 +410,7 @@ public enum GameAssetType

public static class GameAssetTypeExtensions
{
private static readonly Dictionary<int, GameAssetType> _lbpMagics = new()
private static readonly Dictionary<int, GameAssetType> LbpMagics = new()
{
{ BinaryPrimitives.ReadInt32BigEndian("TEX\0"u8), GameAssetType.Texture },
{ BinaryPrimitives.ReadInt32BigEndian("GTF\0"u8), GameAssetType.GameDataTexture },
Expand Down Expand Up @@ -477,13 +477,13 @@ public static class GameAssetTypeExtensions
{
int magicInt = magic[0] << 24 | magic[1] << 16 | magic[2] << 8;

if (!_lbpMagics.TryGetValue(magicInt, out GameAssetType assetType))
if (!LbpMagics.TryGetValue(magicInt, out GameAssetType assetType))
return null;

return assetType;
}

public static string Magic(this GameAssetType type)
public static string? LbpMagic(this GameAssetType type)
{
return type switch
{
Expand Down Expand Up @@ -546,6 +546,9 @@ public static string Magic(this GameAssetType type)
GameAssetType.CachedCostumeData => "CCD",
GameAssetType.DataLabels => "DLA",
GameAssetType.AdventureMaps => "ADM",
GameAssetType.GriefSongState => "MATT",
GameAssetType.ChallengeGhost => "<ghost>",
_ => null,
};
}
}
2 changes: 2 additions & 0 deletions Refresh.Database/Models/Comments/GameLevelComment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

namespace Refresh.Database.Models.Comments;

#nullable disable

public partial class GameLevelComment : IRealmObject, IGameComment, ISequentialId
{
[PrimaryKey] public int SequentialId { get; set; }
Expand Down
2 changes: 2 additions & 0 deletions Refresh.Database/Models/Comments/GameProfileComment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Refresh.Database.Models.Comments;

#nullable disable

public partial class GameProfileComment : IRealmObject, IGameComment, ISequentialId
{
[PrimaryKey] public int SequentialId { get; set; }
Expand Down
2 changes: 2 additions & 0 deletions Refresh.Database/Models/Photos/GamePhotoSubject.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ namespace Refresh.Database.Models.Photos;
[XmlType("subject")]
public class GamePhotoSubject
{
#pragma warning disable CS8618 // Non-nullable field must contain a non-null value when exiting constructor. Consider adding the 'required' modifier or declaring as nullable.
[Obsolete("used for serialization. XML stuff should be moved to SerializedGamePhotoSubject", true)]
public GamePhotoSubject() {}

public GamePhotoSubject(GameUser? user, string displayName, IList<float> bounds)
Expand Down
2 changes: 2 additions & 0 deletions Refresh.Database/Models/Playlists/GamePlaylist.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Refresh.Database.Models.Playlists;

#nullable disable

/// <summary>
/// A user-curated list of levels.
/// </summary>
Expand Down
2 changes: 2 additions & 0 deletions Refresh.Database/Models/Relations/LevelCommentRelation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

namespace Refresh.Database.Models.Relations;

#nullable disable

public partial class LevelCommentRelation : IRealmObject, ICommentRelation<GameLevelComment>
{
public ObjectId CommentRelationId { get; set; } = ObjectId.GenerateNewId();
Expand Down
2 changes: 2 additions & 0 deletions Refresh.Database/Models/Relations/ProfileCommentRelation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@

namespace Refresh.Database.Models.Relations;

#nullable disable

public partial class ProfileCommentRelation : IRealmObject, ICommentRelation<GameProfileComment>
{
public ObjectId CommentRelationId { get; set; } = ObjectId.GenerateNewId();
Expand Down
3 changes: 3 additions & 0 deletions Refresh.Database/Models/Relations/RateReviewRelation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

namespace Refresh.Database.Models.Relations;

#nullable disable

public partial class RateReviewRelation : IRealmObject
{
// we could just reuse RatingType from GameLevel rating logic
Expand All @@ -13,6 +15,7 @@ public RatingType RatingType
set => this._ReviewRatingType = (int)value;
}

// ReSharper disable once InconsistentNaming
public int _ReviewRatingType { get; set; }
public GameReview Review { get; set; }

Expand Down
2 changes: 2 additions & 0 deletions Refresh.Database/Models/Relations/SubPlaylistRelation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Refresh.Database.Models.Relations;

#nullable disable

/// <summary>
/// A mapping of playlist -> sub-playlist
/// </summary>
Expand Down
3 changes: 3 additions & 0 deletions Refresh.Database/Models/Relations/TagLevelRelation.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@

namespace Refresh.Database.Models.Relations;

#nullable disable

public partial class TagLevelRelation : IRealmObject
{
[Ignored]
Expand All @@ -12,6 +14,7 @@ public Tag Tag
set => this._Tag = (byte)value;
}

// ReSharper disable once InconsistentNaming
public byte _Tag { get; set; }

public GameUser User { get; set; }
Expand Down
2 changes: 2 additions & 0 deletions Refresh.Database/Models/Users/DisallowedUser.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
namespace Refresh.Database.Models.Users;

#nullable disable

public partial class DisallowedUser : IRealmObject
{
[PrimaryKey]
Expand Down
1 change: 1 addition & 0 deletions Refresh.Database/Refresh.Database.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<Configurations>Debug;Release;DebugPostgres</Configurations>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'DebugPostgres' ">
Expand Down
1 change: 1 addition & 0 deletions Refresh.GameServer/Refresh.GameServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<Configurations>Debug;Release;DebugLocalBunkum;DebugPostgres</Configurations>
<Platforms>AnyCPU</Platforms>
<ServerGarbageCollection>true</ServerGarbageCollection>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<PropertyGroup Condition=" '$(Configuration)' == 'DebugLocalBunkum' ">
Expand Down
2 changes: 1 addition & 1 deletion Refresh.GameServer/Services/CommandService.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ public void HandleCommand(CommandInvocation command, GameDatabaseContext databas
{
case "forcematch":
{
if (command.Arguments == null)
if (command.Arguments.IsEmpty)
{
throw new Exception("User not provided for force match command");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Refresh.GameServer.Types.Challenges.Lbp3;

#nullable disable

public class SerializedLbp3Challenge
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Refresh.GameServer.Types.Challenges.Lbp3;

#nullable disable

[XmlRoot("Challenge_header")]
public class SerializedLbp3ChallengeList
{
Expand Down
6 changes: 3 additions & 3 deletions Refresh.GameServer/Types/Levels/GameMinimalLevelResponse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@

namespace Refresh.GameServer.Types.Levels;

public class GameMinimalLevelResponse : IDataConvertableFrom<GameMinimalLevelResponse, Database.Models.Levels.GameLevel>, IDataConvertableFrom<GameMinimalLevelResponse, GamePlaylist>, IDataConvertableFrom<GameMinimalLevelResponse, GameLevelResponse>
public class GameMinimalLevelResponse : IDataConvertableFrom<GameMinimalLevelResponse, GameLevel>, IDataConvertableFrom<GameMinimalLevelResponse, GamePlaylist>, IDataConvertableFrom<GameMinimalLevelResponse, GameLevelResponse>
{
//NOTE: THIS MUST BE AT THE TOP OF THE XML RESPONSE OR ELSE LBP PSP WILL CRASH
[XmlElement("id")] public required int LevelId { get; set; }
Expand Down Expand Up @@ -64,7 +64,7 @@ public static GameMinimalLevelResponse FromHash(string hash, DataContext dataCon
return FromOld(GameLevelResponse.FromHash(hash, dataContext), dataContext)!;
}

public static GameMinimalLevelResponse? FromOld(Database.Models.Levels.GameLevel? level, DataContext dataContext)
public static GameMinimalLevelResponse? FromOld(GameLevel? level, DataContext dataContext)
{
if(level == null) return null;
return FromOld(GameLevelResponse.FromOld(level, dataContext), dataContext);
Expand Down Expand Up @@ -152,7 +152,7 @@ public static GameMinimalLevelResponse FromHash(string hash, DataContext dataCon
};
}

public static IEnumerable<GameMinimalLevelResponse> FromOldList(IEnumerable<Database.Models.Levels.GameLevel> oldList,
public static IEnumerable<GameMinimalLevelResponse> FromOldList(IEnumerable<GameLevel> oldList,
DataContext dataContext) => oldList.Select(old => FromOld(old, dataContext)).ToList()!;
public static IEnumerable<GameMinimalLevelResponse> FromOldList(IEnumerable<GameLevelResponse> oldList,
DataContext dataContext) => oldList.Select(old => FromOld(old, dataContext)).ToList()!;
Expand Down
8 changes: 6 additions & 2 deletions Refresh.GameServer/Types/Playlists/SerializedLbp1Playlist.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@

namespace Refresh.GameServer.Types.Playlists;

#nullable disable

[XmlType("playlist")]
[XmlRoot("playlist")]
public class SerializedLbp1Playlist : IDataConvertableFrom<SerializedLbp1Playlist, Database.Models.Playlists.GamePlaylist>, ISerializedCreatePlaylistInfo
Expand All @@ -14,14 +16,16 @@ public class SerializedLbp1Playlist : IDataConvertableFrom<SerializedLbp1Playlis
public int Id { get; set; }

[XmlElement("name")]
public string Name { get; set; }
public string Name { get; set; } = null!;
[XmlElement("description")]
public string Description { get; set; }
public string Description { get; set; } = null!;
[XmlElement("icon")]
public string Icon { get; set; }

[XmlElement("location")]
public GameLocation Location { get; set; }

#nullable enable

public static SerializedLbp1Playlist? FromOld(Database.Models.Playlists.GamePlaylist? old, DataContext dataContext)
{
Expand Down
6 changes: 6 additions & 0 deletions Refresh.GameServer/Types/Playlists/SerializedLbp3Playlist.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,17 @@

namespace Refresh.GameServer.Types.Playlists;

// Disable false nullability warnings caused by Realm's source generators.
#if !POSTGRES
#pragma warning disable CS8766 // Nullability of reference types in return type doesn't match implicitly implemented member (possibly because of nullability attributes).
#endif

[XmlRoot("playlist")]
[XmlType("playlist")]
public class SerializedLbp3Playlist : IDataConvertableFrom<SerializedLbp3Playlist, Database.Models.Playlists.GamePlaylist>, ISerializedCreatePlaylistInfo
{
[XmlElement("id")] public int Id { get; set; }

[XmlElement("name")] public string? Name { get; set; }
[XmlElement("description")] public string? Description { get; set; }

Expand Down
2 changes: 2 additions & 0 deletions Refresh.GameServer/Types/Reviews/GameReviewSlot.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Refresh.GameServer.Types.Reviews;

#nullable disable

[XmlRoot("slot")]
public class GameReviewSlot
{
Expand Down
10 changes: 7 additions & 3 deletions Refresh.GameServer/Types/Reviews/SerializedGameReview.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@

namespace Refresh.GameServer.Types.Reviews;

#nullable disable

[XmlRoot("review")]
[XmlType("review")]
public class SerializedGameReview : IDataConvertableFrom<SerializedGameReview, Database.Models.Comments.GameReview>
public class SerializedGameReview : IDataConvertableFrom<SerializedGameReview, GameReview>
{
[XmlElement("id")]
public int Id { get; set; }
Expand Down Expand Up @@ -49,8 +51,10 @@ public class SerializedGameReview : IDataConvertableFrom<SerializedGameReview, D

[XmlElement("yourthumb")]
public int YourThumb { get; set; }

#nullable enable

public static SerializedGameReview? FromOld(Database.Models.Comments.GameReview? review, DataContext dataContext)
public static SerializedGameReview? FromOld(GameReview? review, DataContext dataContext)
{
if (review == null)
return null;
Expand Down Expand Up @@ -80,6 +84,6 @@ public class SerializedGameReview : IDataConvertableFrom<SerializedGameReview, D
};
}

public static IEnumerable<SerializedGameReview> FromOldList(IEnumerable<Database.Models.Comments.GameReview> oldList,
public static IEnumerable<SerializedGameReview> FromOldList(IEnumerable<GameReview> oldList,
DataContext dataContext) => oldList.Select(old => FromOld(old, dataContext)).ToList()!;
}
2 changes: 2 additions & 0 deletions Refresh.GameServer/Types/Scores/FriendScoresRequest.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

namespace Refresh.GameServer.Types.Scores;

#nullable disable

[XmlRoot("playRecord")]
public class FriendScoresRequest
{
Expand Down
1 change: 1 addition & 0 deletions Refresh.HttpsProxy/Refresh.HttpsProxy.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
<TargetFramework>net9.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<ItemGroup>
Expand Down
2 changes: 1 addition & 1 deletion Refresh.PresenceServer/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace Refresh.PresenceServer;

internal class Program
{
public static Server.PresenceServer PresenceServer;
public static Server.PresenceServer PresenceServer = null!;

public static async Task Main()
{
Expand Down
1 change: 1 addition & 0 deletions Refresh.PresenceServer/Refresh.PresenceServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<ItemGroup>
Expand Down
1 change: 1 addition & 0 deletions RefreshTests.GameServer/RefreshTests.GameServer.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@
<IsTestProject>true</IsTestProject>
<Configurations>Debug;Release;DebugLocalBunkum;DebugPostgres</Configurations>
<Platforms>AnyCPU</Platforms>
<TreatWarningsAsErrors>true</TreatWarningsAsErrors>
</PropertyGroup>

<ItemGroup>
Expand Down
Loading