// // (C) Copyright 2003-2019 by Autodesk, Inc. All rights reserved. // // Permission to use, copy, modify, and distribute this software in // object code form for any purpose and without fee is hereby granted // provided that the above copyright notice appears in all copies and // that both that copyright notice and the limited warranty and // restricted rights notice below appear in all supporting // documentation. // // AUTODESK PROVIDES THIS PROGRAM 'AS IS' AND WITH ALL ITS FAULTS. // AUTODESK SPECIFICALLY DISCLAIMS ANY IMPLIED WARRANTY OF // MERCHANTABILITY OR FITNESS FOR A PARTICULAR USE. AUTODESK, INC. // DOES NOT WARRANT THAT THE OPERATION OF THE PROGRAM WILL BE // UNINTERRUPTED OR ERROR FREE. // // Use, duplication, or disclosure by the U.S. Government is subject to // restrictions set forth in FAR 52.227-19 (Commercial Computer // Software - Restricted Rights) and DFAR 252.227-7013(c)(1)(ii) // (Rights in Technical Data and Computer Software), as applicable. 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, ForgeTypeId spec) : this(name, typeIn, spec, 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, ForgeTypeId spec, SchemaWrapper subSchema) { m_Name = name; m_Type = typeIn; m_Spec = spec; 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(Spec.TypeId); 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 ForgeTypeId Spec { get { return m_Spec; } set { m_Spec = 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 ForgeTypeId m_Spec; #endregion } }