public GAttribute(string attr_name, GDataTypeEnum datatype, bool isuda, string primitive_name = null) { if (string.IsNullOrWhiteSpace(attr_name)) { throw new ArgumentNullException($"Имя атрибута не может быть пустым"); } if (string.IsNullOrWhiteSpace(primitive_name)) { throw new ArgumentNullException($"Имя примитива не может быть пустым"); } AttributeName = attr_name; PrimitiveName = primitive_name; DataType = datatype; IsUDA = isuda; if (PrimitiveName == null) { FullName = AttributeName; } else { FullName = $"{PrimitiveName}.{AttributeName}"; } if (InstanceName != null) { FullPath = $"{InstanceName}.{FullName}"; } else if (Template != null) { FullPath = $"{TemplateName}.{FullName}"; } else { throw new ArgumentException("Поля InstanceName и TemplateName не могут принимать значение однвременно."); } }
public static MxDataType GetMxDataType(GDataTypeEnum type) { switch (type) { #region Соответствие типов GDataTypeEnum -> MxDataType case GDataTypeEnum.Boolean: return(MxDataType.MxBoolean); case GDataTypeEnum.Integer: return(MxDataType.MxInteger); case GDataTypeEnum.Float: return(MxDataType.MxFloat); case GDataTypeEnum.Double: return(MxDataType.MxDouble); case GDataTypeEnum.String: return(MxDataType.MxString); case GDataTypeEnum.NoData: return(MxDataType.MxNoData); case GDataTypeEnum.Time: return(MxDataType.MxTime); case GDataTypeEnum.ElapsedTime: return(MxDataType.MxElapsedTime); case GDataTypeEnum.ReferenceType: return(MxDataType.MxReferenceType); case GDataTypeEnum.StatusType: return(MxDataType.MxStatusType); case GDataTypeEnum.DataTypeEnum: return(MxDataType.MxDataTypeEnum); case GDataTypeEnum.SecurityClassificationEnum: return(MxDataType.MxSecurityClassificationEnum); case GDataTypeEnum.DataQualityType: return(MxDataType.MxDataQualityType); case GDataTypeEnum.QualifiedEnum: return(MxDataType.MxQualifiedEnum); case GDataTypeEnum.QualifiedStruct: return(MxDataType.MxQualifiedStruct); case GDataTypeEnum.InternationalizedString: return(MxDataType.MxInternationalizedString); case GDataTypeEnum.BigString: return(MxDataType.MxBigString); case GDataTypeEnum.DataTypeEND: return(MxDataType.MxDataTypeEND); case GDataTypeEnum.Unknown: return(MxDataType.MxDataTypeUnknown); default: return(MxDataType.MxDataTypeUnknown); #endregion } }