public static string GetInChI(ref InChIStrucInput inp, out int retCode) { InChIStringOutput output = new InChIStringOutput(); string ret; // Console.WriteLine("try getinchi starting"); try { retCode = GetInChI(ref inp, out output); ret = output.InChI; } finally { output.Dispose(); } return(ret); }
public static string GetInChIKey(ref InChIStrucInput inp) { var retCode = GetInChI(ref inp, out InChIStringOutput output); if (retCode != 0) { throw new ApplicationException($"GetInChI returned code {retCode}. Internal error: {output.ErrorMessage}"); } try { sbyte *inchiKeyPtr = stackalloc sbyte[28]; retCode = GetInChIKey(output.inchi, inchiKeyPtr); if (retCode != 0) { throw new ApplicationException($"GetInChIKey returned code {retCode}"); } return(new string(inchiKeyPtr, 0, 27)); } finally { output.Dispose(); } }
public static string GetInChI(ref InChIStrucInput inp) => GetInChI(ref inp, out int ret);
public static extern int GetInChI(ref InChIStrucInput structData, out InChIStringOutput output);