public static List <object> Serialize(string recv) { List <object> requestList = new List <object>(); string[] rawRequests = recv.Replace("\r", "") .Split("\n", StringSplitOptions.RemoveEmptyEntries); // first we convert request into our ChatCommand class // next we handle each command foreach (var rawRequest in rawRequests) { ChatRequestBase generalRequest = new ChatRequestBase(rawRequest); if (!generalRequest.Parse()) { LogWriter.ToLog(LogEventLevel.Error, "Invalid request!"); continue; } Type requestType = AppDomain.CurrentDomain .GetAssemblies() .SelectMany(x => x.GetTypes()) .FirstOrDefault(t => t.Name == generalRequest.CmdName + "Request"); if (requestType != null) { var specificRequest = Activator.CreateInstance(requestType, generalRequest.RawRequest); if (specificRequest == null) { LogWriter.ToLog(LogEventLevel.Error, $"Unknown request {generalRequest.CmdName}!"); continue; } if (!((ChatRequestBase)specificRequest).Parse()) { LogWriter.ToLog(LogEventLevel.Error, "Invalid request!"); continue; } requestList.Add(specificRequest); } else { LogWriter.ToLog(LogEventLevel.Error, $"Request: {generalRequest.CmdName} not implemented!"); } } return(requestList); }
public NICKHandler(ISession session, ChatRequestBase request) : base(session, request) { _request = (NICKRequest)request; }
public WHOHandler(ISession session, ChatRequestBase request) : base(session, request) { _request = (WHORequest)request; }
public SETCKEYHandler(ISession session, ChatRequestBase request) : base(session, request) { _request = (SETCKEYRequest)request; IsSetOthersKeyValue = false; }
public LOGINHandler(ISession session, ChatRequestBase request) : base(session, request) { _request = (LOGINRequest)request; }
public NOTICEHandler(ISession session, ChatRequestBase request) : base(session, request) { _request = new NOTICERequest(request.RawRequest); }
public TOPICHandler(ISession session, ChatRequestBase request) : base(session, request) { _request = (TOPICRequest)request; }
public USRIPHandler(ISession session, ChatRequestBase request) : base(session, request) { _request = (USRIPRequest)request; }
// CRYPT des 1 gamename public CRYPTHandler(ISession session, ChatRequestBase request) : base(session, request) { _request = (CRYPTRequest)request; }
public SETCHANKEYHandler(ISession session, ChatRequestBase request) : base(session, request) { _request = (SETCHANKEYRequest)request; }
public PARTHandler(ISession session, ChatRequestBase request) : base(session, request) { _request = (PARTRequest)request; }
public GETCKEYHandler(ISession session, ChatRequestBase request) : base(session, request) { _request = (GETCKEYRequest)request; }
//:irc.foonet.com 321 Pants Channel :Users Name\r\n:irc.foonet.com 323 Pants :End of /LIST\r\n public LISTHandler(ISession session, ChatRequestBase request) : base(session, request) { _request = (LISTRequest)request; }
public QUITHandler(ISession session, ChatRequestBase request) : base(session, request) { _request = (QUITRequest)request; }
public NAMESHandler(ISession session, ChatRequestBase request) : base(session, request) { _request = (NAMESRequest)request; }
public PRIVMSGHandler(ISession session, ChatRequestBase request) : base(session, request) { _request = (PRIVMSGRequest)request; }
public UTMHandler(ISession session, ChatRequestBase request) : base(session, request) { _request = (UTMRequest)request; }
public MODEHandler(ISession session, ChatRequestBase request) : base(session, request) { _request = (MODERequest)request; }