Ejemplo n.º 1
0
        private void EmitEventMethodOverride(bool global, CodeTypeDeclaration type, EventDecorator d)
        {
            if (global && d.Definition.GlobalSenders == GlobalEventSenders.None)
            {
                return;
            }

            if (!global && d.Definition.EntitySenders == EntityEventSenders.None)
            {
                return;
            }

            type.BaseTypes.Add(d.ListenerInterface);

            type.DeclareMethod(typeof(void).FullName, "OnEvent", method => { method.DeclareParameter(d.Name, "evnt"); })
            .Attributes = MemberAttributes.Public;
        }
Ejemplo n.º 2
0
        private void DecorateDefinitions()
        {
            foreach (StateDefinition def in Project.States)
            {
                StateDecorator decorator;

                decorator           = new StateDecorator(def);
                decorator.Generator = this;

                States.Add(decorator);
            }

            foreach (ObjectDefinition def in Project.Structs)
            {
                ObjectDecorator decorator;

                decorator           = new ObjectDecorator(def);
                decorator.Generator = this;

                Objects.Add(decorator);
            }

            foreach (EventDefinition def in Project.Events)
            {
                EventDecorator decorator;

                decorator           = new EventDecorator(def);
                decorator.Generator = this;

                Events.Add(decorator);
            }

            foreach (CommandDefinition def in Project.Commands)
            {
                CommandDecorator decorator;

                decorator           = new CommandDecorator(def);
                decorator.Generator = this;

                Commands.Add(decorator);
            }
        }