Ejemplo n.º 1
0
        private void _addNodeTypeAttributes(CswNbtMetaDataNodeType NodeType, JObject ReturnVal)
        {
            CswEnumNbtObjectClass ObjectClass = NodeType.getObjectClassValue();
            string NtName = "nodetype_" + NodeType.NodeTypeId;

            ReturnVal[NtName]                  = new JObject();
            ReturnVal[NtName]["id"]            = NodeType.NodeTypeId;
            ReturnVal[NtName]["name"]          = NodeType.NodeTypeName;
            ReturnVal[NtName]["iconfilename"]  = CswNbtMetaDataObjectClass.IconPrefix16 + NodeType.IconFileName;
            ReturnVal[NtName]["objectclass"]   = ObjectClass.ToString();
            ReturnVal[NtName]["objectclassid"] = NodeType.ObjectClassId.ToString();

            switch (ObjectClass)
            {
            // This is expensive, and as far as I can tell, not used by anyone
            //case CswEnumNbtObjectClass.InspectionDesignClass:
            //    CswNbtMetaDataNodeTypeProp InspectionTargetNTP = NodeType.getNodeTypePropByObjectClassProp( CswNbtObjClassInspectionDesign.PropertyName.Target );
            //    ReturnVal[NtName]["targetnodetypeid"] = InspectionTargetNTP.FKValue.ToString();
            //    if( InspectionTargetNTP.FKType == CswEnumNbtViewPropIdType.NodeTypePropId.ToString() )
            //    {
            //        ReturnVal[NtName]["targetnodetypeid"] = InspectionTargetNTP.FKValue.ToString();
            //    }
            //    break;
            case CswEnumNbtObjectClass.NonChemicalClass:
            case CswEnumNbtObjectClass.ChemicalClass:
                ReturnVal["action"] = CswEnumNbtActionName.Create_Material;
                break;
            }
        }
Ejemplo n.º 2
0
 public CswNbtMetaDataNodeType makeTestNodeType(TestNodeTypeNamesFake TestNodeTypeNamesFake)
 {
     return(_CswNbtSchemaModTrnsctn.MetaData.makeNewNodeTypeDeprecated(TestObjectClassLocation.ToString(), _TestNodeTypeNamesFake[TestNodeTypeNamesFake], string.Empty));
 } //makeTestNodeType()
Ejemplo n.º 3
0
        // For validating object class casting
        protected static bool _Validate(CswNbtNode Node, CswEnumNbtObjectClass TargetObjectClass)
        {
            if (Node == null)
            {
                throw new CswDniException(CswEnumErrorType.Error, "Invalid node", "CswNbtObjClass._Validate was given a null node as a parameter");
            }

            if (!(Node.getObjectClass().ObjectClass == TargetObjectClass))
            {
                throw (new CswDniException(CswEnumErrorType.Error, "Invalid cast", "Can't cast current object class as " + TargetObjectClass.ToString() + "; Current object class is " + Node.getObjectClass().ObjectClass.ToString()));
            }
            return(true);
        }