private void btnzlSave_Click(object sender, EventArgs e) { ApiConfig config = new ApiConfig { ApiSupplier = "Hellotrue", ApiUserName = txtalzName.Text.Trim(), ApiUserPwd = txtalzPwd.Text.Trim(), RequestUrl = "http://api.hellotrue.com/api/do.php", UpdateTime = DateTime.Now, TokenValidity = DateTime.Now, CreateDate = DateTime.Now }; new ApiConfigBll().SaveApiConfig(config); }
public void SaveApiConfig(ApiConfig api) { try { using (var db = _dbFactory.OpenDbConnection()) { db.Save(api); } } catch (Exception ex) { LogServer.WriteLog(ex, "DBError"); } }
public void GetApiConfig(ApiConfig api) { try { using (var db = _dbFactory.OpenDbConnection()) { db.Single<ApiConfig>(c=>c.ApiId==api.ApiId); } } catch (Exception ex) { LogServer.WriteLog(ex, "DBError"); } }
public LeagueAPI(string Key, string region) { this.Config = new ApiConfig(); this.Config.APIKey = Key; this.Config.Region = region; this.Champions = new ChampionHandler(Config); this.CurrentGame = new CurrentGameHandler(Config); this.Games = new GameHandler(Config); this.Leagues = new LeagueHandler(Config); this.StaticData = new StaticDataHandler(Config); this.Match = new MatchHandler(Config); this.MatchHistory = new MatchHistoryHandler(Config); this.Stats = new StatsHandler(Config); this.Summoner = new SummonerHandler(Config); }
public SendMessageController(IAmazonSimpleNotificationService client, ApiConfig config, ILogger <SendMessageController> logger) { _client = client ?? throw new ArgumentNullException(nameof(client)); _config = config ?? throw new ArgumentNullException(nameof(config)); _logger = logger ?? throw new ArgumentNullException(nameof(logger)); }
public IdentityService(IHttpClient httpClient, ApiConfig apiConfig) { _apiClient = httpClient; _apiConfig = apiConfig; }
public DbService(IHostingEnvironment hostingEnvironment, ApiConfig apiConfig) { HostingEnvironment = hostingEnvironment; ApiConfig = apiConfig; }
/// <summary> /// Gets the global web api configuration /// </summary> /// <returns>Global configuration</returns> public virtual System.Web.Http.HttpConfiguration GetConfiguration() { return(ApiConfig.Register()); }
public RoadData(IOptions <ApiConfig> apiConfig, HttpClient httpClient) { _apiConfig = apiConfig.Value; _httpClient = httpClient; }
public void tearDown() { ApiConfig.unsetLocalhost(); }
/// <summary> /// Method to signthe signature base string. /// </summary> /// <param name="baseString"></param> /// <param name="KeyStore"></param> /// <returns></returns> public static string RsaSign(string baseString) { return(ApiConfig.getAuthentication().SignMessage(baseString)); }
public PagedController(ApiConfig config) : base(config) { PageSize = config.ConfigStore.GetConfigForController <int>(GetType()); }
public void Configure() { ApiConfig.Proto = "http"; ApiConfig.DomainSuffix = "localcb.com:8080"; ApiConfig.Configure("mannar-test", "__dev__FhJgi9KugVCv9yO8zosAFC11lYCEAufI"); }
public void setup() { ApiConfig.setP12("../../prod_key.p12", "password"); ApiConfig.setClientId("gVaoFbo86jmTfOB4NUyGKaAchVEU8ZVPalHQRLTxeaf750b6!414b543630362f426b4f6636415a5973656c33735661383d"); }
public NumberTriviaService(ApiConfig apiConfig) { _apiConfig = apiConfig; }
public void SaveApiConfig(ApiConfig api) { new ApiConfigDB().SaveApiConfig(api); }
public BaseServiceTests() { var config = new ApiConfig(); ApiClientAsync = new ApiClientAsync(config); }
public void UsesDefaultApiWebClient() { var apiConfig = new ApiConfig(); var apiClient = new PaliBot.ApiClient.ApiClient(apiConfig); }
public void Session_Fires() { var apiConfig = new ApiConfig(); apiConfig.Port = 1234; var mockApiWebClient = new Mock <IApiWebClient>(); mockApiWebClient.Setup(x => x.DownloadString($"http://127.0.0.1:{apiConfig.Port}/session")).Returns(SAMPLE_SESSION); var apiClient = new PaliBot.ApiClient.ApiClient(apiConfig, mockApiWebClient.Object); var sessionReset = new AutoResetEvent(false); var lastSession = (Session)null; apiClient.Session += (s, e) => { lastSession = e; sessionReset.Set(); }; // apiClient.Start(); sessionReset.WaitOne(); apiClient.Stop(); Assert.IsNotNull(lastSession); Assert.AreEqual("ajedi32", lastSession.client_name); Assert.AreEqual("0BD7D136-E487-11E8-9F32-F2801F1B9FD1", lastSession.sessionid); Assert.AreEqual("127.0.0.1", lastSession.sessionip); Assert.AreEqual("Echo_Arena_Private", lastSession.match_type); Assert.AreEqual("mpl_arena_a", lastSession.map_name); Assert.IsTrue(lastSession.private_match); Assert.IsTrue(lastSession.tournament_match); Assert.AreEqual(45.659531f, lastSession.game_clock); Assert.AreEqual("playing", lastSession.game_status); Assert.AreEqual("00:45.65", lastSession.game_clock_display); Assert.AreEqual(1, lastSession.orange_team_restart_request); Assert.AreEqual(1, lastSession.blue_team_restart_request); Assert.IsNotNull(lastSession.player); Assert.IsNotNull(lastSession.player.vr_left); Assert.AreEqual(3, lastSession.player.vr_left.Length); Assert.AreEqual(-0.99600005f, lastSession.player.vr_left[0]); Assert.AreEqual(0.1f, lastSession.player.vr_left[1]); Assert.AreEqual(-0.088000007f, lastSession.player.vr_left[2]); Assert.IsNotNull(lastSession.player.vr_position); Assert.AreEqual(3, lastSession.player.vr_position.Length); Assert.AreEqual(0.26900002f, lastSession.player.vr_position[0]); Assert.AreEqual(4.671f, lastSession.player.vr_position[1]); Assert.AreEqual(52.986004f, lastSession.player.vr_position[2]); Assert.IsNotNull(lastSession.player.vr_forward); Assert.AreEqual(3, lastSession.player.vr_forward.Length); Assert.AreEqual(0.088000007f, lastSession.player.vr_forward[0]); Assert.AreEqual(-0.001f, lastSession.player.vr_forward[1]); Assert.AreEqual(-0.99600005f, lastSession.player.vr_forward[2]); Assert.IsNotNull(lastSession.player.vr_up); Assert.AreEqual(3, lastSession.player.vr_up.Length); Assert.AreEqual(0.1f, lastSession.player.vr_up[0]); Assert.AreEqual(1.0f, lastSession.player.vr_up[1]); Assert.AreEqual(-0.001f, lastSession.player.vr_up[2]); Assert.IsNotNull(lastSession.pause); Assert.AreEqual("unpaused", lastSession.pause.paused_state); Assert.AreEqual("none", lastSession.pause.unpaused_team); Assert.AreEqual("none", lastSession.pause.paused_requested_team); Assert.AreEqual(1f, lastSession.pause.unpaused_timer); Assert.AreEqual(1f, lastSession.pause.paused_timer); Assert.AreEqual(9, lastSession.blue_points); Assert.AreEqual(5, lastSession.orange_points); Assert.IsNotNull(lastSession.possession); Assert.AreEqual(2, lastSession.possession.Length); Assert.AreEqual(1, lastSession.possession[0]); Assert.AreEqual(0, lastSession.possession[1]); Assert.IsNotNull(lastSession.disc); Assert.IsNotNull(lastSession.disc.position); Assert.AreEqual(3, lastSession.disc.position.Length); Assert.AreEqual(0f, lastSession.disc.position[0]); Assert.AreEqual(4.5360003f, lastSession.disc.position[1]); Assert.AreEqual(27.500002f, lastSession.disc.position[2]); Assert.IsNotNull(lastSession.disc.forward); Assert.AreEqual(3, lastSession.disc.forward.Length); Assert.AreEqual(0.001f, lastSession.disc.forward[0]); Assert.AreEqual(-0.001f, lastSession.disc.forward[1]); Assert.AreEqual(1.0f, lastSession.disc.forward[2]); Assert.IsNotNull(lastSession.disc.left); Assert.AreEqual(3, lastSession.disc.left.Length); Assert.AreEqual(1.0f, lastSession.disc.left[0]); Assert.AreEqual(0.001f, lastSession.disc.left[1]); Assert.AreEqual(-0.001f, lastSession.disc.left[2]); Assert.IsNotNull(lastSession.disc.up); Assert.AreEqual(3, lastSession.disc.up.Length); Assert.AreEqual(-0.001f, lastSession.disc.up[0]); Assert.AreEqual(1.0f, lastSession.disc.up[1]); Assert.AreEqual(0.001f, lastSession.disc.up[2]); Assert.IsNotNull(lastSession.disc.velocity); Assert.AreEqual(3, lastSession.disc.velocity.Length); Assert.AreEqual(1f, lastSession.disc.velocity[0]); Assert.AreEqual(2f, lastSession.disc.velocity[1]); Assert.AreEqual(3f, lastSession.disc.velocity[2]); Assert.AreEqual(1, lastSession.disc.bounce_count); Assert.IsNotNull(lastSession.last_score); Assert.AreEqual(1f, lastSession.last_score.disc_speed); Assert.AreEqual("blue", lastSession.last_score.team); Assert.AreEqual("[NO GOAL]", lastSession.last_score.goal_type); Assert.AreEqual(2, lastSession.last_score.point_amount); Assert.AreEqual(1f, lastSession.last_score.distance_thrown); Assert.AreEqual("[INVALID]", lastSession.last_score.person_scored); Assert.AreEqual("[INVALID]", lastSession.last_score.assist_scored); Assert.IsNotNull(lastSession.teams); Assert.AreEqual(1, lastSession.teams.Length); var team = lastSession.teams[0]; Assert.AreEqual("BLUE TEAM", team.team); Assert.IsTrue(team.possession); Assert.IsNotNull(team.stats); Assert.AreEqual(9, team.stats.points); Assert.AreEqual(132.18958f, team.stats.possession_time); Assert.AreEqual(1, team.stats.interceptions); Assert.AreEqual(1, team.stats.blocks); Assert.AreEqual(1, team.stats.steals); Assert.AreEqual(1, team.stats.catches); Assert.AreEqual(1, team.stats.passes); Assert.AreEqual(2, team.stats.saves); Assert.AreEqual(4, team.stats.goals); Assert.AreEqual(29, team.stats.stuns); Assert.AreEqual(2, team.stats.assists); Assert.AreEqual(7, team.stats.shots_taken); Assert.IsNotNull(team.players); Assert.AreEqual(1, team.players.Length); var player = team.players[0]; Assert.AreEqual("Bob", player.name); Assert.AreEqual(1, player.playerid); Assert.AreEqual(9221405949665979L, player.userid); Assert.AreEqual(16, player.level); Assert.AreEqual(88, player.number); Assert.AreEqual(20, player.ping); Assert.IsTrue(player.possession); Assert.IsTrue(player.stunned); Assert.IsTrue(player.blocking); Assert.IsTrue(player.invulnerable); Assert.IsNotNull(player.lhand); Assert.AreEqual(3, player.lhand.pos.Length); Assert.AreEqual(0.88000005f, player.lhand.pos[0]); Assert.AreEqual(4.4900002f, player.lhand.pos[1]); Assert.AreEqual(-50.889004f, player.lhand.pos[2]); Assert.AreEqual(3, player.lhand.forward.Length); Assert.AreEqual(0.12100001f, player.lhand.forward[0]); Assert.AreEqual(0.55900002f, player.lhand.forward[1]); Assert.AreEqual(0.82000005f, player.lhand.forward[2]); Assert.AreEqual(3, player.lhand.left.Length); Assert.AreEqual(0.88800007f, player.lhand.left[0]); Assert.AreEqual(0.30800003f, player.lhand.left[1]); Assert.AreEqual(-0.34100002f, player.lhand.left[2]); Assert.AreEqual(3, player.lhand.up.Length); Assert.AreEqual(-0.44300002f, player.lhand.up[0]); Assert.AreEqual(0.77000004f, player.lhand.up[1]); Assert.AreEqual(-0.45900002f, player.lhand.up[2]); Assert.IsNotNull(player.rhand); Assert.AreEqual(3, player.rhand.pos.Length); Assert.AreEqual(0.57600003f, player.rhand.pos[0]); Assert.AreEqual(4.4050002f, player.rhand.pos[1]); Assert.AreEqual(-50.778004f, player.rhand.pos[2]); Assert.AreEqual(3, player.rhand.forward.Length); Assert.AreEqual(-0.82000005f, player.rhand.forward[0]); Assert.AreEqual(-0.45500001f, player.rhand.forward[1]); Assert.AreEqual(0.34800002f, player.rhand.forward[2]); Assert.AreEqual(3, player.rhand.left.Length); Assert.AreEqual(0.333f, player.rhand.left[0]); Assert.AreEqual(0.116f, player.rhand.left[1]); Assert.AreEqual(0.93600005f, player.rhand.left[2]); Assert.AreEqual(3, player.rhand.up.Length); Assert.AreEqual(-0.46600002f, player.rhand.up[0]); Assert.AreEqual(0.88300002f, player.rhand.up[1]); Assert.AreEqual(0.056000002f, player.rhand.up[2]); Assert.IsNotNull(player.head); Assert.AreEqual(3, player.head.position.Length); Assert.AreEqual(0.65900004f, player.head.position[0]); Assert.AreEqual(4.7800002f, player.head.position[1]); Assert.AreEqual(-51.256004f, player.head.position[2]); Assert.AreEqual(3, player.head.forward.Length); Assert.AreEqual(-0.043000001f, player.head.forward[0]); Assert.AreEqual(-0.0070000002f, player.head.forward[1]); Assert.AreEqual(0.99900007f, player.head.forward[2]); Assert.AreEqual(3, player.head.left.Length); Assert.AreEqual(0.99700004f, player.head.left[0]); Assert.AreEqual(0.062000003f, player.head.left[1]); Assert.AreEqual(0.043000001f, player.head.left[2]); Assert.AreEqual(3, player.head.up.Length); Assert.AreEqual(-0.062000003f, player.head.up[0]); Assert.AreEqual(0.99800003f, player.head.up[1]); Assert.AreEqual(0.0050000004f, player.head.up[2]); Assert.IsNotNull(player.body); Assert.AreEqual(3, player.body.position.Length); Assert.AreEqual(0.65900004f, player.body.position[0]); Assert.AreEqual(4.7800002f, player.body.position[1]); Assert.AreEqual(-51.256004f, player.body.position[2]); Assert.AreEqual(3, player.body.forward.Length); Assert.AreEqual(0.039000001f, player.body.forward[0]); Assert.AreEqual(0.001f, player.body.forward[1]); Assert.AreEqual(0.99900007f, player.body.forward[2]); Assert.AreEqual(3, player.body.left.Length); Assert.AreEqual(0.99900007f, player.body.left[0]); Assert.AreEqual(-0.001f, player.body.left[1]); Assert.AreEqual(-0.039000001f, player.body.left[2]); Assert.AreEqual(3, player.body.up.Length); Assert.AreEqual(0.001f, player.body.up[0]); Assert.AreEqual(1.0f, player.body.up[1]); Assert.AreEqual(-0.001f, player.body.up[2]); Assert.IsNotNull(player.velocity); Assert.AreEqual(3, player.velocity.Length); Assert.AreEqual(1.1f, player.velocity[0]); Assert.AreEqual(2.2f, player.velocity[1]); Assert.AreEqual(3.3f, player.velocity[2]); Assert.IsNotNull(player.stats); Assert.AreEqual(5, player.stats.points); Assert.AreEqual(78.645569f, player.stats.possession_time); Assert.AreEqual(1, player.stats.interceptions); Assert.AreEqual(1, player.stats.blocks); Assert.AreEqual(1, player.stats.steals); Assert.AreEqual(1, player.stats.catches); Assert.AreEqual(1, player.stats.passes); Assert.AreEqual(1, player.stats.saves); Assert.AreEqual(1, player.stats.goals); Assert.AreEqual(14, player.stats.stuns); Assert.AreEqual(1, player.stats.assists); Assert.AreEqual(5, player.stats.shots_taken); }
public ApiDownloadService(ILogger <ApiDownloadService> logger, IOptions <ApiConfig> apiConfig) : base(logger) { _apiConfig = apiConfig.Value; }
public ApiGateway(ApiConfig config) { _config = config; }
public CompareController(ICompareService service, IOptions <ApiConfig> configuration) { _service = service; _configuration = configuration.Value; }
public ReadService(HttpClient http, ApiConfig config, ITokenSource tokenSource) { _http = http; _config = config; _tokenSource = tokenSource; }
public OrderReadEndPoint(HttpClient http, ApiConfig config, ITokenSource tokenSource) : base(http, config, tokenSource) { }
public ReadServiceFactory(HttpClient http, ApiConfig config) { _http = http; _config = config; }
public WeatherDataService(ApiConfig config) { Config = config; }
public RuntimeEnvironmentController(ApiConfig config, ILogger <RuntimeEnvironmentController> logger) { _config = config; _logger = logger; }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { this.securitySettings = ApiConfig.GetSecuritySettings(Configuration); services.AddCors(options => { options.AddPolicy(name: EmpWebOrigins, builder => { builder .AllowAnyHeader() // .WithHeaders(HeaderNames.AccessControlAllowHeaders, "Content-Type") // .AllowAnyOrigin() .WithOrigins( securitySettings.AllowedCorsOrigins.ToArray() ) .AllowAnyMethod(); // .WithMethods("GET", "PUT", "POST", "DELETE"); }); }); services .AddAuthentication(IdentityServerAuthenticationDefaults.AuthenticationScheme) .AddIdentityServerAuthentication(options => { options.Authority = securitySettings.StsAuthority; options.ApiName = securitySettings.ApiName; options.RequireHttpsMetadata = false; }); services.AddResponseCaching(); services.AddMvc(options => { var policy = new AuthorizationPolicyBuilder() .RequireAuthenticatedUser() .Build(); options.Filters.Add(new AuthorizeFilter(policy)); }); services.AddControllers(); // Make MySql Connection Service // TO DO: Create factory to return DB connection by ASYNC var encConnStrMySqlEmployees = Configuration.GetConnectionString("MySqlEmployees(Azure)"); var connStrMySqlEmployees = AesCryptoUtil.Decrypt(encConnStrMySqlEmployees); Log.Information($"Connection String: {connStrMySqlEmployees}"); services.AddDbContext <EmployeesContext>(builder => builder.UseMySQL(connStrMySqlEmployees) ); EnsureDatabaseExists <EmployeesContext>(connStrMySqlEmployees); services.AddTransient <EmployeesDataSeeder>(); var encConnStrMySqlSts = Configuration.GetConnectionString("MySqlSts(Azure)"); var connStrMySqlSts = AesCryptoUtil.Decrypt(encConnStrMySqlSts); services.AddDbContext <StsContext>(builder => builder.UseMySQL(connStrMySqlSts) ); EnsureDatabaseExists <StsContext>(connStrMySqlSts); services.AddScoped <IRepository <DeptManager>, DeptManagerRepository>(); services.AddScoped <IRepository <VwDeptManagerDetail>, DeptManagerDetailRepository>(); services.AddScoped <IRepository <Departments>, DepartmentsRepository>(); services.AddScoped <IRepository <VwDeptEmpCurrent>, DeptEmpRepository>(); services.AddScoped <IRepository <VwDeptManagerCurrent>, DeptManagerCurrentRepository>(); services.AddScoped <IRepository <VwEmpDetails>, EmployeeDetailRepository>(); services.AddScoped <IRepository <VwEmpDetailsShort>, EmployeeDetailShortRepository>(); services.AddScoped <IRepository <Employees>, EmployeeRepository>(); services.AddScoped <IRepository <VwTitlesCurrent>, TitleRepository>(); services.AddScoped <IRepository <DistinctTitles>, DistinctTitleRepository>(); services.AddScoped <IRepository <DistinctGenders>, DistinctGenderRepository>(); services.AddScoped <IRepository <VwSalariesCurrent>, SalaryRepository>(); services.AddScoped <IRepository <Aspnetusers>, AspnetUsersRepository>(); services.AddScoped <IUnitOfWorkEmployees, UnitOfWorkEmployees>(); services.AddScoped <IUnitOfWorkSts, UnitOfWorkSts>(); }
public TileBuilderFactory(ApiConfig config) { _config = config; }
private static List <Autenticacao> ObterAutenticacao(ApiConfig config) { var autenticacao = ApiService.ObterAutenticacao(config); return(autenticacao); }
/// <summary> /// Initializes a new instance of the <see cref="LeagueHandler"/> class. /// </summary> /// <param name="conf">The conf.</param> public StatsHandler(ApiConfig conf) : base(conf) { //Initializes RequestHandler and sets the api config in the base constructor. }
public Startup(IConfiguration configuration) { Configuration = configuration; ApiConfig.LoadMessagesTemplate(); }
public EmployeeController(ApiConfig myConfiguration) { _myConfiguration = myConfiguration; }
public LoLRequestUtil(ApiConfig config) { this.Config = config; }
internal GitHubProvider(ProviderConfig config, IRestClientFactory restClientFactory, string defaultRedirectTemplate, string defaultCallbackTemplate) : base(config, defaultRedirectTemplate, defaultCallbackTemplate) { _apiDetails = config.Api; _restClientFactory = restClientFactory; }
public IDataHandler(ApiConfig config) { this.Config = config; this.RequestHandler = new LoLRequestUtil(config); }
public PostsApiService(IHttpClient httpClient, ApiConfig apiConfig) { _apiClient = httpClient; _apiConfig = apiConfig; }
public TokenQueryHandler(IOptions <ApiConfig> config) { _config = config.Value; }
/// <summary> /// 设置接口 /// </summary> /// <param name="m">接口模型</param> public void Set(ApiConfig m) { m.Change(); RegexDict.AddOrSet(m.Path, m); }