public static void Main(string[] args) { IUnityContainer container = new UnityContainer(); ProjectContainer.RegisterElements(container); if (GetHelp(args)) { IHelp help = container.Resolve <IHelp>(); help.Write(); System.Environment.Exit(-1); } else { IGenerateFiles generateFiles = container.Resolve <IGenerateFiles>(); bool isRun = generateFiles.Run(); if (isRun) { System.Environment.Exit(0); } else { System.Environment.Exit(-1); } } }
public Program(string name, bool isCaseSensitive = false, bool useProgramNamePrefix = true) { Utils.Debug("initializing program..."); _cogs = new Dictionary <string, Cog>(); // Adding default convertors _convertors = new Dictionary <Type, Convertor>(); _convertors.Add(typeof(bool), new BooleanConvertor()); _convertors.Add(typeof(byte), new Convertor(typeof(byte))); _convertors.Add(typeof(sbyte), new Convertor(typeof(sbyte))); _convertors.Add(typeof(char), new Convertor(typeof(char))); _convertors.Add(typeof(decimal), new Convertor(typeof(decimal))); _convertors.Add(typeof(double), new Convertor(typeof(double))); _convertors.Add(typeof(float), new Convertor(typeof(float))); _convertors.Add(typeof(int), new Convertor(typeof(int))); _convertors.Add(typeof(uint), new Convertor(typeof(uint))); _convertors.Add(typeof(long), new Convertor(typeof(long))); _convertors.Add(typeof(ulong), new Convertor(typeof(ulong))); _convertors.Add(typeof(short), new Convertor(typeof(short))); _convertors.Add(typeof(ushort), new Convertor(typeof(ushort))); Name = name; IsCaseSensitive = isCaseSensitive; UseProgramNamePrefix = useProgramNamePrefix; Splitter = new DefaultSplitter(); Help = new DefaultHelp(); Utils.Debug( $"Program: {Name}\nIsCaseSensitive: {IsCaseSensitive.ToString()}" + $"\nUseProgramNamePrefix: {UseProgramNamePrefix.ToString()}" ); }
public void ShowHelp(IHelp ih) { title.text = ih.title; description.text = ih.description; gameObject.SetActive(true); CancelHelp(); }
/// <summary> /// Parses input parameters and finds the correct service and command handler for executing the command. /// </summary> /// <param name="input"> /// User input from command line arguments, split into list of parameters separated by space. /// Commands are structured as follows: [command] [subCommand] [options] /// </param> /// <returns>A commandHandler that can execute the command given by user input</returns> private ISubCommandHandler ProcessArgs(string[] input) { ISubCommandHandler subCommandHandler = ServiceProvider.GetServices <ISubCommandHandler>() .FirstOrDefault(s => string.Equals(s.Name, input[1], StringComparison.OrdinalIgnoreCase) && string.Equals(s.CommandProvider, input[0], StringComparison.OrdinalIgnoreCase)); if (subCommandHandler != null) { subCommandHandler.BuildSelectableCommands(); subCommandHandler.DictOptions = ParseArguments(input); OptionBuilder.Instance(_logger).AssignValueToCliOptions(subCommandHandler); return(subCommandHandler); } // No command found, find help command to display help. IHelp helpService = ServiceProvider.GetServices <IHelp>().FirstOrDefault(); if (helpService != null) { helpService.GetHelp(); } else { _logger.LogError("Help is not found"); } return(null); }
public ActionResult Edit(long id, AddEditHelpDataViewModel vModel) { ApplicationUser authedUser = UserManager.FindById(User.Identity.GetUserId()); IHelp obj = TemplateCache.Get <IHelp>(id); string message; if (obj == null) { message = "That does not exist"; return(RedirectToAction("Index", new { Message = message })); } obj.Name = vModel.DataObject.Name; obj.HelpText = vModel.DataObject.HelpText; if (obj.Save(authedUser.GameAccount, authedUser.GetStaffRank(User))) { LoggingUtility.LogAdminCommandUsage("*WEB* - EditHelpFile[" + obj.Id.ToString() + "]", authedUser.GameAccount.GlobalIdentityHandle); message = "Edit Successful."; } else { message = "Error; Edit failed."; } return(RedirectToAction("Index", new { Message = message })); }
/// <summary> /// List all commands belonging to a specified object /// </summary> /// <param name="input">Object, that can be converted to an IHelp object</param> public void ListAll(object input) { IHelp ihObject = (IHelp)input; if (!File.Exists(ihObject.HelpFile)) { return; } using (System.Xml.XmlReader xml = System.Xml.XmlReader.Create(ihObject.HelpFile)) { while (xml.Read()) { if (xml.IsEmptyElement) { continue; } if (xml.IsStartElement()) { string element = xml.Name; if (element.StartsWith("cmd_")) { string command = element.Substring(4); command = command.Replace(".", " "); xml.Read(); string exp = xml.Value; console.Write(command + " - " + exp + "\r\n"); } } } } console.WriteLine("For more detailed help type: help [command_name], to read the required parameters!"); }
public RootLuisDialog() { _greeting = new GreetingService(); _help = new HelpService(); _actions = new List <IAction> { new FacturaService(), new ContratoService(), new ConsumoService() }; }
public HomeController(IUserStore iuserstore, IBady ibady, ILog ilog, ISetting isetting, IMoney imoney, IUser iuser, IPrice ipirce, IHelp ihelp) { this.iuserstore = iuserstore; this.ibady = ibady; this.ilog = ilog; this.isetting = isetting; this.imoney = imoney; this.iuser = iuser; this.iprice = ipirce; this.ihelp = ihelp; }
public AdminController(IUser iuser, ISetting isetting, ILog ilog, IPrice iprice, INotice inotice, IRequestMoney irequestmoney, IMoney imoney, IHelp ihelp, IUserAccount iuseraccount) { this.iuser = iuser; this.isetting = isetting; this.ilog = ilog; this.iprice = iprice; this.inotice = inotice; this.irequestmoney = irequestmoney; this.imoney = imoney; this.ihelp = ihelp; this.iuseraccount = iuseraccount; }
public Help() { //初始化ASP.NET内置对象 Response = System.Web.HttpContext.Current.Response; Request = System.Web.HttpContext.Current.Request; Server = System.Web.HttpContext.Current.Server; Session = System.Web.HttpContext.Current.Session; Application = System.Web.HttpContext.Current.Application; tools = ToolsFactory.CreateTools(); MyBLL = HelpFactory.CreateHelp(); cate = new HelpCate(); }
public ActionResult Remove(long removeId = -1, string authorizeRemove = "", long unapproveId = -1, string authorizeUnapprove = "") { string message; if (!string.IsNullOrWhiteSpace(authorizeRemove) && removeId.ToString().Equals(authorizeRemove)) { ApplicationUser authedUser = UserManager.FindById(User.Identity.GetUserId()); IHelp obj = TemplateCache.Get <IHelp>(removeId); if (obj == null) { message = "That does not exist"; } else if (obj.Remove(authedUser.GameAccount, authedUser.GetStaffRank(User))) { LoggingUtility.LogAdminCommandUsage("*WEB* - RemoveHelp[" + removeId.ToString() + "]", authedUser.GameAccount.GlobalIdentityHandle); message = "Delete Successful."; } else { message = "Error; Removal failed."; } } else if (!string.IsNullOrWhiteSpace(authorizeUnapprove) && unapproveId.ToString().Equals(authorizeUnapprove)) { ApplicationUser authedUser = UserManager.FindById(User.Identity.GetUserId()); IHelp obj = TemplateCache.Get <IHelp>(unapproveId); if (obj == null) { message = "That does not exist"; } else if (obj.ChangeApprovalStatus(authedUser.GameAccount, authedUser.GetStaffRank(User), ApprovalState.Unapproved)) { LoggingUtility.LogAdminCommandUsage("*WEB* - UnapproveHelp[" + unapproveId.ToString() + "]", authedUser.GameAccount.GlobalIdentityHandle); message = "Unapproval Successful."; } else { message = "Error; Unapproval failed."; } } else { message = "You must check the proper remove or unapprove authorization radio button first."; } return(RedirectToAction("Index", new { Message = message })); }
public Commands( IMovement movement, IRoomActions roomActions, IDebug debug, ISkills skills, ISpells spells, IObject objects, IInventory inventory, Icommunication communication, IEquip equipment, IScore score, ICombat combat, ICache cache, ISocials socials, ICommandHandler commandHandler, ICore core, IMobFunctions mobFunctions, IHelp help, IMobScripts mobScripts, ICrafting crafting, ICooking cooking, IUtilSkills utilSkills, IPassiveSkills passiveSkills, IHealer healer ) { _movement = movement; _roomActions = roomActions; _debug = debug; _skills = skills; _spells = spells; _object = objects; _inventory = inventory; _communication = communication; _equipment = equipment; _score = score; _combat = combat; _cache = cache; _socials = socials; _commandHandler = commandHandler; _core = core; _mobFunctions = mobFunctions; _help = help; _mobScripts = mobScripts; _crafting = crafting; _cooking = cooking; _utilSkills = utilSkills; _passiveSkills = passiveSkills; _healer = healer; }
public ActionResult Edit(long id, string ArchivePath = "") { IHelp obj = TemplateCache.Get <IHelp>(id); if (obj == null) { return(RedirectToAction("Index", new { Message = "That does not exist" })); } AddEditHelpDataViewModel vModel = new AddEditHelpDataViewModel(ArchivePath, obj) { AuthedUser = UserManager.FindById(User.Identity.GetUserId()) }; return(View("~/Views/GameAdmin/Help/Edit.cshtml", vModel)); }
public static void Main(string[] args) { IUnityContainer container = new UnityContainer(); ProjectContainer.RegisterElements(container); if (GetHelp(args)) { IHelp help = container.Resolve <IHelp>(); help.Write(); System.Environment.Exit(-1); } else { IBaseClient baseClient = container.Resolve <IBaseClient>(); baseClient.Run(); } }
//private U_ILinksApplication MyApplication; public CMS() { //初始化ASP.NET内置对象 Response = System.Web.HttpContext.Current.Response; Request = System.Web.HttpContext.Current.Request; Server = System.Web.HttpContext.Current.Server; Session = System.Web.HttpContext.Current.Session; Application = System.Web.HttpContext.Current.Application; Webnotice = NoticeFactory.CreateNotice(); tools = ToolsFactory.CreateTools(); MyHelpCate = HelpFactory.CreateHelpCate(); MyHelp = HelpFactory.CreateHelp(); MyAbout = AboutFactory.CreateAbout(); mylink = FriendlyLinkFactory.CreateFriendlyLink(); pub = new Public_Class(); mylinkcate = FriendlyLinkFactory.CreateFriendlyLinkCate(); MyNoticeCate = NoticeFactory.CreateNoticeCate(); // MyApplication = U_LinksApplicationFactory.CreateU_LinksApplication(); }
public ActionResult Add(AddEditHelpDataViewModel vModel) { ApplicationUser authedUser = UserManager.FindById(User.Identity.GetUserId()); IHelp newObj = vModel.DataObject; string message; if (newObj.Create(authedUser.GameAccount, authedUser.GetStaffRank(User)) == null) { message = "Error; Creation failed."; } else { LoggingUtility.LogAdminCommandUsage("*WEB* - AddHelpFile[" + newObj.Id.ToString() + "]", authedUser.GameAccount.GlobalIdentityHandle); message = "Creation Successful."; } return(RedirectToAction("Index", new { Message = message })); }
// pass the next object in the chain // public FrontEnd(IHelp help) { this._successor = help; }
// pass the next object in the chain // public IntermediateLayer(IHelp help) { this._successor = help; }
public void SetIHelp(IHelp iHelp) { this.contextMenu.HelpPlugin = iHelp; }
internal void InitializePlugins(Screen screen) { AvailablePlugin plugin = Plugin.Plugins.AvailablePlugins.Find("HelpPlugin"); if ((plugin != null) && (plugin.Instance is IHelp)) { this.HelpPlugin = plugin.Instance as IHelp; this.HelpPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); this.HelpPlugin.SetScreen(screen); screen.PluginList.Add(this.HelpPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("PersonDetailPlugin"); if ((plugin != null) && (plugin.Instance is IPersonDetail)) { this.PersonDetailPlugin = plugin.Instance as IPersonDetail; this.PersonDetailPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); this.PersonDetailPlugin.SetScreen(screen); screen.PluginList.Add(this.PersonDetailPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("TroopDetailPlugin"); if ((plugin != null) && (plugin.Instance is ITroopDetail)) { this.TroopDetailPlugin = plugin.Instance as ITroopDetail; this.TroopDetailPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); this.TroopDetailPlugin.SetScreen(screen); screen.PluginList.Add(this.TroopDetailPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("ArchitectureDetailPlugin"); if ((plugin != null) && (plugin.Instance is IArchitectureDetail)) { this.ArchitectureDetailPlugin = plugin.Instance as IArchitectureDetail; this.ArchitectureDetailPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); this.ArchitectureDetailPlugin.SetScreen(screen); screen.PluginList.Add(this.ArchitectureDetailPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("FactionTechniquesPlugin"); if ((plugin != null) && (plugin.Instance is IFactionTechniques)) { this.FactionTechniquesPlugin = plugin.Instance as IFactionTechniques; this.FactionTechniquesPlugin.SetScreen(screen); this.FactionTechniquesPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); screen.PluginList.Add(this.FactionTechniquesPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("TreasureDetailPlugin"); if ((plugin != null) && (plugin.Instance is ITreasureDetail)) { this.TreasureDetailPlugin = plugin.Instance as ITreasureDetail; this.TreasureDetailPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); this.TreasureDetailPlugin.SetScreen(screen); screen.PluginList.Add(this.TreasureDetailPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("ConmentTextPlugin"); if ((plugin != null) && (plugin.Instance is IConmentText)) { this.ConmentTextPlugin = plugin.Instance as IConmentText; this.ConmentTextPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); screen.PluginList.Add(this.ConmentTextPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("ArchitectureSurveyPlugin"); if ((plugin != null) && (plugin.Instance is IArchitectureSurvey)) { this.ArchitectureSurveyPlugin = plugin.Instance as IArchitectureSurvey; this.ArchitectureSurveyPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); screen.PluginList.Add(this.ArchitectureSurveyPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("TroopSurveyPlugin"); if ((plugin != null) && (plugin.Instance is ITroopSurvey)) { this.TroopSurveyPlugin = plugin.Instance as ITroopSurvey; this.TroopSurveyPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); screen.PluginList.Add(this.TroopSurveyPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("ContextMenuPlugin"); if ((plugin != null) && (plugin.Instance is IGameContextMenu)) { this.ContextMenuPlugin = plugin.Instance as IGameContextMenu; this.ContextMenuPlugin.SetScreen(screen); this.ContextMenuPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); this.ContextMenuPlugin.SetIHelp(this.HelpPlugin); screen.PluginList.Add(this.ContextMenuPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("GameFramePlugin"); if ((plugin != null) && (plugin.Instance is IGameFrame)) { this.GameFramePlugin = plugin.Instance as IGameFrame; this.GameFramePlugin.SetScreen(screen); this.GameFramePlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); screen.PluginList.Add(this.GameFramePlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("ScreenBlindPlugin"); if ((plugin != null) && (plugin.Instance is IScreenBlind)) { this.ScreenBlindPlugin = plugin.Instance as IScreenBlind; this.ScreenBlindPlugin.SetScreen(screen); this.ScreenBlindPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); screen.PluginList.Add(this.ScreenBlindPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("MapViewSelectorPlugin"); if ((plugin != null) && (plugin.Instance is IMapViewSelector)) { this.MapViewSelectorPlugin = plugin.Instance as IMapViewSelector; this.MapViewSelectorPlugin.SetScreen(screen); this.MapViewSelectorPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); this.MapViewSelectorPlugin.SetGameFrame(this.GameFramePlugin); screen.PluginList.Add(this.MapViewSelectorPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("TabListPlugin"); if ((plugin != null) && (plugin.Instance is ITabList)) { this.TabListPlugin = plugin.Instance as ITabList; this.TabListPlugin.SetScreen(screen); this.TabListPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); this.TabListPlugin.SetPersonDetailDialog(this.PersonDetailPlugin); this.TabListPlugin.SetTroopDetailDialog(this.TroopDetailPlugin); this.TabListPlugin.SetArchitectureDetailDialog(this.ArchitectureDetailPlugin); this.TabListPlugin.SetFactionTechniquesDialog(this.FactionTechniquesPlugin); this.TabListPlugin.SetTreasureDetailDialog(this.TreasureDetailPlugin); this.TabListPlugin.SetGameFrame(this.GameFramePlugin); this.TabListPlugin.SetMapViewSelector(this.MapViewSelectorPlugin); screen.PluginList.Add(this.TabListPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("OptionDialogPlugin"); if ((plugin != null) && (plugin.Instance is IOptionDialog)) { this.OptionDialogPlugin = plugin.Instance as IOptionDialog; this.OptionDialogPlugin.SetScreen(screen); this.OptionDialogPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); screen.PluginList.Add(this.OptionDialogPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("SimpleTextDialogPlugin"); if ((plugin != null) && (plugin.Instance is ISimpleTextDialog)) { this.SimpleTextDialogPlugin = plugin.Instance as ISimpleTextDialog; this.SimpleTextDialogPlugin.SetScreen(screen); this.SimpleTextDialogPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); screen.PluginList.Add(this.SimpleTextDialogPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("tupianwenziPlugin"); if ((plugin != null) && (plugin.Instance is Itupianwenzi)) { this.tupianwenziPlugin = plugin.Instance as Itupianwenzi; this.tupianwenziPlugin.SetScreen(screen); this.tupianwenziPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); this.tupianwenziPlugin.SetContextMenu(this.ContextMenuPlugin); screen.PluginList.Add(this.tupianwenziPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("ConfirmationDialogPlugin"); if ((plugin != null) && (plugin.Instance is IConfirmationDialog)) { this.ConfirmationDialogPlugin = plugin.Instance as IConfirmationDialog; this.ConfirmationDialogPlugin.SetScreen(screen); this.ConfirmationDialogPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); screen.PluginList.Add(this.ConfirmationDialogPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("ToolBarPlugin"); if ((plugin != null) && (plugin.Instance is IToolBar)) { this.ToolBarPlugin = plugin.Instance as IToolBar; this.ToolBarPlugin.SetScreen(screen); this.ToolBarPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); this.ToolBarPlugin.SetContextMenuPlugin(this.ContextMenuPlugin); screen.PluginList.Add(this.ToolBarPlugin.Instance as GameObject); } if (this.ToolBarPlugin != null) { plugin = Plugin.Plugins.AvailablePlugins.Find("DateRunnerPlugin"); if ((plugin != null) && (plugin.Instance is IDateRunner)) { this.DateRunnerPlugin = plugin.Instance as IDateRunner; this.DateRunnerPlugin.SetScreen(screen); this.DateRunnerPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); this.DateRunnerPlugin.SetGameDate(screen.Scenario.Date); this.ToolBarPlugin.AddTool(this.DateRunnerPlugin.ToolInstance); screen.PluginList.Add(this.DateRunnerPlugin.Instance as GameObject); } } if (this.ToolBarPlugin != null) { plugin = Plugin.Plugins.AvailablePlugins.Find("GameRecordPlugin"); if ((plugin != null) && (plugin.Instance is IGameRecord)) { this.GameRecordPlugin = plugin.Instance as IGameRecord; this.GameRecordPlugin.SetScreen(screen); this.GameRecordPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); this.ToolBarPlugin.AddTool(this.GameRecordPlugin.ToolInstance); screen.PluginList.Add(this.GameRecordPlugin.Instance as GameObject); } } if (this.ToolBarPlugin != null) { plugin = Plugin.Plugins.AvailablePlugins.Find("MapLayerPlugin"); if ((plugin != null) && (plugin.Instance is IMapLayer)) { this.MapLayerPlugin = plugin.Instance as IMapLayer; this.MapLayerPlugin.SetScreen(screen); this.MapLayerPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); this.ToolBarPlugin.AddTool(this.MapLayerPlugin.ToolInstance); screen.PluginList.Add(this.MapLayerPlugin.Instance as GameObject); } } if (this.ToolBarPlugin != null) { plugin = Plugin.Plugins.AvailablePlugins.Find("GameSystemPlugin"); if ((plugin != null) && (plugin.Instance is IGameSystem)) { this.GameSystemPlugin = plugin.Instance as IGameSystem; this.GameSystemPlugin.SetScreen(screen); this.GameSystemPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); this.GameSystemPlugin.SetOptionDialog(this.OptionDialogPlugin); this.ToolBarPlugin.AddTool(this.GameSystemPlugin.ToolInstance); screen.PluginList.Add(this.GameSystemPlugin.Instance as GameObject); } } if (this.ToolBarPlugin != null) { plugin = Plugin.Plugins.AvailablePlugins.Find("AirViewPlugin"); if ((plugin != null) && (plugin.Instance is IAirView)) { this.AirViewPlugin = plugin.Instance as IAirView; this.AirViewPlugin.SetScreen(screen); this.AirViewPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); this.ToolBarPlugin.AddTool(this.AirViewPlugin.ToolInstance); screen.PluginList.Add(this.AirViewPlugin.Instance as GameObject); } } plugin = Plugin.Plugins.AvailablePlugins.Find("PersonPortraitPlugin"); if ((plugin != null) && (plugin.Instance is IPersonPortrait)) { this.PersonPortraitPlugin = plugin.Instance as IPersonPortrait; this.PersonPortraitPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); screen.PluginList.Add(this.PersonPortraitPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("PersonBubblePlugin"); if ((plugin != null) && (plugin.Instance is IPersonBubble)) { this.PersonBubblePlugin = plugin.Instance as IPersonBubble; this.PersonBubblePlugin.SetScreen(screen); this.PersonBubblePlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); screen.PluginList.Add(this.PersonBubblePlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("TroopTitlePlugin"); if ((plugin != null) && (plugin.Instance is ITroopTitle)) { this.TroopTitlePlugin = plugin.Instance as ITroopTitle; this.TroopTitlePlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); screen.PluginList.Add(this.TroopTitlePlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("RoutewayEditorPlugin"); if ((plugin != null) && (plugin.Instance is IRoutewayEditor)) { this.RoutewayEditorPlugin = plugin.Instance as IRoutewayEditor; this.RoutewayEditorPlugin.SetScreen(screen); this.RoutewayEditorPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); screen.PluginList.Add(this.RoutewayEditorPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("NumberInputerPlugin"); if ((plugin != null) && (plugin.Instance is INumberInputer)) { this.NumberInputerPlugin = plugin.Instance as INumberInputer; this.NumberInputerPlugin.SetScreen(screen); this.NumberInputerPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); screen.PluginList.Add(this.NumberInputerPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("TransportDialogPlugin"); if ((plugin != null) && (plugin.Instance is ITransportDialog)) { this.TransportDialogPlugin = plugin.Instance as ITransportDialog; this.TransportDialogPlugin.SetScreen(screen); this.TransportDialogPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); this.TransportDialogPlugin.SetGameFrame(this.GameFramePlugin); this.TransportDialogPlugin.SetTabList(this.TabListPlugin); this.TransportDialogPlugin.SetNumberInputer(this.NumberInputerPlugin); screen.PluginList.Add(this.TransportDialogPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("CreateTroopPlugin"); if ((plugin != null) && (plugin.Instance is ICreateTroop)) { this.CreateTroopPlugin = plugin.Instance as ICreateTroop; this.CreateTroopPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); this.CreateTroopPlugin.SetScreen(screen); this.CreateTroopPlugin.SetGameFrame(this.GameFramePlugin); this.CreateTroopPlugin.SetTabList(this.TabListPlugin); this.CreateTroopPlugin.SetNumberInputer(this.NumberInputerPlugin); screen.PluginList.Add(this.CreateTroopPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("MarshalSectionDialogPlugin"); if ((plugin != null) && (plugin.Instance is IMarshalSectionDialog)) { this.MarshalSectionDialogPlugin = plugin.Instance as IMarshalSectionDialog; this.MarshalSectionDialogPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); this.MarshalSectionDialogPlugin.SetScreen(screen); this.MarshalSectionDialogPlugin.SetGameFrame(this.GameFramePlugin); this.MarshalSectionDialogPlugin.SetTabList(this.TabListPlugin); screen.PluginList.Add(this.MarshalSectionDialogPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("youcelanPlugin"); if ((plugin != null) && (plugin.Instance is Iyoucelan)) { this.youcelanPlugin = plugin.Instance as Iyoucelan; this.youcelanPlugin.SetScreen(screen); this.youcelanPlugin.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); this.youcelanPlugin.SetPersonDetailDialog(this.PersonDetailPlugin); this.youcelanPlugin.SetTroopDetailDialog(this.TroopDetailPlugin); this.youcelanPlugin.SetArchitectureDetailDialog(this.ArchitectureDetailPlugin); this.youcelanPlugin.SetFactionTechniquesDialog(this.FactionTechniquesPlugin); this.youcelanPlugin.SetTreasureDetailDialog(this.TreasureDetailPlugin); this.youcelanPlugin.SetGameFrame(this.GameFramePlugin); this.youcelanPlugin.SetMapViewSelector(this.MapViewSelectorPlugin); screen.PluginList.Add(this.youcelanPlugin.Instance as GameObject); } plugin = Plugin.Plugins.AvailablePlugins.Find("BianduiLiebiaoChajian"); if ((plugin != null) && (plugin.Instance is IBianduiLiebiao)) { this.BianduiLiebiao = plugin.Instance as IBianduiLiebiao; this.BianduiLiebiao.SetScreen(screen); this.BianduiLiebiao.SetGraphicsDevice(screen.spriteBatch.GraphicsDevice); this.BianduiLiebiao.SetPersonDetailDialog(this.PersonDetailPlugin); this.BianduiLiebiao.SetTroopDetailDialog(this.TroopDetailPlugin); this.BianduiLiebiao.SetArchitectureDetailDialog(this.ArchitectureDetailPlugin); this.BianduiLiebiao.SetFactionTechniquesDialog(this.FactionTechniquesPlugin); this.BianduiLiebiao.SetTreasureDetailDialog(this.TreasureDetailPlugin); this.BianduiLiebiao.SetGameFrame(this.GameFramePlugin); this.BianduiLiebiao.SetMapViewSelector(this.MapViewSelectorPlugin); screen.PluginList.Add(this.BianduiLiebiao.Instance as GameObject); } }
/// <summary> /// Assume that the input parameter order is help GetData /// </summary> /// <param name="input"></param> public void Run(Dictionary <string, string> input) { if (input.Count == 1) { AllCommandsHelp(); } else { IHelp service = _serviceProvider.GetServices <IHelp>() .FirstOrDefault(s => string.Equals(s.Name, input.Keys.ElementAt(1), StringComparison.OrdinalIgnoreCase)); if (service is ICommand) { Console.ForegroundColor = ConsoleColor.Yellow; Console.WriteLine(service.Name); Console.ResetColor(); Console.WriteLine($"\nDESCRIPTION\t{service.Description}"); Console.WriteLine($"\nUSAGE\t{service.Usage}\n"); Console.WriteLine($"Commands:\n"); List <ISubCommandHandler> items; if (input.Count > 2) { items = _serviceProvider.GetServices <ISubCommandHandler>() .Where(x => x is IHelp && string.Equals(x.CommandProvider, service.Name, StringComparison.OrdinalIgnoreCase) && string.Equals(x.Name, input.Keys.ElementAt(2).Trim(), StringComparison.OrdinalIgnoreCase)).ToList(); if (items.Count > 0) { foreach (IHelp handler in items) { ((ISubCommandHandler)handler).BuildSelectableCommands(); Console.Write(handler.Name); Console.ResetColor(); Console.Write($"\t{handler.Description}\n"); Console.Write($"\t{handler.Usage}\n"); } } else { Console.Write($"No help for specified options\n"); } } else { items = _serviceProvider.GetServices <ISubCommandHandler>().Where(x => x is IHelp && string.Equals(x.CommandProvider, service.Name, StringComparison.OrdinalIgnoreCase)).ToList(); foreach (IHelp handler in items) { Console.ForegroundColor = ConsoleColor.Yellow; Console.Write(handler.Name); Console.ResetColor(); Console.Write($"\t{handler.Description}\n"); } } Console.WriteLine(); } else { Console.WriteLine("No help, the requested service is not found"); } } }