using System; using System.Collections.Generic; using System.Linq; using System.Text; using Autodesk.Revit.DB; using Autodesk.Revit.UI; using Autodesk.Revit.DB.ExtensibleStorage; using System.Xml.Serialization; using System.Runtime.Serialization; using System.IO; namespace SchemaWrapperTools { /// /// A class to store schema field information /// [Serializable] public class FieldData { #region Constructors /// /// For serialization only -- Do not use. /// internal FieldData() { } /// /// Create a new FieldData object /// /// The name of the field /// The AssemblyQualifiedName of the Field's data type /// The unit type of the Field (set to UT_Undefined for non-floating point types public FieldData(string name, string typeIn, UnitType unit) : this(name, typeIn, unit, null) { } /// /// Create a new FieldData object /// /// The name of the field /// The AssemblyQualifiedName of the Field's data type /// The unit type of the Field (set to UT_Undefined for non-floating point types /// The SchemaWrapper of the field's subSchema, if the field is of type "Entity" public FieldData(string name, string typeIn, UnitType unit, SchemaWrapper subSchema) { m_Name = name; m_Type = typeIn; m_Unit = unit; m_SubSchema = subSchema; } #endregion #region Other helper functions public override string ToString() { StringBuilder strBuilder = new StringBuilder(); strBuilder.Append(" Field: "); strBuilder.Append(Name); strBuilder.Append(", "); strBuilder.Append(Type); strBuilder.Append(", "); strBuilder.Append(Unit.ToString()); if (SubSchema != null) { strBuilder.Append(Environment.NewLine + " " + SubSchema.ToString()); } return strBuilder.ToString(); } #endregion #region Properties /// /// The name of a schema field /// public string Name { get { return m_Name; } set { m_Name = value; } } /// /// The string representation of a schema field type (e.g. System.Int32) /// public string Type { get { return m_Type; } set { m_Type = value; } } /// /// The Unit type of the field /// public UnitType Unit { get { return m_Unit; } set { m_Unit = value; } } /// /// The SchemaWrapper of the field's sub-Schema, if is of type "Entity" /// public SchemaWrapper SubSchema { get { return m_SubSchema; } set { m_SubSchema = value; } } #endregion #region Data private SchemaWrapper m_SubSchema; private string m_Name; private string m_Type; private UnitType m_Unit; #endregion } }