/// <summary>
        /// Сохранить настройки.
        /// </summary>
        /// <param name="storage">Хранилище настроек.</param>
        public override void Save(SettingsStorage storage)
        {
            storage.SetValue("Login", Login);
            storage.SetValue("Password", Password);
            storage.SetValue("Address", Address.To <string>());
            storage.SetValue("DllPath", DllPath);
            storage.SetValue("ApiLogsPath", ApiLogsPath);
            storage.SetValue("ApiLogLevel", ApiLogLevel.To <string>());
            storage.SetValue("IsHFT", IsHFT);
            storage.SetValue("MarketDataInterval", MarketDataInterval);

            storage.SetValue("HasProxy", Proxy != null);

            if (Proxy != null)
            {
                storage.SetValue("ProxyAddress", Proxy.Address.To <string>());
                storage.SetValue("ProxyLogin", Proxy.Login);
                storage.SetValue("ProxyPassword", Proxy.Password);
                storage.SetValue("ProxyType", Proxy.Type.To <string>());
            }

            // не нужно сохранять это свойство, так как иначе окно смены пароля будет показывать каждый раз
            //storage.SetValue("ChangePasswordOnConnect", ShowChangePasswordWindowOnConnect);

            storage.SetValue("MicexRegisters", MicexRegisters);
            storage.SetValue("OverrideDll", OverrideDll);

            base.Save(storage);
        }
Exemple #2
0
        private static LogLevel FromAPILogLevelToLogLevel(ApiLogLevel apiLogLevel)
        {
            switch (apiLogLevel)
            {
            case ApiLogLevel.Trace:
                return(LogLevel.Trace);

            case ApiLogLevel.Debug:
                return(LogLevel.Debug);

            case ApiLogLevel.Information:
                return(LogLevel.Information);

            case ApiLogLevel.Warning:
                return(LogLevel.Warning);

            case ApiLogLevel.Error:
                return(LogLevel.Error);

            case ApiLogLevel.Critical:
                return(LogLevel.Critical);;

            case ApiLogLevel.None:
                return(LogLevel.None);

            default:
                return(LogLevel.None);
            }
        }
Exemple #3
0
        private static void SetCustomerLogLevel(LogsForCustomer customerId, ApiLogLevel defaultLogLevel)
        {
            var logLevel     = defaultLogLevel;
            var custLogLevel = GetCustLogeLevelsFromJson().Where(cust => cust.CustomerId == customerId).SingleOrDefault();

            if (custLogLevel != null)
            {
                logLevel = custLogLevel.LogLevel;
                CustomLogLevels.GetLogLevel.MinimumLevel = FromApiLogLevelToLogEventLevel(logLevel);
            }
        }
Exemple #4
0
        private static LogLevel GetCustomerLogLevel_1(LogsForCustomer customerId, ApiLogLevel defaultLogLevel)
        {
            var logLevel     = defaultLogLevel;
            var custLogLevel = GetCustLogeLevelsFromJson().Where(cust => cust.CustomerId == customerId).SingleOrDefault();

            if (custLogLevel != null)
            {
                logLevel = custLogLevel.LogLevel;
            }

            return(FromAPILogLevelToLogLevel(logLevel));
        }
Exemple #5
0
        public static void Emit <T>(this ILogger <T> @this, LogsForCustomer custEventId,
                                    ApiLogLevel apiLogLevel, Exception exception,
                                    string message, params object[] args)
        {
            var i          = (int)Convert.ChangeType(custEventId, custEventId.GetTypeCode());
            var eventName  = Enum.GetName(custEventId.GetType(), custEventId);
            var eventScope = custEventId.GetType().Name;

            SetCustomerLogLevel(custEventId, apiLogLevel);
            var parameters = args.Append(eventScope).Append(eventName).ToArray();
            var lvl        = GetCustomerLogLevel_1(custEventId, apiLogLevel);

            @this.Log(lvl, i, exception, message + " (Event scope: {eventScope}, name: {eventName})", parameters);
        }
Exemple #6
0
 public ApiLogMessage(string message, ApiLogLevel level)
 {
     Message = message;
     Level   = level;
 }