Beispiel #1
0
        /// <summary> Returns the XML string to save this element and its data to the template XML file </summary>
        /// <param name="indent"> Indent to use for each line </param>
        /// <returns>String for template XML file</returns>
        public string To_Template_XML(string indent)
        {
            // Get the innner data
            string inner_data = Inner_Write_Data();

            // Build the result
            StringBuilder results = new StringBuilder();

            // Start out the elements line
            results.Append(indent + "<element type=\"" + Element_Type_Convertor.ToString(Type) + "\"");

            // Add the subtype, if there is one.
            if (display_subtype.Length > 0)
            {
                results.Append(" subtype=\"" + Display_SubType + "\"");
            }

            // If this element is just being used as a constant, x will be less than 0
            if (!isConstant)
            {
                // Add location and dimension to this
                results.Append(" x=\"" + Location.X + "\"");
                results.Append(" y=\"" + Location.Y + "\"");
                results.Append(" width=\"" + Width + "\"");
                results.Append(" height=\"" + Height + "\"");

                // Add repeatable if it is
                if (Repeatable)
                {
                    results.Append(" repeatable=\"true\"");
                }

                // Add mandatory if it is
                if (Mandatory)
                {
                    results.Append(" mandatory=\"true\"");
                }
            }

            if (inner_data.Length == 0)
            {
                // Finish off the first line
                results.Append(" />\r\n");
            }
            else
            {
                results.Append(">\r\n");
                results.Append(indent + "\t<element_data>\r\n");
                results.Append(indent + "\t\t" + inner_data);
                results.Append(indent + "\t</element_data>\r\n");
                results.Append(indent + "</element>\r\n");
            }

            // Return the string
            return(results.ToString());
        }
Beispiel #2
0
 /// <summary> Gets the element object associated with the provided type </summary>
 /// <param name="Type">Element type</param>
 /// <param name="SubType"> Subtype for this element</param>
 /// <returns>Correct element object</returns>
 public static abstract_Element getElement(string Type, string SubType)
 {
     return(getElement(Element_Type_Convertor.ToType(Type), SubType));
 }
Beispiel #3
0
 /// <summary> Gets the element object associated with the provided type </summary>
 /// <param name="Type">Element type</param>
 /// <returns>Correct element object</returns>
 public static abstract_Element getElement(string Type)
 {
     return(getElement(Element_Type_Convertor.ToType(Type), String.Empty));
 }