private static void ConvertHub(ArticyData articyData, HubType hub) { if (hub != null) { articyData.hubs.Add(hub.Id, new ArticyData.Hub(hub.Id, hub.TechnicalName, ConvertLocalizableText(hub.DisplayName), ConvertLocalizableText(hub.Text), ConvertFeatures(hub.Features), Vector2.zero, ConvertPins(hub.Pins))); } }
/// <summary> /// 显示一个英雄Hub /// </summary> /// <param name="type">Hub类型</param> public void ShowHeroHub(HubType type, ValueUnit value = null) { BaseBattleHeroHub hub = ObjectPool.Instance.GetComponentFromPool <BaseBattleHeroHub>(Name + "_Hub"); if (hub != null) { hub.ShowHubInfo(this, type, value); } }
public SystemType(string body) : base(body) { HubType = Body.Substring(10, 2) switch { "40" => HubType.BoostMoveHub, "41" => HubType.TwoPortHub, "42" => HubType.TwoPortHandset, _ => HubType.Unknown, }; }
public List <ArticleCard> GetArticleCardsFor(string landingPageSlug, HubType hubType) { var endpoint = _redisConnection.GetEndPoints()[0]; var server = _redisConnection.GetServer(endpoint); var articleCardKeys = server.Keys(pattern: "articleCard_*"); var articleCards = articleCardKeys.Select(articleCardKey => JsonConvert.DeserializeObject <ArticleCard>(_redisDatabase.StringGet(articleCardKey))).ToList(); return(articleCards.Where(ac => ac.HubType == hubType && ac.LandingPageSlug == landingPageSlug).ToList()); }
/// <summary> /// 根据Hub类型获取Hub属性 /// </summary> /// <param name="type">Hub类型</param> /// <returns>返回此Hub的信息</returns> protected override HeroHubInfo GetHubInfoByType(HubType type) { for (int i = 0; i < Hubs.Count; i++) { if (Hubs[i].type == type) { return(Hubs[i]); } } return(null); }
/// <summary> /// Creates a new instance. /// </summary> /// <param name="hubType">The type of hub to match.</param> /// <param name="logger">Optional logger for debugging.</param> public HubWatcher(HubType hubType, ILogger logger = null) { if (!Enum.IsDefined(typeof(HubType), hubType)) { throw new ArgumentOutOfRangeException(nameof(hubType)); } manfuacturerData = new byte[] { 0x00, 0x00, 0x00, 0x10, (byte)hubType, 0x02 }; watcher = new AdvertisementWatcher(BLEConnection.ServiceUuid); watcher.Received += Watcher_Received; this.logger = logger; ads = new Dictionary <BluetoothAddress, AdvertisementReceivedEventArgs>(); }
//creates the radio button for a hub type private RadioButton createHubType(HubType type, Panel panel) { RadioButton rbHub = new RadioButton(); rbHub.Content = string.Format("{0} ({1})", type.Name, new ValueCurrencyConverter().Convert(AirportHelpers.GetHubPrice(this.Airport, type))); rbHub.GroupName = "Hub"; rbHub.Tag = new KeyValuePair <HubType, Panel>(type, panel); rbHub.Checked += rbHub_Checked; rbHub.IsChecked = true; return(rbHub); }
public static List <string> GetConnectionId(string userId, HubType type) { List <string> idList = new List <string>(); if (UserDic != null) { User user = UserDic[userId]; if (user != null) { idList = user.MyConnDic.Where(d => d.Value.MyHubType == type).Select(d => d.Value.MyConnId).ToList(); } } return(idList); }
public async Task HandleEventAsync_SetsType(string systemTypeCode, HubType hubType) { var controllerMock = new Mock <IHubController>(); var legoHubMock = new Mock <ILegoHub>(); controllerMock.SetupGet(x => x.Hub).Returns(legoHubMock.Object); legoHubMock.SetupSet(x => x.HubType = hubType); var eventHandler = new SystemTypeUpdateHubTypeEventHandler(controllerMock.Object); await eventHandler.HandleEventAsync(new SystemType($"0000000000{systemTypeCode}")); controllerMock.VerifyAll(); controllerMock.VerifyNoOtherCalls(); legoHubMock.VerifyAll(); legoHubMock.VerifyNoOtherCalls(); }
internal Hub(string id, string name, HubType hubType) { this.Id = id; this.HubType = hubType; switch (hubType) { case HubType.Channel: this.Name = "#" + name; break; case HubType.DirectMessage: this.Name = "@" + name; break; default: this.Name = name; break; } }
public Hub Create(string name, string password, bool online, bool noAnonymousEnumUser = true, HubType hubType = HubType.Standalone, int maxSession = 0) { var hashPair = _softEther.CreateHashAnSecure(password); var requestData = new SoftEtherParameterCollection { { "HubName", name }, { "HashedPassword", hashPair.Hash }, { "SecurePassword", hashPair.SaltedHash }, { "Online", online }, { "MaxSession", maxSession }, { "NoEnum", noAnonymousEnumUser }, { "HubType", (int)hubType } }; var rawData = _softEther.CallMethod("CreateHub", requestData); return(Hub.Deserialize(rawData)); }
private void btnCreateHub_Click(object sender, RoutedEventArgs e) { HubType type = HubTypes.GetHubType(HubType.TypeOfHub.Hub);//(HubType)cbHubType.SelectedItem; if (AirportHelpers.GetHubPrice(this.Airport.Airport, type) > GameObject.GetInstance().HumanAirline.Money) { WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2212"), Translator.GetInstance().GetString("MessageBox", "2212", "message"), WPFMessageBoxButtons.Ok); } else { WPFMessageBoxResult result = WPFMessageBox.Show(Translator.GetInstance().GetString("MessageBox", "2213"), string.Format(Translator.GetInstance().GetString("MessageBox", "2213", "message"), AirportHelpers.GetHubPrice(this.Airport.Airport, type)), WPFMessageBoxButtons.YesNo); if (result == WPFMessageBoxResult.Yes) { this.Airport.addHub(new Hub(GameObject.GetInstance().HumanAirline, type)); AirlineHelpers.AddAirlineInvoice(GameObject.GetInstance().HumanAirline, GameObject.GetInstance().GameTime, Invoice.InvoiceType.Purchases, -AirportHelpers.GetHubPrice(this.Airport.Airport, type)); } } }
public bool Join(HubType groupName, string connectionId) { lock (Loginstate) { switch (groupName) { case HubType.Feeder: Groups.Add(connectionId, HubType.Feeder.ToString()); if (Feeders.IndexOf(connectionId) == -1) { Feeders.Add(connectionId); return(true); } break; case HubType.Listener: Groups.Add(connectionId, HubType.Listener.ToString()); if (Listeners.IndexOf(connectionId) == -1) { Listeners.Add(connectionId); return(true); } break; } return(false); } //if (Connections[connectionId] == null) //{ // Groups.Add(connectionId, groupName.ToString()); // Connections.Add(new Connection(connectionId, groupName), new TimeSpan(20, 0, 0)); // return true; //} //else //{ // return false; //} }
/// <summary> /// 显示一个Hub /// </summary> /// <param name="hero">为哪个英雄显示</param> /// <param name="type">Hub类型</param> /// <param name="life">生命值变化</param> /// <param name="magic">魔力值变化</param> public override void ShowHubInfo(HeroMono hero, HubType type, ValueUnit value = null) { HeroHubInfo info = GetHubInfoByType(type); if (info == null) { return; } TextHub.color = info.TextColor; TextHub.text = info.Name.Replace("[CRITICAL]", value.RealTempValue(0).ToString()); TextHub.text = TextHub.text.Replace("[LIFE]", value.RealTempValue(0).ToString()); TextHub.text = TextHub.text.Replace("[MAGIC]", value.RealTempValue(0).ToString()); TextHub.text = TextHub.text.Replace("[ATTACK]", value.RealTempValue(0).ToString()); TextHub.text = TextHub.text.Replace("[DEFENSE]", value.RealTempValue(0).ToString()); TextHub.text = TextHub.text.Replace("[MAGIC ATTACK]", value.RealTempValue(0).ToString()); TextHub.text = TextHub.text.Replace("[MAGIC DEFENSE]", value.RealTempValue(0).ToString()); TextHub.text = TextHub.text.Replace("[MAX LIFE]", value.RealTempValue(0).ToString()); TextHub.text = TextHub.text.Replace("[MAX MAGIC]", value.RealTempValue(0).ToString()); TextHub.text = TextHub.text.Replace("[SPEED]", value.RealTempValue(0).ToString()); this.transform.position = hero.HeroPosition; this.gameObject.SetActive(true); StartCoroutine(Show(this.transform.position)); }
public HubConfigurationModel(HubType type) { Type = type; }
/// <summary> /// Add WART dependency to IServiceCollection specifying the SignalR Hub type. /// </summary> /// <param name="services"></param> /// <param name="hubType"></param> /// <param name="tokenKey"></param> /// <returns></returns> public static IServiceCollection AddWartMiddleware(this IServiceCollection services, HubType hubType, string tokenKey = "") { if (hubType == HubType.NoAuthentication) { // use WART without authentication services.AddWartMiddleware(); } else { // use WART with JWT authentication services.AddJwtMiddleware(tokenKey); } return(services); }
public void AddHub(string id, string name, HubType hubType) => this.hubs[id] = new Hub(id, name, hubType);
/* public Dictionary<string, string> metadict { get { return _metadict; } } private Dictionary<string, string> _metadict; */ public Calinfo(string id) { var metadict = Metadata.LoadMetadataForIdFromAzureTable(id); try { this._id = id; if (metadict.ContainsKey("type") == false) { GenUtils.PriorityLogMsg("exception", "new calinfo: no hub type for id (" + id + ")", null); return; } this._contact = Configurator.GetStrSetting(metadict, Configurator.usersettings, "contact"); this._css = Configurator.GetUriSetting(metadict, Configurator.usersettings, "css").ToString(); this._default_image_html = Configurator.GetStrSetting(metadict, Configurator.usersettings, "default_img_html"); //this._has_descriptions = Configurator.GetBoolSetting(metadict, Configurator.usersettings, "descriptions"); this._has_descriptions = true; //this._has_locations = Configurator.GetBoolSetting(metadict, Configurator.usersettings, "locations"); this._has_locations = true; this._display_width = Configurator.GetStrSetting(metadict, Configurator.usersettings, "display_width"); // todo: obsolete this this._feed_count = Configurator.GetMetadictValueOrSettingsValue(metadict, Configurator.usersettings, "feed_count"); this._has_img = Configurator.GetBoolSetting(metadict, Configurator.usersettings, "header_image"); this._icalendar_horizon_days = Configurator.GetIntSetting(metadict, Configurator.usersettings, "icalendar_horizon_days"); this._img_url = Configurator.GetUriSetting(metadict, Configurator.usersettings, "img"); this._title = Configurator.GetTitleSetting(metadict, Configurator.usersettings, "title"); this._template_url = Configurator.GetUriSetting(metadict, Configurator.usersettings, "template"); //this._template_url = new Uri(Configurator.settings["template"]); this._twitter_account = Configurator.GetStrSetting(metadict, Configurator.usersettings, "twitter"); this._tzname = Configurator.GetStrSetting(metadict, Configurator.usersettings, "tz"); this._tzinfo = Utils.TzinfoFromName(this._tzname); this._use_rdfa = Configurator.GetBoolSetting(metadict, Configurator.usersettings, "use_rdfa"); this._use_x_wr_timezone = Configurator.GetBoolSetting(metadict, Configurator.usersettings, "use_x_wr_timezone"); //if (metadict.ContainsKey("where")) if (metadict["type"] == "where") { this._hub_enum = HubType.where; this._where = metadict[this.hub_enum.ToString()]; this._what = Configurator.nothing; //this._radius = metadict.ContainsKey("radius") ? Convert.ToInt16(metadict["radius"]) : Configurator.default_radius; this._radius = Configurator.GetIntSetting(metadict, Configurator.usersettings, "radius"); // enforce the default max radius if (this._radius > Configurator.max_radius) this._radius = Configurator.max_radius; this._population = Configurator.GetPopSetting(this.id, metadict, Configurator.usersettings, "population"); this._eventful = Configurator.GetBoolSetting(metadict, Configurator.usersettings, "eventful"); this._upcoming = Configurator.GetBoolSetting(metadict, Configurator.usersettings, "upcoming"); this._eventbrite = Configurator.GetBoolSetting(metadict, Configurator.usersettings, "eventbrite"); this._facebook = Configurator.GetBoolSetting(metadict, Configurator.usersettings, "facebook"); // curator gets to override the lat/lon that will otherwise be looked up based on the location // if (!metadict.ContainsKey("lat") && !metadict.ContainsKey("lon")) if ( GenUtils.KeyExistsAndHasValue(metadict, "lat") && GenUtils.KeyExistsAndHasValue(metadict, "lon") ) { this._lat = metadict["lat"]; this._lon = metadict["lon"]; } else { var apikeys = new Apikeys(); var lookup_lat = Utils.LookupLatLon(apikeys.bing_maps_key, this.where)[0]; var lookup_lon = Utils.LookupLatLon(apikeys.bing_maps_key, this.where)[1]; if (!String.IsNullOrEmpty(lookup_lat) && !String.IsNullOrEmpty(lookup_lon)) { this._lat = metadict["lat"] = lookup_lat; this._lon = metadict["lon"] = lookup_lon; Utils.UpdateLatLonToAzureForId(id, lookup_lat, lookup_lon); } } if (String.IsNullOrEmpty(this.lat) && String.IsNullOrEmpty(this.lon)) { GenUtils.PriorityLogMsg("warning", "Configurator: no lat and/or lon for " + id, null); } } // if (metadict.ContainsKey("what")) if (metadict["type"] == "what") { this._hub_enum = HubType.what; this._what = metadict[this.hub_enum.ToString()]; this._where = Configurator.nowhere; } if (metadict["type"] == "region") { this._hub_enum = HubType.region; this._what = Configurator.nothing; this._where = Configurator.nowhere; } } catch (Exception e) { GenUtils.PriorityLogMsg("exception", "new Calinfo: " + id, e.Message + e.StackTrace); } }
/// <summary> /// Use WART dependency to IApplicationBuilder. /// </summary> /// <param name="app"></param> /// <param name="hubName">The SignalR hub name</param> /// <param name="hubType"></param> /// <returns></returns> public static IApplicationBuilder UseWartMiddleware(this IApplicationBuilder app, string hubName, HubType hubType) { if (string.IsNullOrEmpty(hubName)) { throw new ArgumentNullException("Invalid hub name"); } if (hubType == HubType.NoAuthentication) { app.UseEndpoints(endpoints => { endpoints.MapControllers(); endpoints.MapHub <WartHub>($"/{hubName.Trim()}"); }); } else { app.UseJwtMiddleware(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); endpoints.MapHub <WartHubJwt>($"/{hubName.Trim()}"); }); } app.UseForwardedHeaders(); return(app); }
/// <summary> /// Use WART dependency to IApplicationBuilder. /// The default SignalR hub name is warthub. /// </summary> /// <param name="app"></param> /// <param name="hubType"></param> /// <returns></returns> public static IApplicationBuilder UseWartMiddleware(this IApplicationBuilder app, HubType hubType) { if (hubType == HubType.NoAuthentication) { app.UseEndpoints(endpoints => { endpoints.MapControllers(); endpoints.MapHub <WartHub>($"/{DefaultHubName}"); }); } else { app.UseJwtMiddleware(); app.UseEndpoints(endpoints => { endpoints.MapControllers(); endpoints.MapHub <WartHubJwt>($"/{DefaultHubName}"); }); } app.UseForwardedHeaders(); return(app); }
/// <summary> /// 显示一个Hub /// </summary> /// <param name="hero">为哪个英雄显示</param> /// <param name="type">Hub类型</param> /// <param name="value">数值变化</param> public virtual void ShowHubInfo(HeroMono hero, HubType type, ValueUnit value = null) { }
public MyConn(string userId, HubType type, string connId) { MyUserId = userId; MyHubType = type; MyConnId = connId; }
/// <summary> /// Sets up a listener on the defined channelId types (see <paramref name="hubs"/>) that the bot is a member of. The <paramref name="handler"/> /// is executed when an incoming message matches the given <paramref name="match"/>. /// Messages in <see cref="HubType.Channel"/> and <see cref="HubType.Group"/> are expected to /// contain the name of the bot before the handler will fire. /// </summary> /// <param name="match">Defines when to execute this handler</param> /// <param name="hubs">The Slack channels to listen on</param> /// <param name="handler">Function to be run when a message matches</param> /// <returns></returns> public IWhenHandler When(MessageMatcher match, HubType hubs, Func <IConversation, Task> handler) => this.When(match, hubs, Modes.None, handler);
public static List<string> LoadHubIdsFromAzureTableByType(HubType hub_type) { var type = hub_type.ToString(); var q = string.Format("$filter=type eq '{0}'",type); var ids = QueryIds(q); return ids; }
public HubEntidade(string idUsuario, string idConexao, HubType tipo) { IdUsuario = idUsuario; IdConexao = idConexao; Tipo = tipo; }
/* * public Dictionary<string, string> metadict * { get { return _metadict; } } * private Dictionary<string, string> _metadict; */ public Calinfo(string id) { this.timestamp = DateTime.UtcNow; var metadict = Metadata.LoadMetadataForIdFromAzureTable(id); try { this._id = id; if (metadict.ContainsKey("type") == false) { GenUtils.PriorityLogMsg("exception", "new calinfo: no hub type for id (" + id + ")", null); return; } this._contact = Configurator.GetStrSetting(metadict, Configurator.usersettings, "contact"); this._css = Configurator.GetUriSetting(metadict, Configurator.usersettings, "css").ToString(); this._default_image_html = Configurator.GetStrSetting(metadict, Configurator.usersettings, "default_img_html"); //this._has_descriptions = Configurator.GetBoolSetting(metadict, Configurator.usersettings, "descriptions"); this._has_descriptions = true; //this._has_locations = Configurator.GetBoolSetting(metadict, Configurator.usersettings, "locations"); this._has_locations = true; this._display_width = Configurator.GetStrSetting(metadict, Configurator.usersettings, "display_width"); // todo: obsolete this this._feed_count = Configurator.GetMetadictValueOrSettingsValue(metadict, Configurator.usersettings, "feed_count"); this._has_img = Configurator.GetBoolSetting(metadict, Configurator.usersettings, "header_image"); this._icalendar_horizon_days = Configurator.GetIntSetting(metadict, Configurator.usersettings, "icalendar_horizon_days"); this._img_url = Configurator.GetUriSetting(metadict, Configurator.usersettings, "img"); this._title = Configurator.GetTitleSetting(metadict, Configurator.usersettings, "title"); this._template_url = Configurator.GetUriSetting(metadict, Configurator.usersettings, "template"); //this._template_url = new Uri(Configurator.settings["template"]); this._twitter_account = Configurator.GetStrSetting(metadict, Configurator.usersettings, "twitter"); this._tzname = Configurator.GetStrSetting(metadict, Configurator.usersettings, "tz"); this._tzinfo = Utils.TzinfoFromName(this._tzname); this._use_rdfa = Configurator.GetBoolSetting(metadict, Configurator.usersettings, "use_rdfa"); this._use_x_wr_timezone = Configurator.GetBoolSetting(metadict, Configurator.usersettings, "use_x_wr_timezone"); //if (metadict.ContainsKey("where")) if (metadict["type"] == "where") { this._hub_enum = HubType.where; this._where = metadict[this.hub_enum.ToString()]; this._what = Configurator.nothing; //this._radius = metadict.ContainsKey("radius") ? Convert.ToInt16(metadict["radius"]) : Configurator.default_radius; this._radius = Configurator.GetIntSetting(metadict, Configurator.usersettings, "radius"); // enforce the default max radius if (this._radius > Configurator.max_radius) { this._radius = Configurator.max_radius; } this._population = Configurator.GetPopSetting(this.id, metadict, Configurator.usersettings, "population"); this._eventful = Configurator.GetBoolSetting(metadict, Configurator.usersettings, "eventful"); this._eventbrite = Configurator.GetBoolSetting(metadict, Configurator.usersettings, "eventbrite"); this._facebook = Configurator.GetBoolSetting(metadict, Configurator.usersettings, "facebook"); // curator gets to override the lat/lon that will otherwise be looked up based on the location // if (!metadict.ContainsKey("lat") && !metadict.ContainsKey("lon")) if (GenUtils.KeyExistsAndHasValue(metadict, "lat") && GenUtils.KeyExistsAndHasValue(metadict, "lon")) { this._lat = metadict["lat"]; this._lon = metadict["lon"]; } else { var apikeys = new Apikeys(); var lookup_lat = Utils.LookupLatLon(apikeys.bing_maps_key, this.where)[0]; var lookup_lon = Utils.LookupLatLon(apikeys.bing_maps_key, this.where)[1]; if (!String.IsNullOrEmpty(lookup_lat) && !String.IsNullOrEmpty(lookup_lon)) { this._lat = metadict["lat"] = lookup_lat; this._lon = metadict["lon"] = lookup_lon; Utils.UpdateLatLonToAzureForId(id, lookup_lat, lookup_lon); } } if (String.IsNullOrEmpty(this.lat) && String.IsNullOrEmpty(this.lon)) { GenUtils.PriorityLogMsg("warning", "Configurator: no lat and/or lon for " + id, null); } this.SetShowBadgesForHub(); } // if (metadict.ContainsKey("what")) if (metadict["type"] == "what") { this._hub_enum = HubType.what; this._what = metadict[this.hub_enum.ToString()]; this._where = Configurator.nowhere; this.SetShowBadgesForHub(); } if (metadict["type"] == "region") { this._hub_enum = HubType.region; this._what = Configurator.nothing; this._where = Configurator.nowhere; this.SetShowBadgesForRegion(); } } catch (Exception e) { GenUtils.PriorityLogMsg("exception", "new Calinfo: " + id, e.Message + e.StackTrace); } }