Ejemplo n.º 1
0
        public override bool Register()
        {
            if (!base.Register())
            {
                return(false);
            }

            if (HostController == null)
            {
                return(false);
            }

            RegisterEnumSymbols();

            DataType2 dt2 = new DataType2();

            string s = "EachSourceClass";

            Transform.For("EachLogMethod");
            string format = EachLogMethod_Format != null ? EachSourceClass.EachLogMethod_Format : "{0}";

            if (HostController.RegisterEvent(s + ".EachLogMethod", format, ref EachLogMethod_Handle))
            {
                DebugStub.WriteLine("register event succeeded");


                Transform.For("eachParam");
                HostController.RegisterEventField(EachSourceClass.EachLogMethod_Handle,
                                                  "eachParam",
                                                  0,
                                                  dt2.__EachParam);
                Transform.EndFor();

                //
                // HACK!!!!! Some instruction is needed here, otherwise, the transform
                // will merge the enumeration below with the one above
                // producing a mismatch in the order of argumets in the structure declaration
                //
                DebugStub.WriteLine("Registering enums");

                Transform.For("eachBasicEnumParam");

                HostController.RegisterEventGenericField(EachSourceClass.EachLogMethod_Handle,
                                                         "eachBasicEnumParam",
                                                         0,
                                                         sizeof(int),
                                                         BasicEnum_Handle);
                Transform.EndFor();
            }
            else
            {
                // The event might have been registered already
                // Check whether we foundit already in the table or not

                if (EachSourceClass.EachLogMethod_Handle == 0)
                {
                    return(false);
                }
            }
            Transform.EndFor();

            return(true);
        }