public ApiClient(Action<string> callback, string dllPath, bool overrideDll, bool isHft, string logsPath, ApiLogLevels logLevel) { if (callback == null) throw new ArgumentNullException("callback"); _callback = callback; if (overrideDll || !File.Exists(dllPath)) { dllPath.CreateDirIfNotExists(); (Environment.Is64BitProcess ? (isHft ? Resources.txcn64 : Resources.txmlconnector64) : (isHft ? Resources.txcn : Resources.txmlconnector)).Save(dllPath); } _api = new Api(dllPath, OnCallback); try { Directory.CreateDirectory(logsPath); using (var handle = _encoding.ToHGlobal(logsPath + "\0")) CheckErrorResult(_api.Initialize(handle.DangerousGetHandle(), (int)logLevel)); } catch (Exception) { _api.Dispose(); throw; } }