Esempio n. 1
0
    /// <summary>
    ///
    /// </summary>
    private static string DumpEventsOfType(string type, string caption, vp_EventHandler handler)
    {
        string s = caption.ToUpper();

        foreach (FieldInfo f in handler.GetType().GetFields((BindingFlags.Public | BindingFlags.NonPublic |
                                                             BindingFlags.Instance | BindingFlags.DeclaredOnly)))
        {
            string listeners = null;

            switch (type)
            {
            case "vp_Message":
                if (f.FieldType.ToString().Contains("vp_Message"))
                {
                    vp_Message e = (vp_Message)f.GetValue(handler);
                    listeners = DumpEventListeners(e, new string[] { "Send" });
                }
                break;

            case "vp_Attempt":
                if (f.FieldType.ToString().Contains("vp_Attempt"))
                {
                    vp_Event e = (vp_Event)f.GetValue(handler);
                    listeners = DumpEventListeners(e, new string[] { "Try" });
                }
                break;

            case "vp_Value":
                if (f.FieldType.ToString().Contains("vp_Value"))
                {
                    vp_Event e = (vp_Event)f.GetValue(handler);
                    listeners = DumpEventListeners(e, new string[] { "Get", "Set" });
                }
                break;

            case "vp_Activity":
                if (f.FieldType.ToString().Contains("vp_Activity"))
                {
                    vp_Event e = (vp_Event)f.GetValue(handler);
                    listeners = DumpEventListeners(e, new string[] { "StartConditions", "StopConditions", "StartCallbacks", "StopCallbacks" });
                }
                break;
            }
            if (!string.IsNullOrEmpty(listeners))
            {
                s += "\t\t" + f.Name + "\n" + listeners + "\n";
            }
        }
        return(s);
    }
Esempio n. 2
0
    private static string DumpEventsOfType(string type, string caption, vp_EventHandler handler)
    {
        string text = caption.ToUpper();

        FieldInfo[] fields = handler.GetType().GetFields(BindingFlags.DeclaredOnly | BindingFlags.Instance | BindingFlags.Public | BindingFlags.NonPublic);
        for (int i = 0; i < fields.Length; i++)
        {
            FieldInfo fieldInfo = fields[i];
            string    text2     = null;
            switch (type)
            {
            case "vp_Message":
                if (fieldInfo.FieldType.ToString().Contains("vp_Message"))
                {
                    vp_Message e = (vp_Message)fieldInfo.GetValue(handler);
                    text2 = vp_EventDump.DumpEventListeners(e, new string[]
                    {
                        "Send"
                    });
                }
                break;

            case "vp_Attempt":
                if (fieldInfo.FieldType.ToString().Contains("vp_Attempt"))
                {
                    vp_Event e2 = (vp_Event)fieldInfo.GetValue(handler);
                    text2 = vp_EventDump.DumpEventListeners(e2, new string[]
                    {
                        "Try"
                    });
                }
                break;

            case "vp_Value":
                if (fieldInfo.FieldType.ToString().Contains("vp_Value"))
                {
                    vp_Event e3 = (vp_Event)fieldInfo.GetValue(handler);
                    text2 = vp_EventDump.DumpEventListeners(e3, new string[]
                    {
                        "Get",
                        "Set"
                    });
                }
                break;

            case "vp_Activity":
                if (fieldInfo.FieldType.ToString().Contains("vp_Activity"))
                {
                    vp_Event e4 = (vp_Event)fieldInfo.GetValue(handler);
                    text2 = vp_EventDump.DumpEventListeners(e4, new string[]
                    {
                        "StartConditions",
                        "StopConditions",
                        "StartCallbacks",
                        "StopCallbacks"
                    });
                }
                break;
            }
            if (!string.IsNullOrEmpty(text2))
            {
                string text3 = text;
                text = string.Concat(new string[]
                {
                    text3,
                    "\t\t",
                    fieldInfo.Name,
                    "\n",
                    text2,
                    "\n"
                });
            }
        }
        return(text);
    }