/// <summary>
 /// 注册
 /// </summary>
 /// <param name="jsonConvert">json序列化接口</param>
 /// <param name="login">登录接口</param>
 /// <param name="url">接口地址</param>
 public static void Register(IJsonConvert jsonConvert,
                             ILogin login,
                             string url = "")
 {
     _jsonConvert = jsonConvert;
     if (!string.IsNullOrWhiteSpace(url))
     {
         _3rdHttp = url;
     }
     if (string.IsNullOrWhiteSpace(_3rdHttp))
     {
         throw new Exception("接口地址为空[AppSetting][3rdHttp]");
     }
     if (_logins.ContainsKey(_3rdHttp))
     {
         _logins[_3rdHttp] = login;
     }
     else
     {
         _logins.Add(_3rdHttp, login);
     }
     if (_token == null)
     {
         var appID = 0;
         if (System.Configuration.ConfigurationManager.AppSettings["AppID"] != null)
         {
             appID = Convert.ToInt32(System.Configuration.ConfigurationManager.AppSettings["AppID"]);
         }
         SetToken(GetLogin().Login(appID));
     }
 }
Exemple #2
0
 public Payment(IGateway gateway, IHttpClient httpClient, IJsonConvert jsonConvert)
 {
     this.gateway        = gateway;
     this.httpClient     = httpClient;
     this.jsonConvert    = jsonConvert;
     gateway.httpClient  = httpClient;
     gateway.jsonConvert = jsonConvert;
 }
 public ThingObserver(IJsonConvert convert,
                      ThingOption option,
                      ILogger <ThingObserver> logger)
 {
     _convert = convert ?? throw new ArgumentNullException(nameof(convert));
     _option  = option ?? throw new ArgumentNullException(nameof(option));
     _logger  = logger ?? throw new ArgumentNullException(nameof(logger));
 }
Exemple #4
0
        public static void RegisterObjectConvert <T>(
            IJsonConvert <T> convert)
        {
            ConvertFunc convert_wrapper =
                delegate(IJsonWrapper input) {
                return(convert.Convert(input));
            };

            custom_object_convert[typeof(T)] = convert_wrapper;
        }
Exemple #5
0
        public DefaultAuthProvider(IPasswordEncryptionProvider pwdEncrypt, IAuthEncryptionProvider authEncrypt, IRandomTextGenerator generator, IHostService host, IIdGenerator idGen, IJsonConvert jsonConvert
            , IRepository<ServerSession> repoSession, IRepository<User> repoUser, IRepository<Role> repoRole, IRepository<UserRole> repoUr, IRepository<RolePrivilege> repoRp)
        {
            this.pwdEncrypt = pwdEncrypt;
            this.authEncrypt = authEncrypt;
            this.generator = generator;
            this.host = host;
            this.idGen = idGen;
            this.jsonConvert = jsonConvert;

            this.repoSession = repoSession;
            this.repoUser = repoUser;
            this.repoRole = repoRole;
            this.repoUr = repoUr;
            this.repoRp = repoRp;
        }
Exemple #6
0
        public DefaultAuthProvider(IPasswordEncryptionProvider pwdEncrypt, IAuthEncryptionProvider authEncrypt, IRandomTextGenerator generator, IHostService host, IIdGenerator idGen, IJsonConvert jsonConvert
                                   , IRepository <ServerSession> repoSession, IRepository <User> repoUser, IRepository <Role> repoRole, IRepository <UserRole> repoUr, IRepository <RolePrivilege> repoRp)
        {
            this.pwdEncrypt  = pwdEncrypt;
            this.authEncrypt = authEncrypt;
            this.generator   = generator;
            this.host        = host;
            this.idGen       = idGen;
            this.jsonConvert = jsonConvert;

            this.repoSession = repoSession;
            this.repoUser    = repoUser;
            this.repoRole    = repoRole;
            this.repoUr      = repoUr;
            this.repoRp      = repoRp;
        }
Exemple #7
0
 public RedisClient(RedisConfig configuration)
     : base(configuration)
 {
     JsonConvert    = Configuration.JsonConvert ?? new JsonConvert();
     _configuration = configuration;
 }
 public DefaultController(IJsonConvert jsonConvert, IGateway gateway, IHttpClient httpClient)
 {
     this.httpClient  = httpClient;
     this.gateway     = gateway;
     this.jsonConvert = jsonConvert;
 }
 public HybridWebView(IJsonConvert jsonConvert)
 {
     this.jsonConvert       = jsonConvert;
     this.registeredActions = new Dictionary <string, Action <string> >();
 }
 public DefaultAccountProvider(IAuthEncryptionProvider encrypt, IJsonConvert jsonConvert)
 {
     this.encrypt = encrypt;
     this.jsonConvert = jsonConvert;
 }
Exemple #11
0
 public Program()
 {
     _convert = new AdapterClass();
 }
 public JsonConvertAttribute(Type Type)
 {
     jsonConvert = (IJsonConvert)Activator.CreateInstance(Type, null);
 }
Exemple #13
0
 public DefaultAccountProvider(IAuthEncryptionProvider encrypt, IJsonConvert jsonConvert)
 {
     this.encrypt     = encrypt;
     this.jsonConvert = jsonConvert;
 }
Exemple #14
0
 /// <summary>
 /// Initzializes a new instance of <see cref="Json"/>-class.
 /// </summary>
 /// <param name="jsonConvert">[Dependency] Underlying converter.</param>
 public Json(IJsonConvert jsonConvert)
 {
     JsonConvert = jsonConvert ?? throw new ArgumentNullException(nameof(jsonConvert));
 }