/// <summary>
        /// Gets the using for flags.
        /// </summary>
        /// <param name="flags">The flags.</param>
        /// <param name="addBasic">if set to <c>true</c> [add basic].</param>
        /// <param name="output">The output.</param>
        /// <returns></returns>
        public static List <String> GetUsingForFlags(PropertyAppendFlags flags, Boolean addBasic = true, List <String> output = null)
        {
            if (output == null)
            {
                output = new List <string>();
            }

            if (addBasic)
            {
                output.Add("System");
                output.Add("System.Data");
                output.Add("System.Collection.Generic");
                output.Add("System.Text");
                output.Add("System");
            }

            var fl = flags.getEnumListFromFlags();

            foreach (PropertyAppendFlags f in fl)
            {
                switch (f)
                {
                case PropertyAppendFlags.setComponentModelAttributes:
                    output.Add("System.ComponentModel");
                    break;

                case PropertyAppendFlags.setXmlSerializationAttributes:
                    output.Add("System.Xml.Serialization");
                    break;

                case PropertyAppendFlags.setSCIReportingDefinitions:
                    output.Add("imbSCI.Core.attributes");
                    output.Add("imbSCI.Core");
                    output.Add("imbSCI.Data");
                    output.Add("imbSCI.Core.enums");
                    output.Add("imbSCI.Core.reporting.zone");


                    break;

                case PropertyAppendFlags.setXmlDocumentation:
                    break;

                case PropertyAppendFlags.setDefaultValue:
                    break;
                }
            }


            return(output);
        }
        public void AppendProperty(settingsPropertyEntry property, PropertyAppendType type, PropertyAppendFlags flags)
        {
            String def_value = "";

            if (flags.HasFlag(PropertyAppendFlags.setDefaultValue))
            {
                if (property.type.IsValueType)
                {
                    def_value = " = default(" + property.type + ");";
                }
                else
                {
                    if (property.type.GetConstructor(new Type[] { }) != null)
                    {
                        def_value = " = new " + property.type + "();";
                    }
                    else
                    {
                        def_value = " = default(" + property.type + ");";
                    }
                }

                def_value = def_value.Replace("  ", " ").Trim();
            }
            else
            {
            }

            List <String> inserts = property.GetPropertyCodeInsertLines(flags);

            switch (type)
            {
            case PropertyAppendType.autoproperty:

                foreach (var l in inserts)
                {
                    AppendLine(l);
                }

                String apl = "public " + property.name + " {get;set;} " + def_value;
                if (def_value != "")
                {
                    apl = apl.ensureEndsWith(";");
                }
                apl = apl.Replace("  ", " ");

                AppendLine(apl);
                break;

            case PropertyAppendType.backingField:

                AppendLine("protected " + property.relevantTypeName + " _" + property.name + "  " + def_value.ensureEndsWith(";"));

                foreach (var l in inserts)
                {
                    AppendLine(l);
                }

                AppendLine("public " + property.relevantTypeName + " " + property.name + "");

                open(CodeBlockType.codeBlock);

                AppendGetSetBlock(property.name, true, true);

                close(CodeBlockType.codeBlock);
                break;
            }
        }
        /// <summary>Gets C# code lines to be inserted before property declaration</summary>
        /// <param name="property">The property.</param>
        /// <param name="flags">The flags.</param>
        /// <returns>List with C# code lines declaring attributes and XML documentation</returns>
        public static List <String> GetPropertyCodeInsertLines(this settingsPropertyEntry property, PropertyAppendFlags flags = PropertyAppendFlags.setAll)
        {
            List <String> inserts = new List <string>();

            if (flags.HasFlag(PropertyAppendFlags.setComponentModelAttributes))
            {
                inserts.Add($"[Category(\"{property.categoryName}\")]");
                inserts.Add($"[DisplayName(\"{property.displayName}\")]");
                inserts.Add($"[Description(\"{property.description}\")]");
            }

            if (flags.HasFlag(PropertyAppendFlags.setXmlSerializationAttributes))
            {
                if (property.IsXmlIgnore)
                {
                    inserts.Add($"[XmlIgnore]");
                }
            }

            if (flags.HasFlag(PropertyAppendFlags.setSCIReportingDefinitions))
            {
                if (!property.escapeValueString)
                {
                    inserts.Add($"[imb(imbAttributeName.reporting_escapeoff)]");
                }

                if (!property.letter.isNullOrEmpty())
                {
                    inserts.Add($"[imb(imbAttributeName.measure_letter, \"{property.letter}\")]");
                }

                if (!property.unit.isNullOrEmpty())
                {
                    inserts.Add($"[imb(imbAttributeName.measure_setUnit, \"{property.unit}\")]");
                }

                if (!property.format.isNullOrEmpty())
                {
                    inserts.Add($"[imb(imbAttributeName.reporting_valueformat, \"{property.format}\")]");
                }

                if (property.width != 0)
                {
                    inserts.Add($"[imb(imbAttributeName.reporting_columnWidth, {property.width})]");
                }

                if (property.isHiddenInReport)
                {
                    inserts.Add($"[imb(imbAttributeName.reporting_hide)]");
                }

                if (!property.color.isNullOrEmpty())
                {
                    inserts.Add($"[imb(imbAttributeName.basicColor, \"{property.color}\")]");
                }

                if (property.Alignment != textCursorZoneCorner.none)
                {
                    inserts.Add($"[imb(templateFieldDataTable.col_alignment, textCursorZoneCorner.{property.Alignment})]");
                }
            }



            if (flags.HasFlag(PropertyAppendFlags.setXmlDocumentation))
            {
                inserts.Add("/// <summary>");

                inserts.Add($"/// {property.description}");

                inserts.Add("/// </summary>");
            }

            return(inserts);
        }