Example #1
0
        protected override string GenerateBefore(int indent)
        {
            var output = string.Empty;

            for (int i = 0; i < attributes.Count; i++)
            {
                output += attributes[i].Generate(indent) + "\n";
            }

            output += CodeBuilder.Indent(indent) + scope.AsString().ConstructHighlight() + " enum ".ConstructHighlight() + typeName.LegalMemberName().EnumHighlight();

            return(output);
        }
Example #2
0
        protected override string GenerateBefore(int indent)
        {
            var output = string.Empty;

            for (int i = 0; i < attributes.Count; i++)
            {
                output += attributes[i].Generate(indent) + "\n";
            }

            output += CodeBuilder.Indent(indent) + scope.AsString() + " enum " + typeName;

            return(output);
        }
Example #3
0
        protected override string GenerateBefore(int indent)
        {
            var output = string.Empty;

            for (int i = 0; i < attributes.Count; i++)
            {
                output += attributes[i].Generate(indent) + "\n";
            }

            output += CodeBuilder.Indent(indent) + scope.AsString() + modifier.AsString() + " struct " + name.LegalMemberName();
            output += interfaces.Count == 0 ? string.Empty : " : ";

            for (int i = 0; i < interfaces.Count; i++)
            {
                output += interfaces[i].As().CSharpName();
                output += i < interfaces.Count - 1 ? ", " : string.Empty;
            }

            return(output);
        }
Example #4
0
        protected override string GenerateBefore(int indent)
        {
            var output = string.Empty;

            if (generateUsings)
            {
                var usings    = Usings();
                var hasUsings = false;
                for (int i = 0; i < usings.Count; i++)
                {
                    if (!string.IsNullOrEmpty(usings[i]))
                    {
                        output   += "using".ConstructHighlight() + " " + usings[i] + ";" + ((i < usings.Count - 1) ? "\n" : string.Empty);
                        hasUsings = true;
                    }
                }
                if (hasUsings)
                {
                    output += "\n\n";
                }
            }

            for (int i = 0; i < attributes.Count; i++)
            {
                output += attributes[i].Generate(indent) + "\n";
            }

            var canShowInherits = !(inherits == null && string.IsNullOrEmpty(assemblyQualifiedInheritanceType) || inherits == typeof(object) && inherits.BaseType == null);

            output += CodeBuilder.Indent(indent) + scope.AsString().ConstructHighlight() + (modifier == ClassModifier.None ? string.Empty : " " + modifier.AsString().ConstructHighlight()) + " class ".ConstructHighlight() + name.LegalMemberName().TypeHighlight();
            output += !canShowInherits && interfaces.Count == 0 ? string.Empty : " : ";
            output += canShowInherits ? (inherits == null ? assemblyQualifiedInheritanceType : inherits.As().CSharpName()) + (interfaces.Count > 0 ? ", " : string.Empty) : string.Empty;

            for (int i = 0; i < interfaces.Count; i++)
            {
                output += interfaces[i].As().CSharpName();
                output += i < interfaces.Count - 1 ? ", " : string.Empty;
            }

            return(output);
        }
        protected override string GenerateBefore(int indent)
        {
            var output = string.Empty;

            if (generateUsings)
            {
                var usings    = Usings();
                var hasUsings = false;
                for (int i = 0; i < usings.Count; i++)
                {
                    if (!string.IsNullOrEmpty(usings[i]))
                    {
                        output   += "using".ConstructHighlight() + " " + usings[i] + ";" + ((i < usings.Count - 1) ? "\n" : string.Empty);
                        hasUsings = true;
                    }
                }
                if (hasUsings)
                {
                    output += "\n\n";
                }
            }

            for (int i = 0; i < attributes.Count; i++)
            {
                output += attributes[i].Generate(indent) + "\n";
            }

            output += CodeBuilder.Indent(indent) + scope.AsString().ConstructHighlight() + modifier.AsString().ConstructHighlight() + " struct ".ConstructHighlight() + name.LegalMemberName().TypeHighlight();
            output += interfaces.Count == 0 ? string.Empty : " : ";

            for (int i = 0; i < interfaces.Count; i++)
            {
                output += interfaces[i].As().CSharpName();
                output += i < interfaces.Count - 1 ? ", " : string.Empty;
            }

            return(output);
        }
        protected override string GenerateBefore(int indent)
        {
            var output = string.Empty;

            if (generateUsings)
            {
                var usings = Usings();
                for (int i = 0; i < usings.Count; i++)
                {
                    output += "using".ConstructHighlight() + " " + usings[i] + ";" + ((i < usings.Count - 1) ? "\n" : string.Empty);
                }
                output += "\n\n";
            }

            for (int i = 0; i < attributes.Count; i++)
            {
                output += attributes[i].Generate(indent) + "\n";
            }

            output += CodeBuilder.Indent(indent) + scope.AsString().ConstructHighlight() + " enum ".ConstructHighlight() + typeName.LegalMemberName().EnumHighlight();

            return(output);
        }
Example #7
0
        protected override string GenerateBefore(int indent)
        {
            var output = string.Empty;

            for (int i = 0; i < attributes.Count; i++)
            {
                output += attributes[i].Generate(indent) + "\n";
            }

            var canShowInherits = !(inherits == null && string.IsNullOrEmpty(stringInherits) || inherits == typeof(object) && inherits.BaseType == null);

            output += CodeBuilder.Indent(indent) + scope.AsString().ConstructHighlight() + (modifier == ClassModifier.None ? string.Empty : " " + modifier.AsString().ConstructHighlight()) + " class ".ConstructHighlight() + name.LegalMemberName().TypeHighlight();
            output += !canShowInherits && interfaces.Count == 0 ? string.Empty : " : ";
            output += canShowInherits ? (inherits == null ? stringInherits : inherits.As().CSharpName()) + (interfaces.Count > 0 ? ", " : string.Empty) : string.Empty;

            for (int i = 0; i < interfaces.Count; i++)
            {
                output += interfaces[i].As().CSharpName();
                output += i < interfaces.Count - 1 ? ", " : string.Empty;
            }

            return(output);
        }
Example #8
0
        protected override string GenerateBefore(int indent)
        {
            var output = string.Empty;

            if (generateUsings)
            {
                var usings = Usings();
                for (int i = 0; i < usings.Count; i++)
                {
                    output += "using".ConstructHighlight() + " " + usings[i] + ";" + ((i < usings.Count - 1) ? "\n" : string.Empty);
                }
            }

            for (int i = 0; i < attributes.Count; i++)
            {
                output += attributes[i].Generate(indent);
                if (i < attributes.Count - 1)
                {
                    output += "\n";
                }
            }

            var hasInterfaces = interfaces.Length > 0;

            output += CodeBuilder.Indent(indent) + scope.AsString().ConstructHighlight() + " interface ".ConstructHighlight() + typeName.LegalMemberName().InterfaceHighlight() + (hasInterfaces ? " : " : string.Empty);

            for (int i = 0; i < interfaces.Length; i++)
            {
                output += interfaces[i].Name.LegalMemberName().InterfaceHighlight();
                if (i < interfaces.Length - 1)
                {
                    output += ", ";
                }
            }

            return(output);
        }
Example #9
0
        protected override string GenerateBefore(int indent)
        {
            var output = string.Empty;

            for (int i = 0; i < attributes.Count; i++)
            {
                output += attributes[i].Generate(indent) + "\n";
            }

            var hasInterfaces = interfaces.Length > 0;

            output += CodeBuilder.Indent(indent) + scope.AsString() + " interface " + typeName + (hasInterfaces ? " : " : string.Empty);

            for (int i = 0; i < interfaces.Length; i++)
            {
                output += interfaces[i].Name;
                if (i < interfaces.Length - 1)
                {
                    output += ", ";
                }
            }

            return(output);
        }