public void ApplyChanges() { Lines.RemoveAll(x => x.Empty); CommandList.Clear(); for (int i = 0; i < Lines.Count; i++) { string lineText = Lines[i].Text.Trim(); if (lineText.StartsWith("//")) { continue; } ACMDCommand cmd = Lines[i].Parse(); uint ident = cmd._commandInfo.Identifier; int amt = 0; if ((amt = ParseCommands(i, ident)) > 0) { i += amt; continue; } else { CommandList.Add(cmd); } } }
public void TryStartCommandList(List <CommandUI> commandList) { CommandList.Clear(); _currentCommandLine = 0; _findError = false; CommandStartError += StopStartCommandList; foreach (var container in commandList) { if (_findError) { break; } BaseCommand newCommand; if (TryGetRealCommand(container, out newCommand)) { CommandList.Enqueue(newCommand); } } CommandStartError -= StopStartCommandList; }
public CommandList ApplyChanges() { // Don't bother selectively processing events, just clear and repopulate the whole thing. string[] lines = Lines.Where(x => !string.IsNullOrWhiteSpace(x) && !x.Contains("//")).Select(x => x.Trim()).ToArray(); _list.Clear(); UnknownCommand unkC = null; for (int i = 0; i < lines.Length; i++) { if (lines[i].StartsWith("0x")) { if (unkC == null) { unkC = new UnknownCommand(); } unkC.data.Add(Int32.Parse(lines[i].Substring(2, 8), System.Globalization.NumberStyles.HexNumber)); continue; } foreach (CommandInfo e in Runtime.commandDictionary) { if (lines[i].StartsWith(e.Name)) { if (unkC != null) { _list.Add(unkC); unkC = null; } string temp = lines[i].Substring(lines[i].IndexOf('(')).Trim(new char[] { '(', ')' }); List <string> Params = temp.Replace("0x", "").Split(',').ToList(); Command c = new Command(e); for (int counter = 0; counter < e.ParamSpecifiers.Count; counter++) { // parameter - it's syntax keyword(s), and then parse. if (e.ParamSyntax.Count > 0) { Params[counter] = Params[counter].Substring(Params[counter].IndexOf('=') + 1); } if (e.ParamSpecifiers[counter] == 0) { c.parameters.Add(Int32.Parse(Params[counter], System.Globalization.NumberStyles.HexNumber)); } else if (e.ParamSpecifiers[counter] == 1) { c.parameters.Add(float.Parse(Params[counter])); } else if (e.ParamSpecifiers[counter] == 2) { c.parameters.Add(decimal.Parse(Params[counter])); } } _list.Add(c); } } } CommandList = _list; return(_list); }
public void UpdateList([NotNull] List <ObservableCommand> cmdList) { // set the current commandlist to be displayed in the listview CommandList.Clear(); foreach (var x in cmdList) { CommandList.Add(x); } }
public IEnumerable <GameCommandBase> GetActionCommands() { CommandList.Clear(); foreach (var obj in GameObjects) { CommandList.AddRange(obj.GetActionCommands()); } CommandList.Add(new QuitGameCommand(this)); return(CommandList); }
/// <summary> /// 绑定命令类型 /// </summary> /// <param name="id"></param> /// <param name="commandType"></param> /// <param name="handleResult"></param> public void BindCommandModel(int id, AdvertManage.Model.Enum.CommandType commandType, AdvertManage.Model.Enum.CommandHandleResult handleResult) { CommandList.Clear(); List <AdvertManage.Model.AMS_CommandListModel> cmdList = AdvertManage.BLL.AMS_CommandBLL.GetCommandListByCondition(id, commandType, handleResult); foreach (AdvertManage.Model.AMS_CommandListModel model in cmdList) { CommandList.Add(model); } }
public void PrepareAsRenderTarget(CommandList commandList) { // Switch to render target commandList.ResourceBarrierTransition(Texture, GraphicsResourceState.DepthWrite); if (clearNeeded) { // TODO GRAPHICS REFACTOR commandList.Clear(Texture, DepthStencilClearOptions.DepthBuffer); clearNeeded = false; } }
public static void Run(List <_Command> cmdlist) { Debug.Log($"{PlaceholderParser.ParseTimeStamp()} [INFO] Registering commands.."); CommandList.Clear(); foreach (var command in cmdlist) { if (DebugLevel >= 1) { Debug.Log($"{PlaceholderParser.ParseTimeStamp()} [INFO] Registering command: {command.CommandName}.."); } Action <SvPlayer, string> rMethod = null; try { rMethod = (Action <SvPlayer, string>) Delegate.CreateDelegate(typeof(Action <SvPlayer, string>), Type.GetType($"BP_Essentials.Commands.{command.CommandName}") .GetMethod(nameof(Run))); } catch (ArgumentException) { rMethod = null; } if (command.CommandName == "ToggleReceiveStaffChat") { CmdStaffChatExecutableBy = command.ExecutableBy; } if (command.CommandName == "Confirm") { CmdConfirm = command.Commands[0]; } if (command.CommandName == "ToggleChat") { CmdToggleChat = command.Commands[0]; } if (command.CommandName == "TpaAccept") { CmdTpaaccept = command.Commands[0]; } CommandList.Add(CommandList.Count + 1, new _CommandList { RunMethod = rMethod, commandGroup = command.ExecutableBy ?? "everyone", commandName = command.CommandName, commandCmds = command.Commands.Select(x => $"{CmdCommandCharacter}{x}").ToList(), commandDisabled = command.Disabled ?? false, commandWantedAllowed = command.AllowWithCrimes ?? true, commandHandcuffedAllowed = command.AllowWhileCuffed ?? true, commandWhileJailedAllowed = command.AllowWhileJailed ?? true }); } Debug.Log($"{PlaceholderParser.ParseTimeStamp()} [INFO] Registered commands! ({CommandList.Count} commands loaded in.)"); }
public void EndCommands() { if (agent != null) { agent.isStopped = true; agent.SetDestination(transform.position); } CanAction = false; CommandList.Clear(); soldierAnimator.SetBool(0, false); soldierAnimator.SetBool(1, false); soldierAnimator.SetBool(2, false); }
private void RemoveCommands() { if (CommandList.Any(x => x.Completed)) { CommandList.RemoveAt(0); } if (!CommandList.Any()) { CommandList.Clear(); CanAction = true; } }
/// <summary> /// clear all commands from commanders /// </summary> private void FlushCommands() { allCommands.Clear(); foreach (var unit in allUnits) { allCommands[unit] = null; } foreach (var commander in commanders) { commander.ResetCommands(); } }
public async Task ExecuteRefresh() { try { CommandViewModel cmd = SelectedContent; var res = new ObservableCollection <CommandViewModel>(); var cmds = await _warehouse.DBService.GetCommands(Command.EnumCommandStatus.Active, DateTime.Now.AddMinutes(-30), DateTime.Now); CommandList.Clear(); foreach (var c in cmds) { if (c is CommandMaterial) { CommandList.Add((CommandViewModel) new CommandMaterialViewModel { Command = c }); } else if (c is CommandSegment) { CommandList.Add((CommandViewModel) new CommandSegmentViewModel { Command = c }); } else { CommandList.Add((CommandViewModel) new CommandCommandViewModel { Command = c }); } } foreach (var c in CommandList) { c.Initialize(_warehouse); } if (cmd != null) { SelectedContent = CommandList.FirstOrDefault(p => p.ID == cmd.ID); } } catch (Exception e) { _warehouse.AddEvent(Database.Event.EnumSeverity.Error, Database.Event.EnumType.Exception, string.Format("{0}.{1}: {2}", this.GetType().Name, (new StackTrace()).GetFrame(0).GetMethod().Name, e.Message)); } }
public void LaunchDemo() { Updating = true; // Active le mode démo config.SetDemoMode(); // Charger les données json Version = "Démo"; LoadingMessage = "Chargement des Objets"; var assembly = GetType().GetTypeInfo().Assembly; var stream = assembly.GetManifestResourceStream("Jeedom.Demo.object.json"); var sr = new StreamReader(stream); ObjectList = JsonConvert.DeserializeObject <ObservableCollection <JeedomObject> >(sr.ReadToEnd()); // Populate EqlogicList and CmdList EqLogicList.Clear(); CommandList.Clear(); //foreach (var obj in ObjectList) //{ // foreach (var eq in obj.EqLogics) // { // EqLogicList.Add(eq); // foreach (var cmd in eq.Cmds) // { // CommandList.Add(cmd); // } // } //} LoadingMessage = "Chargement des Scénarios"; stream = assembly.GetManifestResourceStream("Jeedom.Demo.scenario.json"); sr = new StreamReader(stream); SceneList = JsonConvert.DeserializeObject <ObservableCollection <Scene> >(sr.ReadToEnd()); LoadingMessage = "Chargement des Messages"; stream = assembly.GetManifestResourceStream("Jeedom.Demo.message.json"); sr = new StreamReader(stream); MessageList = JsonConvert.DeserializeObject <ObservableCollection <Message> >(sr.ReadToEnd()); // Mise à jour des favoris PopulateFavoriteList(); LoadingMessage = "Prêt"; Updating = false; }
//从Protobuffer类型初始化 public void FromPB(DramaModuleDramaInfoV1 v) { if (v == null) { return; } Name = v.Name; TotalTime = v.TotalTime; CommandList.Clear(); for (int i = 0; i < v.CommandList.Count; i++) { CommandList.Add(new DramaModuleCommandInfoWraperV1()); } for (int i = 0; i < v.CommandList.Count; i++) { CommandList[i].FromPB(v.CommandList[i]); } }
public void Draw() { CommandList CommandList = Context.CommandList; Device.WaitIdle(); CommandList.Begin(); CommandList.BeginFramebuffer(Framebuffer); CommandList.Clear(0.0f, 0.2f, 0.4f, 1.0f); CommandList.SetViewport(Window.Width, Window.Height, 0, 0); CommandList.SetScissor(Window.Width, Window.Height, 0, 0); CommandList.EndFramebuffer(); CommandList.End(); CommandList.Submit(); Device.NativeSwapChain.Present(); }
public void Parse(String content) { if (content == null) { return; } String[] sArray = Regex.Split(content, CommandSeparator, RegexOptions.IgnoreCase); CommandList.Clear(); Commands.Clear(); Commands2.Clear(); foreach (String _command in sArray) { CommandList.Add(_command); String[] keyValue = Regex.Split(_command, KeyValueSeparator, RegexOptions.IgnoreCase); if (keyValue.Length == 2) { //Commands.Add(keyValue[0], Int32.Parse(keyValue[1])); Commands2.Add(keyValue[0], keyValue[1]); } } }
public HrmpProgram Parse(string filepath) { HrmpProgram program = null; using (StreamReader file = new StreamReader(filepath)) { string lastLabel = null; CommandList commandList = new CommandList(); string line; while ((line = file.ReadLine()) != null) { ICommand command = ParseLine(line); if (command == null) { // Not a command, check if it is a label for a jump. if (line.EndsWith(":")) { // If there was a previous label, save the current commandList to that ExecutionNode. if (lastLabel != null && program != null) { ExecutionNode en = new ExecutionNode(lastLabel, commandList); program.AddExecutionNode(en); } // Else, create the main ExecutionNode and create the HrmpProgram. else { ExecutionNode en = new ExecutionNode("main", commandList); program = new HrmpProgram(en); } // Clear the current commandList. commandList.Clear(); // Save the label for the next ExecutionNode. line = line.Remove(line.Count() - 1); lastLabel = line; } continue; } // Else, it is a command. else { commandList.Add(command); } } // End of file, so add the current commandList. // If there was a previous label, save the current commandList to that ExecutionNode. if (lastLabel != null && program != null) { ExecutionNode en = new ExecutionNode(lastLabel, commandList); program.AddExecutionNode(en); } // Else, create the main ExecutionNode and create the HrmpProgram. else { ExecutionNode en = new ExecutionNode("main", commandList); program = new HrmpProgram(en); } file.Close(); } return program; }
public void Clear() { CommandList.Clear(); TextSection.Clear(); DataSection.Clear(); }
public static void Clear() { m_commands.Clear(); m_commandsLookup.Clear(); }
public void ParseFile([CanBeNull] string[] hLines) { if (hLines == null) { return; } CommandTable.Clear(); CommandList.Clear(); DataTable.Clear(); DataList.Clear(); var currentSection = EFileSection.Undefined; foreach (var hLine in hLines) { var line = hLine; // Check for comments var commentIndex = line.IndexOf("@", StringComparison.Ordinal); if (commentIndex > -1) { line = line.Substring(0, commentIndex); } commentIndex = line.IndexOf("//", StringComparison.Ordinal); if (commentIndex > -1) { line = line.Substring(0, commentIndex); } // Remove leading, ending spaces, tabs line = line.Trim(' ', '\t'); if (string.IsNullOrEmpty(line)) { continue; } // Check for sections if (line.StartsWith(".", StringComparison.Ordinal)) { if (line.StartsWith(".text", StringComparison.Ordinal)) { currentSection = EFileSection.Text; continue; } if (line.StartsWith(".data", StringComparison.Ordinal)) { currentSection = EFileSection.Data; continue; } if (line.StartsWith(".global", StringComparison.Ordinal) || line.StartsWith(".globl", StringComparison.Ordinal)) { var split = line.Split(new [] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries); if (split.Length != 2) { throw new ArgumentException(); } EntryFunction = split[1]; continue; } if (line.StartsWith(".align", StringComparison.Ordinal)) { var split = line.Split(new[] { ' ', '\t' }, StringSplitOptions.RemoveEmptyEntries); if (split.Length != 2) { throw new ArgumentException(); } ParseAlign(split[1]); continue; } if (line.StartsWith(".type", StringComparison.Ordinal)) { // TODO: Implement missing member continue; } if (line.StartsWith(".Lfe", StringComparison.Ordinal)) { // TODO: Implement missing member continue; } if (line.StartsWith(".size", StringComparison.Ordinal)) { // TODO: Implement missing member continue; } if (line.Equals(".end", StringComparison.Ordinal)) { // End of file return; } } switch (currentSection) { case EFileSection.Undefined: break; case EFileSection.Text: ParseTextSection(line); break; case EFileSection.Data: ParseDataSection(line); break; case EFileSection.Comm: break; default: throw new ArgumentOutOfRangeException(); } } }
public HrmpProgram Parse(string filepath) { HrmpProgram program = null; using (StreamReader file = new StreamReader(filepath)) { string lastLabel = null; CommandList commandList = new CommandList(); string line; while ((line = file.ReadLine()) != null) { ICommand command = ParseLine(line); if (command == null) { // Not a command, check if it is a label for a jump. if (line.EndsWith(":")) { // If there was a previous label, save the current commandList to that ExecutionNode. if (lastLabel != null && program != null) { ExecutionNode en = new ExecutionNode(lastLabel, commandList); program.AddExecutionNode(en); } // Else, create the main ExecutionNode and create the HrmpProgram. else { ExecutionNode en = new ExecutionNode("main", commandList); program = new HrmpProgram(en); } // Clear the current commandList. commandList.Clear(); // Save the label for the next ExecutionNode. line = line.Remove(line.Count() - 1); lastLabel = line; } continue; } // Else, it is a command. else { commandList.Add(command); } } // End of file, so add the current commandList. // If there was a previous label, save the current commandList to that ExecutionNode. if (lastLabel != null && program != null) { ExecutionNode en = new ExecutionNode(lastLabel, commandList); program.AddExecutionNode(en); } // Else, create the main ExecutionNode and create the HrmpProgram. else { ExecutionNode en = new ExecutionNode("main", commandList); program = new HrmpProgram(en); } file.Close(); } return(program); }
public void ClearCommandList() { mCommandList.Clear(); }
public async Task <Error> SynchMobilePlugin() { var jsonrpc = new JsonRpcClient(); Parameters parameters = new Parameters(); parameters.plugin = "mobile"; jsonrpc.SetParameters(parameters); EqLogicList.Clear(); CommandList.Clear(); if (await jsonrpc.SendRequest("sync")) { // Récupère la liste de tous les eqLogics var EqLogics = jsonrpc.GetRequestResponseDeserialized <Response <JeedomObject> >(); if (EqLogics != null) { foreach (Model.EqLogic eq in EqLogics.result.eqLogics) { EqLogicList.Add(eq); } } // Récupère la liste de toutes les cmds var Cmds = jsonrpc.GetRequestResponseDeserialized <Response <Model.EqLogic> >(); if (Cmds.result.Cmds != null) { foreach (Model.Command cmd in Cmds.result.Cmds) { // AJoute la cmd à son eqLogic var eq = (from e in EqLogicList where e.Id == cmd.EqLogic_id select e).FirstOrDefault(); if (eq.Cmds == null) { eq.Cmds = new ObservableCollectionEx <Model.Command>(); } eq.Cmds.Add(cmd); /*if (EqLogicList.Where(o => o.Id.Equals(cmd.EqLogic_id)).FirstOrDefault().Cmds == null) * EqLogicList.Where(o => o.Id.Equals(cmd.EqLogic_id)).FirstOrDefault().Cmds = new ObservableCollectionEx<Command>(); * EqLogicList.Where(o => o.Id.Equals(cmd.EqLogic_id)).FirstOrDefault().Cmds.Add(cmd);*/ // Ajoute la commande à la liste globale des cmds CommandList.Add(cmd); } } // Suppression des eqLogics sans cmds for (int i = EqLogicList.Count - 1; i >= 0; i--) { if (EqLogicList[i].Cmds == null) { EqLogicList.RemoveAt(i); } } // Affecte les eqLogics à leurs objects correspondants foreach (EqLogic eq in EqLogicList) { var ob = (from o in ObjectList where o.id == eq.object_id select o).FirstOrDefault(); if (ob.eqLogics == null) { ob.eqLogics = new List <EqLogic>(); } ob.eqLogics.Add(eq); } // Suppression des objects sans eqLogics for (int i = ObjectList.Count - 1; i >= 0; i--) { //todo review eqlogics //if (ObjectList[i].EqLogics == null) // ObjectList.RemoveAt(i); } // Mise à jour des favoris PopulateFavoriteList(); } return(jsonrpc.Error); }