示例#1
0
        public static NInchiInputData GetInputFromAuxInfo(string auxInfo)
        {
            if (auxInfo == null)
            {
                throw new ArgumentNullException(nameof(auxInfo), "Null AuxInfo");
            }

            var native_output = new InchiInpData();
            var iiii          = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(Inchi_Input)));

            try
            {
                native_output.pInp = iiii;

                int ret;
                ret = Get_inchi_Input_FromAuxInfo(auxInfo, 0, 0, out native_output);

                NInchiInput  oos = new NInchiInput();
                Inchi_Input *pii = (Inchi_Input *)native_output.pInp.ToPointer();
                {
                    CreateAtoms(oos, pii->num_atoms, pii->atom);
                    CreateBonds(oos, pii->num_atoms, pii->atom);
                    CreateStereos(oos, pii->num_stereo0D, pii->stereo0D);
                }

                var oo = new NInchiInputData(ret, oos, native_output.bChiral, new string(native_output.szErrMsg));
                return(oo);
            }
            finally
            {
                Free_inchi_Input((Inchi_Input *)iiii.ToPointer());
            }
        }
示例#2
0
 public void TestAuxinfo2Input()
 {
     // START SNIPPET: auxinfo2input
     NInchiInputData data = NInchiWrapper.GetInputFromAuxInfo("AuxInfo=1/1/N:4,1,2,3,5,6/"
                                                              + "E:(5,6)/it:im/rA:6CCNCOO/rB:s1;N1;s1;s2;d2;/rC:264,968,0;295,985,0;233,986,0;"
                                                              + "264,932,0;326,967,0;295,1021,0;");
     InChIReturnCode ret   = data.ReturnStatus;
     NInchiInput     input = data.Input;
     // END SNIPPET: auxinfo2input
 }