protected override bool OnInit() { var succ = init2?.Invoke(DllPath, 0); var inited = succ ?? init(DllPath); return(inited == 0); }
protected override void Initialize(string libraryPath) { try { _end = Loader.LoadFunction <eg_end>("eg_end"); _translate = Loader.LoadFunction <eg_translate_multi>("eg_translate_multi"); } catch (Exception e) { throw new Exception($"Could not load functions from LEC library '{libraryPath}'.", e); } try { _init2 = Loader.LoadFunction <eg_init2>("eg_init2"); } catch { try { _init = Loader.LoadFunction <eg_init>("eg_init"); } catch (Exception e) { throw new Exception($"Could not load functions from LEC library '{libraryPath}'.", e); } } var directory = Path.GetDirectoryName(libraryPath) + Path.DirectorySeparatorChar; var initializationCode = _init2?.Invoke(directory, 0); if (initializationCode == null) { initializationCode = _init(directory); } if (initializationCode != 0) { throw new Exception($"Could not initialize LEC library. Received code '{initializationCode}'."); } }