Improve error routine

This way we avoid slow reflection-based Enum.IsDefined() while covering out-of-range values.
This commit is contained in:
JustArchi
2017-12-01 01:01:02 +01:00
parent d07d82438f
commit 97c1a7a1a6

View File

@@ -273,9 +273,21 @@ namespace ArchiSteamFarm {
foreach (CMsgClientUserNotifications.Notification notification in msg.notifications) {
ENotification type = (ENotification) notification.user_notification_type;
if (type == ENotification.Unknown) {
ASF.ArchiLogger.LogGenericWarning(string.Format(Strings.WarningUnknownValuePleaseReport, nameof(type), type));
continue;
switch (type) {
case ENotification.AccountAlerts:
case ENotification.Chat:
case ENotification.Comments:
case ENotification.GameTurns:
case ENotification.Gifts:
case ENotification.HelpRequestReplies:
case ENotification.Invites:
case ENotification.Items:
case ENotification.ModeratorMessages:
case ENotification.Trading:
break;
default:
ASF.ArchiLogger.LogGenericWarning(string.Format(Strings.WarningUnknownValuePleaseReport, nameof(type), type));
continue;
}
Notifications[type] = notification.count;