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; using System.ComponentModel; namespace SchemaWrapperTools { /// /// A class to store a list of FieldData objects as well as the top level data (name, access levels, SchemaId, etc..) /// of an Autodesk.Revit.DB.ExtensibleStorage.Schema /// [Serializable] public class SchemaDataWrapper { #region Constructors /// /// For serialization only -- Do not use. /// internal SchemaDataWrapper() { } /// /// Create a new SchemaDataWrapper /// /// The Guid of the Schema /// The access level for read permission /// The access level for write permission /// The user-registered vendor ID string /// The application ID from the application manifest /// The name of the schema /// Descriptive details on the schema public SchemaDataWrapper(Guid schemaId, AccessLevel readAccess, AccessLevel writeAccess, string vendorId, string applicationId, string name, string documentation) { DataList = new System.Collections.Generic.List(); SchemaId = schemaId.ToString(); ReadAccess = readAccess; WriteAccess = writeAccess; VendorId = vendorId; ApplicationId = applicationId; Name = name; Documentation = documentation; } #endregion #region Data addition /// /// Adds a new field to the wrapper's list of fields. /// /// the name of the field /// the data type of the field /// 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 void AddData(string name, System.Type typeIn, UnitType unit, SchemaWrapper subSchema) { m_DataList.Add(new FieldData(name, typeIn.FullName, unit, subSchema)); } #endregion #region Properties /// /// The list of FieldData objects in the wrapper /// public List DataList { get { return m_DataList; } set { m_DataList = value; } } /// /// The schemaId Guid of the Schema /// public string SchemaId { get { return m_schemaId; } set { m_schemaId = value; } } /// /// The read access of the Schema /// public AccessLevel ReadAccess { get { return m_ReadAccess; } set { m_ReadAccess = value; } } /// /// The write access of the Schema /// public AccessLevel WriteAccess { get { return m_WriteAccess; } set { m_WriteAccess = value; } } /// /// Vendor Id /// public string VendorId { get { return m_vendorId; } set { m_vendorId = value; } } /// /// Application Id /// public string ApplicationId { get { return m_applicationId; } set { m_applicationId = value; } } /// /// The documentation string for the schema /// public string Documentation { get { return m_Documentation; } set { m_Documentation = value; } } /// /// The name of the schema /// public string Name { get { return m_Name; } set { m_Name = value; } } #endregion #region Data private AccessLevel m_ReadAccess; private AccessLevel m_WriteAccess; private System.Collections.Generic.List m_DataList; private string m_applicationId; private string m_schemaId; private string m_vendorId; private string m_Name; private string m_Documentation; #endregion } }