public string GetHeader(ArchAngel.Interfaces.Scripting.DatabaseChanges.IDatabase database) { object[] parms = new object[] { database }; string body = (string)HeaderMethod.Invoke(null, parms); if (body.StartsWith(" ")) { body = body.Substring(10); } body = Slyce.Common.Scripter.RemoveDebugSymbols(body); return(body); }
public ClientSession(IChannel channel, bool isWorldClient) : base(channel) { // set last received lastPacketReceive = DateTime.Now.Ticks; _random = new Random((int)ClientId); _isWorldClient = isWorldClient; foreach (var controller in PacketControllerFactory.GenerateControllers()) { controller.RegisterSession(this); foreach (MethodInfo methodInfo in controller.GetType().GetMethods().Where(x => x.GetParameters().FirstOrDefault()?.ParameterType.BaseType == typeof(PacketDefinition))) { var type = methodInfo.GetParameters().FirstOrDefault()?.ParameterType; PacketHeaderAttribute packetheader = (PacketHeaderAttribute)Array.Find(type.GetCustomAttributes(true), ca => ca.GetType().Equals(typeof(PacketHeaderAttribute))); HeaderMethod.Add(packetheader, new Tuple <IPacketController, Type>(controller, type)); ControllerMethods.Add(packetheader, DelegateBuilder.BuildDelegate <Action <object, object> >(methodInfo)); } } }