Log unimplemented ticket version

This commit is contained in:
jvyden 2022-01-30 14:38:58 -05:00
commit f26cfaa7fc
No known key found for this signature in database
GPG key ID: 18BCF2BE0262B278

View file

@ -33,13 +33,14 @@ public class NPTicket
/// </summary> /// </summary>
public static NPTicket? CreateFromBytes(byte[] data) public static NPTicket? CreateFromBytes(byte[] data)
{ {
NPTicket npTicket = new();
#if DEBUG #if DEBUG
if (data[0] == 'u' && ServerStatics.IsUnitTesting) if (data[0] == 'u' && ServerStatics.IsUnitTesting)
{ {
string dataStr = Encoding.UTF8.GetString(data); string dataStr = Encoding.UTF8.GetString(data);
if (dataStr.StartsWith("unitTestTicket")) if (dataStr.StartsWith("unitTestTicket"))
{ {
NPTicket npTicket = new() npTicket = new NPTicket
{ {
IssuerId = 0, IssuerId = 0,
ticketVersion = new Version(0, 0), ticketVersion = new Version(0, 0),
@ -57,7 +58,6 @@ public class NPTicket
#endif #endif
try try
{ {
NPTicket npTicket = new();
using MemoryStream ms = new(data); using MemoryStream ms = new(data);
using TicketReader reader = new(ms); using TicketReader reader = new(ms);
@ -133,13 +133,24 @@ public class NPTicket
return 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) catch(Exception e)
{ {
Logger.Log("Failed to read npTicket!", LoggerLevelLogin.Instance); 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("Either this is spam data, or the more likely that this is a bug.", LoggerLevelLogin.Instance);
Logger.Log 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 LoggerLevelLogin.Instance
); );