public void Load() { this.allEvents = new Dictionary <int, List <IInstanceMethod> >(); Type[] types = DllHelper.GetHotfixTypes(); foreach (Type type in types) { object[] attrs = type.GetCustomAttributes(typeof(CrossEventAttribute), false); foreach (object attr in attrs) { CrossEventAttribute aEventAttribute = (CrossEventAttribute)attr; IInstanceMethod method = new ILInstanceMethod(type, "Run"); if (!this.allEvents.ContainsKey(aEventAttribute.Type)) { this.allEvents.Add(aEventAttribute.Type, new List <IInstanceMethod>()); } this.allEvents[aEventAttribute.Type].Add(method); } } }
private void Load() { allEvents = new Dictionary <int, List <IInstanceMethod> >(); Type[] types = DllHelper.GetHotfixTypes(); foreach (Type type in types) { object[] attrs = type.GetCustomAttributes(typeof(CrossEventAttribute), false); foreach (object attr in attrs) { CrossEventAttribute aEventAttribute = (CrossEventAttribute)attr; #if ILRuntime IInstanceMethod method = new ILInstanceMethod(type, "Run"); #else IInstanceMethod method = new MonoInstanceMethod(type, "Run"); #endif if (!allEvents.ContainsKey(aEventAttribute.Type)) { allEvents.Add(aEventAttribute.Type, new List <IInstanceMethod>()); } allEvents[aEventAttribute.Type].Add(method); } } }