Exemplo n.º 1
0
    /// <summary>
    /// Through reflection, if finds and stores all the event classes in project.
    /// </summary>
    void Init()
    {
        List <Type> eventClasses = GetEventClasses();

        int count = eventClasses.Count;

        MethodInfo method;

        for (int i = 0; i < count; ++i)
        {
            method = eventClasses[i].GetMethod("GetStaticId", BindingFlags.Public | BindingFlags.Static);
            System.Diagnostics.Debug.Assert(method != null);
            System.Diagnostics.Debug.Assert(method.ReturnType == typeof(byte));

            byte id = (byte)method.Invoke(eventClasses[i], null);
            m_events.AddUnique(id, eventClasses[i]);
        }
        MethodInfo methodInfo = eventClasses[0].GetMethod("GetID", BindingFlags.Static);
    }