diff --git a/ProjectLighthouse.sln.DotSettings b/ProjectLighthouse.sln.DotSettings index 1feed309..6dab5440 100644 --- a/ProjectLighthouse.sln.DotSettings +++ b/ProjectLighthouse.sln.DotSettings @@ -1,8 +1,13 @@  + <Policy Inspect="True" Prefix="" Suffix="" Style="AaBb"><ExtraRule Prefix="" Suffix="" Style="aaBb" /></Policy> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + <Policy Inspect="True" Prefix="" Suffix="" Style="aaBb" /> + True True True True True + True True True True \ No newline at end of file diff --git a/ProjectLighthouse/Controllers/ClientConfigurationController.cs b/ProjectLighthouse/Controllers/ClientConfigurationController.cs index 8d700e0e..fe8ff61f 100644 --- a/ProjectLighthouse/Controllers/ClientConfigurationController.cs +++ b/ProjectLighthouse/Controllers/ClientConfigurationController.cs @@ -1,3 +1,4 @@ +using System.Diagnostics.CodeAnalysis; using Microsoft.AspNetCore.Mvc; using ProjectLighthouse.Types; @@ -7,6 +8,7 @@ namespace ProjectLighthouse.Controllers { [Produces("text/plain")] public class ClientConfigurationController : ControllerBase { [HttpGet("network_settings.nws")] + [SuppressMessage("ReSharper", "StringLiteralTypo")] public IActionResult NetworkSettings() { return this.Ok("ProbabilityOfPacketDelay 0.0\nMinPacketDelayFrames 0\nMaxPacketDelayFrames 3\nProbabilityOfPacketDrop 0.0\nEnableFakeConditionsForLoopback true\nNumberOfFramesPredictionAllowedForNonLocalPlayer 1000\nEnablePrediction true\nMinPredictedFrames 0\nMaxPredictedFrames 10\nAllowGameRendCameraSplit true\nFramesBeforeAgressiveCatchup 30\nPredictionPadSides 200\nPredictionPadTop 200\nPredictionPadBottom 200\nShowErrorNumbers true\nAllowModeratedLevels true\nAllowModeratedPoppetItems true\nShowLevelBoos true\nTIMEOUT_WAIT_FOR_JOIN_RESPONSE_FROM_PREV_PARTY_HOST 50.0\nTIMEOUT_WAIT_FOR_CHANGE_LEVEL_PARTY_HOST 30.0\nTIMEOUT_WAIT_FOR_CHANGE_LEVEL_PARTY_MEMBER 45.0\nTIMEOUT_WAIT_FOR_REQUEST_JOIN_FRIEND 15.0\nTIMEOUT_WAIT_FOR_CONNECTION_FROM_HOST 30.0\nTIMEOUT_WAIT_FOR_ROOM_ID_TO_JOIN 60.0\nTIMEOUT_WAIT_FOR_GET_NUM_PLAYERS_ONLINE 60.0\nTIMEOUT_WAIT_FOR_SIGNALLING_CONNECTIONS 120.0\nTIMEOUT_WAIT_FOR_PARTY_DATA 60.0\nTIME_TO_WAIT_FOR_LEAVE_MESSAGE_TO_COME_BACK 20.0\nTIME_TO_WAIT_FOR_FOLLOWING_REQUESTS_TO_ARRIVE 30.0\nTIMEOUT_WAIT_FOR_FINISHED_MIGRATING_HOST 30.0\nTIMEOUT_WAIT_FOR_PARTY_LEADER_FINISH_JOINING 45.0\nTIMEOUT_WAIT_FOR_QUICKPLAY_LEVEL 60.0\nTIMEOUT_WAIT_FOR_PLAYERS_TO_JOIN 30.0\nTIMEOUT_WAIT_FOR_DIVE_IN_PLAYERS 120.0\nTIMEOUT_WAIT_FOR_FIND_BEST_ROOM 30.0\nTIMEOUT_DIVE_IN_TOTAL 1000000.0\nTIMEOUT_WAIT_FOR_SOCKET_CONNECTION 120.0\nTIMEOUT_WAIT_FOR_REQUEST_RESOURCE_MESSAGE 120.0\nTIMEOUT_WAIT_FOR_LOCAL_CLIENT_TO_GET_RESOURCE_LIST 120.0\nTIMEOUT_WAIT_FOR_CLIENT_TO_LOAD_RESOURCES 120.0\nTIMEOUT_WAIT_FOR_LOCAL_CLIENT_TO_SAVE_GAME_STATE 30.0\nTIMEOUT_WAIT_FOR_ADD_PLAYERS_TO_TAKE 30.0\nTIMEOUT_WAIT_FOR_UPDATE_FROM_CLIENT 90.0\nTIMEOUT_WAIT_FOR_HOST_TO_GET_RESOURCE_LIST 60.0\nTIMEOUT_WAIT_FOR_HOST_TO_SAVE_GAME_STATE 60.0\nTIMEOUT_WAIT_FOR_HOST_TO_ADD_US 30.0\nTIMEOUT_WAIT_FOR_UPDATE 60.0\nTIMEOUT_WAIT_FOR_REQUEST_JOIN 50.0\nTIMEOUT_WAIT_FOR_AUTOJOIN_PRESENCE 60.0\nTIMEOUT_WAIT_FOR_AUTOJOIN_CONNECTION 120.0\nSECONDS_BETWEEN_PINS_AWARDED_UPLOADS 300.0\nEnableKeepAlive true\nAllowVoIPRecordingPlayback true\nCDNHostName localhost\nTelemetryServer localhost\nOverheatingThresholdDisallowMidgameJoin 0.95\nMaxCatchupFrames 3\nMaxLagBeforeShowLoading 23\nMinLagBeforeHideLoading 30\nLagImprovementInflectionPoint -1.0\nFlickerThreshold 2.0\nClosedDemo2014Version 1\nClosedDemo2014Expired false\nEnablePlayedFilter true\nEnableCommunityDecorations true\nGameStateUpdateRate 10.0\nGameStateUpdateRateWithConsumers 1.0\nDisableDLCPublishCheck false\nEnableDiveIn true\nEnableHackChecks false"); } diff --git a/ProjectLighthouse/Controllers/CommentController.cs b/ProjectLighthouse/Controllers/CommentController.cs index c1df2206..49c64b30 100644 --- a/ProjectLighthouse/Controllers/CommentController.cs +++ b/ProjectLighthouse/Controllers/CommentController.cs @@ -35,12 +35,13 @@ namespace ProjectLighthouse.Controllers { User poster = await database.Users.FirstOrDefaultAsync(u => u.Username == "jvyden"); User target = await database.Users.FirstOrDefaultAsync(u => u.Username == username); + if(comment == null) return this.BadRequest(); + comment.PosterUserId = poster.UserId; comment.TargetUserId = target.UserId; database.Comments.Add(comment); await database.SaveChangesAsync(); - return this.Ok(); } } diff --git a/ProjectLighthouse/Controllers/UserController.cs b/ProjectLighthouse/Controllers/UserController.cs index fab353d8..14afc6e2 100644 --- a/ProjectLighthouse/Controllers/UserController.cs +++ b/ProjectLighthouse/Controllers/UserController.cs @@ -60,6 +60,7 @@ namespace ProjectLighthouse.Controllers { using(XmlReader reader = XmlReader.Create(Request.Body, settings)) { List path = new(); // you can think of this as a file path in the XML, like -> -> while(await reader.ReadAsync()) { + // ReSharper disable once SwitchStatementMissingSomeEnumCasesNoDefault switch(reader.NodeType) { case XmlNodeType.Element: path.Add(reader.Name); diff --git a/ProjectLighthouse/Serialization/LbpSerializer.cs b/ProjectLighthouse/Serialization/LbpSerializer.cs index 8ebbd79d..d72f6216 100644 --- a/ProjectLighthouse/Serialization/LbpSerializer.cs +++ b/ProjectLighthouse/Serialization/LbpSerializer.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using System.Diagnostics.CodeAnalysis; using System.Linq; namespace ProjectLighthouse.Serialization { @@ -6,13 +7,14 @@ namespace ProjectLighthouse.Serialization { /// 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. /// + [SuppressMessage("ReSharper", "UnusedMember.Global")] public static class LbpSerializer { public static string BlankElement(string key) => $"<{key}>"; public static string StringElement(KeyValuePair pair) => $"<{pair.Key}>{pair.Value}"; public static string StringElement(string key, object value) => $"<{key}>{value}"; - + public static string TaggedStringElement(KeyValuePair pair, KeyValuePair tagPair) => $"<{pair.Key} {tagPair.Key}=\"{tagPair.Value}\">{pair.Value}"; diff --git a/ProjectLighthouse/Types/LevelTags.cs b/ProjectLighthouse/Types/LevelTags.cs index 501ffaa1..af721f42 100644 --- a/ProjectLighthouse/Types/LevelTags.cs +++ b/ProjectLighthouse/Types/LevelTags.cs @@ -1,7 +1,11 @@ +using System.Diagnostics.CodeAnalysis; + namespace ProjectLighthouse.Types { /// /// A series of tags that can be applied to a level /// + [SuppressMessage("ReSharper", "InconsistentNaming")] + [SuppressMessage("ReSharper", "UnusedMember.Global")] public enum LevelTags { Brilliant, Beautiful, diff --git a/ProjectLighthouse/Types/User.cs b/ProjectLighthouse/Types/User.cs index f6c12e83..37ec6640 100644 --- a/ProjectLighthouse/Types/User.cs +++ b/ProjectLighthouse/Types/User.cs @@ -37,13 +37,13 @@ namespace ProjectLighthouse.Types { public int FavouriteSlotCount { get; set; } public int FavouriteUserCount { get; set; } - public int lolcatftwCount { get; set; } + public int LolCatFtwCount { get; set; } public string Pins { get; set; } public int StaffChallengeGoldCount { get; set; } public int StaffChallengeSilverCount { get; set; } public int StaffChallengeBronzeCount { get; set; } // [NotMapped] - public ClientsConnected ClientsConnected = new(); + public readonly ClientsConnected ClientsConnected = new(); #region Slots @@ -57,7 +57,7 @@ namespace ProjectLighthouse.Types { /// public int FreeSlots => ServerSettings.EntitledSlots - this.UsedSlots; - private static string[] slotTypes = { + private static readonly string[] slotTypes = { // "lbp1", "lbp2", "lbp3", @@ -102,7 +102,7 @@ namespace ProjectLighthouse.Types { LbpSerializer.StringElement("location", this.Location.Serialize()) + LbpSerializer.StringElement("favouriteSlotCount", this.FavouriteSlotCount) + LbpSerializer.StringElement("favouriteUserCount", this.FavouriteUserCount) + - LbpSerializer.StringElement("lolcatftwCount", this.lolcatftwCount) + + LbpSerializer.StringElement("lolcatftwCount", this.LolCatFtwCount) + LbpSerializer.StringElement("pins", this.Pins) + LbpSerializer.StringElement("staffChallengeGoldCount", this.StaffChallengeGoldCount) + LbpSerializer.StringElement("staffChallengeSilverCount", this.StaffChallengeSilverCount) +