コード例 #1
0
ファイル: ApiClient.cs プロジェクト: hbwjz/StockSharp
		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;
			}
		}
コード例 #2
0
 public void SetLogLevel(ApiLogLevels logLevel)
 {
     CheckErrorResult(_api.SetLogLevel((int)logLevel));
 }
コード例 #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;
            }
        }
コード例 #4
0
ファイル: ApiClient.cs プロジェクト: hbwjz/StockSharp
		public void SetLogLevel(ApiLogLevels logLevel)
		{
			CheckErrorResult(_api.SetLogLevel((int)logLevel));
		}
コード例 #5
0
ファイル: ApiClient.cs プロジェクト: sanjeev8800/stocksharp
        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));
        }