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; } }
public void SetLogLevel(ApiLogLevels logLevel) { CheckErrorResult(_api.SetLogLevel((int)logLevel)); }
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; } }
public ApiClient(Action <string> callback, string dllPath, bool isHft, string path, ApiLogLevels logLevel) { if (callback == null) { throw new ArgumentNullException("callback"); } _callback = callback; //esper: если сначала запускаем 32 битную, а потом 64, то коннектор не работает. //if (!File.Exists(dllPath)) //{ dllPath.CreateDirIfNotExists(); (Environment.Is64BitProcess ? (isHft ? Resources.txcn64 : Resources.txmlconnector64) : (isHft ? Resources.txcn : Resources.txmlconnector)).Save(dllPath); //} _api = new Api(dllPath, OnCallback); using (var handle = _encoding.ToHGlobal(path)) CheckErrorResult(_api.Initialize(handle.DangerousGetHandle(), (int)logLevel)); }