/// <summary> /// Constructor for the module /// </summary> public ModuleList() { try { this.InitializeComponent(); ModuleHandler.Panel = this.stackPanel1; this.ImageNew.Source = Framework.Images.GetImage("NewDocumentHS", "VS2010ImageLibrary").Source; this.ImageRefresh.Source = Framework.Images.GetImage("RepeatHS", "VS2010ImageLibrary").Source; this.Tag = Properties.Resources.Modules; _instance = this; if (Framework.Database.IsConnected() == false) { Framework.Notification.Display(Properties.Resources.DatabaseConnectionRequired, 5000); Framework.EventBus.Publish(new PreferencesEvent(this, typeof(IDatabase))); return; } if (ModuleHandler.GetClient() == null) { Framework.Notification.Display(Properties.Resources.ServerConnectionRequired, 5000); Framework.EventBus.Publish(new PreferencesEvent(this, typeof(INetwork))); return; } ModuleHandler.RefreshModuleFiles(); } catch (Exception error) { Framework.EventBus.Publish(error); } }
private void NewMenuItemClick(object sender, RoutedEventArgs e) { try { if (Framework.Database.IsConnected() == false) { Framework.Notification.Display(Properties.Resources.DatabaseConnectionRequired, 5000); Framework.EventBus.Publish(new PreferencesEvent(this, typeof(IDatabase))); return; } if (ModuleHandler.GetClient() == null) { Framework.Notification.Display(Properties.Resources.ServerConnectionRequired, 5000); Framework.EventBus.Publish(new PreferencesEvent(this, typeof(INetwork))); return; } this.CallBackDelegate += ModuleHandler.CreateModule; var popup = Framework.Dialog; var cou = new AddModule(this, popup); popup.SetChild(cou); popup.ShowBlocking(); this.CallBackDelegate -= ModuleHandler.CreateModule; } catch (Exception error) { Framework.EventBus.Publish(error); } }
public Task Initialize() { Task.Run(() => LoadCache()).ContinueWith(continuation => AutoJobRunner()); var moduleHandler = new ModuleHandler(); return(Task.CompletedTask); }
private void RefreshMenuItemClick(object sender, RoutedEventArgs e) { try { if (Framework.Database.IsConnected() == false) { Framework.Notification.Display(Properties.Resources.DatabaseConnectionRequired, 5000); Framework.EventBus.Publish(new PreferencesEvent(this, typeof(IDatabase))); return; } if (ModuleHandler.GetClient() == null) { Framework.Notification.Display(Properties.Resources.ServerConnectionRequired, 5000); Framework.EventBus.Publish(new PreferencesEvent(this, typeof(INetwork))); return; } ModuleHandler.RefreshModuleFiles(); } catch (Exception error) { Framework.EventBus.Publish(error); } }
private void LoadModule(ModuleHandler bot) { SetTableHeader TableHeaderSetterCommand = new SetTableHeader(); TableHeaderSetterCommand.TableIdentifier = TableName; TableHeaderSetterCommand.Header = GetMapListTableHeader(); HTMLlistiner.HandleCommand(TableHeaderSetterCommand); loadPersistentData(); ServerMapListUrl = config["ServerMapListUrl"].ToString(); MaxMapNumber = int.Parse(config["MaxMapList"].ToString()); Console.WriteLine("URL list is now {0} and maximum map number {1}", ServerMapListUrl, MaxMapNumber); userhandler = bot; mapList.CollectionChanged += MapChange; ConvertMaplistToTable(); commands.Add(new Add(bot, this)); commands.Add(new GetMaps(bot, this)); commands.Add(new UpdateMap(bot, this)); commands.Add(new UpdateName(bot, this)); commands.Add(new DeleteMaps(bot, this)); commands.Add(new UploadCheck(bot, this)); adminCommands.Add(new InsertMap(bot, this)); adminCommands.Add(new RepositionMap(bot, this)); adminCommands.Add(new WipeMaps(bot, this)); adminCommands.Add(new AllowOnlyUploadedMapsSetter(bot, this)); commands.Add(new GetOwner(bot, this)); bot.AddMapChangeEventListiner(this); }
public Core() { Instance = this; Info = new PluginInfo("BPEssentials", "bpe") { Description = "Basic commands for powerful moderation.", Website = "https://bpessentials.github.io/Docs/" }; CooldownHandler = new CooldownHandler(); WarpHandler = new WarpHandler(); KitHandler = new KitHandler(); OnReloadRequestAsync(); SetCustomData(); EntityHandler = new EntityHandler(); EntityHandler.LoadEntities(); ModuleHandler = new ModuleHandler(); ModuleHandler.Initialize(); EventsHandler.Add("bpe:reload", new Action(OnReloadRequestAsync)); EventsHandler.Add("bpe:version", new Action <string>(OnVersionRequest)); new Commands.Save().StartSaveTimer(); Logger.LogInfo($"BP Essentials {(IsDevelopmentBuild() ? "[DEVELOPMENT-BUILD] " : "")}v{Version} loaded in successfully!"); }
private void LoadDependencies(ModuleHandler bot) { this.userhandler = bot; commands = new List <BaseCommand>(); adminCommands = new List <BaseCommand>(); tasks = new List <BaseTask>(); }
private static void StartGame(string cat) { category = cat; gameRunning = true; ModuleHandler.SendMessage(string.Format("Trivia game started. Category: {0}", category), gameChannel); //selectedQuestion = new KeyValuePair<string, string>(questions.); }
public EventListener AddModuleListener <M>(string name, ModuleHandler <M> handler) where M : Module { if (handler == null || handler.Method.GetParameters().Length != 1 || !handler.Method.GetParameters()[0].ParameterType.IsSubclassOf(typeof(ModuleEvent))) { return(null); } return(_AddEventListener(ModuleEvent.GLOBAL, handler, name)); }
public BaseModule(ModuleHandler bot, Dictionary <string, Dictionary <string, object> > Config) { string ThisObject = this.GetType().Name.ToString(); Console.WriteLine(ThisObject); this.config = Config[ThisObject]; LoadDependencies(bot); bot.AddModuleToCurrentModules(this); }
public override void OnMessageReceived(string sender, string receivedMessage, string channel) { if (receivedMessage.ToLower().Contains("it's a trap") || receivedMessage.ToLower().Contains("its a trap")) { Random rand = new Random(); ModuleHandler.SendMessage(ackbars[rand.Next(ackbars.Length)], channel); } }
/// <summary> /// 角色信息权限设定 /// </summary> /// <param name="id">角色编码</param> /// <param name="pager">页码</param> /// <returns>执行结果</returns> public ActionResult Authority(string id, string pager) { if (string.IsNullOrEmpty(id)) { return(RedirectToAction("List")); } ViewBag.RoleCode = id; ViewBag.PageCurrent = pager; return(View(ModuleHandler.GetTree())); }
public ActionResult Trees(string id) { IList <DawnAuthModuleMDL> sourceList = null; if (!string.IsNullOrEmpty(id)) { sourceList = ModuleHandler.GetTree(int.Parse(id)); } return(View(sourceList)); }
/// <summary> /// 管理员权限绑定 /// </summary> /// <param name="id">管理员编号</param> /// <param name="pager">页码</param> /// <returns>执行结果</returns> public ActionResult BindPower(string id, string pager) { if (string.IsNullOrEmpty(id) || TypeHelper.TypeToInt32(id, -1) < 0) { return(RedirectToAction("List")); } ViewBag.UserId = id; ViewBag.PageCurrent = pager; return(View(ModuleHandler.GetPowerTree())); }
static void Main(string[] args) { IEnumerable <ApplicationInfo> credentials = ModuleHandler.GetCredentials(); foreach (ApplicationInfo application in credentials) { Console.WriteLine(application); } Console.ReadLine(); }
public void Place(ModuleHandler moduleHandler) { if (moduleHandler != null) { attached = true; handler = moduleHandler; handler.module = this; } transform.SetParent(moduleHandler.place); transform.localPosition = new Vector3(0, 0, 0); transform.localRotation = Quaternion.identity; }
public override void OnMessageReceived(string sender, string receivedMessage, string channel) { if (sender == "RockyTV") { if (receivedMessage.StartsWith("!join ")) { string targetChannel = receivedMessage.Substring(6); ModuleHandler.client.JoinChannel(targetChannel); ModuleHandler.SendPrivateMessage("Joined " + targetChannel + ".", sender); } } }
private void DeleteButtonClick(object sender, RoutedEventArgs e) { try { ModuleHandler.DeleteModule(this._module); this._popupWindow.CloseDialog(); } catch (Exception error) { Framework.EventBus.Publish(error); } }
public void PickUp(Transform player) { attached = false; if (handler) { handler.module = null; } handler = null; GetComponent <Rigidbody>().useGravity = false; GetComponent <Rigidbody>().isKinematic = true; transform.SetParent(player); transform.localPosition = new Vector3(.4f, -.4f, 1); transform.localRotation = Quaternion.identity; }
static void Main(string[] args) { //Dont.Be.A.Scumbag.And.Remove.This.Warn.warn(); Console.WriteLine("Xri Client"); Console.WriteLine("Flare port to C#"); Console.WriteLine("Xri port to C#"); Console.WriteLine("Discord: https://discord.gg/t8pp4Vm"); Process.Start("minecraft://"); try { MCM.openGame(); MCM.openWindowHost(); CommandHook cmh = new CommandHook(); SDK sdk = new SDK(); FileMan fm = new FileMan(); CategoryHandler ch = new CategoryHandler(); TabUiHandler tuih = new TabUiHandler(); ModuleHandler mh = new ModuleHandler(); KeybindHandler kh = new KeybindHandler(); Thread uiApp = new Thread(() => { OverlayHost ui = new OverlayHost(); Application.Run(ui); }); if (fm.readConfig()) { Console.WriteLine("Loaded configurations!"); } else { Console.WriteLine("Could not load configurations!"); } uiApp.Start(); while (true) { try { mainLoop.Invoke(null, new EventArgs()); Thread.Sleep(threadSleep); } catch (Exception) { } } } catch (Exception ex) { Console.WriteLine("Message: " + ex.Message); Console.WriteLine("Stacktrace: " + ex.StackTrace); MessageBox.Show("Xri crashed! Check the console for error details. Click 'Ok' to quit."); } }
internal static string GetServerPath(ModuleHandler handler, XmlElement element) { XmlHelper h = handler.Source; string path = element.GetAttribute("Name"); XmlElement xml = h.GetElement("Directory"); XmlElement currentXml = element.ParentNode as XmlElement; while (xml != currentXml) { path = currentXml.GetAttribute("Name") + "/" + path; currentXml = currentXml.ParentNode as XmlElement; } return(path); }
public override void OnMessageReceived(string sender, string receivedMessage, string channel) { if (receivedMessage.StartsWith("!time ")) { string trimmedMessage = receivedMessage.Substring(5).Trim(); if (trimmedMessage.Contains("+")) { string utcZone = trimmedMessage.Substring(0, trimmedMessage.IndexOf("+") + 2).ToUpper(); Console.WriteLine(trimmedMessage.IndexOf("+").ToString()); ModuleHandler.SendMessage(DateTime.UtcNow.ToString("s"), channel); ModuleHandler.SendPrivateMessage("UTC zone: " + utcZone, sender); } } }
public TrackingServerListHolder(ModuleHandler bot, IHTMLFileFromArrayPasser listiner, Dictionary <string, Dictionary <string, object> > Jsconfig) : base(bot, Jsconfig) { loadPersistentData(); this.Maplists = new List <Maplist>(); List <Maplist> Templist = new List <Maplist>(); Templist = JsonConvert.DeserializeObject <List <Maplist> >(config["ListConfigs"].ToString()); if (Templist != null) { this.Maplists = Templist; } this.listiner = listiner; UpdateList(); bot.AddMapChangeEventListiner(this); }
public override void OnMessageReceived(string sender, string receivedMessage, string channel) { string[] responses = new string[] { "Om nom nom!", "That's very nice of you!", "Oh thx, have a cookie yourself!", "Thank you very much.", "Thanks for the treat!" }; if (receivedMessage.ToLower().Contains("botsnack")) { Random rand = new Random(); ModuleHandler.SendMessage(responses[rand.Next(responses.Length)], channel); } }
public AdminModule(ModuleHandler handler, IHTMLFileFromArrayPasser HtmlHandler, UserHandler userhandler, Dictionary <string, Dictionary <string, object> > Jsconfig) : base(handler, Jsconfig) { DeletableModule = false; this.modulehandler = handler; this.HtmlHandler = HtmlHandler; loadPersistentData(); savePersistentData(); handler.AddLoginEventListiner(this); commands.Add(new CommandListRetrieve(handler, this)); commands.Add(new UserInfo(handler, this)); adminCommands.Add(new GetAllModules(handler, this)); adminCommands.Add(new Reboot(handler, this)); adminCommands.Add(new RunScript(handler, this)); }
public override void OnMessageReceived(string sender, string message, string channel) { if (message == "!hello") { ModuleHandler.SendMessage("Hello!", channel); } if (message.StartsWith("!hello ")) { string target = message.Substring(7); if (ModuleHandler.client.Channels[channel].Users.Contains(target)) { ModuleHandler.SendMessage("Hello, " + target + "!", channel); } else { ModuleHandler.SendPrivateMessage("Looks like that the user '" + target + "' is not on the channel '" + channel + "'", sender); } } }
public IdentityModule(UserHandler bot, ModuleHandler handler, Dictionary <string, Dictionary <string, object> > Jsconfig) : base(handler, Jsconfig) { handler.AddListChangeEventListiner(this); DeletableModule = false; userhandler = bot; this.modulehandler = handler; username = config["DefaultUsername"].ToString(); status = config["DefaultStatus"].ToString(); UseStatus = bool.Parse(config["UseStatus"].ToString()); loadPersistentData(); savePersistentData(); handler.AddLoginEventListiner(this); adminCommands.Add(new Rename(handler, this)); adminCommands.Add(new SetStatusMessage(userhandler, modulehandler, this)); adminCommands.Add(new UnsetStatusMessage(userhandler, modulehandler, this)); }
private void Initialise() { if (moduleHandler != null) return; moduleHandler = new ModuleHandler(); moduleHandler.RegisterModules(); moduleHandler.CheckDependencies(); moduleHandler.AttachEventHandlers(); SprocketSettings.Instance.ValidateSettings(); if (!SprocketSettings.Instance.HasErrors) { if (OnInitialise != null) OnInitialise(moduleHandler.InterfaceImplementations); if (OnInitialiseComplete != null) OnInitialiseComplete(); } }
public override void OnMessageReceived(string sender, string receivedMessage, string channel) { if (receivedMessage.StartsWith("!trivia ")) { string trimmedMessage = receivedMessage.Substring(8); string inputCategory = trimmedMessage.ToUpper(); if (!questions.ContainsKey(inputCategory)) { ModuleHandler.SendMessage(string.Format("Category '{0}' does not exist.", inputCategory), channel); } if (!gameRunning) { StartGame(category); gameChannel = channel; } else { ModuleHandler.SendMessage("A game is already in progress!", channel); } } }
public ServerTrackingModule(ModuleHandler bot, IHTMLFileFromArrayPasser WebServer, Dictionary <string, Dictionary <string, object> > Jsconfig) : base(bot, Jsconfig) { this.WebServer = WebServer; Bot = bot; List <TrackingServerInfo> ServersBeingTracked = new List <TrackingServerInfo>(); int updateInterval = int.Parse(config["updateInterval"].ToString()); Tuple <string, string, int>[] servers; if (File.Exists(ModuleSavedDataFilePath())) { ServersBeingTracked = JsonConvert.DeserializeObject <List <TrackingServerInfo> >(System.IO.File.ReadAllText(ModuleSavedDataFilePath())); for (int i = 0; i < ServersBeingTracked.Count; i++) { commands.Add(new ServerStatus(bot, ServersBeingTracked[i], this)); } } else { Console.WriteLine("No servers found in config file"); servers = null; } TrackedServers = new TrackingServerList(this, ServersBeingTracked); commands.Add(new ActiveServers(bot, this)); commands.Add(new SpecificServerStatus(bot, this)); adminCommands.Add(new ServerAdd(bot, this)); adminCommands.Add(new ServerRemove(bot, this)); adminCommands.Add(new FullServerQuery(bot, this)); serverUpdate = new BaseTask(updateInterval, new System.Timers.ElapsedEventHandler(SyncTrackingServerInfo)); ServerMapChanged += bot.ServerUpdated; ServerMapChanged += ServerTrackingModule_ServerMapChanged; }
static void Main(string[] args) { Console.WriteLine("Flare# Client"); Console.WriteLine("Flare port to C#"); Console.WriteLine("Discord: https://discord.gg/Hz3Dxg8"); try { MCM.openGame(); MCM.openWindowHost(); SDK sdk = new SDK(); CategoryHandler ch = new CategoryHandler(); ModuleHandler mh = new ModuleHandler(); TabUI ui = new TabUI(); KeybindHandler kh = new KeybindHandler(); Application.Run(ui); } catch (Exception ex) { Console.WriteLine("Message: " + ex.Message); Console.WriteLine("Stacktrace: " + ex.StackTrace); MessageBox.Show("Flare crashed! Check the console for error details. Click 'Ok' to quit."); } }
internal void Initialise() { if (moduleHandler != null) return; moduleHandler = new ModuleHandler(); moduleHandler.RegisterModules(); moduleHandler.CheckDependencies(); moduleHandler.AttachEventHandlers(); SprocketSettings.Instance.ValidateSettings(); if (!SprocketSettings.Instance.HasErrors) { if (OnInitialise != null) OnInitialise(moduleHandler.InterfaceImplementations); if (OnInitialiseComplete != null) OnInitialiseComplete(); } else HttpRuntime.UnloadAppDomain(); // reset the application }