public CommandListSnapshot(IEnumerable<DteCommand> commands) { var list = new List<CommandKeyBinding>(); var scopes = new HashSet<string>(StringComparer.OrdinalIgnoreCase); foreach (var command in commands) { CommandId commandId; if (!command.TryGetCommandId(out commandId)) { continue; } var commandKeybindings = command.GetCommandKeyBindings().ToReadOnlyCollection(); var commandData = new CommandData() { Command = command, CommandKeyBindings = commandKeybindings }; _commandMap[commandId] = commandData; foreach (var commandKeyBinding in commandData.CommandKeyBindings) { list.Add(commandKeyBinding); scopes.Add(commandKeyBinding.KeyBinding.Scope); } } _commandKeyBindings = list.ToReadOnlyCollectionShallow(); _scopes = scopes.ToReadOnlyCollection(); }
public bool ExecuteBuildFolder(CommandData data) { IModelTree tree = data.Context as IModelTree; if (tree == null) return true; bool success = false; try { CommonServices.Output.StartSection(Resources.Messages.BuildFolder); List<EntityKey> keys = GetAllObjectsKeys(tree.SelectedObjects.OfType<KBObject>()); if (keys == null) return true; GenexusUIServices.Build.Build(keys); success = true; } catch (Exception ex) { CommonServices.Output.AddErrorLine(ex.Message); } finally { CommonServices.Output.EndSection(Resources.Messages.BuildFolder, success); } return true; }
public CommandName(string file) { try { using (L2BinaryReader reader = new L2BinaryReader(File.OpenRead(file))) { Data = new CommandData[reader.ReadInt32()]; for (uint i = 0; i < Data.Length; i++) { CommandData data = new CommandData(); data.Number = reader.ReadUInt32(); data.Id = reader.ReadUInt32(); data.Name = reader.ReadString(); Data[i] = data; } reader.Validate(); } } catch (Exception) { Data = null; throw new InvalidDataException(ParsingFailed); } }
public override void Exec(CommandData cmdData) { AttributeVariableDialogInfo dialogInfo = new AttributeVariableDialogInfo(); dialogInfo.Filter = TypedObjectKind.Attribute; dialogInfo.MultiSelection = true; IList<object> selectedObjects = GenexusUIServices.SelectAttributeVariable.SelectAttributeVariable(dialogInfo); if (selectedObjects != null && selectedObjects.Count != 0) { foreach (Gx.Attribute selectedAtt in selectedObjects) { PatternInstanceElement filterAttElement = BaseElement.Children.AddNewElement(InstanceChildren.FilterAttributes.FilterAttribute); filterAttElement.Attributes[InstanceAttributes.FilterAttribute.Name] = selectedAtt.Name; filterAttElement.Attributes[InstanceAttributes.FilterAttribute.Description] = selectedAtt.Title; //filterAttElement.Attributes[InstanceAttributes.FilterAttribute.Attribute] = selectedAtt; if (selectedAtt.GetPropertyValue<int>(Properties.ATT.ControlType) == Properties.ATT.ControlType_Values.ComboBox) filterAttElement.Attributes[InstanceAttributes.FilterAttribute.AllValue] = true; } if (StandardMessageBox.Confirm(Messages.ConfirmAddFilterCondition)) { PatternInstanceElement conditionsElement = BaseElement.Parent.Children[InstanceChildren.Filter.Conditions]; foreach (Gx.Attribute selectedAtt in selectedObjects) { PatternInstanceElement conditionElement = conditionsElement.Children.AddNewElement(InstanceChildren.Conditions.Condition); string attCondition = CreateCondition(selectedAtt, BaseElement); conditionElement.Attributes[InstanceAttributes.Condition.Value] = attCondition; } } } }
public override void Think( Enemy enemy ) { var commandData = new CommandData(); var allyParty = BattleAllyPartyManager.Instance.Party; commandData.AddTargetId( TypeConstants.PartyType.Ally, Random.Range( 0, allyParty.List.Count ) ); commandData.SetCommandType( TypeConstants.CommandType.Attack ); enemy.DecideCommand( commandData ); }
public void タスクセーブ() { var task = new TaskData(); var command = new CommandData(); task.ProjectPaths.Add(@"C:\Program Files"); gTaskList.Add(task); task.CommandDataList.Add(command); Assert.True(gTaskList.Save(@"C:\My Program\FullAutomationSupportSystem\FullAutomationSupportSystemTest\fas.fas") == true); }
public void コマンドの追加() { var task = new TaskData(); var command = new CommandData(); task.ProjectPaths.Add(@"C:\Program Files"); gTaskList.Add(task); task.CommandDataList.Add(command); Assert.True(task.CommandDataList.Count == 1); }
public void AddUpdate(ControllerReference controllerReference, CommandData command) { if(IsDisposed) throw new ObjectDisposedException(null); // Add to the update buffer. lock(_inBuffer) { //vs enumerating a copy of the collection _inBuffer.Add(new ControllerOutputUpdate() { ControllerReference = controllerReference, Command = command }); } }
// This is where you implement whatever you want to do // when this command is invoked public bool ExecGeneraWebxmlCommand(CommandData cmdData) { DateTime inicio = DateTime.Now; IKBService kbserv = UIServices.KB; if (kbserv != null && kbserv.CurrentKB != null) { try { SaveFileDialog SFD = new SaveFileDialog(); SFD.Filter = "web.xml file (web.xml)|"; SFD.FileName = "web.xml"; DialogResult Res = SFD.ShowDialog(); if (Res == DialogResult.OK) { string filename = SFD.FileName; if (!filename.ToLower().EndsWith("xml")) { filename = filename + ".xml"; } string xml = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\n" + "<web-app xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\" " + "xmlns=\"http://java.sun.com/xml/ns/javaee\" " + "xmlns:web=\"http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd\" " + "xsi:schemaLocation=\"http://java.sun.com/xml/ns/j2ee http://java.sun.com/xml/ns/j2ee/web-app_2_4.xsd\" " + "version=\"2.4\">\n" + "<listener><listener-class>com.genexus.webpanels.ServletEventListener</listener-class></listener>\n" + "<listener><listener-class>com.genexus.webpanels.SessionEventListener</listener-class></listener>\n"; KBModel model = kbserv.CurrentKB.WorkingEnvironment.DesignModel; string servletTemplate = "<servlet-mapping><servlet-name>{objName}</servlet-name><url-pattern>/{objName}</url-pattern> </servlet-mapping> \n" + "<servlet> <servlet-name>{objName}</servlet-name><servlet-class>{objName}</servlet-class> </servlet>\n"; foreach (KBObject obj in Transaction.GetAll(model)) { string servlet = servletTemplate.Replace("{objName}", obj.Name); xml += servlet; } foreach (KBObject obj in WebPanel.GetAll(model)) { string servlet = servletTemplate.Replace("{objName}", obj.Name); xml += servlet; } xml += "</web-app>"; File.WriteAllText(filename, xml); MessageBox.Show("Archivo generado en " + SFD.FileName); } } catch (Exception e) { MessageBox.Show(e.Message, "Error while exporting the KB"); } } return true; }
private void CommandButton_Click(object sender, EventArgs e) { var data = new CommandData(); data.Name = CommandListManager.GetInstance()[CommandComboBox.SelectedIndex].Name; data.Type = CommandListManager.GetInstance()[CommandComboBox.SelectedIndex].Type; data.Checked = true; gTaskData.CommandDataList.Add(data); var form = new CommandForm(gTaskData.CommandDataList[gTaskData.CommandDataList.Count - 1]); if (form.ShowDialog() == System.Windows.Forms.DialogResult.OK) { AddDataGridView(data); } }
private bool QueryGeneraWebxmlCommand(CommandData cmdData, ref CommandStatus status) { // This is where you have a chance to modify the status of // menu / toolbar items. status.State = CommandState.Disabled; IKBService kbserv = UIServices.KB; if (kbserv != null && kbserv.CurrentKB != null) { status.State = CommandState.Enabled; } // return true to indicate you already resolved the command status; // otherwise the framework will try with its next registered // command target return true; }
public CommandForm(CommandData data) { InitializeComponent(); gCommandData = data; gCommandListData = CommandListManager.GetInstance()[(int)data.Type]; Param1ReadTextBox.Text = gCommandListData.Param1Txt; Param2ReadTextBox.Text = gCommandListData.Param2Txt; SetParam1CommandListData(); SetParam2CommandListData(); if (gCommandData.Type == CommandListType.Bat) { openFileDialog1.Filter = "batファイル|*.bat"; } if (gCommandData.Type == CommandListType.File) { openFileDialog1.Filter = "すべてのファイル|*.*"; } }
public void TestCommandDataDispose() { var data = new CommandData() { Content = new List<String>(), Connections = new List<ConnectionModel>(), Groups = new List<Core.Shared.Models.GroupModel>(), Accounts = new List<AccountModel>(), Permissions = new List<PermissionModel>(), AccountPlayers = new List<AccountPlayerModel>(), Variables = new List<VariableModel>(), Languages = new List<LanguageModel>(), TextCommands = new List<TextCommandModel>(), TextCommandMatches = new List<TextCommandMatchModel>(), Chats = new List<ChatModel>(), Players = new List<PlayerModel>(), Kills = new List<KillModel>(), Spawns = new List<SpawnModel>(), Kicks = new List<KickModel>(), Bans = new List<BanModel>() }; data.Dispose(); Assert.IsNull(data.Content); Assert.IsNull(data.Connections); Assert.IsNull(data.Groups); Assert.IsNull(data.Accounts); Assert.IsNull(data.Permissions); Assert.IsNull(data.AccountPlayers); Assert.IsNull(data.Variables); Assert.IsNull(data.Languages); Assert.IsNull(data.TextCommands); Assert.IsNull(data.TextCommandMatches); Assert.IsNull(data.Chats); Assert.IsNull(data.Players); Assert.IsNull(data.Kills); Assert.IsNull(data.Spawns); Assert.IsNull(data.Kicks); Assert.IsNull(data.Bans); }
public CommandListSnapshot(IEnumerable<Command> commands) { var list = new List<CommandKeyBinding>(); foreach (var command in commands) { CommandId commandId; if (!command.TryGetCommandId(out commandId)) { continue; } var commandKeybindings = command.GetCommandKeyBindings().ToReadOnlyCollection(); var commandData = new CommandData() { Command = command, CommandKeyBindings = commandKeybindings }; _commandMap[commandId] = commandData; list.AddRange(commandData.CommandKeyBindings); } _commandKeyBindings = list.ToReadOnlyCollectionShallow(); }
void ParseBestMoveCommand( CommandData cmdData, string [] str_tokens ) { if( str_tokens != null && str_tokens.Length > 1 ) { string [] str_next_tokens = GetNextTokens( str_tokens ); // bestmove <move1> [ ponder <move2> ] string strValue = str_next_tokens[0]; cmdData.QueueStrValue.Enqueue( strValue ); if( str_next_tokens.Length > 1 ) { // sub command - ponder <move2> str_next_tokens = GetNextTokens( str_next_tokens ); string strSubCmd = str_next_tokens[0]; if( strSubCmd == "ponder" ) { // subsub command CommandData subCmdData = new CommandData(); subCmdData.StrCmd = strSubCmd; str_next_tokens = GetNextTokens( str_next_tokens ); strValue = str_next_tokens[0]; subCmdData.QueueStrValue.Enqueue( strValue ); subCmdData.InvalidCmd = false; cmdData.QueueSubCmdData.Enqueue( subCmdData ); } } cmdData.InvalidCmd = false; } else { throw new CmdParseException( "ParseBestMoveCommand() - Invalid Parameter Exception Throw!!!" ); } }
public void HandleCommand(Player p, string cmd, string arg, CommandData data) { if (_survivalMaps.Maps.Contains(p.level.name) && p.Rank < LevelPermission.Operator) { if (cmd != "rules" && cmd != "agree" && cmd != "Rules" && cmd != "help" && cmd != "survival" && cmd != "craft" && cmd != "inventory" && //Default allowed commands. cmd != "craftlist" && cmd != "drop" && cmd != "main" && cmd != "goto" && cmd != "g" && cmd != "spawn") { if (!CmdsWhitelist.CmdsWhitelist.Commands.Contains(cmd)) { p.SendMessage("Only Op and Op+ can use this command here."); p.cancelcommand = true; } } } string[] args = arg.Split(' '); if (cmd == "craft") { p.cancelcommand = true; _cmdCraft.Execute(p, args); return; } else if (cmd == "inventory") { p.cancelcommand = true; _cmdInventory.Execute(p); return; } else if (cmd == "craftlist") { p.cancelcommand = true; _cmdCraftList.Execute(p, args); return; } else if (cmd == "drop") { p.cancelcommand = true; _cmdDrop.Execute(p, args); return; } else if (cmd == "chest") { p.cancelcommand = true; _cmdChest.Execute(p, args); return; } if (args.Length == 0) { help(p); return; } if (cmd == "survival") { p.cancelcommand = true; switch (args[0]) { case "op": helpOp(p); break; case "maps": _cmdMap.Execute(p, args); break; case "cmds": _cmdCmdsWhitelist.Execute(p, args); break; case "cmdperm": _cmdSetPerms.Execute(p, args); break; case "blocks": _cmdBlock.Execute(p, args); break; case "crafting": _cmdCrafting.Execute(p, args); break; case "tools": _cmdTools.Execute(p, args); break; case "actions": _cmdActionBlocks.Execute(p, args); break; default: help(p); break; } } }
private void AddDataGridView(CommandData command) { int count = commandDataBindingSource.Add(command); dataGridView1["run", count].Value = "実行"; }
public override void Use(Player p, string message, CommandData data) { if (message.Length == 0) { Help(p); return; } string[] args = message.SplitSpaces(); PlayerBot bot = Matcher.FindBots(p, args[0]); if (bot == null) { return; } if (!LevelInfo.Check(p, data.Rank, p.level, "change AI of bots in this level")) { return; } if (!bot.EditableBy(p, "change the AI of")) { return; } if (args.Length == 1) { bot.Instructions.Clear(); bot.kill = false; bot.hunt = false; bot.AIName = null; UpdateBot(p, bot, "'s AI was turned off."); return; } else if (args.Length != 2) { Help(p); return; } string ai = args[1].ToLower(); if (ai.CaselessEq("hunt")) { bot.hunt = !bot.hunt; bot.Instructions.Clear(); bot.AIName = null; UpdateBot(p, bot, "'s hunt instinct: " + bot.hunt); return; } else if (ai.CaselessEq("kill")) { if (!CheckExtraPerm(p, data, 1)) { return; } bot.kill = !bot.kill; UpdateBot(p, bot, "'s kill instinct: " + bot.kill); return; } if (!ScriptFile.Parse(p, bot, ai)) { return; } UpdateBot(p, bot, "'s AI was set to " + ai); }
public static void Execute(Player p, string message, CommandData data, bool global, string cmd) { string[] parts = message.SplitSpaces(4); Level lvl = p.IsSuper ? null : p.level; for (int i = 0; i < Math.Min(parts.Length, 3); i++) { parts[i] = parts[i].ToLower(); } if (message.Length == 0) { if (GetBD(p, global) != null) { SendStepHelp(p, global); } else { Help(p, cmd); } return; } switch (parts[0]) { case "add": case "create": AddHandler(p, lvl, parts, global, cmd); break; case "copyall": case "copyfrom": CopyAllHandler(p, lvl, parts, data, global, cmd); break; case "copy": case "clone": case "duplicate": CopyHandler(p, lvl, parts, data, global, cmd); break; case "delete": case "remove": RemoveHandler(p, lvl, parts, global, cmd); break; case "info": case "about": InfoHandler(p, lvl, parts, global, cmd); break; case "list": case "ids": ListHandler(p, lvl, parts, global, cmd); break; case "abort": p.Message("Aborted the custom block creation process."); SetBD(p, global, null); break; case "edit": EditHandler(p, lvl, parts, global, cmd); break; default: if (GetBD(p, global) != null) { DefineBlockStep(p, lvl, message, global, cmd); } else { Help(p, cmd); } break; } }
public override void Use(Player p, string message, CommandData data) { if (message.Length == 0) { p.Message("You need to provide a player name."); return; } string[] parts = message.SplitSpaces(), names = null; int[] ids = GetIds(p, data, parts, out names); if (ids == null) { return; } TimeSpan delta = GetDelta(p, parts[0], parts, 1); if (delta == TimeSpan.MinValue) { return; } BlockDB db = p.level.BlockDB; DateTime start = DateTime.UtcNow - delta; BlockDBCacheWriter w = new BlockDBCacheWriter(); w.start = (int)((start - BlockDB.Epoch).TotalSeconds); using (IDisposable locker = db.Locker.AccquireWrite()) { if (!File.Exists(db.FilePath)) { p.Message("&WBlockDB file for this map doesn't exist."); return; } Vec3U16 dims; FastList <BlockDBEntry> entries = new FastList <BlockDBEntry>(4096); using (Stream src = OpenRead(db.FilePath), dst = OpenWrite(db.FilePath + ".tmp")) { BlockDBFile format = BlockDBFile.ReadHeader(src, out dims); BlockDBFile.WriteHeader(dst, dims); w.dst = dst; w.format = format; w.ids = ids; Read(src, format, w.Output); // flush entries leftover if (w.entries.Count > 0) { format.WriteEntries(dst, w.entries); } } string namesStr = names.Join(name => p.FormatNick(name)); if (w.left > 0) { File.Delete(db.FilePath); File.Move(db.FilePath + ".tmp", db.FilePath); p.Message("Pruned {1}&S's changes ({2} entries left now) for the past &b{0}", delta.Shorten(true), namesStr, w.left); } else { File.Delete(db.FilePath + ".tmp"); p.Message("No changes found by {1} &Sin the past &b{0}", delta.Shorten(true), namesStr); } } }
void ParseRegistrationCommand( CommandData cmdData, string [] str_tokens ) { if( str_tokens != null && str_tokens.Length > 1 ) { string [] str_next_tokens = GetNextTokens( str_tokens ); // value 1, checking, 2, ok, 3, error cmdData.QueueStrValue.Clear(); cmdData.QueueStrValue.Enqueue( str_next_tokens[0] ); cmdData.QueueSubCmdData.Clear(); cmdData.InvalidCmd = false; } else { throw new CmdParseException( "ParseRegistrationCommand() - Invalid Command Value Exception Throw!!!" ); } }
private TextCleaner(Builder builder) : base(builder.GetObject("TextCleaner").Handle) { builder.Autoconnect(this); operationFactory = new OperationFactory(Operations); processor = new FullTextProcessor(); currentOp = new Nop(); DeleteEvent += Window_DeleteEvent; var fira = Pango.FontDescription.FromString("Fira Code Regular 11"); textMain.ModifyFont(fira); textResult.ModifyFont(fira); textMain.Buffer.Changed += (object sender, EventArgs e) => ProcessText(); operation.Changed += (object sender, EventArgs e) => { if (operation.Active < 0) { return; } currentOp = Operations[operation.Active]; string[] argNames = currentOp.ArgNames; if (argNames.Length >= 1) { textArgument1.IsEditable = true; labelArgument1.Text = argNames[0]; textArgument1.Show(); labelArgument1.Show(); } else { textArgument1.IsEditable = false; textArgument1.Hide(); labelArgument1.Hide(); } if (argNames.Length >= 2) { textArgument2.IsEditable = true; labelArgument2.Text = argNames[1]; textArgument2.Show(); labelArgument2.Show(); } else { textArgument2.IsEditable = false; textArgument2.Hide(); labelArgument2.Hide(); } ProcessText(); }; textArgument1.Changed += (object sender, EventArgs e) => ProcessText(); textArgument2.Changed += (object sender, EventArgs e) => ProcessText(); radioLines.Clicked += (object sender, EventArgs e) => { btnCopy.Sensitive = true; processor = new LineProcessor(); ProcessText(); }; radioFullText.Clicked += (object sender, EventArgs e) => { btnCopy.Sensitive = true; processor = new FullTextProcessor(); ProcessText(); }; radioTesting.Clicked += (object sender, EventArgs e) => { btnCopy.Sensitive = false; TreeIter iter; if (!listWorkspace.GetIterFirst(out iter)) { return; } var list = new List <CommandData>(); do { if (treeOperations.Selection.IterIsSelected(iter)) { CommandData data = (CommandData)listWorkspace.GetValue(iter, 0); list.Add(data); } } while (listWorkspace.IterNext(ref iter)); processor = new ProcessorList(operationFactory, list.ToArray()); ProcessText(); }; btnCopy.Clicked += (sender, args) => { string processorName = ""; if (radioFullText.Active) { processorName = "full"; } else if (radioLines.Active) { processorName = "line"; } string opName = currentOp.Name; string arg1 = textArgument1.Text; string arg2 = textArgument2.Text; listWorkspace.AppendValues( CommandData.CreateInstance( processorName, opName, operation.Active, arg1, arg2 ) ); }; treeOperations.Selection.Changed += (sender, args) => { if (radioTesting.Active) { btnCopy.Sensitive = false; TreeIter iter; if (!listWorkspace.GetIterFirst(out iter)) { return; } var list = new List <CommandData>(); do { if (treeOperations.Selection.IterIsSelected(iter)) { CommandData data = (CommandData)listWorkspace.GetValue(iter, 0); list.Add(data); } } while (listWorkspace.IterNext(ref iter)); processor = new ProcessorList(operationFactory, list.ToArray()); ProcessText(); } }; for (int i = 0; i < Operations.Length; i++) { var op = Operations[i]; listOperations.AppendValues(i, op.Name); } operation.IdColumn = 0; operation.EntryTextColumn = 1; operation.Model = listOperations; var em = new TextTag("highlight") { Background = "#ff0" }; textMain.Buffer.TagTable.Add(em); cellRendererName.Editable = false; columnName.SetCellDataFunc(cellRendererName, RenderCommandName); listWorkspace = new ListStore(typeof(CommandData)); treeOperations.Model = listWorkspace; treeOperations.Reorderable = true; treeOperations.Selection.Mode = SelectionMode.Multiple; cellRendererName.Sensitive = true; treeOperations.Sensitive = true; FillFromClipboard(); }
public override void Use(Player p, string message, CommandData data) { if (message.Length == 0) { Help(p); return; } string[] args = message.SplitSpaces(3); args[0] = PlayerInfo.FindMatchesPreferOnline(p, args[0]); if (args[0] == null) { return; } Player who = PlayerInfo.FindExact(args[0]); if (args.Length == 1) { p.Message("&WYou must specify a type to modify."); MessageValidTypes(p); return; } string opt = args[1].ToLower(); if (opt == "firstlogin") { SetDate(p, args, PlayerData.ColumnFirstLogin, who, v => who.FirstLogin = v); } else if (opt == "lastlogin") { SetDate(p, args, PlayerData.ColumnLastLogin, who, v => who.LastLogin = v); } else if (opt == "logins") { SetInteger(p, args, PlayerData.ColumnLogins, 1000000000, who, v => who.TimesVisited = v, type_norm); } else if (opt == "deaths") { SetInteger(p, args, PlayerData.ColumnDeaths, short.MaxValue, who, v => who.TimesDied = v, type_norm); } else if (opt == "money") { SetInteger(p, args, PlayerData.ColumnMoney, 100000000, who, v => who.money = v, type_norm); } else if (opt == "title") { if (args.Length < 3) { p.Message("Title can be up to 20 characters. Use \"null\" to remove the title"); return; } if (args[2].Length >= 20) { p.Message("Title must be under 20 characters"); return; } if (args[2] == "null") { args[2] = ""; } if (who != null) { who.title = args[2]; who.SetPrefix(); } PlayerDB.Update(args[0], PlayerData.ColumnTitle, args[2].UnicodeToCp437()); MessageDataChanged(p, args[0], args[1], args[2]); } else if (opt == "ip") { if (args.Length < 3) { p.Message("A new IP address must be provided."); return; } IPAddress ip; if (!IPAddress.TryParse(args[2], out ip)) { p.Message("&W\"{0}\" is not a valid IP address.", args[2]); return; } if (who != null) { who.ip = args[2]; } PlayerDB.Update(args[0], PlayerData.ColumnIP, args[2]); MessageDataChanged(p, args[0], args[1], args[2]); } else if (opt == "modified") { SetInteger(p, args, PlayerData.ColumnBlocks, int.MaxValue, who, v => who.TotalModified = v, type_lo); } else if (opt == "drawn") { SetInteger(p, args, PlayerData.ColumnDrawn, int.MaxValue, who, v => who.TotalDrawn = v, type_lo); } else if (opt == "placed") { SetInteger(p, args, PlayerData.ColumnBlocks, int.MaxValue, who, v => who.TotalPlaced = v, type_hi); } else if (opt == "deleted") { SetInteger(p, args, PlayerData.ColumnDrawn, int.MaxValue, who, v => who.TotalDeleted = v, type_hi); } else if (opt == "totalkicked") { SetInteger(p, args, PlayerData.ColumnKicked, 16777215, who, v => who.TimesBeenKicked = v, type_norm); } else if (opt == "messages") { SetInteger(p, args, PlayerData.ColumnMessages, 16777215, who, v => who.TotalMessagesSent = v, type_norm); } else if (opt == "timespent") { SetTimespan(p, args, PlayerData.ColumnTimeSpent, who, v => who.TotalTime = v); } else if (opt == "color") { SetColor(p, args, PlayerData.ColumnColor, who, v => who.UpdateColor(v.Length == 0 ? who.group.Color : v)); } else if (opt == "titlecolor") { SetColor(p, args, PlayerData.ColumnTColor, who, v => who.titlecolor = v); } else { p.Message("&WInvalid type"); MessageValidTypes(p); } }
/// <summary>Send a single character to terminal sessions</summary> /// <param name="arg">The character to send</param> /// <returns>A <seealso cref="CommandData"/> object containing the character to send</returns> internal static CommandData SendCharHandler(string arg) { CommandData data = new CommandData(arg); return(data); }
public int RunCommand(string input) { string cmd; if (input.Length == 0) { return(0); } if (input[0] != '/') { ChiConsole.WriteLine("Input is not a command: {0}", input); return(-1); } int idx = input.IndexOf(' '); if (idx == -1) { cmd = input.Substring(1); input = ""; } else { cmd = input.Substring(1, idx - 1); input = input.Substring(idx + 1); } if (!m_commandMap.ContainsKey(cmd)) { List <string> l = new List <string>(); foreach (string c in m_commandMap.Keys) { if (c.StartsWith(cmd)) { l.Add(c); } } if (l.Count == 0) { ChiConsole.WriteLine("Unknown command {0}", cmd); return(-1); } else if (l.Count > 1) { ChiConsole.WriteLine("Ambigious command. ({0})", String.Join(", ", l.ToArray())); return(-1); } else { cmd = l[0]; } } CommandData cmdData = m_commandMap[cmd]; int res = -1; try { res = cmdData.m_handler(input); } catch (Exception e) { ChiConsole.WriteError("Error handling command " + cmd, e); } return(res); }
void GetAutoCompleteList(string command) { if (command == lastAutoCompleteCommand) { if (command == string.Empty && autoCompleteList.Count > 0) { ClearAutoCompleteList(); } return; } lastAutoCompleteCommand = command; ClearAutoCompleteList(); command = command.Trim(' '); if (command == string.Empty) { return; } if (command[0] == searchCommandPrefix) { return; } int spaceIndex = command.IndexOf(" "); if (spaceIndex != -1) { command = command.Substring(0, spaceIndex); } IsRemoteCommand(ref command); if (command == string.Empty) { return; } if (command[0] == '?') { command = command.Substring(1); } string[] names = commandsTable.names; for (int i = 0; i < names.Length; i++) { if (ignoreCasesInAutoCompleteInput ? names[i].StartsWith(command, StringComparison.CurrentCultureIgnoreCase) : names[i].StartsWith(command)) { string name = names[i]; CommandData commandData = commandsTable.lookup[name]; if (commandData.consoleCommand == null) { if (accessLevel != AccessLevel.Admin) { continue; } bool found = false; for (int j = i + 1; j < names.Length; j++) { if (ignoreCasesInAutoCompleteInput ? names[j].StartsWith(name, StringComparison.CurrentCultureIgnoreCase) : names[j].StartsWith(name)) { CommandData commandData2 = commandsTable.lookup[names[j]]; if (commandData2.consoleCommand == null || !commandData2.consoleCommand.HasAccess(accessLevel) || !commandData2.IsRegistered()) { continue; } found = true; break; } else { break; } } if (!found) { continue; } } else { if (!commandData.consoleCommand.HasAccess(accessLevel) || !commandData.IsRegistered()) { continue; } } autoCompleteList.Add(new AutoComplete(name, commandData)); } } }
void ParseInfoCommand( CommandData cmdData, string [] str_tokens ) { if( str_tokens != null && str_tokens.Length > 1 ) { string [] str_next_tokens = GetNextTokens( str_tokens ); string strSubCmd = str_next_tokens[0]; str_next_tokens = GetNextTokens( str_next_tokens ); CommandData subCmdData = null; string strValue = null; while( strSubCmd != null ) { // should have sub command!!! switch( strSubCmd ) { case "depth": { subCmdData = new CommandData(); subCmdData.StrCmd = strSubCmd; strValue = str_next_tokens[0]; subCmdData.QueueStrValue.Enqueue( strValue ); subCmdData.InvalidCmd = false; cmdData.QueueSubCmdData.Enqueue( subCmdData ); } break; case "seldepth": { subCmdData = new CommandData(); subCmdData.StrCmd = strSubCmd; strValue = str_next_tokens[0]; subCmdData.QueueStrValue.Enqueue( strValue ); subCmdData.InvalidCmd = false; cmdData.QueueSubCmdData.Enqueue( subCmdData ); } break; case "time": { subCmdData = new CommandData(); subCmdData.StrCmd = strSubCmd; strValue = str_next_tokens[0]; subCmdData.QueueStrValue.Enqueue( strValue ); subCmdData.InvalidCmd = false; cmdData.QueueSubCmdData.Enqueue( subCmdData ); } break; case "nodes": { subCmdData = new CommandData(); subCmdData.StrCmd = strSubCmd; strValue = str_next_tokens[0]; subCmdData.QueueStrValue.Enqueue( strValue ); subCmdData.InvalidCmd = false; cmdData.QueueSubCmdData.Enqueue( subCmdData ); } break; case "pv": { } break; case "multipv": { subCmdData = new CommandData(); subCmdData.StrCmd = strSubCmd; strValue = str_next_tokens[0]; subCmdData.QueueStrValue.Enqueue( strValue ); subCmdData.InvalidCmd = false; cmdData.QueueSubCmdData.Enqueue( subCmdData ); } break; case "score": { } break; case "currmove": { subCmdData = new CommandData(); subCmdData.StrCmd = strSubCmd; strValue = str_next_tokens[0]; subCmdData.QueueStrValue.Enqueue( strValue ); subCmdData.InvalidCmd = false; cmdData.QueueSubCmdData.Enqueue( subCmdData ); } break; case "currmovenumber": { subCmdData = new CommandData(); subCmdData.StrCmd = strSubCmd; strValue = str_next_tokens[0]; subCmdData.QueueStrValue.Enqueue( strValue ); subCmdData.InvalidCmd = false; cmdData.QueueSubCmdData.Enqueue( subCmdData ); } break; case "hashfull": { subCmdData = new CommandData(); subCmdData.StrCmd = strSubCmd; strValue = str_next_tokens[0]; subCmdData.QueueStrValue.Enqueue( strValue ); subCmdData.InvalidCmd = false; cmdData.QueueSubCmdData.Enqueue( subCmdData ); } break; case "nps": { subCmdData = new CommandData(); subCmdData.StrCmd = strSubCmd; strValue = str_next_tokens[0]; subCmdData.QueueStrValue.Enqueue( strValue ); subCmdData.InvalidCmd = false; cmdData.QueueSubCmdData.Enqueue( subCmdData ); } break; case "tbhits": { subCmdData = new CommandData(); subCmdData.StrCmd = strSubCmd; strValue = str_next_tokens[0]; subCmdData.QueueStrValue.Enqueue( strValue ); subCmdData.InvalidCmd = false; cmdData.QueueSubCmdData.Enqueue( subCmdData ); } break; case "sbhits": { subCmdData = new CommandData(); subCmdData.StrCmd = strSubCmd; strValue = str_next_tokens[0]; subCmdData.QueueStrValue.Enqueue( strValue ); subCmdData.InvalidCmd = false; cmdData.QueueSubCmdData.Enqueue( subCmdData ); } break; case "cpuload": { subCmdData = new CommandData(); subCmdData.StrCmd = strSubCmd; strValue = str_next_tokens[0]; subCmdData.QueueStrValue.Enqueue( strValue ); subCmdData.InvalidCmd = false; cmdData.QueueSubCmdData.Enqueue( subCmdData ); } break; case "string": { subCmdData = new CommandData(); subCmdData.StrCmd = strSubCmd; strValue = str_next_tokens[0]; subCmdData.QueueStrValue.Enqueue( strValue ); subCmdData.InvalidCmd = false; cmdData.QueueSubCmdData.Enqueue( subCmdData ); } break; case "refutation": { } break; case "currline": { } break; } if( str_next_tokens != null && str_next_tokens.Length > 1 ) { str_next_tokens = GetNextTokens( str_next_tokens ); strSubCmd = str_next_tokens[0]; } else { strSubCmd = null; } } cmdData.InvalidCmd = false; } else { throw new CmdParseException( "ParseInfoCommand() - Invalid Parameter Exception Throw!!!" ); } }
public override void Use(Player p, string message, CommandData data) { RateMap(p, false); }
void ParseOptionCommand( CommandData cmdData, string [] str_tokens ) { if( str_tokens != null && str_tokens.Length > 1 ) { string [] str_next_tokens = GetNextTokens( str_tokens ); //str_next_tokens = GetNextTokens( str_next_tokens ); string strSubCmd = str_next_tokens[0]; // should have sub command!!! if( strSubCmd == "name" ) { CommandData subCmdData = new CommandData(); subCmdData.StrCmd = strSubCmd; str_next_tokens = GetNextTokens( str_next_tokens ); string strCmdValue; str_next_tokens = GetNextCommandTokens( str_next_tokens, "type", out strCmdValue ); subCmdData.QueueStrValue.Enqueue( strCmdValue ); subCmdData.InvalidCmd = false; cmdData.QueueSubCmdData.Enqueue( subCmdData ); strSubCmd = str_next_tokens[0]; if( strSubCmd == "type" ) { subCmdData = new CommandData(); subCmdData.StrCmd = strSubCmd; str_next_tokens = GetNextTokens( str_next_tokens ); strCmdValue = str_next_tokens[0]; subCmdData.QueueStrValue.Enqueue( strCmdValue ); subCmdData.InvalidCmd = false; cmdData.QueueSubCmdData.Enqueue( subCmdData ); } if( str_next_tokens != null && str_next_tokens.Length > 1 ) { str_next_tokens = GetNextTokens( str_next_tokens ); strSubCmd = str_next_tokens[0]; if( strSubCmd == "default" ) { subCmdData = new CommandData(); subCmdData.StrCmd = strSubCmd; str_next_tokens = GetNextTokens( str_next_tokens ); strCmdValue = str_next_tokens[0]; subCmdData.QueueStrValue.Enqueue( strCmdValue ); subCmdData.InvalidCmd = false; cmdData.QueueSubCmdData.Enqueue( subCmdData ); } if( str_next_tokens != null && str_next_tokens.Length > 1 ) { str_next_tokens = GetNextTokens( str_next_tokens ); strSubCmd = str_next_tokens[0]; if( strSubCmd == "var" ) { subCmdData = new CommandData(); subCmdData.StrCmd = strSubCmd; str_next_tokens = GetNextTokens( str_next_tokens ); strCmdValue = str_next_tokens[0]; subCmdData.QueueStrValue.Enqueue( strCmdValue ); subCmdData.InvalidCmd = false; while( str_next_tokens.Length > 1 ) { str_next_tokens = GetNextTokens( str_next_tokens ); str_next_tokens = GetNextTokens( str_next_tokens ); strCmdValue = str_next_tokens[0]; subCmdData.QueueStrValue.Enqueue( strCmdValue ); } cmdData.QueueSubCmdData.Enqueue( subCmdData ); } else { if( strSubCmd == "min" ) { subCmdData = new CommandData(); subCmdData.StrCmd = strSubCmd; str_next_tokens = GetNextTokens( str_next_tokens ); strCmdValue = str_next_tokens[0]; subCmdData.QueueStrValue.Enqueue( strCmdValue ); subCmdData.InvalidCmd = false; cmdData.QueueSubCmdData.Enqueue( subCmdData ); str_next_tokens = GetNextTokens( str_next_tokens ); } strSubCmd = str_next_tokens[0]; if( strSubCmd == "max" ) { subCmdData = new CommandData(); subCmdData.StrCmd = strSubCmd; str_next_tokens = GetNextTokens( str_next_tokens ); strCmdValue = str_next_tokens[0]; subCmdData.QueueStrValue.Enqueue( strCmdValue ); subCmdData.InvalidCmd = false; cmdData.QueueSubCmdData.Enqueue( subCmdData ); } } } } cmdData.InvalidCmd = false; } else { throw new CmdParseException( "ParseOptionCommand() - Invalid Command Value Exception Throw!!!" ); } } else { throw new CmdParseException( "ParseOptionCommand() - Invalid Parameter Exception Throw!!!" ); } }
internal void CmdPrompt(GameObject invoker, CommandData cmd) { invoker.SendPrompt(true); }
public override void Use(Player p, string message, CommandData data) { ToggleAfk(p, message); }
public BotCommand_ScheduleAdd(String recipientID, Guid botCD, BotCommandRecord record) : base(recipientID, botCD, record) { this.Data = JsonConvert.DeserializeObject <CommandData>(record.CommandData); }
static void CopyHandler(Player p, Level lvl, string[] parts, CommandData data, bool global, string cmd) { if (parts.Length < 2) { Help(p, cmd); return; } int min, max; if (!CheckRawBlocks(p, parts[1], out min, out max, true)) { return; } BlockID dst; BlockDefinition[] defs = global ? BlockDefinition.GlobalDefs : lvl.CustomBlockDefs; if (parts.Length > 2) { if (!CheckBlock(p, parts[2], out dst)) { return; } if (parts.Length > 3) { string coloredMap = null; defs = GetDefs(p, data, parts[3], ref coloredMap); if (defs == null) { return; } } } else { dst = GetFreeBlock(p, global, lvl, cmd); if (dst == Block.Invalid) { return; } } bool changed = false; for (int i = min; i <= max && Block.ToRaw(dst) <= Block.MaxRaw; i++, dst++) { BlockID src = Block.FromRaw((BlockID)i); if (!DoCopy(p, lvl, global, cmd, false, defs[src], src, dst)) { continue; } string scope = global ? "global" : "level"; p.Message("Duplicated the {0} custom block with id \"{1}\" to \"{2}\".", scope, i, Block.ToRaw(dst)); changed = true; } if (changed) { BlockDefinition.Save(global, lvl); } }
public override void Use(Player p, string message, CommandData data) { base.Use(p, p.name, data); }
void DrawAutoComplete(int windowId) { WindowManager.BeginRenderTextureGUI(); GUISkin skin = windowData.skin; GUI.backgroundColor = backgroundColor; GUI.Box(new Rect(0, 0, rectAutoComplete.width - 10, rectAutoComplete.height), string.Empty); GUI.backgroundColor = Color.white; if (updateAutoCompleteScrollView) { updateAutoCompleteScrollView = false; autoCompleteScrollView.y = Mathf.Max((autoCompleteIndex * 25) - (rectAutoComplete.height / 2), 0); } autoCompleteScrollView = GUILayout.BeginScrollView(autoCompleteScrollView); float prefix1 = 0, prefix2 = 0, prefix3 = 0, prefix4 = 0; for (int i = 0; i < autoCompleteList.Count; i++) { AutoComplete autoComplete = autoCompleteList.items[i]; CommandData commandData = autoComplete.commandData; float size = skin.button.CalcSize(Helper.GetGUIContent(autoComplete.command)).x; if (size > prefix1) { prefix1 = size; } if (commandData.memberType == MemberType.Field || commandData.memberType == MemberType.Property) { object value = commandData.GetValue(); if (value != null) { size = skin.label.CalcSize(Helper.GetGUIContent(value.ToString())).x; if (size > prefix3) { prefix3 = size; } } } size = skin.label.CalcSize(Helper.GetGUIContent(commandData.syntax)).x; if (size > prefix2) { prefix2 = size; } int instanceCount = commandData.GetInstanceCount(); if (instanceCount > 0) { size = skin.label.CalcSize(Helper.GetGUIContent("Instances: " + instanceCount)).x; if (size > prefix4) { prefix4 = size; } } } prefix2 += 15; if (prefix3 > 0) { prefix3 += 15; } if (prefix4 > 0) { prefix4 += 15; } GUILayout.Space(-2); for (int i = 0; i < autoCompleteList.Count; i++) { AutoComplete autoComplete = autoCompleteList.items[i]; CommandData commandData = autoComplete.commandData; string autoCompleteCommand = autoComplete.command; if (i % 2 == 0) { Rect rect = GUILayoutUtility.GetRect(0, 27); rect.width = rectAutoComplete.width - 11; rect.y += 2; rect.height -= 2; GUILayout.Space(-27); GUI.backgroundColor = new Color(0.0675f, 0.0675f, 0.0675f, 1); GUI.Box(rect, string.Empty); GUI.backgroundColor = Color.white; } GUILayout.BeginHorizontal(); GUI.backgroundColor = (i == autoCompleteIndex ? Color.green : Color.white); if (GUILayout.Button(autoCompleteCommand, GUILayout.Width(prefix1))) { inputCommand = autoCompleteCommand; moveInputCursor = 1; } GUILayout.BeginVertical(); GUILayout.Space(7); GUILayout.BeginHorizontal(); GUILayout.Label(commandData.syntax, GUILayout.Width(prefix2)); if (prefix3 > 0) { if (commandData.memberType == MemberType.Field || commandData.memberType == MemberType.Property) { object value = commandData.GetValue(); if (value != null) { GUI.color = Color.green; GUILayout.Label(value.ToString(), GUILayout.Width(prefix3)); GUI.color = Color.white; } else { GUILayout.Space(prefix3); } } else { GUILayout.Space(prefix3); } } if (prefix4 > 0) { int instanceCount = commandData.GetInstanceCount(); if (instanceCount > 0) { GUI.color = new Color(0.3f, 0.5f, 1, 1); GUILayout.Label("Instances: " + instanceCount, GUILayout.Width(prefix4)); GUI.color = Color.white; } else { GUILayout.Space(prefix4); } } if (commandData.consoleCommand != null && commandData.consoleCommand.description != string.Empty) { GUI.color = Color.yellow; GUILayout.Label(commandData.consoleCommand.description); GUI.color = Color.white; } GUILayout.EndHorizontal(); GUILayout.Space(-7); GUILayout.EndVertical(); GUILayout.EndHorizontal(); } GUI.backgroundColor = Color.white; GUILayout.EndScrollView(); WindowManager.EndRenderTextureGUI(); }
public override void Use(Player p, string message, CommandData data) { if (message.Length == 0) { Help(p); return; } string[] parts = message.SplitSpaces(); switch (parts[0].ToLower()) { case "reload": Server.ircControllers = PlayerList.Load("ranks/IRC_Controllers.txt"); p.Message("IRC Controllers reloaded!"); break; case "add": if (parts.Length < 2) { p.Message("You need to provide a name to add."); return; } if (!Server.ircControllers.AddUnique(parts[1])) { p.Message(parts[1] + " is already an IRC controller."); } else { Server.ircControllers.Save(); p.Message(parts[1] + " added to the IRC controller list."); } break; case "remove": if (parts.Length < 2) { p.Message("You need to provide a name to remove."); return; } if (!Server.ircControllers.Remove(parts[1])) { p.Message(parts[1] + " is not an IRC controller."); } else { Server.ircControllers.Save(); p.Message(parts[1] + " removed from the IRC controller list."); } break; case "list": string modifier = parts.Length > 1 ? parts[1] : ""; Server.ircControllers.OutputPlain(p, "IRC controllers", "IRCControllers list", modifier); break; case "rank": if (parts.Length < 2) { p.Message("IRC controllers have the rank {0}", Group.GetColoredName(Server.Config.IRCControllerRank)); return; } Group grp = Matcher.FindRanks(p, parts[1]); if (grp == null) { return; } if (Server.Config.IRCControllerRank > data.Rank) { p.Message("Cannot change the IRC controllers rank, as it is currently a rank higher than yours."); return; } if (grp.Permission > data.Rank) { p.Message("Cannot set the IRC controllers rank to a rank higher than yours."); return; } Server.Config.IRCControllerRank = grp.Permission; SrvProperties.Save(); p.Message("Set IRC controller rank to {0}%S.", grp.ColoredName); break; default: Help(p); break; } }
public override void Exec(CommandData cmdData) { SelectObjectOptions dialogInfo = new SelectObjectOptions(); dialogInfo.ObjectTypes.Add(KBObjectDescriptor.Get<Gx.WebPanel>()); dialogInfo.ObjectTypes.Add(KBObjectDescriptor.Get<Gx.Transaction>()); dialogInfo.MultipleSelection = true; IList<KBObject> selectedObjects = UIServices.SelectObjectDialog.SelectObjects(dialogInfo); if (selectedObjects != null && selectedObjects.Count != 0) { foreach (KBObject selectedObj in selectedObjects) { PatternInstanceElement tabAttElement = BaseElement.Children.AddNewElement(InstanceChildren.Tabs.Tab); tabAttElement.Attributes[InstanceAttributes.Tab.Name] = selectedObj.Name; tabAttElement.Attributes[InstanceAttributes.Tab.Code] = selectedObj.Name; tabAttElement.Attributes[InstanceAttributes.Tab.Description] = selectedObj.Description; String tipo = TabElement.TypeValue.UserDefined; if (selectedObj is Gx.Transaction) { string[] btns = { "UserDefined", "Tabular", "Grid"}; int i = StandardMessageBox.Show("Qual tipo de aba ?", "Adicionar Aba", btns, ExceptionMessageBoxSymbol.Question, 0, ExceptionMessageBoxOptions.None); switch (i) { case 1: tipo = TabElement.TypeValue.Tabular; break; case 2: tipo = TabElement.TypeValue.Grid; break; } } tabAttElement.Attributes[InstanceAttributes.Tab.Type] = tipo; switch (tipo) { case TabElement.TypeValue.UserDefined: tabAttElement.Attributes[InstanceAttributes.Tab.Wcname] = selectedObj.Name; break; case TabElement.TypeValue.Tabular: tabAttElement.Attributes[InstanceAttributes.Tab.Wcname] = BaseElement.Instance.Parent.Name+selectedObj.Name; if (selectedObj is Gx.Transaction) { Gx.Transaction gxt = (Gx.Transaction)selectedObj; AddTrn(tabAttElement, gxt); PatternInstanceElement actsElement = tabAttElement.Children.AddNewElement(InstanceChildren.Tab.Actions); actsElement.Children.AddNewElement(InstanceChildren.Actions.Action).Attributes[InstanceAttributes.Action.Name] = Helpers.StandardAction.Update; actsElement.Children.AddNewElement(InstanceChildren.Actions.Action).Attributes[InstanceAttributes.Action.Name] = Helpers.StandardAction.Delete; } break; case TabElement.TypeValue.Grid: tabAttElement.Attributes[InstanceAttributes.Tab.Wcname] = BaseElement.Instance.Parent.Name+selectedObj.Name + "WC"; if (selectedObj is Gx.Transaction) { Gx.Transaction gxt = (Gx.Transaction)selectedObj; AddTrn(tabAttElement, gxt); PatternInstanceElement modesElement = tabAttElement.Children.AddNewElement(InstanceChildren.Tab.Modes); HPatternSettings sett = HPatternSettings.Get(BaseElement.Instance.Model); modesElement.Attributes[InstanceAttributes.Modes.InsertCondition] = sett.StandardActions.Insert.Condition; modesElement.Attributes[InstanceAttributes.Modes.UpdateCondition] = sett.StandardActions.Update.Condition; modesElement.Attributes[InstanceAttributes.Modes.DeleteCondition] = sett.StandardActions.Delete.Condition; modesElement.Attributes[InstanceAttributes.Modes.DisplayCondition] = sett.StandardActions.Display.Condition; modesElement.Attributes[InstanceAttributes.Modes.ExportCondition] = sett.StandardActions.Export.Condition; } break; } } } }
public override void Use(Player p, string message, CommandData data) { p.ClickToMark = !p.ClickToMark; p.Message("Click blocks to &T/mark&S: {0}", p.ClickToMark ? "&2ON" : "&4OFF"); }
void OnTrigger(CommandData command) { try { if (CheckReload(command)) { return; } if (command.ControlPoint != heldHand) { // Let them use the off hand to reload the gun, but otherwise early exit. if (DebugLogging) { Log.Write(GetType().Name, $"Dropping Non-reload from device {command.ControlPoint.ToString()} while being held by {command.ControlPoint.ToString()}"); } return; } if (ammo <= 0) { // Play 'empty' sound if (OutOfAmmoSound != null) { ScenePrivate.PlaySoundAtPosition(OutOfAmmoSound, command.TargetingOrigin, ShotSettings); } if (DebugLogging) { Log.Write(GetType().Name, "Out of ammo"); } return; } shotsFired++; ammo--; var targetAgent = ScenePrivate.FindAgent(command.TargetingComponent.ObjectId); if (targetAgent != null) { shotsHit++; score += PointsPerPlayer; if (PlayerHitSound != null) { ScenePrivate.PlaySoundAtPosition(PlayerHitSound, command.TargetingPosition, TargetSettings); } if (ShotHitSound != null) { ScenePrivate.PlaySoundAtPosition(ShotHitSound, command.TargetingOrigin, ShotSettings); } if (DebugLogging) { Log.Write(GetType().Name, "Player Hit"); } } else { ObjectPrivate targetObject = ScenePrivate.FindObject(command.TargetingComponent.ObjectId); if (targetObject != null) { Target target = targetObject.FindScripts <Target>("PewPewExample.Target").FirstOrDefault(); if (target != null) { if (ShotHitSound != null) { ScenePrivate.PlaySoundAtPosition(ShotHitSound, command.TargetingOrigin, ShotSettings); } if (DebugLogging) { Log.Write(GetType().Name, "Target hit"); } score += target.Hit(holdingAgent, ScenePrivate); shotsHit++; return; } } if (ShotMissSound != null) { ScenePrivate.PlaySoundAtPosition(ShotMissSound, command.TargetingOrigin, ShotSettings); } if (DebugLogging) { Log.Write(GetType().Name, "Miss:: " + command.ToString()); } } } catch (System.Exception) { } // ignore exceptions for not found agents. }
void CommandReceived(CommandData Button) { if ((Button.Command == "Modifier") && (Button.Action == CommandAction.Pressed)) //shift acts a toggle { if (Shifted == true) { Shifted = false; } else { Shifted = true; } } if ((Button.Command == "Action1") && (Button.Action == CommandAction.Pressed) && (!(Shifted))) { SendKey(BaseEventName + "1"); } else if ((Button.Command == "Action2") && (Button.Action == CommandAction.Pressed) && (!(Shifted))) { SendKey(BaseEventName + "2"); } else if ((Button.Command == "Action3") && (Button.Action == CommandAction.Pressed) && (!(Shifted))) { SendKey(BaseEventName + "3"); } else if ((Button.Command == "Action4") && (Button.Action == CommandAction.Pressed) && (!(Shifted))) { SendKey(BaseEventName + "4"); } else if ((Button.Command == "Action5") && (Button.Action == CommandAction.Pressed) && (!(Shifted))) { SendKey(BaseEventName + "5"); } else if ((Button.Command == "Action6") && (Button.Action == CommandAction.Pressed) && (!(Shifted))) { SendKey(BaseEventName + "6"); } else if ((Button.Command == "Action7") && (Button.Action == CommandAction.Pressed) && (!(Shifted))) { SendKey(BaseEventName + "7"); } else if ((Button.Command == "Action8") && (Button.Action == CommandAction.Pressed) && (!(Shifted))) { SendKey(BaseEventName + "8"); } else if ((Button.Command == "Action9") && (Button.Action == CommandAction.Pressed) && (!(Shifted))) { SendKey(BaseEventName + "9"); } else if ((Button.Command == "Action0") && (Button.Action == CommandAction.Pressed) && (!(Shifted))) { SendKey(BaseEventName + "10"); } else if ((Button.Command == "Keypad0") && (Button.Action == CommandAction.Pressed) && (!(Shifted))) { SendKey(BaseEventName + "11"); } else if ((Button.Command == "Keypad1") && (Button.Action == CommandAction.Pressed) && (!(Shifted))) { SendKey(BaseEventName + "12"); } else if ((Button.Command == "Keypad2") && (Button.Action == CommandAction.Pressed) && (!(Shifted))) { SendKey(BaseEventName + "13"); } else if ((Button.Command == "Keypad3") && (Button.Action == CommandAction.Pressed) && (!(Shifted))) { SendKey(BaseEventName + "14"); } else if ((Button.Command == "Keypad4") && (Button.Action == CommandAction.Pressed) && (!(Shifted))) { SendKey(BaseEventName + "15"); } else if ((Button.Command == "Keypad5") && (Button.Action == CommandAction.Pressed) && (!(Shifted))) { SendKey(BaseEventName + "16"); } else if ((Button.Command == "Keypad6") && (Button.Action == CommandAction.Pressed) && (!(Shifted))) { SendKey(BaseEventName + "17"); } else if ((Button.Command == "Keypad7") && (Button.Action == CommandAction.Pressed) && (!(Shifted))) { SendKey(BaseEventName + "18"); } else if ((Button.Command == "Keypad8") && (Button.Action == CommandAction.Pressed) && (!(Shifted))) { SendKey(BaseEventName + "19"); } else if ((Button.Command == "Keypad9") && (Button.Action == CommandAction.Pressed) && (!(Shifted))) { SendKey(BaseEventName + "20"); } else if ((Button.Command == "Action1") && (Button.Action == CommandAction.Pressed) && (Shifted)) { SendKey(BaseEventName + "21"); } else if ((Button.Command == "Action2") && (Button.Action == CommandAction.Pressed) && (Shifted)) { SendKey(BaseEventName + "22"); } else if ((Button.Command == "Action3") && (Button.Action == CommandAction.Pressed) && (Shifted)) { SendKey(BaseEventName + "23"); } else if ((Button.Command == "Action4") && (Button.Action == CommandAction.Pressed) && (Shifted)) { SendKey(BaseEventName + "24"); } else if ((Button.Command == "Action5") && (Button.Action == CommandAction.Pressed) && (Shifted)) { SendKey(BaseEventName + "25"); } else if ((Button.Command == "Action6") && (Button.Action == CommandAction.Pressed) && (Shifted)) { SendKey(BaseEventName + "26"); } else if ((Button.Command == "Action7") && (Button.Action == CommandAction.Pressed) && (Shifted)) { SendKey(BaseEventName + "27"); } else if ((Button.Command == "Action8") && (Button.Action == CommandAction.Pressed) && (Shifted)) { SendKey(BaseEventName + "28"); } else if ((Button.Command == "Action9") && (Button.Action == CommandAction.Pressed) && (Shifted)) { SendKey(BaseEventName + "29"); } else if ((Button.Command == "Action0") && (Button.Action == CommandAction.Pressed) && (Shifted)) { SendKey(BaseEventName + "30"); } else if ((Button.Command == "Keypad0") && (Button.Action == CommandAction.Pressed) && (Shifted)) { SendKey(BaseEventName + "31"); } else if ((Button.Command == "Keypad1") && (Button.Action == CommandAction.Pressed) && (Shifted)) { SendKey(BaseEventName + "32"); } else if ((Button.Command == "Keypad2") && (Button.Action == CommandAction.Pressed) && (Shifted)) { SendKey(BaseEventName + "33"); } else if ((Button.Command == "Keypad3") && (Button.Action == CommandAction.Pressed) && (Shifted)) { SendKey(BaseEventName + "34"); } else if ((Button.Command == "Keypad4") && (Button.Action == CommandAction.Pressed) && (Shifted)) { SendKey(BaseEventName + "35"); } else if ((Button.Command == "Keypad5") && (Button.Action == CommandAction.Pressed) && (Shifted)) { SendKey(BaseEventName + "36"); } else if ((Button.Command == "Keypad6") && (Button.Action == CommandAction.Pressed) && (Shifted)) { SendKey(BaseEventName + "37"); } else if ((Button.Command == "Keypad7") && (Button.Action == CommandAction.Pressed) && (Shifted)) { SendKey(BaseEventName + "38"); } else if ((Button.Command == "Keypad8") && (Button.Action == CommandAction.Pressed) && (Shifted)) { SendKey(BaseEventName + "39"); } else if ((Button.Command == "Keypad9") && (Button.Action == CommandAction.Pressed) && (Shifted)) { SendKey(BaseEventName + "40"); } if ((Button.Command == "Action1") && (Button.Action == CommandAction.Released) && (!(Shifted))) { SendKey(BaseEventName + "1Off"); } else if ((Button.Command == "Action2") && (Button.Action == CommandAction.Released) && (!(Shifted))) { SendKey(BaseEventName + "2Off"); } else if ((Button.Command == "Action3") && (Button.Action == CommandAction.Released) && (!(Shifted))) { SendKey(BaseEventName + "3Off"); } else if ((Button.Command == "Action4") && (Button.Action == CommandAction.Released) && (!(Shifted))) { SendKey(BaseEventName + "4Off"); } else if ((Button.Command == "Action5") && (Button.Action == CommandAction.Released) && (!(Shifted))) { SendKey(BaseEventName + "5Off"); } else if ((Button.Command == "Action6") && (Button.Action == CommandAction.Released) && (!(Shifted))) { SendKey(BaseEventName + "6Off"); } else if ((Button.Command == "Action7") && (Button.Action == CommandAction.Released) && (!(Shifted))) { SendKey(BaseEventName + "7Off"); } else if ((Button.Command == "Action8") && (Button.Action == CommandAction.Released) && (!(Shifted))) { SendKey(BaseEventName + "8Off"); } else if ((Button.Command == "Action9") && (Button.Action == CommandAction.Released) && (!(Shifted))) { SendKey(BaseEventName + "9Off"); } else if ((Button.Command == "Action0") && (Button.Action == CommandAction.Released) && (!(Shifted))) { SendKey(BaseEventName + "10Off"); } else if ((Button.Command == "Keypad0") && (Button.Action == CommandAction.Released) && (!(Shifted))) { SendKey(BaseEventName + "11Off"); } else if ((Button.Command == "Keypad1") && (Button.Action == CommandAction.Released) && (!(Shifted))) { SendKey(BaseEventName + "12Off"); } else if ((Button.Command == "Keypad2") && (Button.Action == CommandAction.Released) && (!(Shifted))) { SendKey(BaseEventName + "13Off"); } else if ((Button.Command == "Keypad3") && (Button.Action == CommandAction.Released) && (!(Shifted))) { SendKey(BaseEventName + "14Off"); } else if ((Button.Command == "Keypad4") && (Button.Action == CommandAction.Released) && (!(Shifted))) { SendKey(BaseEventName + "15Off"); } else if ((Button.Command == "Keypad5") && (Button.Action == CommandAction.Released) && (!(Shifted))) { SendKey(BaseEventName + "16Off"); } else if ((Button.Command == "Keypad6") && (Button.Action == CommandAction.Released) && (!(Shifted))) { SendKey(BaseEventName + "17Off"); } else if ((Button.Command == "Keypad7") && (Button.Action == CommandAction.Released) && (!(Shifted))) { SendKey(BaseEventName + "18Off"); } else if ((Button.Command == "Keypad8") && (Button.Action == CommandAction.Released) && (!(Shifted))) { SendKey(BaseEventName + "19Off"); } else if ((Button.Command == "Keypad9") && (Button.Action == CommandAction.Released) && (!(Shifted))) { SendKey(BaseEventName + "2Off"); } else if ((Button.Command == "Action1") && (Button.Action == CommandAction.Released) && (Shifted)) { SendKey(BaseEventName + "21Off"); } else if ((Button.Command == "Action2") && (Button.Action == CommandAction.Released) && (Shifted)) { SendKey(BaseEventName + "22Off"); } else if ((Button.Command == "Action3") && (Button.Action == CommandAction.Released) && (Shifted)) { SendKey(BaseEventName + "23Off"); } else if ((Button.Command == "Action4") && (Button.Action == CommandAction.Released) && (Shifted)) { SendKey(BaseEventName + "24Off"); } else if ((Button.Command == "Action5") && (Button.Action == CommandAction.Released) && (Shifted)) { SendKey(BaseEventName + "25Off"); } else if ((Button.Command == "Action6") && (Button.Action == CommandAction.Released) && (Shifted)) { SendKey(BaseEventName + "26Off"); } else if ((Button.Command == "Action7") && (Button.Action == CommandAction.Released) && (Shifted)) { SendKey(BaseEventName + "27Off"); } else if ((Button.Command == "Action8") && (Button.Action == CommandAction.Released) && (Shifted)) { SendKey(BaseEventName + "28Off"); } else if ((Button.Command == "Action9") && (Button.Action == CommandAction.Released) && (Shifted)) { SendKey(BaseEventName + "29Off"); } else if ((Button.Command == "Action0") && (Button.Action == CommandAction.Released) && (Shifted)) { SendKey(BaseEventName + "30Off"); } else if ((Button.Command == "Keypad0") && (Button.Action == CommandAction.Released) && (Shifted)) { SendKey(BaseEventName + "31Off"); } else if ((Button.Command == "Keypad1") && (Button.Action == CommandAction.Released) && (Shifted)) { SendKey(BaseEventName + "32Off"); } else if ((Button.Command == "Keypad2") && (Button.Action == CommandAction.Released) && (Shifted)) { SendKey(BaseEventName + "33Off"); } else if ((Button.Command == "Keypad3") && (Button.Action == CommandAction.Released) && (Shifted)) { SendKey(BaseEventName + "34Off"); } else if ((Button.Command == "Keypad4") && (Button.Action == CommandAction.Released) && (Shifted)) { SendKey(BaseEventName + "35Off"); } else if ((Button.Command == "Keypad5") && (Button.Action == CommandAction.Released) && (Shifted)) { SendKey(BaseEventName + "36Off"); } else if ((Button.Command == "Keypad6") && (Button.Action == CommandAction.Released) && (Shifted)) { SendKey(BaseEventName + "37Off"); } else if ((Button.Command == "Keypad7") && (Button.Action == CommandAction.Released) && (Shifted)) { SendKey(BaseEventName + "38Off"); } else if ((Button.Command == "Keypad8") && (Button.Action == CommandAction.Released) && (Shifted)) { SendKey(BaseEventName + "39Off"); } else if ((Button.Command == "Keypad9") && (Button.Action == CommandAction.Released) && (Shifted)) { SendKey(BaseEventName + "40Off"); } }
/// <summary> /// コマンド決定処理. /// </summary> /// <param name="type">Type.</param> public void DecideCommand( CommandData commandData ) { this.SelectCommandData = commandData; this.SetAddActiveTimeValue(); }
private bool TryGetPossibleMethods(Player player, UserInputData userInputData, string[] usedParameters, CommandData commandData, [NotNullWhen(true)] out List <CommandMethodData>?possibleMethods) { if (commandData is null) { possibleMethods = null; if (_configuration.CommandDoesNotExistError is { } text) { _configuration.MessageOutputHandler.Invoke(new CommandOutputData(player, text, userInputData)); } return(false); } possibleMethods = _methodParser.GetPossibleMethods(userInputData.Command, usedParameters, commandData).ToList(); if (!possibleMethods.Any()) { var wrongUsageOutputted = _wrongUsageHandler.Handle(player, userInputData, commandData.Methods, possibleMethods); if (!wrongUsageOutputted) { if (_configuration.CommandUsedIncorrectly is { } text) { _configuration.MessageOutputHandler.Invoke(new CommandOutputData(player, text, userInputData)); } else if (_configuration.CommandDoesNotExistError is { } text2) { _configuration.MessageOutputHandler.Invoke(new CommandOutputData(player, text2, userInputData)); } } return(false); }
// parse // parse sub command void ParseIdCommand( CommandData cmdData, string [] str_tokens ) { // sub command 1, name <x>, 2, author <x> string [] str_next_tokens = GetNextTokens( str_tokens ); //str_next_tokens = GetNextTokens( str_next_tokens ); string strSubCmd = str_next_tokens[0]; // should have sub command!!! if( strSubCmd == "name" ) { // sub command CommandData subCmdData = new CommandData(); subCmdData.StrCmd = strSubCmd; string strValue = GetTokensToString( str_next_tokens ); subCmdData.QueueStrValue.Enqueue( strValue ); subCmdData.InvalidCmd = false; cmdData.QueueSubCmdData.Enqueue(subCmdData); cmdData.InvalidCmd = false; } else if( strSubCmd == "author" ) { // sub command CommandData subCmdData = new CommandData(); subCmdData.StrCmd = strSubCmd; string strValue = GetTokensToString( str_next_tokens ); subCmdData.QueueStrValue.Enqueue( strValue ); subCmdData.InvalidCmd = false; cmdData.QueueSubCmdData.Enqueue(subCmdData); cmdData.InvalidCmd = false; } else { throw new CmdParseException( "ParseIdCommand() - Invalid Sub Command Exception Throw!!!" ); } }
public override void Install(Control control, CommandID command, EventHandler<VisualGit.Commands.CommandEventArgs> handler, EventHandler<VisualGit.Commands.CommandUpdateEventArgs> updateHandler) { CommandData cd = new CommandData(control, handler, updateHandler); List<CommandData> items; if (!_data.TryGetValue(command, out items)) _data[command] = items = new List<CommandData>(); items.Add(cd); }
void ParseInitStockfishCommand( CommandData cmdData, string [] str_tokens ) { if( str_tokens != null && str_tokens.Length > 1 ) { string [] str_next_tokens = GetNextTokens( str_tokens ); string strValue = GetTokensToString( str_next_tokens ); cmdData.QueueStrValue.Enqueue( strValue ); cmdData.InvalidCmd = false; } else { throw new CmdParseException( "ParseBestMoveCommand() - Invalid Parameter Exception Throw!!!" ); } }
public override void Use(Player p, string message, CommandData data) { CustomBlockCommand.Execute(p, message, data, false, "/lb"); }
// interface // init public void Init( string strCommandSrc ) { StrCmdSrc = strCommandSrc; CmdData = new CommandData(); }
internal static global::System.Runtime.InteropServices.HandleRef getCPtr(CommandData obj) { return((obj == null) ? new global::System.Runtime.InteropServices.HandleRef(null, global::System.IntPtr.Zero) : obj.swigCPtr); }
void ParseUciOkCommand( CommandData cmdData, string [] str_tokens ) { cmdData.InvalidCmd = false; }
public IAsyncResult <bool> UpdateInterfaceData([Implicit] ICallContext context = null) { #region dump //14326094 Script Execution -GetHelp //14326101 sti_commands.GetHelp - < arguments > //14326107 SerialPort - Open(but already open) //14326114 SerialPort - Write "help" //14326119 SerialPort - ReadLine : "*Get list of commands: list commands" //14326126 SerialPort - ReadLine : "*Get help for a command: help <name of command>" //14326131 SerialPort - ReadLine : ":END" //14332094 Script Execution -Script execution ended. Result value: < null > //14348346 Script Execution -ListCommands //14348352 sti_commands.ListCommands - < arguments > //14348356 SerialPort - Open(but already open) //14348363 SerialPort - Write "list commands" //14348368 SerialPort - ReadLine : "*1 - help" //14348373 SerialPort - ReadLine : "*2 - list" //14348379 SerialPort - ReadLine : "*1000 - henry" //14348385 SerialPort - ReadLine : "*1001 - eigil" //14348394 SerialPort - ReadLine : ":END" //14350350 Script Execution -Script execution ended. Result value: < null > //14355597 Script Execution -HelpEigil //14355605 sti_commands.HelpEigil - < arguments > //14355614 SerialPort - Open(but already open) //14355622 SerialPort - Write "help eigil" //14355630 SerialPort - ReadLine : "*Command 1001: eigil" //14355635 SerialPort - ReadLine : "*Help: Just a prototype command to be deleted." //14355642 SerialPort - ReadLine : "*Parameters: int input. Return value: int" //14355646 SerialPort - ReadLine : ":END" //14359597 Script Execution -Script execution ended. Result value: < null > #endregion var task = Task.Run <bool>(() => { // FIRST GET THE LIST OF AVAILABLE COMMANDS var command = new CommandData(context, "list commands", CommandResponseTimeout, typeof(List <string>)); var cmd = EnqueueCommand(command); if (cmd.CompletedSynchronously) { throw new NotImplementedException(); } else { if (cmd.AsyncWaitHandle.WaitOne(CommandResponseTimeout)) { if (cmd.IsFaulted) { return(false); } var procedures = new List <RemoteProcedureInfo>(); var commandListLines = cmd.Result as List <string>; foreach (var commandListLine in commandListLines) { int id; var commandName = DecodeCommandListLine(commandListLine, out id); // THEN, GET THE INFORMATION FOR EACH COMMAND command = new CommandData(context, "help " + commandName, CommandResponseTimeout, typeof(List <string>)); cmd = EnqueueCommand(command); if (cmd.CompletedSynchronously) { throw new NotImplementedException(); } else { if (cmd.AsyncWaitHandle.WaitOne(CommandResponseTimeout)) { if (cmd.Result is List <string> ) { var procedure = DecodeRemoteProcedureInfo(commandName, id, cmd.Result as List <string>); procedures.Add(procedure); } else { //TODO: report error somehow } } else { return(false); } } } m_remoteProcedures = procedures; } else { return(false); } } return(true); }); return(new TaskToAsyncResult <bool>(task)); }
/// <summary> /// Will execute commands on the simulated cores /// </summary> /// <param name="data">Data to send</param> /// <param name="serverId">optional serverId, ignored in this implementation</param> public override void SendCommand(CommandData data, long serverId = 0) { // record it pastMessages.Add(data); if (data.SenderId == data.Recipient) { // resource is trying to send to itself serverId = data.Recipient.ServerId; } if (executionCount > 100) { throw new Exception($"to many commands, probalby a loop {data}"); } executionCount++; // guess sender if there is none if (data.Recipient == userId) { data.SenderId = new EntityId(data.Recipient.ServerId, 0); } var devData = new DevCommandData(data); devData.Connection = new DevConnection(); data = devData; /* * if(data.type == "registerUser" || data.type == "loginUser" || data.type == "response"){ * * devData.sender = lastAddedClient; * } * * if (data.type == "registeredUser" || data.type == "loginUserResponse" || data.type =="response") { * data.rId = ConfigController.ActiveUserId; * * // * }*/ // // search for the serverId first if (serverId != 0 && simulationInstances.ContainsKey(new EntityId(serverId, 0))) { simulationInstances[new EntityId(serverId, 0)].ReceiveCommand(devData); } else if (simulationInstances.ContainsKey(data.Recipient)) { // the receiver is known, send it to him simulationInstances[data.Recipient].ReceiveCommand(devData); } else if (simulationInstances.ContainsKey(EntityId.Default) || simulationInstances.Where(i => i.Value.core.Id == data.Recipient).Any()) // && simulationInstances[SourceReference.Default].core.Id == data.rId) { // the receiver is unknown but is asigned the last added client since it hasn't got an ID yet SimulationInstance value; if (!simulationInstances.TryGetValue(default(EntityId), out value)) { value = simulationInstances.Where(i => i.Value.core.Id == data.Recipient).First().Value; } simulationInstances[data.Recipient] = value; simulationInstances[data.Recipient].ReceiveCommand(devData); simulationInstances.Remove(EntityId.Default); } else if (simulationInstances.ContainsKey(data.Recipient.FullServerId)) { // the receiver itself doesn't exist, but the server for it does simulationInstances[data.Recipient.FullServerId].ReceiveCommand(devData); } else if (data is DevCommandData && (data as DevCommandData).sender != null) { // no idea what id this is supposed to go but the container has a sender (data as DevCommandData).sender.core.EntityManager.ExecuteForReference(data); } else { throw new Exception($"the target {data.Recipient} is not registered in the development enviroment {data.Type}"); } /* * if (data.rId == ConfigController.ActiveUserId || data.rId == ConfigController.ApplicationSettings.id) * ReferenceManager.Instance.ExecuteForReference (data); * else { * throw new Exception ($"the target {data.rId} is not registered in the development enviroment {data.t}"); * }*/ }
/// <summary> /// Return a new command buffer. /// This will be called the first time /// the mesh is rendered for each camera /// that renders the ocean. /// </summary> public override CommandBuffer Create(Camera cam) { CommandBuffer cmd = new CommandBuffer(); cmd.name = "Ceto DepthGrab Cmd: " + cam.name; //int width = cam.pixelWidth; //int height = cam.pixelHeight; //int scale = ResolutionToNumber(Resolution); //width /= scale; //height /= scale; RenderTextureFormat format; //screen grab currently disabled. /* if (cam.hdr) format = RenderTextureFormat.ARGBHalf; else format = RenderTextureFormat.ARGB32; //Copy screen into temporary RT. int grabID = Shader.PropertyToID("Ceto_GrabCopyTexture"); cmd.GetTemporaryRT(grabID, width, height, 0, FilterMode.Bilinear, format, RenderTextureReadWrite.Default); cmd.Blit(BuiltinRenderTextureType.CurrentActive, grabID); cmd.SetGlobalTexture(GrabName, grabID); */ if (SystemInfo.SupportsRenderTextureFormat(RenderTextureFormat.RFloat)) format = RenderTextureFormat.RFloat; else format = RenderTextureFormat.RHalf; //Copy depths into temporary RT. int depthID = Shader.PropertyToID("Ceto_DepthCopyTexture"); cmd.GetTemporaryRT(depthID, cam.pixelWidth, cam.pixelHeight, 0, FilterMode.Point, format, RenderTextureReadWrite.Linear); cmd.Blit(BuiltinRenderTextureType.CurrentActive, depthID, m_copyDepthMat, 0); cmd.SetGlobalTexture(DepthName, depthID); cam.AddCommandBuffer(Event, cmd); CommandData data = new CommandData(); data.command = cmd; data.width = cam.pixelWidth; data.height = cam.pixelHeight; if (m_data.ContainsKey(cam)) m_data.Remove(cam); m_data.Add(cam, data); return cmd; }
public bool Load(string fileName) { if (File.Exists(fileName) == false) return false; bool bSuccess = false; XmlReaderSettings settings = new XmlReaderSettings(); using (var reader = XmlReader.Create(fileName, settings)) { TaskData task = new TaskData(); CommandData command = new CommandData(); bool bTaskData = false; bool bCommandData = false; bool bOptionData = false; while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element) { if (reader.Name == "TaskData") { bTaskData = true; } if (reader.Name == "CommandData") { bCommandData = true; } if (reader.Name == "OptionData") { bOptionData = true; } if (bCommandData) { command.XmlReader(reader); } else if (bTaskData) { task.XmlReader(reader); } else if (bOptionData) { //一旦仮バッファにいれるべきか? OptionData.GetInstance().XmlReader(reader); } } else if (reader.NodeType == XmlNodeType.EndElement) { if (reader.Name == "TaskData") { this.SaveData.TaskList.Add((TaskData)task.Clone()); //初期化。コンストラクタと同一化するのがベター task.CommandDataList.Clear(); bTaskData = false; } if (reader.Name == "CommandData") { task.CommandDataList.Add((CommandData)command.Clone()); bCommandData = false; } } } } bSuccess = true; return bSuccess; }
public override void Use(Player p, string message, CommandData data) { string end = DateTime.Now.ToString(Database.DateFormat); string start = "thismonth", name = null; string[] args = message.SplitSpaces(); if (message.Length == 0 || ValidTimespan(message.ToLower())) { if (p.IsSuper) { SuperRequiresArgs(p, "player name"); return; } name = p.name; if (message.Length > 0) { start = message.ToLower(); } } else { name = PlayerInfo.FindMatchesPreferOnline(p, args[0]); if (args.Length > 1 && ValidTimespan(args[1].ToLower())) { start = args[1].ToLower(); } } if (name == null) { return; } if (start == "today") { start = DateTime.Now.ToString("yyyy-MM-dd 00:00:00"); } else if (start == "yesterday") { start = DateTime.Now.AddDays(-1).ToString("yyyy-MM-dd 00:00:00"); end = DateTime.Now.ToString("yyyy-MM-dd 00:00:00"); } else if (start == "thismonth") { start = DateTime.Now.ToString("yyyy-MM-01 00:00:00"); } else if (start == "lastmonth") { start = DateTime.Now.AddMonths(-1).ToString("yyyy-MM-01 00:00:00"); end = DateTime.Now.ToString("yyyy-MM-01 00:00:00"); } else if (start == "all") { start = "0000-00-00 00:00:00"; } else { Help(p); return; } p.Message("OpStats for {0} %Ssince {1}", PlayerInfo.GetColoredName(p, name), start); int reviews = Count(start, end, name, "review", "LIKE 'next'"); int ranks = Count(start, end, name, "setrank", "!=''"); int promotes = Count(start, end, name, "setrank", "LIKE '+up%'"); int demotes = Count(start, end, name, "setrank", "LIKE '-down%'"); int promotesOld = Count(start, end, name, "promote"); int demotesOld = Count(start, end, name, "demote"); int mutes = Count(start, end, name, "mute"); int freezes = Count(start, end, name, "freeze"); int warns = Count(start, end, name, "warn"); int kicks = Count(start, end, name, "kick"); int bans = Count(start, end, name, "ban"); int kickbans = Count(start, end, name, "kickban"); int ipbans = Count(start, end, name, "banip"); int xbans = Count(start, end, name, "xban"); int tempbans = Count(start, end, name, "tempban"); p.Message(" &a{0}%S bans, &a{1}%S IP-bans, &a{2}%S tempbans", bans + kickbans + xbans, ipbans + xbans, tempbans); p.Message(" &a{0}%S mutes, &a{1}%S warns, &a{2}%S freezes, &a{3}%S kicks", mutes, warns, freezes, kicks + kickbans + xbans); p.Message(" &a{0}%S reviews, &a{1}%S ranks (&a{2}%S promotes, &a{3}%S demotes)", reviews, ranks + promotesOld + demotesOld, promotes + promotesOld, demotes + demotesOld); }
public static CommandData GetCommandData(string data) { CommandData result = new CommandData(); Dictionary<string, object> values = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, object>>(data); if (values.ContainsKey("command")) { result.Command = values["command"].ToString(); } if (values.ContainsKey("metadata")) { string metadataString = values["metadata"] as string; if (metadataString != null) { result.Metadata = Newtonsoft.Json.JsonConvert.DeserializeObject<Dictionary<string, string>>(metadataString); } } return result; }
public void Add(string[] _Name, CommandType _CommandType, UserFlags _FlagsRequired, string _Description, CommandTable _SubCommandTable, Delegate _ProcMethod) { System.Reflection.MethodInfo mi = _ProcMethod.Method; System.Reflection.ParameterInfo[] pars = mi.GetParameters(); CommandData data = new CommandData { CommandName = _Name, CommandType = _CommandType, FlagsRequired = _FlagsRequired, Description = _Description, SubCommandTable = _SubCommandTable, ProcMethod = mi, ParameterInfo = pars, ParameterCount = pars.Length - 2 }; _dict.Add(_Name, data); }
public override void Use(Player p, string message, CommandData data) { Command.Find("Nick").Use(p, "bot " + message); }
public AutoComplete(string command, CommandData commandData) { this.command = command; this.commandData = commandData; }
public void ExecuteCommand(CommandData commandData) { if (commandData.c == Command.Error) { return; } List <string> parameters = commandData.parameters; Command c = commandData.c; //WARNING! DON'T UNCOLLAPSE! ALL CODE FOR EACH OF THE COMMANDS INSIDE! switch (c) { case Command.Help: string str = string.Empty; IEnumerable <string> sNames; IEnumerable <string> sDocumentation; sNames = CommandHelper.GetAllNamesOfType(CommandType.Basic); sDocumentation = CommandHelper.GetAllDocumentationOfType(CommandType.Basic); Print("=== Basic Commands ===\n", true); List <ListElement> names = new List <ListElement>(); List <ListElement> documentation = new List <ListElement>(); foreach (string n in sNames) { names.Add(new ListElement(n)); } foreach (string d in sDocumentation) { documentation.Add(new ListElement(d)); } List <ListColumn> columns = new List <ListColumn>(); columns.Add(new ListColumn("Name", names)); columns.Add(new ListColumn("Description", documentation)); PrintList(columns); if (CurrentMachine.type == MachineType.Shell) { Print("\n === For a list of Advanced Commands visit the help module === ", true); } break; case Command.Modules: columns = new List <ListColumn>(); List <ListElement> modules = new List <ListElement>(); List <ListElement> status = new List <ListElement>(); foreach (ModuleType m in windowManager.GetModules()) { modules.Add(new ListElement(m.ToString())); status.Add(new ListElement(windowManager.ModuleToStatus[m].ToString())); if (windowManager.ModuleToStatus[m] == Status.Used) { status[status.Count - 1].color = new Color(1, 0, 0, 0.5f); modules[modules.Count - 1].color = new Color(1, 0, 0, 0.5f); } } columns.Add(new ListColumn("Name", modules)); columns.Add(new ListColumn("Status", status)); PrintList(columns); break; case Command.Windows: string output = string.Empty; foreach (int window in windowManager.GetWindows()) { output += "\t\n" + window + " - " + windowManager.WindowToStatus[windowManager.IndexToWindow[window]].ToString(); } Print(output.Substring(2)); break; case Command.Load: string mString = FormatString(parameters[0]); ModuleType mod = ModuleType.None; try { mod = (ModuleType)Enum.Parse(typeof(ModuleType), mString); } catch (ArgumentException) { Print("The module requested is not avalible. Type 'Modules' for a list of avalible modules."); return; } if (!windowManager.ModuleIsOpenableByPlayer(mod) || windowManager.ModuleToStatus[mod] == Status.Used) { Print("The module requested is not avalible. Type 'Modules' for a list of avalible modules."); return; } int w = int.Parse(parameters[1]); if (!windowManager.WindowAvalible(w)) { Print("The requested window is currently in use or doesn't exist. Type 'Windows' for a list of avalible windows"); return; } windowManager.LoadModuleOnWindow(mod, w); Print("The requested module " + parameters[0] + " has succesfully been loaded on window " + parameters[1] + "."); break; case Command.Unload: if (windowManager.WindowAvalible(int.Parse(parameters[0]))) { Print("Window either doesn't exist or already has module loaded on it. For more info, tpye 'help' or visit the 'commands' page in the shell help menu."); return; } if (windowManager.WindowToModule[windowManager.IndexToWindow[int.Parse(parameters[0])]] == ModuleType.Shell) { Print("You can't unload the shell from shell!"); return; } windowManager.UnloadOnWindow(int.Parse(parameters[0])); break; case Command.Load_database: string name = parameters[0]; if (!databaseMan.HasDatabaseByName(name)) { Print("The database you are trying to access doesn't exist. Did you spell the name right?"); return; } CurrentMachine = databaseMan.GetDataBase(name); Print("You are now in database " + parameters[0] + ". To get back, type the command 'Back'."); break; case Command.Back: CurrentMachine = new Shell(); Print("You're now in the shell."); break; case Command.Files: if ((CurrentMachine as DataBase).files.Length == 0) { Print("Could not list the files on this database since it doesn't have any."); return; } string tempS = string.Empty; foreach (File file in (CurrentMachine as DataBase).files) { tempS += file.name + "\n"; } Print(tempS); break; case Command.Open: File?fn = (CurrentMachine as DataBase).GetFile(parameters[0]); if (fn == null) { Print("Could not open the requested file since there's no file named " + parameters[0] + ". Did you misspel the name?"); return; } File f = fn.Value; Print("==== File begin ====", true); Print(f.file.text); Print("==== File end ====\n", true); break; } }
public void Delete() { Destroy(commandObj); commandData = null; gameObject.SetActive(false); }