SafeDispatch/SocketIOComponent/SocketIOKey.cs

54 lines
1.9 KiB
C#
Raw Permalink Normal View History

2024-02-22 16:43:59 +00:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace SocketIOComponent
{
/// <summary>
/// A "type-safe Enum" containing the types of events used on socket IO
/// </summary>
/// <remarks>http://blog.falafel.com/introducing-type-safe-enum-pattern/</remarks>
sealed class SocketIOEvent
{
#region Fields
private readonly string _name;
private readonly int _value;
#endregion
private SocketIOEvent(int value, string name)
{
_value = value;
_name = name;
}
#region Public static members
public static readonly SocketIOEvent Ars = new SocketIOEvent(1, "ars");
public static readonly SocketIOEvent PrivateCallRequest = new SocketIOEvent(2, "private-call-request");
public static readonly SocketIOEvent GroupCallRequest = new SocketIOEvent(3, "group-call-request");
public static readonly SocketIOEvent CallStatus = new SocketIOEvent(4, "call-status");
public static readonly SocketIOEvent Sms = new SocketIOEvent(5, "sms");
public static readonly SocketIOEvent Emergency = new SocketIOEvent(6, "emergency");
public static readonly SocketIOEvent SmsAck = new SocketIOEvent(7, "sms-ack");
public static readonly SocketIOEvent Gps = new SocketIOEvent(8, "gps");
public static readonly SocketIOEvent EmergencyReq = new SocketIOEvent(9, "emergency-request");
public static readonly SocketIOEvent EmergencyAck = new SocketIOEvent(10, "emergency-ack");
public static readonly SocketIOEvent PollReq = new SocketIOEvent(11, "poll-request");
public static readonly SocketIOEvent PollResponse = new SocketIOEvent(12, "poll-response");
#endregion
#region Virtual Members Implementation
public override string ToString()
{
return _name;
}
#endregion
}
}