public override void Init() { ClassEnumerator enumerator = new ClassEnumerator(typeof(SkillFuncHandlerClassAttribute), null, typeof(SkillFuncDelegator).Assembly, true, false, false); ListView<System.Type>.Enumerator enumerator2 = enumerator.results.GetEnumerator(); while (enumerator2.MoveNext()) { MethodInfo[] methods = enumerator2.Current.GetMethods(); for (int i = 0; (methods != null) && (i < methods.Length); i++) { MethodInfo method = methods[i]; if (method.IsStatic) { object[] customAttributes = method.GetCustomAttributes(typeof(SkillFuncHandlerAttribute), true); for (int j = 0; j < customAttributes.Length; j++) { SkillFuncHandlerAttribute attribute = customAttributes[j] as SkillFuncHandlerAttribute; if (attribute != null) { this.RegisterHandler(attribute.ID, (DealSkillFunc) Delegate.CreateDelegate(typeof(DealSkillFunc), method)); if (attribute.AdditionalIdList != null) { int length = attribute.AdditionalIdList.Length; for (int k = 0; k < length; k++) { this.RegisterHandler(attribute.AdditionalIdList[k], (DealSkillFunc) Delegate.CreateDelegate(typeof(DealSkillFunc), method)); } } } } } } } }
public override void Init() { this.isOnlineMode = true; ClassEnumerator enumerator = new ClassEnumerator(typeof(MessageHandlerClassAttribute), null, typeof(NetworkModule).Assembly, true, false, false); ListView <System.Type> .Enumerator enumerator2 = enumerator.results.GetEnumerator(); while (enumerator2.MoveNext()) { MethodInfo[] methods = enumerator2.Current.GetMethods(); for (int i = 0; (methods != null) && (i < methods.Length); i++) { MethodInfo info = methods[i]; if (info.IsStatic) { object[] customAttributes = info.GetCustomAttributes(typeof(MessageHandlerAttribute), true); for (int j = 0; j < customAttributes.Length; j++) { MessageHandlerAttribute attribute = customAttributes[j] as MessageHandlerAttribute; if (attribute != null) { this.RegisterMsgHandler(attribute.ID, (NetMsgDelegate)Delegate.CreateDelegate(typeof(NetMsgDelegate), info)); if (attribute.AdditionalIdList != null) { int length = attribute.AdditionalIdList.Length; for (int k = 0; k < length; k++) { this.RegisterMsgHandler(attribute.AdditionalIdList[k], (NetMsgDelegate)Delegate.CreateDelegate(typeof(NetMsgDelegate), info)); } } } } } } } }
public override void Init() { ClassEnumerator classEnumerator = new ClassEnumerator(typeof(CreateTypeAttribute), typeof(CreateType), typeof(CreateTypeAttribute).get_Assembly(), true, false, false); foreach (Type current in classEnumerator.results) { Attribute customAttribute = Attribute.GetCustomAttribute(current, typeof(CreateTypeAttribute)); this.energyTypeSet.Add((customAttribute as CreateTypeAttribute).attributeType, current); } }
public override void Init() { ClassEnumerator enumerator = new ClassEnumerator(typeof(CreateTypeAttribute), typeof(CreateType), typeof(CreateTypeAttribute).Assembly, true, false, false); foreach (System.Type type in enumerator.results) { Attribute customAttribute = Attribute.GetCustomAttribute(type, typeof(CreateTypeAttribute)); this.eventTypeSet.Add((customAttribute as CreateTypeAttribute).attributeType, type); } }
public override void Init() { ClassEnumerator classEnumerator = new ClassEnumerator(typeof(SkillBaseDetectionAttribute), typeof(SkillBaseDetection), typeof(SkillBaseDetectionAttribute).get_Assembly(), true, false, false); foreach (Type current in classEnumerator.results) { SkillBaseDetection value = (SkillBaseDetection)Activator.CreateInstance(current); Attribute customAttribute = Attribute.GetCustomAttribute(current, typeof(SkillBaseDetectionAttribute)); this._registedRule.Add((uint)(customAttribute as SkillBaseDetectionAttribute).UseRule, value); } }
public override void Init() { ClassEnumerator enumerator = new ClassEnumerator(typeof(SkillBaseSelectTargetAttribute), typeof(SkillBaseSelectTarget), typeof(SkillBaseSelectTargetAttribute).Assembly, true, false, false); foreach (System.Type type in enumerator.results) { SkillBaseSelectTarget target = (SkillBaseSelectTarget)Activator.CreateInstance(type); Attribute customAttribute = Attribute.GetCustomAttribute(type, typeof(SkillBaseSelectTargetAttribute)); this.registedRule.Add((uint)(customAttribute as SkillBaseSelectTargetAttribute).TargetRule, target); } }
public override void Init() { ClassEnumerator enumerator = new ClassEnumerator(typeof(SkillBaseDetectionAttribute), typeof(SkillBaseDetection), typeof(SkillBaseDetectionAttribute).Assembly, true, false, false); foreach (System.Type type in enumerator.results) { SkillBaseDetection detection = (SkillBaseDetection)Activator.CreateInstance(type); Attribute customAttribute = Attribute.GetCustomAttribute(type, typeof(SkillBaseDetectionAttribute)); this._registedRule.Add((uint)(customAttribute as SkillBaseDetectionAttribute).UseRule, detection); } }
protected void RegisterMethodCommands(Assembly InAssembly) { ClassEnumerator classEnumerator = new ClassEnumerator(typeof(CheatCommandEntryAttribute), null, InAssembly, true, false, false); ListView <Type> .Enumerator enumerator = classEnumerator.results.GetEnumerator(); while (enumerator.MoveNext()) { Type current = enumerator.Current; this.RegisterMethods(current); } }
public ClassEnumerator RegisterStateByAttributes <TAttributeType>(Assembly InAssembly, params object[] args) where TAttributeType : AutoRegisterAttribute { ClassEnumerator enumerator = new ClassEnumerator(typeof(TAttributeType), typeof(IState), InAssembly, true, false, false); ListView <Type> .Enumerator enumerator2 = enumerator.results.GetEnumerator(); while (enumerator2.MoveNext()) { Type current = enumerator2.Current; IState state = (IState)Activator.CreateInstance(current, args); this.RegisterState <IState>(state, state.name); } return(enumerator); }
public ClassEnumerator RegisterStateByAttributes <TAttributeType>(Assembly inAssembly) where TAttributeType : AutoRegisterAttribute { ClassEnumerator classEnumerator = new ClassEnumerator(typeof(TAttributeType), typeof(IState), inAssembly, true, false, false); List <Type> .Enumerator enumerator = classEnumerator.results.GetEnumerator(); while (enumerator.MoveNext()) { Type current = enumerator.Current; IState state = (IState)Activator.CreateInstance(current); RegisterState <IState>(state, state.name); } return(classEnumerator); }
public ArgumentDescriptionRepository() { ClassEnumerator classEnumerator = new ClassEnumerator(typeof(ArgumentAttribute), typeof(IArgumentDescription), typeof(ArgumentAttribute).get_Assembly(), true, false, false); ListView <Type> .Enumerator enumerator = classEnumerator.results.GetEnumerator(); while (enumerator.MoveNext()) { Type current = enumerator.Current; ArgumentAttribute argumentAttribute = current.GetCustomAttributes(typeof(ArgumentAttribute), false)[0] as ArgumentAttribute; IArgumentDescription argumentDescription = Activator.CreateInstance(current) as IArgumentDescription; this.Descriptions.Add(argumentAttribute.order, argumentDescription); } }
public override void Init() { ClassEnumerator classEnumerator = new ClassEnumerator(typeof(CreateTypeAttribute), typeof(CreateType), typeof(CreateTypeAttribute).get_Assembly(), true, false, false); using (ListView <Type> .Enumerator enumerator = classEnumerator.get_results().GetEnumerator()) { while (enumerator.MoveNext()) { Type current = enumerator.get_Current(); Attribute customAttribute = Attribute.GetCustomAttribute(current, typeof(CreateTypeAttribute)); this.eventTypeSet.Add((customAttribute as CreateTypeAttribute).attributeType, current); } } }
public override void Init() { ClassEnumerator classEnumerator = new ClassEnumerator(typeof(SkillBaseDetectionAttribute), typeof(SkillBaseDetection), typeof(SkillBaseDetectionAttribute).get_Assembly(), true, false, false); using (ListView <Type> .Enumerator enumerator = classEnumerator.get_results().GetEnumerator()) { while (enumerator.MoveNext()) { Type current = enumerator.get_Current(); SkillBaseDetection skillBaseDetection = (SkillBaseDetection)Activator.CreateInstance(current); Attribute customAttribute = Attribute.GetCustomAttribute(current, typeof(SkillBaseDetectionAttribute)); this._registedRule.Add((customAttribute as SkillBaseDetectionAttribute).UseRule, skillBaseDetection); } } }
protected void RegisterMethodCommands(Assembly InAssembly) { ClassEnumerator Enumerator = new ClassEnumerator( typeof(CheatCommandEntryAttribute), null, InAssembly ); var Iter = Enumerator.results.GetEnumerator(); while (Iter.MoveNext()) { Type ThisType = Iter.Current; RegisterMethods(ThisType); } }
public ArgumentDescriptionRepository() { ClassEnumerator ArgDescEnumertor = new ClassEnumerator( typeof(ArgumentAttribute), typeof(IArgumentDescription), typeof(ArgumentAttribute).Assembly); var Iter = ArgDescEnumertor.results.GetEnumerator(); while (Iter.MoveNext()) { Type ThisType = Iter.Current; var Attr = ThisType.GetCustomAttributes(typeof(ArgumentAttribute), false)[0] as ArgumentAttribute; IArgumentDescription DescInterface = Activator.CreateInstance(ThisType) as IArgumentDescription; Descriptions.Add(Attr.order, DescInterface); } }
//private IState _registedState; public ClassEnumerator RegisterStateByAttributes <TAttributeType>(Assembly InAsswmbly) where TAttributeType : GameStateAttribute { var Classes = new ClassEnumerator( typeof(TAttributeType), typeof(IState), InAsswmbly); var Iter = Classes.results.GetEnumerator(); while (Iter.MoveNext()) { var StateType = Iter.Current; IState StateObj = (IState)System.Activator.CreateInstance(StateType); // if (!_registedState.ContainsKey(StateObj.name)) // { // _registedState.Add(StateObj.name, StateObj); // } } return(Classes); }
public override void Init() { this.isOnlineMode = true; ClassEnumerator classEnumerator = new ClassEnumerator(typeof(MessageHandlerClassAttribute), null, typeof(NetworkModule).get_Assembly(), true, false, false); ListView <Type> .Enumerator enumerator = classEnumerator.results.GetEnumerator(); while (enumerator.MoveNext()) { Type current = enumerator.Current; MethodInfo[] methods = current.GetMethods(); int num = 0; while (methods != null && num < methods.Length) { MethodInfo methodInfo = methods[num]; if (methodInfo.get_IsStatic()) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(MessageHandlerAttribute), true); for (int i = 0; i < customAttributes.Length; i++) { MessageHandlerAttribute messageHandlerAttribute = customAttributes[i] as MessageHandlerAttribute; if (messageHandlerAttribute != null) { this.RegisterMsgHandler(messageHandlerAttribute.ID, (NetMsgDelegate)Delegate.CreateDelegate(typeof(NetMsgDelegate), methodInfo)); if (messageHandlerAttribute.AdditionalIdList != null) { int num2 = messageHandlerAttribute.AdditionalIdList.Length; for (int j = 0; j < num2; j++) { this.RegisterMsgHandler(messageHandlerAttribute.AdditionalIdList[j], (NetMsgDelegate)Delegate.CreateDelegate(typeof(NetMsgDelegate), methodInfo)); } } } } } num++; } } }
public override void Init() { ClassEnumerator classEnumerator = new ClassEnumerator(typeof(SkillFuncHandlerClassAttribute), null, typeof(SkillFuncDelegator).get_Assembly(), true, false, false); ListView <Type> .Enumerator enumerator = classEnumerator.get_results().GetEnumerator(); while (enumerator.MoveNext()) { Type current = enumerator.get_Current(); MethodInfo[] methods = current.GetMethods(); int num = 0; while (methods != null && num < methods.Length) { MethodInfo methodInfo = methods[num]; if (methodInfo.get_IsStatic()) { object[] customAttributes = methodInfo.GetCustomAttributes(typeof(SkillFuncHandlerAttribute), true); for (int i = 0; i < customAttributes.Length; i++) { SkillFuncHandlerAttribute skillFuncHandlerAttribute = customAttributes[i] as SkillFuncHandlerAttribute; if (skillFuncHandlerAttribute != null) { this.RegisterHandler(skillFuncHandlerAttribute.get_ID(), (DealSkillFunc)Delegate.CreateDelegate(typeof(DealSkillFunc), methodInfo)); if (skillFuncHandlerAttribute.get_AdditionalIdList() != null) { int num2 = skillFuncHandlerAttribute.get_AdditionalIdList().Length; for (int j = 0; j < num2; j++) { this.RegisterHandler(skillFuncHandlerAttribute.get_AdditionalIdList()[j], (DealSkillFunc)Delegate.CreateDelegate(typeof(DealSkillFunc), methodInfo)); } } } } } num++; } } }