Example #1
0
		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;
			}
		}
Example #2
0
 public void SetLogLevel(ApiLogLevels logLevel)
 {
     CheckErrorResult(_api.SetLogLevel((int)logLevel));
 }
Example #3
0
        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;
            }
        }
Example #4
0
		public void SetLogLevel(ApiLogLevels logLevel)
		{
			CheckErrorResult(_api.SetLogLevel((int)logLevel));
		}
Example #5
0
        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));
        }