CodeGenFile generateInterface(string contextName, ComponentData data)
        {
            var optionalContextName = data.GetContextNames().Length > 1 ? contextName : string.Empty;
            var componentName       = data.GetTypeName().ToComponentName(_ignoreNamespacesConfig.ignoreNamespaces);
            var memberData          = data.GetMemberData();

            if (memberData.Length == 0)
            {
                memberData = new[] { new MemberData("bool", data.GetUniquePrefix().LowercaseFirst() + componentName) };
            }

            var eventTypeSuffix = string.Empty;
            var memberArgs      = ", " + getMemberArgs(memberData);

            if (data.GetMemberData().Length == 0)
            {
                switch (data.GetEventType())
                {
                case EventType.Added:
                    eventTypeSuffix = "Added";
                    memberArgs      = string.Empty;
                    break;

                case EventType.Removed:
                    eventTypeSuffix = "Removed";
                    memberArgs      = string.Empty;
                    break;
                }
            }
            else
            {
                switch (data.GetEventType())
                {
                case EventType.Removed:
                    eventTypeSuffix = "Removed";
                    memberArgs      = string.Empty;
                    break;

                case EventType.AddedOrRemoved:
                    eventTypeSuffix = "AddedOrRemoved";
                    break;
                }
            }

            var fileContent = INTERFACE_TEMPLATE
                              .Replace("${ContextName}", contextName)
                              .Replace("${OptionalContextName}", optionalContextName)
                              .Replace("${ComponentName}", componentName)
                              .Replace("${ComponentName}", componentName)
                              .Replace("${EventType}", eventTypeSuffix)
                              .Replace("${memberArgs}", memberArgs);

            return(new CodeGenFile(
                       "Events" + Path.DirectorySeparatorChar +
                       "Interfaces" + Path.DirectorySeparatorChar +
                       "I" + contextName + componentName + "Listener.cs",
                       fileContent,
                       GetType().FullName
                       ));
        }
        CodeGenFile generateSystem(string contextName, ComponentData data)
        {
            var optionalContextName = data.GetContextNames().Length > 1 ? contextName : string.Empty;
            var componentName       = data.GetTypeName().ToComponentName(_ignoreNamespacesConfig.ignoreNamespaces);
            var memberData          = data.GetMemberData();

            var methodArgs = ", " + (memberData.Length == 0
                                 ? data.GetUniquePrefix() + componentName
                                 : getMethodArgs(memberData));

            var eventTypeSuffix = string.Empty;
            var filter          = string.Empty;

            if (data.GetMemberData().Length == 0)
            {
                switch (data.GetEventType())
                {
                case EventType.Added:
                    eventTypeSuffix = "Added";
                    methodArgs      = string.Empty;
                    filter          = "entity." + data.GetUniquePrefix() + componentName;
                    break;

                case EventType.Removed:
                    eventTypeSuffix = "Removed";
                    methodArgs      = string.Empty;
                    filter          = "!entity." + data.GetUniquePrefix() + componentName;
                    break;

                case EventType.AddedOrRemoved:
                    filter = "true";
                    break;
                }
            }
            else
            {
                switch (data.GetEventType())
                {
                case EventType.Added:
                    filter = "entity.has" + componentName;
                    break;

                case EventType.Removed:
                    eventTypeSuffix = "Removed";
                    methodArgs      = string.Empty;
                    filter          = "!entity.has" + componentName;
                    break;

                case EventType.AddedOrRemoved:
                    eventTypeSuffix = "AddedOrRemoved";
                    filter          = "true";
                    break;
                }
            }

            if (data.GetEventBindToEntity())
            {
                if (filter == "true")
                {
                    filter = "entity.has${OptionalContextName}${ComponentName}Listener";
                }
                else
                {
                    filter += " && entity.has${OptionalContextName}${ComponentName}Listener";
                }
            }

            filter = filter
                     .Replace("${OptionalContextName}", optionalContextName)
                     .Replace("${ComponentName}", componentName);

            var cachedAccess = memberData.Length == 0
                ? "var " + data.GetUniquePrefix() + componentName + " = e." + data.GetUniquePrefix() + componentName + ";"
                : "var component = e." + componentName.LowercaseFirst() + ";";

            var template = data.GetEventBindToEntity()
                ? ENTITY_SYSTEM_TEMPLATE
                : SYSTEM_TEMPLATE;

            var fileContent = template
                              .Replace("${ContextName}", contextName)
                              .Replace("${contextName}", contextName.LowercaseFirst())
                              .Replace("${OptionalContextName}", optionalContextName)
                              .Replace("${optionalContextName}", optionalContextName == string.Empty ? string.Empty : optionalContextName.LowercaseFirst())
                              .Replace("${ComponentName}", componentName)
                              .Replace("${contextDependentComponentName}", optionalContextName == string.Empty ? componentName.LowercaseFirst() : componentName)
                              .Replace("${GroupEvent}", data.GetEventType().ToString())
                              .Replace("${filter}", filter)
                              .Replace("${cachedAccess}", cachedAccess)
                              .Replace("${EventType}", eventTypeSuffix)
                              .Replace("${methodArgs}", methodArgs);

            return(new CodeGenFile(
                       "Events" + Path.DirectorySeparatorChar +
                       "Systems" + Path.DirectorySeparatorChar +
                       optionalContextName + componentName + "EventSystem.cs",
                       fileContent,
                       GetType().FullName
                       ));
        }