public Game1() { graphics = new GraphicsDeviceManager(this); Content.RootDirectory = "Content"; commandManager = new CommandManager(); interactiveMusic = new InteractiveMusic(); }
/// <summary> /// Constructor. Inicializa instancias de la clase ConnectionManagerTester /// </summary> public ConnectionManagerTester() { /* * Primero se crea el CommandManager. Este gestiona los comandos de * sistema como alive, busy, ready, etc. Ahorra trabajo. * Adicionalmente se suscriben los eventos (apuntador a funcion) * para manejar las notificaciones de la clase */ commandManager = new CommandManager(); commandManager.Started += new CommandManagerStatusChangedEventHandler(commandManager_Started); commandManager.Stopped += new CommandManagerStatusChangedEventHandler(commandManager_Stopped); commandManager.CommandReceived += new CommandReceivedEventHandler(commandManager_CommandReceived); commandManager.ResponseReceived += new ResponseReceivedEventHandler(commandManager_ResponseReceived); /* * Ahora se inicializa el ConnectionManager. Bajo el esquema actual * todas las aplicaciones son servidores y es el blackboard el que * se conecta a ellas (asi solo es necesario configurar una * aplicacion). Se le indica nombre del modulo, puerto de conexion * y el gestor de comandos. El modulo y puerto deben ser * configurados en el blackboard */ connectionManager = new ConnectionManager("TESTER", 2000, 2000, IPAddress.Loopback, commandManager); connectionManager.Started += new ConnectionManagerStatusChangedEventHandler(connectionManager_Started); connectionManager.Stopped += new ConnectionManagerStatusChangedEventHandler(connectionManager_Stopped); connectionManager.ClientDisconnected += new TcpClientDisconnectedEventHandler(connectionManager_ClientDisconnected); connectionManager.ClientConnected += new TcpClientConnectedEventHandler(connectionManager_ClientConnected); // Configuro el reloj sw = new System.Diagnostics.Stopwatch(); }
protected void Application_Start() { var cs = ConnectionSettings.Create(); var endpoint = new IPEndPoint(IPAddress.Loopback, 1113); var con = EventStoreConnection.Create(endpoint); con.ConnectAsync(); var credentials = new EventStore.ClientAPI.SystemData.UserCredentials("admin", "changeit"); var adapter = new EventStoreAdapter(endpoint, credentials); ProjectionManager = new ProjectionManager(endpoint, credentials, adapter); ProjectionManager.Run(); CommandManager = new CommandManager(con); //var binder = new DefaultModelBinder(); //ModelBinders.Binders.Add(typeof(DateTime), binder); //ModelBinders.Binders.Add(typeof(DateTime?), binder); AreaRegistration.RegisterAllAreas(); GlobalConfiguration.Configure(WebApiConfig.Register); FilterConfig.RegisterGlobalFilters(GlobalFilters.Filters); RouteConfig.RegisterRoutes(RouteTable.Routes); BundleConfig.RegisterBundles(BundleTable.Bundles); }
public Players(CommandManager c) { this.c = c; //CommandManager.AddTab(ParseTab, "help", "h"); c.AddCommand(TheEnd, null, "theend"); c.AddCommand(Position, "position", "pos", "coord", "coords", "cord"); c.AddCommand(Time, null, "time", "timeset", "settime"); c.AddCommand(Load, "load", "lag", "uptime", "l"); c.AddCommand(Die, "kill", "suicide", "killmyself", "kil", "death", "die"); c.AddCommand(Inbox.Read, "read"); c.AddCommand(Stat, "stat"); c.AddCommand(Donate, "donate", "donors", "donor", "doner", "donator", "dontae", "vip"); c.AddCommand(Motd, "motd", "welcome", "info"); c.AddCommand(Rules, "rulebook", "rules", "rule"); c.AddCommand(Version, "version", "ver"); c.AddCommand(Pardon, "pardon", "vote", "vot", "unban", "uban", "umbanned", "unbanned"); c.AddCommand(ToGreenRoom, "greenroom", "wait"); c.AddCommand(ToConstruct, "construct", "con", "cons"); c.AddCommand(ToHell, "hell", "hel"); c.AddCommand(ToRealWorld, "vanilla", "real", "back"); c.AddCommand(ToIsland, "island"); c.AddCommand(ToHardcore, "hardcore"); c.AddCommand(ToWarp, "warp"); c.AddCommand(LockChest, null, "lock", "lwc", "chest", "cprivate", "private", "lcpassword"); }
public MoveTo(CommandManager parent,Vector3 target) { m_target = target; m_parent = parent; //find the navagation agent and set the destination m_parent.GetComponent<NavMeshAgent>().destination = m_target; }
public void GetCommand_ThrowsIfNoCommandFound() { // Arrange CommandManager cm = new CommandManager(); // Act and Assert ExceptionAssert.Throws<CommandLineException>(() => cm.GetCommand("NoCommandByThisName"), "Unknown command: 'NoCommandByThisName'"); }
public PluginExample() { this.cmdMan = new CommandManager(); Engine engine = new Engine(); this.cmdMan.CommandExecuters.Add(new FactorialCommandExecuter(engine)); this.cmdMan.CommandExecuters.Add(new StatusCommandExecuter(engine)); this.gui = new FrmPluginExample(); }
public static CommandManager getInstance() { if ( _instance == null ) { _instance = new CommandManager(); } return _instance; }
public HttpResponseMessage Create(FileDto fileDto) { CommandManager cm = new CommandManager(); cm.Send(new CreateCommand(Guid.NewGuid(), fileDto.Name, fileDto.CreateDate)); return new HttpResponseMessage(HttpStatusCode.OK); }
// Use this for initialization void Start() { renderer.material.SetTexture ("_MainTex", switchOff); //Die Standardtextur wird auf aus gestellt switchState = false; //Die Abfrage wird Standardmässig auf aus gestellt cm = GameObject.FindGameObjectWithTag("GameController").GetComponent<CommandManager>(); //Es wird das GameObjekt mit dem Tag "GameController" gesucht und die Daten die es //dank des Scripts CommandManager sammelt werden hier eingebunden }
public Help(CommandManager c) { this.c = c; c.AddTab(ParseTab, "help", "h"); c.AddCommand(ParseCommandHelp, "help", "h"); c.AddCommand(ParseCommandChatHelp, "chathelp"); }
void OnCommandEvent( CommandManager.CommandEventData data ) { data.LockInput(); FrameRateUtility.StartCoroutine( delay, () => { Application.Quit(); }); }
public static void Main() { ICommandManager commandManager = new CommandManager(); IUserInterface userInterface = new ConsoleInterface(); IRequester requester = new Requester(); var engine = new GameEngine(userInterface, commandManager, requester); engine.Run(); }
public void RegisterCommand_AddsCommandToDictionary() { // Arrange CommandManager cm = new CommandManager(); ICommand mockCommand = new MockCommand(); // Act cm.RegisterCommand(mockCommand); // Assert Assert.Equal(1, cm.GetCommands().Count()); }
public void GetCommandOptions_ThrowsWhenOptionHasNoSetter() { // Arrange CommandManager cm = new CommandManager(); ICommand cmd = new MockCommandBadOption(); cm.RegisterCommand(cmd); string expectedErrorText = "[option] on 'NuGet.Test.NuGetCommandLine.CommandManagerTests+MockCommandBadOption.Message' is invalid without a setter."; // Act & Assert ExceptionAssert.Throws<InvalidOperationException>(() => cm.GetCommandOptions(cmd), expectedErrorText); }
/// <summary> /// Initializes a new instance of CommandExecuter /// </summary> /// <param name="commandName">The name of the command that the CommandExecuter will execute</param> /// <param name="commandManager">The CommandManager object that will handle the command executed by this CommandExecuter instance</param> public CommandExecuter(string commandName, CommandManager commandManager) { this.commandName = commandName; this.responseRequired = true; SignatureBuilder sb = new SignatureBuilder(); sb.AddNewFromDelegate(new StringArrayEventHandler(this.DefaultParameterParser)); this.signature = sb.GenerateSignature(this.commandName); //if (commandManager != null) // commandManager.CommandExecuters.Add(this); }
public void GetCommand_ReturnsCorrectCommand() { // Arrange CommandManager cm = new CommandManager(); ICommand expectedCommand = new MockCommand(); cm.RegisterCommand(expectedCommand); // Act ICommand actualCommand = cm.GetCommand("MockCommand"); // Assert Assert.Equal(expectedCommand, actualCommand); }
public void Execute(ICharacter caller, GameManager manager, CommandManager cm) { if (caller == null) throw new ArgumentException(); if (manager == null) throw new ArgumentException(); if (cm == null) throw new ArgumentException(); cm.CreateStack(); manager.GoToNextCharacter(); cm.SetCurrent(manager.ActivePlayer); }
public ChatCommands(CommandManager c) { c.AddCommand(TellAdmin, "telladmin", "admin"); c.AddCommand(Channel, "channel", "ch", "c"); c.AddCommand(Shout, "shout"); c.AddCommand(Prod, "push", "prod", "slap"); c.AddCommand(Firehose, "firehose"); c.AddCommand(Tell, "tell", "msg"); c.AddCommand(Timestamp, "timestamp"); c.AddCommand(Me, null, "me"); c.AddCommand(Chat.ResetChannel, "reset"); }
//initialization public void Start() { m_inp = Managers.GetInstance().GetInputManager(); m_cmanager = Managers.GetInstance().GetCommandManager(); m_bulletPool = Managers.GetInstance().GetBulletPoolManager().GetBulletPool(20, Managers.GetInstance().GetGameProperties().playerBulletPrefab); m_moveTimer = m_cmanager.GetTimer(); m_isAlive = true; m_explosion = transform.GetChild(0).gameObject; m_sprite = GetComponent<SpriteRenderer>(); m_deathCounter = 0; m_stillDead = false; }
public ChatConsoleActor(string userName,string clientActorPath) { _userName = userName; _clientActorPath = clientActorPath; _clientActor = ActorSystemContainer.Instance.System.ActorSelection(_clientActorPath).ResolveOne(new TimeSpan(0, 0, 10)).Result; _clientActor.Tell(new Messages.AttachConsole(Self)); Dictionary<string, object> parameters = new Dictionary<string, object>() { { "actor", _clientActor }, { "userName", _userName } }; //Dictionary<string, object> parameters = new Dictionary<string, object>() { { "filePath", @"c:\logs\fileoutput.txt" } }; _receiver = GlobalIocContainer.Container.IocContainer.Resolve<IReceiver>(parameters); _commandFactory = GlobalIocContainer.Container.IocContainer.Resolve<CommandFactory>(); _commandManager = new CommandManager(); }
public void Execute(CharacterObservable caller, CharacterObservable interactWith, CommandManager cm, GameManager gm) { if (caller == null) throw new ArgumentException("Caller cannot be null"); if (cm.CommandStack == null) throw new NullReferenceException("Command stack cannot be null in order to perform an undo"); if (cm.CurrentCharater == null && gm.ActivePlayer == null) throw new ArgumentException("The command and game manager can't be null at the same time"); if (cm.CommandStack.Count == 0) throw new Exception("Active player did not select any actions that can be undone"); if (cm != null && gm != null && !cm.CurrentCharater.Equals(gm.ActivePlayer)) throw new Exception("Cannot Undo action of previous player"); cm.Undo(caller, gm.ActivePlayer); }
/// <summary> /// Initializes a new instance of the <see cref="CrossThreadingTestForm"/> class. /// </summary> public CrossThreadingTestForm(ThreadAwareCommand command) { InitializeComponent(); CheckForIllegalCrossThreadCalls = true; Values = new List<int>{1, 2}; this.target.DataSource = Values; Mock<IEventAggregator> aggregator = new Mock<IEventAggregator>(); CommandManager manager = new CommandManager(aggregator.Object, SynchronizationContext.Current); manager.Do( Execute.The(command) .RunCommandInBackground()); }
void OnCommandEvent( CommandManager.CommandEventData data ) { var holder = new ConditionHolder(); holder.IsSuccess = true; if( refConditionObject != null ) { refConditionObject.SendMessage( ConditionHolder.ConditionMessage, holder ); } if( holder.IsSuccess ) { data.LockInput(); Change(); } }
public static void Main() { Thread.CurrentThread.CurrentCulture = CultureInfo.InvariantCulture; ICreaturesFactory creaturesFactory = GetCreaturesFactory(); ILogger logger = new ConsoleLogger(); IBattleManager battleManager = GetBattleManager(creaturesFactory, logger); ICommandManager commandManager = new CommandManager(); while (true) { var commandLine = Console.ReadLine(); commandManager.ProcessCommand(commandLine, battleManager); } }
public static void Main() { ITicketCatalog catalog = new TicketCatalog(); ICommandManager commandManager = new CommandManager(catalog); IInputReader reader = new ConsoleReader(); IOutputWriter writer = new ConsoleWriter { AutoFlush = true }; IEngine engine = new Engine(commandManager, reader, writer); engine.Run(); }
void Aveva.ApplicationFramework.IAddin.Start(ServiceManager serviceManager) { sServiceManager = serviceManager; sCommandManager = (CommandManager)sServiceManager.GetService(typeof(CommandManager)); sCommandBarManager = (CommandBarManager)sServiceManager.GetService(typeof(CommandBarManager)); //Add ExampleCommand to Command Manager sCommandManager.Commands.Add(new ExampleCommand()); //Create example toolbar menu CommandBar myToolBar = sCommandBarManager.CommandBars.AddCommandBar("ExampleCommandBar"); //sCommandBarManager.RootTools.AddButtonTool("ExampleCommand", "ExampleCommand", null, "ExampleCommand"); //myToolBar.Tools.AddTool("ExampleCommand"); ComboBoxTool tool = sCommandBarManager.RootTools.AddComboBoxTool("ExampleCommand", "Examples", null, "ExampleCommand"); tool.SelectedIndex = 0; myToolBar.Tools.AddTool("ExampleCommand"); }
/// <summary> /// Initializes a new instance of the ChatManager class. /// </summary> public ChatManager() { this._emotions = new ChatEmotionsManager(); this._logs = new ChatlogManager(); this._filter = new WordFilterManager(); this._filter.Init(); this._commands = new CommandManager(":"); this._petCommands = new PetCommandManager(); this._petLocale = new PetLocale(); this._chatStyles = new ChatStyleManager(); this._chatStyles.Init(); log.Info("Chat Manager -> LOADED"); }
public void ExtractOptionAddsValuesToListCommand() { // Arrange var cmdMgr = new CommandManager(); var command = new MockCommandWithMultiple(); var arguments = "/ListProperty Val1 /RegularProp RegularPropValue /ListProperty Val2 /ListProperty Val3"; var parser = new CommandLineParser(cmdMgr); // Act parser.ExtractOptions(command, arguments.Split().AsEnumerable().GetEnumerator()); // Assert Assert.AreEqual(command.RegularProp, "RegularPropValue"); Assert.AreEqual(command.ListProperty.Count, 3); Assert.AreEqual(command.ListProperty[0], "Val1"); Assert.AreEqual(command.ListProperty[1], "Val2"); Assert.AreEqual(command.ListProperty[2], "Val3"); }
public void ExtractOptionsSplitsValueBySemiColorForCollectionOption() { // Arrange var cmdMgr = new CommandManager(); var command = new MockCommandWithMultiple(); var arguments = "/ListProperty Val1 /RegularProp RegularPropValue /ListProperty Val2;Val3;Val4 /ListProperty Val5"; var parser = new CommandLineParser(cmdMgr); // Act parser.ExtractOptions(command, arguments.Split().AsEnumerable().GetEnumerator()); // Assert Assert.AreEqual(command.RegularProp, "RegularPropValue"); Assert.AreEqual(command.ListProperty.Count, 5); Assert.AreEqual(command.ListProperty[0], "Val1"); Assert.AreEqual(command.ListProperty[1], "Val2"); Assert.AreEqual(command.ListProperty[2], "Val3"); Assert.AreEqual(command.ListProperty[3], "Val4"); Assert.AreEqual(command.ListProperty[4], "Val5"); }
/// <summary> /// Отменить последнее действие /// </summary> public virtual void Undo() { CommandManager.Undo(); }
public RibbonButtonsSample() { InitializeComponent(); CommandManager.AddExecutedHandler(this, this.OnExecuted); CommandManager.AddCanExecuteHandler(this, this.OnCanExecute); }
protected override void OnCleanup() { CommandManager.RemovePreviewCanExecuteHandler(AssociatedObject, OnPreviewCanExecute); CommandManager.RemovePreviewExecutedHandler(AssociatedObject, OnPreviewExecuted); }
internal void EndPasteForCanCommands() { Cursor = Cursors.Arrow; isPasting = false; CommandManager.InvalidateRequerySuggested(); }
internal protected override Gtk.ToolItem CreateToolItem(CommandManager manager) { Gtk.Menu menu = manager.CreateMenu(this); return(new MenuToolButton(menu, icon)); }
static ExportSelectedCommand() { CommandManager.RegisterClassCommandBinding(typeof(SfDataGrid), new CommandBinding(ExportToExcel, OnExecuteExportToExcel, OnCanExecuteExportToExcel)); }
private void HandleSendChatMessage() { if (_account.Character.Status == CharacterStatus.Disconnected) { return; } if (string.IsNullOrWhiteSpace(ChatTextBox.Text)) { Logger.Default.Log("Vous ne pouvez pas envoyer un texte vide.", LogMessageType.Public); } else { _chatHistory.Add(ChatTextBox.Text); Logger.Default.Log(ChatTextBox.Text, LogMessageType.Command); if (ChatTextBox.Text.Length > 2 && ChatTextBox.Text[0] == '.') { var txt = ChatTextBox.Text.Substring(1); try { CommandManager.ParseAndCall(_account, txt); } catch (Exception e) { Logger.Default.Log(e.Message); Logger.Default.Log("Commande Incorrecte ou qui a échouée.", LogMessageType.Public); } ChatTextBox.BeginInvoke(new Action(() => ChatTextBox.Text = "")); return; } if (ChatTextBox.Text.Length < 2) { var ccmm = new ChatClientMultiMessage { Channel = (byte)ChatChannelsMultiEnum.CHANNEL_GLOBAL, Content = ChatTextBox.Text }; _account.Network.SendToServer(ccmm); } else { var txt = ChatTextBox.Text.Substring(0, 2); var chattxt = ChatTextBox.Text.Replace(txt, ""); var ccmm = new ChatClientMultiMessage { Channel = (byte)ChatChannelsMultiEnum.CHANNEL_GLOBAL, Content = chattxt }; switch (txt) { case "/g": if (string.IsNullOrWhiteSpace(chattxt)) { ccmm.Channel = (byte)ChatChannelsMultiEnum.CHANNEL_GUILD; } break; case "/s": if (string.IsNullOrWhiteSpace(chattxt)) { ccmm.Channel = (byte)ChatChannelsMultiEnum.CHANNEL_GLOBAL; } break; case "/t": if (string.IsNullOrWhiteSpace(chattxt)) { ccmm.Channel = (byte)ChatChannelsMultiEnum.CHANNEL_TEAM; } break; case "/a": if (string.IsNullOrWhiteSpace(chattxt)) { ccmm.Channel = (byte)ChatChannelsMultiEnum.CHANNEL_ALLIANCE; } break; case "/p": if (string.IsNullOrWhiteSpace(chattxt)) { ccmm.Channel = (byte)ChatChannelsMultiEnum.CHANNEL_PARTY; } break; case "/k": if (string.IsNullOrWhiteSpace(chattxt)) { ccmm.Channel = (byte)ChatChannelsMultiEnum.CHANNEL_ARENA; } break; case "/b": if (string.IsNullOrWhiteSpace(chattxt)) { ccmm.Channel = (byte)ChatChannelsMultiEnum.CHANNEL_SALES; } break; case "/r": if (string.IsNullOrWhiteSpace(chattxt)) { ccmm.Channel = (byte)ChatChannelsMultiEnum.CHANNEL_SEEK; } break; default: ccmm.Channel = (byte)ChatChannelsMultiEnum.CHANNEL_GLOBAL; break; } _account.Network.SendToServer(ccmm); ChatTextBox.BeginInvoke(new Action(() => ChatTextBox.Text = "")); } } }
public override bool IsEnabled(CommandManager commandManager) { return(IsSolutionOpen(commandManager) && _builder.IsBuilding); }
private void SaveWorldThreaded(string filename) { Task.Factory.StartNew(() => World.Save(CurrentWorld, filename)) .ContinueWith(t => CommandManager.InvalidateRequerySuggested(), TaskFactoryHelper.UiTaskScheduler); }
private void RaiseCanExecuteChanged() => CommandManager.InvalidateRequerySuggested();
private void UpdateCommandsTimer_Tick(object sender, EventArgs e) { CommandManager.InvalidateRequerySuggested(); }
public void RaiseCanExecuteChanged() { CommandManager.InvalidateRequerySuggested(); }
public void RegisterHelpCommandBinding() { var commandBinding = new CommandBinding(ApplicationCommands.Help, ShowHelpExecuted, ShowHelpCanExecute); CommandManager.RegisterClassCommandBinding(typeof(FrameworkElement), commandBinding); }
public void Refresh() { CommandManager.InvalidateRequerySuggested(); }
static Commands() { CommandManager.RegisterClassCommandBinding(typeof(SfTreeGrid), new CommandBinding(ExportToExcel, OnExecuteExportToExcel, OnCanExecuteExportToExcel)); }
static DataList() { //this.SelectionMode = SelectionMode.Multiple; //this.ListViewColumnSorter = new ListViewColumnSorter(); _EditCommand = new RoutedCommand("EditCommand", typeof(DataList)); CommandManager.RegisterClassCommandBinding(typeof(DataList), new CommandBinding(_EditCommand, OnEditCommand)); EditEvent = EventManager.RegisterRoutedEvent("Edit", RoutingStrategy.Bubble, typeof(ExecutedRoutedEventHandler), typeof(DataList)); _AddCommand = new RoutedCommand("AddCommand", typeof(DataList)); CommandManager.RegisterClassCommandBinding(typeof(DataList), new CommandBinding(_AddCommand, OnAddCommand)); AddEvent = EventManager.RegisterRoutedEvent("Add", RoutingStrategy.Bubble, typeof(ExecutedRoutedEventHandler), typeof(DataList)); _DeleteCommand = new RoutedCommand("DeleteCommand", typeof(DataList)); CommandManager.RegisterClassCommandBinding(typeof(DataList), new CommandBinding(_DeleteCommand, OnDeleteCommand)); DeleteEvent = EventManager.RegisterRoutedEvent("Delete", RoutingStrategy.Bubble, typeof(ExecutedRoutedEventHandler), typeof(DataList)); _UploadCommand = new RoutedCommand("UploadCommand", typeof(DataList)); CommandManager.RegisterClassCommandBinding(typeof(DataList), new CommandBinding(_UploadCommand, OnUploadCommand)); UploadEvent = EventManager.RegisterRoutedEvent("Upload", RoutingStrategy.Bubble, typeof(ExecutedRoutedEventHandler), typeof(DataList)); _SearchCommand = new RoutedCommand("SearchCommand", typeof(DataList)); CommandManager.RegisterClassCommandBinding(typeof(DataList), new CommandBinding(_SearchCommand, OnSearchCommand)); SearchEvent = EventManager.RegisterRoutedEvent("Search", RoutingStrategy.Bubble, typeof(ExecutedRoutedEventHandler), typeof(DataList)); _ClearAllCommand = new RoutedCommand("ClearAllCommand", typeof(DataList)); CommandManager.RegisterClassCommandBinding(typeof(DataList), new CommandBinding(_ClearAllCommand, OnClearAllCommand)); ClearAllEvent = EventManager.RegisterRoutedEvent("ClearAll", RoutingStrategy.Bubble, typeof(ExecutedRoutedEventHandler), typeof(DataList)); _SelectAllCommand = new RoutedCommand("SelectAllCommand", typeof(DataList)); CommandManager.RegisterClassCommandBinding(typeof(DataList), new CommandBinding(_SelectAllCommand, OnSelectAllCommand)); SelectAllEvent = EventManager.RegisterRoutedEvent("SelectAll", RoutingStrategy.Bubble, typeof(ExecutedRoutedEventHandler), typeof(DataList)); _SelectCustomCommand = new RoutedCommand("SelectCustomCommand", typeof(DataList)); CommandManager.RegisterClassCommandBinding(typeof(DataList), new CommandBinding(_SelectCustomCommand, OnSelectCustomCommand)); SelectCustomEvent = EventManager.RegisterRoutedEvent("SelectCustom", RoutingStrategy.Bubble, typeof(ExecutedRoutedEventHandler), typeof(DataList)); _FilterCustomCommand = new RoutedCommand("FilterCustomCommand", typeof(DataList)); CommandManager.RegisterClassCommandBinding(typeof(DataList), new CommandBinding(_FilterCustomCommand, OnFilterCustomCommand)); FilterCustomEvent = EventManager.RegisterRoutedEvent("FilterCustom", RoutingStrategy.Bubble, typeof(ExecutedRoutedEventHandler), typeof(DataList)); _ManualSelectionChangedCommand = new RoutedCommand("ManualSelectionChangedCommand", typeof(DataList)); CommandManager.RegisterClassCommandBinding(typeof(DataList), new CommandBinding(_ManualSelectionChangedCommand, OnManualSelectionChangedCommand)); ManualSelectionChangedEvent = EventManager.RegisterRoutedEvent("ManualSelectionChanged", RoutingStrategy.Bubble, typeof(ExecutedRoutedEventHandler), typeof(DataList)); }
/// <summary>Execute the command.</summary> public override void Execute() { ICommand newQueryFormCommand = CommandManager.GetCommandInstance("NewQueryFormCommand"); newQueryFormCommand.Execute(); }
public override void Load() { base.Load(); ItemHold.Clear(); Hotkeys = new HotkeysManager(); Macros = new MacroManager(); // ######################################################### // [FILE_FIX] // TODO: this code is a workaround to port old macros to the new xml system. if (ProfileManager.CurrentProfile.Macros != null) { for (int i = 0; i < ProfileManager.CurrentProfile.Macros.Length; i++) { Macros.PushToBack(ProfileManager.CurrentProfile.Macros[i]); } Macros.Save(); ProfileManager.CurrentProfile.Macros = null; } // ######################################################### Macros.Load(); InfoBars = new InfoBarManager(); InfoBars.Load(); _healthLinesManager = new HealthLinesManager(); Weather = new Weather(); WorldViewportGump viewport = new WorldViewportGump(this); UIManager.Add(viewport); if (!ProfileManager.CurrentProfile.TopbarGumpIsDisabled) { TopBarGump.Create(); } CommandManager.Initialize(); NetClient.Socket.Disconnected += SocketOnDisconnected; MessageManager.MessageReceived += ChatOnMessageReceived; UIManager.ContainerScale = ProfileManager.CurrentProfile.ContainersScale / 100f; SDL.SDL_SetWindowMinimumSize(Client.Game.Window.Handle, 640, 480); if (ProfileManager.CurrentProfile.WindowBorderless) { Client.Game.SetWindowBorderless(true); } else if (Settings.GlobalSettings.IsWindowMaximized) { Client.Game.MaximizeWindow(); } else if (Settings.GlobalSettings.WindowSize.HasValue) { int w = Settings.GlobalSettings.WindowSize.Value.X; int h = Settings.GlobalSettings.WindowSize.Value.Y; w = Math.Max(640, w); h = Math.Max(480, h); Client.Game.SetWindowSize(w, h); } CircleOfTransparency.Create(ProfileManager.CurrentProfile.CircleOfTransparencyRadius); Plugin.OnConnected(); Camera.SetZoomValues ( new[] { .5f, .6f, .7f, .8f, 0.9f, 1f, 1.1f, 1.2f, 1.3f, 1.5f, 1.6f, 1.7f, 1.8f, 1.9f, 2.0f, 2.1f, 2.2f, 2.3f, 2.4f, 2.5f } ); Camera.Zoom = ProfileManager.CurrentProfile.DefaultScale; }
public override void OnConnect() { CommandManager.AddCommandGroup <Commands>().CommandClick += SwAddin_CommandClick; AppDomain.CurrentDomain.AssemblyResolve += ResolveAssembly; }
public void Execute(GameClient Session, Room Room, string[] Params) { if (Params.Length == 1) { Session.SendWhisper("Please enter the username of the user you'd like to IP ban & account ban."); return; } Habbo Habbo = NeonEnvironment.GetHabboByUsername(Params[1]); if (Habbo == null) { Session.SendWhisper("An error occoured whilst finding that user in the database."); return; } if (Habbo.GetPermissions().HasRight("mod_tool") && !Session.GetHabbo().GetPermissions().HasRight("mod_ban_any")) { Session.SendWhisper("Oops, you cannot ban that user."); return; } string IPAddress = string.Empty; double Expire = NeonEnvironment.GetUnixTimestamp() + 78892200; string Username = Habbo.Username; using (IQueryAdapter dbClient = NeonEnvironment.GetDatabaseManager().GetQueryReactor()) { dbClient.RunQuery("UPDATE `user_info` SET `bans` = `bans` + '1' WHERE `user_id` = '" + Habbo.Id + "' LIMIT 1"); dbClient.SetQuery("SELECT `ip_last` FROM `users` WHERE `id` = '" + Habbo.Id + "' LIMIT 1"); IPAddress = dbClient.getString(); } string Reason; if (Params.Length >= 3) { Reason = CommandManager.MergeParams(Params, 2); } else { Reason = "No reason specified."; } if (!string.IsNullOrEmpty(IPAddress)) { NeonEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.IP, IPAddress, Reason, Expire); } NeonEnvironment.GetGame().GetModerationManager().BanUser(Session.GetHabbo().Username, ModerationBanType.USERNAME, Habbo.Username, Reason, Expire); GameClient TargetClient = NeonEnvironment.GetGame().GetClientManager().GetClientByUsername(Username); if (TargetClient != null) { TargetClient.Disconnect(); } Session.SendWhisper("Success, you have IP and account banned the user '" + Username + "' for '" + Reason + "'!"); }
public void ForceRequery() { CommandManager.Requery(this); }
public MDMenu(CommandManager manager, CommandEntrySet ces, CommandSource commandSource, object initialCommandTarget, EventHandler closeHandler) { Delegate = new MenuDelegate(closeHandler); AutoEnablesItems = false; var label = ces.Name ?? ""; Title = ContextMenuItem.SanitizeMnemonics(label); foreach (CommandEntry ce in ces) { if (ce.CommandId == Command.Separator) { AddItem(NSMenuItem.SeparatorItem); if (!string.IsNullOrEmpty(ce.OverrideLabel)) { AddItem(new MDMenuHeaderItem(ce)); } continue; } if (string.Equals(ce.CommandId as string, servicesID, StringComparison.Ordinal)) { AddItem(new MDServicesMenuItem()); continue; } var subset = ce as CommandEntrySet; if (subset != null) { AddItem(new MDSubMenuItem(manager, subset, commandSource, initialCommandTarget)); continue; } var lce = ce as LinkCommandEntry; if (lce != null) { AddItem(new MDLinkMenuItem(lce)); continue; } Command cmd = ce.GetCommand(manager); if (cmd == null) { LoggingService.LogError("MacMenu: '{0}' maps to null command", ce.CommandId); continue; } if (cmd is CustomCommand) { LoggingService.LogWarning("MacMenu: '{0}' is unsupported custom-rendered command' '", ce.CommandId); continue; } var acmd = cmd as ActionCommand; if (acmd == null) { LoggingService.LogWarning("MacMenu: '{0}' has unknown command type '{1}'", cmd.GetType(), ce.CommandId); continue; } AddItem(new MDMenuItem(manager, ce, acmd, commandSource, initialCommandTarget)); } }
void StartPasteForCanCommands() { Cursor = Cursors.Wait; isPasting = true; CommandManager.InvalidateRequerySuggested(); }
public MDMenu(CommandManager manager, CommandEntrySet ces, CommandSource commandSource, object initialCommandTarget) : this(manager, ces, commandSource, initialCommandTarget, null) { }
private async void Listener_ProgressUpdate(Dictionary <string, AnalysisProgress> status) { bool anyUpdates = status.Any(); if (!anyUpdates) { lock (_environments) { anyUpdates = _currentlyRefreshing.Count != 0; } } if (anyUpdates) { var updates = new List <DispatcherOperation>(); lock (_environments) { foreach (var env in _environments) { if (env.Factory == null) { continue; } AnalysisProgress progress; if (status.TryGetValue(AnalyzerStatusUpdater.GetIdentifier(env.Factory), out progress)) { _currentlyRefreshing[env.Factory] = progress; updates.Add(env.Dispatcher.InvokeAsync(() => { if (progress.Maximum > 0) { var percent = progress.Progress * 100 / progress.Maximum; var current = env.RefreshDBProgress; // Filter out small instances of 'reverse' // progress, but allow big jumps backwards. if (percent > current || percent < current - 25) { env.RefreshDBProgress = percent; } env.IsRefreshDBProgressIndeterminate = false; } else { env.IsRefreshDBProgressIndeterminate = true; } env.RefreshDBMessage = progress.Message; env.IsRefreshingDB = true; })); } else if (_currentlyRefreshing.TryGetValue(env.Factory, out progress)) { _currentlyRefreshing.Remove(env.Factory); try { TelemetryLogger?.LogEvent(PythonLogEvent.AnalysisCompleted, new AnalysisInfo { InterpreterId = env.Factory.Configuration.Id, AnalysisSeconds = progress.Seconds }); } catch (Exception ex) { Debug.Fail(ex.ToUnhandledExceptionMessage(GetType())); } updates.Add(env.Dispatcher.InvokeAsync(() => { env.IsRefreshingDB = false; env.IsRefreshDBProgressIndeterminate = false; env.RefreshDBMessage = string.Empty; CommandManager.InvalidateRequerySuggested(); })); } } } try { await Task.WhenAll(updates.Select(d => d.Task).ToArray()); } catch (OperationCanceledException) { // Tasks were cancelled, which probably means we are closing. // In this case, _timer will be disposed before the next update. } } if (Interlocked.Decrement(ref _listenerTimeToLive) == 0) { // It's time to reset the listener. We do this periodically in // case the global mutex has become abandoned. By releasing our // handle, it should go away and any errors (which may be caused // by users killing the analyzer) become transient rather than // permanent. // Because we are currently on the listener's thread, we need to // recreate on a separate thread so that this one can terminate. Task.Run((Action)CreateListener) .HandleAllExceptions(Site, GetType()) .DoNotWait(); } }
/// <summary> /// InvalidateCanExecute method will initiate validation of the Command. /// </summary> private void InvalidateCanExecute() { CommandManager.InvalidateRequerySuggested(); }
private void BeginRestore() { if (Utilities.IsGameRunning(Game)) { M3L.ShowDialog(window, M3L.GetString(M3L.string_interp_dialogCannotRestoreXWhileItIsRunning, Utilities.GetGameName(Game)), M3L.GetString(M3L.string_gameRunning), MessageBoxButton.OK, MessageBoxImage.Error); return; } var result = M3L.ShowDialog(window, M3L.GetString(M3L.string_dialog_restoringXWillDeleteGameDir, Utilities.GetGameName(Game)), M3L.GetString(M3L.string_gameTargetWillBeDeleted), MessageBoxButton.YesNo, MessageBoxImage.Warning); if (result == MessageBoxResult.Yes) { NamedBackgroundWorker bw = new NamedBackgroundWorker(Game + @"-Restore"); bw.DoWork += (a, b) => { RestoreInProgress = true; string restoreTargetPath = b.Argument as string; string backupPath = BackupLocation; BackupStatusLine2 = M3L.GetString(M3L.string_deletingExistingGameInstallation); if (Directory.Exists(restoreTargetPath)) { if (Directory.GetFiles(restoreTargetPath).Any() || Directory.GetDirectories(restoreTargetPath).Any()) { Log.Information(@"Deleting existing game directory: " + restoreTargetPath); try { bool deletedDirectory = Utilities.DeleteFilesAndFoldersRecursively(restoreTargetPath); if (deletedDirectory != true) { b.Result = RestoreResult.ERROR_COULD_NOT_DELETE_GAME_DIRECTORY; return; } } catch (Exception ex) { //todo: handle this better Log.Error($@"Exception deleting game directory: {restoreTargetPath}: {ex.Message}"); b.Result = RestoreResult.EXCEPTION_DELETING_GAME_DIRECTORY; return; } } } else { Log.Error(@"Game directory not found! Was it removed while the app was running?"); } //Todo: Revert LODs, remove IndirectSound settings (MEUITM) var created = Utilities.CreateDirectoryWithWritePermission(restoreTargetPath); if (!created) { b.Result = RestoreResult.ERROR_COULD_NOT_CREATE_DIRECTORY; return; } BackupStatusLine2 = M3L.GetString(M3L.string_restoringGameFromBackup); if (restoreTargetPath != null) { //callbacks #region callbacks void fileCopiedCallback() { ProgressValue++; } string dlcFolderpath = MEDirectories.DLCPath(backupPath, Game) + '\\'; //\ at end makes sure we are restoring a subdir int dlcSubStringLen = dlcFolderpath.Length; Debug.WriteLine(@"DLC Folder: " + dlcFolderpath); Debug.Write(@"DLC Fodler path len:" + dlcFolderpath); bool aboutToCopyCallback(string fileBeingCopied) { if (fileBeingCopied.Contains(@"\cmmbackup\")) { return(false); //do not copy cmmbackup files } Debug.WriteLine(fileBeingCopied); if (fileBeingCopied.StartsWith(dlcFolderpath, StringComparison.InvariantCultureIgnoreCase)) { //It's a DLC! string dlcname = fileBeingCopied.Substring(dlcSubStringLen); int index = dlcname.IndexOf('\\'); try { dlcname = dlcname.Substring(0, index); if (MEDirectories.OfficialDLCNames(RestoreTarget.Game).TryGetValue(dlcname, out var hrName)) { BackupStatusLine2 = M3L.GetString(M3L.string_interp_restoringX, hrName); } else { BackupStatusLine2 = M3L.GetString(M3L.string_interp_restoringX, dlcname); } } catch (Exception e) { Crashes.TrackError(e, new Dictionary <string, string>() { { @"Source", @"Restore UI display callback" }, { @"Value", fileBeingCopied }, { @"DLC Folder path", dlcFolderpath } }); } } else { //It's basegame if (fileBeingCopied.EndsWith(@".bik")) { BackupStatusLine2 = M3L.GetString(M3L.string_restoringMovies); } else if (new FileInfo(fileBeingCopied).Length > 52428800) { BackupStatusLine2 = M3L.GetString(M3L.string_interp_restoringX, Path.GetFileName(fileBeingCopied)); } else { BackupStatusLine2 = M3L.GetString(M3L.string_restoringBasegame); } } return(true); } void totalFilesToCopyCallback(int total) { ProgressValue = 0; ProgressIndeterminate = false; ProgressMax = total; } #endregion BackupStatus = M3L.GetString(M3L.string_restoringGame); Log.Information($@"Copying backup to game directory: {backupPath} -> {restoreTargetPath}"); CopyDir.CopyAll_ProgressBar(new DirectoryInfo(backupPath), new DirectoryInfo(restoreTargetPath), totalItemsToCopyCallback: totalFilesToCopyCallback, aboutToCopyCallback: aboutToCopyCallback, fileCopiedCallback: fileCopiedCallback, ignoredExtensions: new[] { @"*.pdf", @"*.mp3" }); Log.Information(@"Restore of game data has completed"); } //Check for cmmvanilla file and remove it present string cmmVanilla = Path.Combine(restoreTargetPath, @"cmm_vanilla"); if (File.Exists(cmmVanilla)) { Log.Information(@"Removing cmm_vanilla file"); File.Delete(cmmVanilla); } Log.Information(@"Restore thread wrapping up"); RestoreTarget.ReloadGameTarget(); b.Result = RestoreResult.RESTORE_OK; }; bw.RunWorkerCompleted += (a, b) => { if (b.Result is RestoreResult result) { switch (result) { case RestoreResult.ERROR_COULD_NOT_CREATE_DIRECTORY: Analytics.TrackEvent(@"Restored game", new Dictionary <string, string>() { { @"Game", Game.ToString() }, { @"Result", @"Failure, Could not create target directory" } }); M3L.ShowDialog(window, M3L.GetString(M3L.string_dialogCouldNotCreateGameDirectoryAfterDeletion), M3L.GetString(M3L.string_errorRestoringGame), MessageBoxButton.OK, MessageBoxImage.Error); break; case RestoreResult.ERROR_COULD_NOT_DELETE_GAME_DIRECTORY: Analytics.TrackEvent(@"Restored game", new Dictionary <string, string>() { { @"Game", Game.ToString() }, { @"Result", @"Failure, Could not delete existing game directory" } }); M3L.ShowDialog(window, M3L.GetString(M3L.string_dialogcouldNotFullyDeleteGameDirectory), M3L.GetString(M3L.string_errorRestoringGame), MessageBoxButton.OK, MessageBoxImage.Error); break; case RestoreResult.EXCEPTION_DELETING_GAME_DIRECTORY: Analytics.TrackEvent(@"Restored game", new Dictionary <string, string>() { { @"Game", Game.ToString() }, { @"Result", @"Failure, Exception deleting existing game directory" } }); M3L.ShowDialog(window, M3L.GetString(M3L.string_dialogErrorOccuredDeletingGameDirectory), M3L.GetString(M3L.string_errorRestoringGame), MessageBoxButton.OK, MessageBoxImage.Error); break; case RestoreResult.RESTORE_OK: Analytics.TrackEvent(@"Restored game", new Dictionary <string, string>() { { @"Game", Game.ToString() }, { @"Result", @"Success" } }); break; } } EndRestore(); CommandManager.InvalidateRequerySuggested(); }; var restTarget = RestoreTarget.TargetPath; if (RestoreTarget.IsCustomOption) { CommonOpenFileDialog m = new CommonOpenFileDialog { IsFolderPicker = true, EnsurePathExists = true, Title = M3L.GetString(M3L.string_selectNewRestoreDestination) }; if (m.ShowDialog() == CommonFileDialogResult.Ok) { //Check empty restTarget = m.FileName; if (Directory.Exists(restTarget)) { if (Directory.GetFiles(restTarget).Length > 0 || Directory.GetDirectories(restTarget).Length > 0) { //Directory not empty M3L.ShowDialog(window, M3L.GetString(M3L.string_dialogDirectoryIsNotEmptyLocationToRestoreToMustBeEmpty), M3L.GetString(M3L.string_cannotRestoreToThisLocation), MessageBoxButton.OK, MessageBoxImage.Error); return; } //TODO: PREVENT RESTORING TO DOCUMENTS/BIOWARE } Analytics.TrackEvent(@"Chose to restore game to custom location", new Dictionary <string, string>() { { @"Game", Game.ToString() } }); } else { return; } } RefreshTargets = true; bw.RunWorkerAsync(restTarget); } }
/// <summary> /// Повторить отмененное действие /// </summary> public virtual void Redo() { CommandManager.Redo(); }
public void Execute(Player Session, Room Room, string[] Params) { if (Params.Length == 1) { Session.SendWhisper("Please enter the username of the user you wish to summon."); return; } var TargetClient = Program.GameContext.PlayerController.GetClientByUsername(Params[1]); if (TargetClient == null) { Session.SendWhisper("An error occoured whilst finding that user, maybe they're not online."); return; } if (TargetClient.GetHabbo() == null) { Session.SendWhisper("An error occoured whilst finding that user, maybe they're not online."); return; } if (TargetClient.GetHabbo().Username == Session.GetHabbo().Username) { Session.SendWhisper("Get a life."); return; } if (!TargetClient.GetHabbo().InRoom) { Session.SendWhisper("That user currently isn't in a room."); return; } Room TargetRoom; if (!Program.GameContext.GetRoomManager().TryGetRoom(TargetClient.GetHabbo().CurrentRoomId, out TargetRoom)) { return; } if (Params.Length > 2) { TargetClient.SendNotification("A moderator has kicked you from the room for the following reason: " + CommandManager.MergeParams(Params, 2)); } else { TargetClient.SendNotification("A moderator has kicked you from the room."); } TargetRoom.GetRoomUserManager().RemoveUserFromRoom(TargetClient, true, false); }
/// <summary> /// The main start method that loads the controllers and prints information to the console /// </summary> public async void Start() { if (m_assembly == null) { Console.WriteLine($"HELLION_Dedicated.exe does not exist.\r\n Cannot start the server."); return; } if (Server.IsRunning) { return; } String[] serverArgs = new String[] { "", }; await ServerWrapper.HellionDedi.StartServer(serverArgs); m_serverWrapper.Init(); while (ServerWrapper.HellionDedi.Server == null) { await Task.Delay(25); } m_server = ServerWrapper.HellionDedi.Server; OnServerRunning?.Invoke(m_server); if (IsRunning) { Log.Instance.Info("Hellion Extended Server: World Initialized!"); Stopwatch stopwatch = new Stopwatch(); stopwatch.Start(); Thread.Sleep(1); stopwatch.Stop(); long num = (long)(1000.0 / stopwatch.Elapsed.TotalMilliseconds); Console.WriteLine(string.Format(HES.Localization.Sentences["ServerDesc"], DateTime.UtcNow.ToString("yyyy/MM/dd HH:mm:ss.ffff"), (Server.NetworkController.ServerID <= 0L ? "Not yet assigned" : string.Concat(Server.NetworkController.ServerID)), 64, num, (64 > num ? " WARNING: Server ticks is larger than max tick" : ""), Server.ServerName)); } Server.NetworkController.EventSystem.RemoveListener(typeof(TextChatMessage), new EventSystem.NetworkDataDelegate(Server.TextChatMessageListener)); //Deletes Old Listener Server.NetworkController.EventSystem.AddListener(typeof(TextChatMessage), new EventSystem.NetworkDataDelegate(this.TextChatMessageListener)); //Referances New Listener new NetworkManager(m_server.NetworkController); //Load Permission m_permissionmanager = new PermissionManager(); //Load Events m_eventhelper = new EventHelper(); //Load Commands m_commandManager = new CommandManager(); //Load Plugins! m_pluginManager = new PluginManager(); PluginManager.InitializeAllPlugins(); //TODO load Server Event Listeners EventHelper.RegisterEvent(new EventListener(typeof(JoinEvent).GetMethod("PlayerSpawnRequest"), typeof(JoinEvent), EventID.PlayerSpawnRequest)); //Command Listner Log.Instance.Info(HES.Localization.Sentences["ReadyForConnections"]); HES.PrintHelp(); HES.KeyPressSimulator(); }