internal static DataPipe CreateServerUdp(CAServer server, IPAddress address, int udpPort) { DataPipe res = new DataPipe(); res.Add(new UdpReceiver(address, udpPort)); res[0].Pipe = res; AddToPipe(new Type[] { typeof(PacketSplitter), typeof(ServerHandleMessage) }, res); ((ServerHandleMessage)res.LastFilter).Server = server; return(res); }
private static void AddToPipe(object[] objects, DataPipe pipe) { foreach (var o in objects) { DataFilter w; if (o is Type) { var t = (Type)o; w = (DataFilter)t.GetConstructor(new Type[] { }).Invoke(new object[] { }); } else { w = (DataFilter)o; } w.Pipe = pipe; pipe.Add(w); } }