public CometCommandHandlerPipeline(HttpServer server, CometCommand cmd) { if (server == null) throw new Exception("HttpServer cannot be null."); if (cmd == null) throw new Exception("CometCommand cannot be null."); Server = server; Command = cmd; }
public HttpHandlerBase(HttpServer server, CometCommand command) { if (server == null) throw new Exception("HttpServer cannot be null."); if (command == null) throw new Exception("CometCommand cannot be null."); Server = server; Command = command; }
public CometCommandHandlerPipeline(HttpServer server, CometCommand cmd) { if (server == null) { throw new Exception("HttpServer cannot be null."); } if (cmd == null) { throw new Exception("CometCommand cannot be null."); } Server = server; Command = cmd; }
/// <summary> /// 根据命令实例化管道处理命令类 /// </summary> /// <param name="cmd"></param> /// <returns></returns> private IHttpHandler ParseCometCommand(CometCommand cmd) { string currAssemblyName = Process.GetCurrentProcess().MainModule.FileName; currAssemblyName = currAssemblyName.Substring(currAssemblyName.LastIndexOf("\\") + 1).Replace(".vshost", ""); Assembly assembly = Assembly.LoadFrom(currAssemblyName); Type[] assemblyAllTypes = assembly.GetTypes(); Type currCommand = null; foreach (Type type in assemblyAllTypes) { if (type.Name == cmd.ToString()) { currCommand = type; break; } } IHttpHandler commandHandler = Activator.CreateInstance(currCommand) as IHttpHandler; return commandHandler; }
/// <summary> /// 注册Handler /// </summary> /// <param name="command"></param> /// <param name="cmdHandler"></param> public void RegistCommandHandler(CometCommand command, Handler.IHttpHandler cmdHandler) { if (command == null || cmdHandler == null || _CometCommands == null) return; CometCommandHandlerPipeline handlers = null; if (_CometCommands.ContainsKey(command.CommandID)) { handlers = _CometCommands[command.CommandID]; handlers.RegistHandler(cmdHandler); } else { handlers = new CometCommandHandlerPipeline(this, command); handlers.RegistHandler(cmdHandler); _CometCommands[command.CommandID] = handlers; } }
public ValidationUserKey(HttpServer server, CometCommand command) : base(server, command) { }
public Default(HttpServer server, CometCommand command) : base(server, command) { }