From f26cfaa7fc44bf943b62d7667806157b6fb8617e Mon Sep 17 00:00:00 2001 From: jvyden Date: Sun, 30 Jan 2022 14:38:58 -0500 Subject: [PATCH] Log unimplemented ticket version --- ProjectLighthouse/Types/Tickets/NPTicket.cs | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/ProjectLighthouse/Types/Tickets/NPTicket.cs b/ProjectLighthouse/Types/Tickets/NPTicket.cs index 5262fdfa..aa5158e4 100644 --- a/ProjectLighthouse/Types/Tickets/NPTicket.cs +++ b/ProjectLighthouse/Types/Tickets/NPTicket.cs @@ -33,13 +33,14 @@ public class NPTicket /// public static NPTicket? CreateFromBytes(byte[] data) { + NPTicket npTicket = new(); #if DEBUG if (data[0] == 'u' && ServerStatics.IsUnitTesting) { string dataStr = Encoding.UTF8.GetString(data); if (dataStr.StartsWith("unitTestTicket")) { - NPTicket npTicket = new() + npTicket = new NPTicket { IssuerId = 0, ticketVersion = new Version(0, 0), @@ -57,7 +58,6 @@ public class NPTicket #endif try { - NPTicket npTicket = new(); using MemoryStream ms = new(data); using TicketReader reader = new(ms); @@ -133,13 +133,24 @@ public class NPTicket return npTicket; } + catch(NotImplementedException) + { + Logger.Log($"The ticket version {npTicket.ticketVersion} is not implemented yet.", LoggerLevelLogin.Instance); + Logger.Log + ( + "Please let us know that this is a ticket version that is actually used on our issue tracker at https://github.com/LBPUnion/project-lighthouse/issues !", + LoggerLevelLogin.Instance + ); + + return null; + } catch(Exception e) { Logger.Log("Failed to read npTicket!", LoggerLevelLogin.Instance); Logger.Log("Either this is spam data, or the more likely that this is a bug.", LoggerLevelLogin.Instance); Logger.Log ( - "Please report the following exception to our issue tracker at https://github.com/LBPUnion/project-lighthouse/issues", + "Please report the following exception to our issue tracker at https://github.com/LBPUnion/project-lighthouse/issues!", LoggerLevelLogin.Instance );