} //threadCallBack() private void _generateCTab(CswNbtResources CswNbtResources, CswPrimaryKey NodePK) { CswNbtSdBlobData sdBlobData = new CswNbtSdBlobData(CswNbtResources); CswNbtNode node = CswNbtResources.Nodes.GetNode(NodePK); foreach (CswNbtNodePropWrapper molProp in node.Properties[(CswEnumNbtFieldType)CswEnumNbtFieldType.MOL]) { CswNbtNodePropMol AsMol = molProp.AsMol; string href; string error; string formatted; sdBlobData.saveMol(AsMol.getMol(), new CswPropIdAttr(node, AsMol.NodeTypeProp).ToString(), out href, out formatted, out error); } }
public static void SaveMolPropFile(ICswResources CswResources, MolDataReturn Return, MolData ImgData) { CswNbtResources NBTResources = (CswNbtResources)CswResources; string Href; CswNbtSdBlobData SdBlobData = new CswNbtSdBlobData(NBTResources); string FormattedMolString; string errorMsg; SdBlobData.saveMol(ImgData.molString, ImgData.propId, out Href, out FormattedMolString, out errorMsg); ImgData.molString = FormattedMolString; ImgData.href = Href; ImgData.errorMsg = errorMsg; Return.Data = ImgData; }
/// <summary> /// Add values to the NodeType Properties of a Node. /// </summary> /// <param name="Node">The Node whose properties are being filled in.</param> /// <param name="CurrentIndex">The current index in the ProductSize array in a CswC3Product object. This is ONLY needed for Size Nodes.</param> public void addNodeTypeProps(CswNbtNode Node, int CurrentIndex = 0) { CswNbtMetaDataNodeType NodeType = _CswNbtResources.MetaData.getNodeType(Node.NodeTypeId); foreach (CswNbtMetaDataNodeTypeProp NTP in NodeType.getNodeTypeProps()) { if (null != Node.Properties[NTP] && _Mappings.ContainsKey(NTP.PropName)) { C3Mapping C3Mapping = _Mappings[NTP.PropName]; switch (Node.Properties[NTP].getFieldTypeValue()) { case CswEnumNbtFieldType.MOL: if (false == string.IsNullOrEmpty(C3Mapping.C3ProductPropertyValue)) { string propAttr = new CswPropIdAttr(Node, NTP).ToString(); string molData = C3Mapping.C3ProductPropertyValue; CswNbtSdBlobData SdBlobData = new CswNbtSdBlobData(_CswNbtResources); MolecularGraph Mol = MoleculeBuilder.CreateMolFromString(molData); if (false == Mol.ContainsInvalidAtom()) { string Href; string FormattedMolString; string errorMsg; SdBlobData.saveMol(molData, propAttr, out Href, out FormattedMolString, out errorMsg, Node: Node); } else { _CswNbtResources.logMessage("Failed to save the MOL file for product with ProductId " + _ProductToImport.ProductId + " during the C3 import process because it contained an invalid atom."); } } break; default: CswNbtSubField SubField = NTP.getFieldTypeRule().SubFields[(CswEnumNbtPropColumn)C3Mapping.NBTSubFieldPropColName]; if (null != SubField) { Node.Properties[NTP].SetSubFieldValue(SubField, C3Mapping.C3ProductPropertyValue); } break; } } //if( null != Node.Properties[NTP] && _Mappings.ContainsKey( NTP.PropName ) ) } //foreach( CswNbtMetaDataNodeTypeProp NTP in NodeType.getNodeTypeProps() ) } //addNodeTypeProps()