/// <summary> /// /// </summary> /// <param name="clrName"></param> /// <returns></returns> public ITelegramBotCommand GetInternalCommandByClrName(string clrName) { var info = Infos.FirstOrDefault(s => s.CommandType == TelegramBotCommandType.InternalCommand && s.CommandClrName == clrName); return(GetCommandInstance(info)); }
/// <summary> /// /// </summary> /// <param name="commandId"></param> /// <returns></returns> public ITelegramBotCommand GetCallbackCommand(long commandId) { var info = Infos.FirstOrDefault(s => s.CommandType == TelegramBotCommandType.CallbackCommand && s.CommandId == commandId); return GetCommandInstance(info); }
/// <summary> /// /// </summary> /// <param name="clrName"></param> /// <returns></returns> public ITelegramBotCommand GetCallbackCommandByClrName(string clrName) { var info = Infos.FirstOrDefault(s => s.CommandType == TelegramBotCommandType.CallbackCommand && s.CommandClrName == clrName); return GetCommandInstance(info); }
/// <summary> /// /// </summary> /// <param name="name"></param> /// <param name="role"></param> /// <returns></returns> public TelegramBotCommandInfo GetPublicCommandInfo(string name, string role) { return(Infos.FirstOrDefault(s => s.CommandType == TelegramBotCommandType.PublicCommand && s.CommandName != null && s.CommandName.IsEqualName(name) && s.CommandRole != null && s.CommandRole.IsEqualRole(role))); }
public bool AlreadyExist(string startKey) { if (Infos == null) { Infos = new List <string>(); } return(Infos.FirstOrDefault(p => p.StartsWith(startKey)) == null); }
/// <summary> /// /// </summary> /// <param name="name"></param> /// <returns></returns> public ITelegramBotCommand GetCallbackCommand(string name) { var info = Infos.FirstOrDefault(s => s.CommandType == TelegramBotCommandType.CallbackCommand && s.CommandName != null && s.CommandName.IsEqualName(name)); return GetCommandInstance(info); }
/// <summary> /// /// </summary> /// <param name="clrName"></param> /// <returns></returns> public ITelegramBotCommand GetPublicOrInternalCommandByClrName(string clrName) { var info = Infos.FirstOrDefault(s => (s.CommandType == TelegramBotCommandType.PublicCommand || s.CommandType == TelegramBotCommandType.InternalCommand) && s.CommandName != null && s.CommandClrName == clrName); return(GetCommandInstance(info)); }
/// <summary> /// /// </summary> /// <param name="name"></param> /// <returns></returns> public ITelegramBotCommand GetPublicCommand(string name, string role) { var info = Infos.FirstOrDefault(s => s.CommandType == TelegramBotCommandType.PublicCommand && s.CommandName != null && s.CommandName.IsEqualName(name) && s.CommandRole != null && s.CommandRole.IsEqualRole(role)); return(GetCommandInstance(info)); }
public static int GetSpellID(SkillName name) { MasteryInfo info = Infos.FirstOrDefault(i => i.MasterySkill == name && i.Passive); if (info == null) { return(-1); } return(info.SpellID); }
public static PassiveSpell GetActivePassive(Mobile m) { if (m == null || m.Skills == null || Infos == null) { return(PassiveSpell.None); } SkillName mastery = m.Skills.CurrentMastery; MasteryInfo info = Infos.FirstOrDefault(i => i.Passive && i.MasterySkill == mastery && i.PassiveSpell != PassiveSpell.AnticipateHit); if (info != null) { return(info.PassiveSpell); } return(PassiveSpell.None); }
/// <summary> /// Build treeview for Oracle /// </summary> /// <returns>Collection of treeview items</returns> public override List <TreeViewItem> BuildTreeView() { List <TreeViewItem> res = new List <TreeViewItem>(); TreeViewItem tables = new TreeViewItem(); tables.Header = "Tables"; List <TableModel> models = Infos.FirstOrDefault()?.Tables; if (models != null) { foreach (TableModel model in models) { var item = new TreeViewItem { Header = model.Title }; SetupTreeViewItemContextMenu(item, model); tables.Items.Add(item); } } res.Add(tables); TreeViewItem diagrams = new TreeViewItem(); diagrams.Header = "Diagrams"; List <DiagramModel> diagramModels = Infos.FirstOrDefault()?.Diagrams; if (diagramModels != null) { foreach (DiagramModel model in diagramModels) { var item = new TreeViewItem { Header = model.Name }; SetupTreeViewItemDiagramContextMenu(item, model); diagrams.Items.Add(item); } } res.Add(diagrams); return(res); }
public void Register(string userId, long price, DateTime createdDate) { if (IsProcessed) { return; } var model = Infos?.FirstOrDefault(m => m.UserId.Equals(userId)); if (model == null) { model = new BidLastTimeInfo() { UserId = userId }; Infos.Add(model); } model.Price = price; model.CreatedDate = createdDate; model.RegisteredDate = DateTime.UtcNow; }
/// <summary> /// /// </summary> /// <param name="name"></param> /// <returns></returns> public TelegramBotCommandInfo GetBackCommandHandler(string name) { return(Infos.FirstOrDefault(s => s.CommandType == TelegramBotCommandType.BackCommand && s.CommandClrName == name)); }
public static MasteryInfo GetInfo(int spellID, SkillName name) { return(Infos.FirstOrDefault(info => info.SpellID == spellID && info.MasterySkill == name)); }
public static MasteryInfo GetInfo(int spellID) { return(Infos.FirstOrDefault(info => info.SpellID == spellID)); }
public static MasteryInfo GetInfo(Type spell, SkillName skill) { return(Infos.FirstOrDefault(info => info.SpellType == spell && info.MasterySkill == skill)); }
/// <summary>根据Format名称获取Format /// </summary> public static ImageFormat GetImageFormatByFormatName(string formatName) { var imageInfo = Infos.FirstOrDefault(x => string.Equals(x.FormatName, formatName, StringComparison.OrdinalIgnoreCase)); return(imageInfo?.ImageFormat ?? DefaultImageFormat()); }
/// <summary>根据图片格式获取扩展名 /// </summary> public static string GetExtensionByImageFormat(ImageFormat format) { return(Infos.FirstOrDefault(x => x.ImageFormat.Guid == format.Guid)?.FirstExtension() ?? DefaultExtension); }
/// <summary>根据Format名称获取扩展名 /// </summary> public static string GetExtensionByFormatName(string formatName) { return(Infos.FirstOrDefault(x => string.Equals(x.FormatName, formatName, StringComparison.OrdinalIgnoreCase))?.FirstExtension() ?? DefaultExtension); }
public BidLastTimeInfo GetByUserId(string userId) { return(Infos?.FirstOrDefault(m => m.UserId.Equals(userId))); }
/// <summary>根据Format获取Format名称 /// </summary> public static string GetFormatNameByImageFormat(ImageFormat format) { return(Infos.FirstOrDefault(x => x.ImageFormat.Guid == format.Guid)?.FormatName ?? DefaultFormatName); }
/// <summary>根据扩展名获取Format名称 /// </summary> public static string GetFormatNameByExtension(string extension) { var imageInfo = Infos.FirstOrDefault(x => x.Extensions.Any(c => string.Equals(c, extension, StringComparison.OrdinalIgnoreCase))); return(imageInfo?.FormatName ?? DefaultFormatName); }
/// <summary> /// /// </summary> /// <param name="commandType"></param> /// <returns></returns> public TelegramBotCommandInfo GetCommandInfo(Type commandType) { return(Infos.FirstOrDefault(s => s.ClrType == commandType)); }
/// <summary> /// /// </summary> /// <param name="clrName"></param> /// <returns></returns> public TelegramBotCommandInfo GetCommandInfoByClrName(string clrName) { return(Infos.FirstOrDefault(s => s.CommandClrName == clrName)); }