public static void getMolImg(ICswResources CswResources, MolDataReturn Return, MolData ImgData) { string molData = ImgData.molString; string nodeId = ImgData.nodeId; string base64String = ""; CswNbtResources NbtResources = (CswNbtResources)CswResources; if (String.IsNullOrEmpty(molData) && false == String.IsNullOrEmpty(nodeId)) //if we only have a nodeid, get the mol text from the mol property if there is one { CswPrimaryKey pk = CswConvert.ToPrimaryKey(nodeId); CswNbtNode node = NbtResources.Nodes[pk]; CswNbtMetaDataNodeTypeProp molNTP = node.getNodeType().getMolProperty(); if (null != molNTP) { molData = node.Properties[molNTP].AsMol.getMol(); } } if (false == String.IsNullOrEmpty(molData)) { //If the Direct Structure Search module is enabled, use the AcclDirect methods to generate an image. Otherwise, use the legacy code. byte[] bytes = (NbtResources.Modules.IsModuleEnabled(CswEnumNbtModuleName.DirectStructureSearch) ? NbtResources.AcclDirect.GetImage(molData) : CswStructureSearch.GetImage(molData)); base64String = Convert.ToBase64String(bytes); } ImgData.molImgAsBase64String = base64String; ImgData.molString = molData; Return.Data = ImgData; }
public static void ClearMolFingerprint(ICswResources CswResources, MolDataReturn Return, MolData Request) { //TODO: remove me CswNbtResources NbtResources = (CswNbtResources)CswResources; CswPrimaryKey pk = new CswPrimaryKey(); pk.FromString(Request.nodeId); }
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; }