public GameConfigButtonDescriptor AddNewSequenceCommand(GameConfigButtonDescriptor.Etype type, string tittle, List <KeyValuePair <string, string> > commandList, int sectionIndex) { GameConfigButtonDescriptor newCommand = new GameConfigButtonDescriptor(); newCommand._tittle = tittle; newCommand._type = type; newCommand.AddSequenceCommand(commandList); _sections[sectionIndex]._buttons.Add(newCommand); return(newCommand); }
public GameConfigButtonDescriptor AddNewCommand(GameConfigButtonDescriptor.Etype type, string tittle, string command, string arguments, int sectionIndex) { GameConfigButtonDescriptor newCommand = new GameConfigButtonDescriptor(); newCommand._tittle = tittle; newCommand._type = type; newCommand._command = command; newCommand._arguments = arguments; _sections[sectionIndex]._buttons.Add(newCommand); return(newCommand); }
public void OnMenuAddNewCommandButtonPress(object sender, EventArgs e, GameConfigButtonDescriptor.Etype type, int sectionIndex) { UIUtils.ShutDownWindowSafe(ref _windowAddSingleCommand); UIUtils.ShutDownWindowSafe(ref _windowAddExposedCommand); UIUtils.ShutDownWindowSafe(ref _windowAddSequenceCommand); if (type == GameConfigButtonDescriptor.Etype.FixedArgument) { _windowAddSingleCommand = new WindowAddSingleCommand(this, sectionIndex); MoveWindowToWindowPos(_windowAddSingleCommand); _windowAddSingleCommand.Show(); } else if (type == GameConfigButtonDescriptor.Etype.ExposedArgument) { _windowAddExposedCommand = new WindowAddExposedCommand(this, sectionIndex); MoveWindowToWindowPos(_windowAddExposedCommand); _windowAddExposedCommand.Show(); } else if (type == GameConfigButtonDescriptor.Etype.MultiCommand) { _windowAddSequenceCommand = new WindowAddSequenceCommand(this, sectionIndex); MoveWindowToWindowPos(_windowAddSequenceCommand); _windowAddSequenceCommand.Show(); } }
public FileOperationResult Load() { try { XmlReader reader = XmlReader.Create(_descriptorFile); while (reader.Read()) { // Only detect start elements. if (reader.IsStartElement()) { // Get element name and switch on it. switch (reader.Name) { case "commands": { _gameConfigDB = new GameConfigDB(); string attribute = reader["name"]; Config.AssertResource(attribute); _gameConfigDB.SetName(attribute); attribute = reader["creationDate"]; Config.AssertResource(attribute); _gameConfigDB.SetCreationDate(Int32.Parse(attribute)); } break; case "section": { if (_currentGameConfigSectionDescriptor != null) { _gameConfigDB.AddSection(_currentGameConfigSectionDescriptor); _currentGameConfigSectionDescriptor = null; } _currentGameConfigSectionDescriptor = new GameConfigSectionDescriptor(); string attribute = reader["tittle"]; Config.AssertResource(attribute); _currentGameConfigSectionDescriptor._tittle = Utils.DecodeHTML(attribute); } break; case "command": { _currentGameConfigButtonDescriptor = new GameConfigButtonDescriptor(); string attribute = reader["type"]; Config.AssertResource(attribute); GameConfigButtonDescriptor.Etype type = Utils.static_cast <GameConfigButtonDescriptor.Etype>(Int32.Parse(attribute)); _currentGameConfigButtonDescriptor._type = type; attribute = reader["tittle"]; Config.AssertResource(attribute); _currentGameConfigButtonDescriptor._tittle = Utils.DecodeHTML(attribute); if (type == GameConfigButtonDescriptor.Etype.MultiCommand) { _currentGameConfigButtonDescriptor._commandList = new List <GameConfigCommandDescriptor>(); } else { attribute = reader["command"]; Config.AssertResource(attribute); _currentGameConfigButtonDescriptor._command = Utils.DecodeHTML(attribute); } if (type == GameConfigButtonDescriptor.Etype.FixedArgument || type == GameConfigButtonDescriptor.Etype.ExposedArgument) { attribute = reader["arguments"]; Config.AssertResource(attribute); _currentGameConfigButtonDescriptor._arguments = Utils.DecodeHTML(attribute); } _currentGameConfigSectionDescriptor._buttons.Add(_currentGameConfigButtonDescriptor); } break; case "command_sequence": { GameConfigCommandDescriptor commandDescriptor = new GameConfigCommandDescriptor(); string attribute = reader["command"]; Config.AssertResource(attribute); commandDescriptor._command = Utils.DecodeHTML(attribute); attribute = reader["arguments"]; Config.AssertResource(attribute); commandDescriptor._arguments = Utils.DecodeHTML(attribute); _currentGameConfigButtonDescriptor._commandList.Add(commandDescriptor); } break; } } } if (_currentGameConfigSectionDescriptor != null) { _gameConfigDB.AddSection(_currentGameConfigSectionDescriptor); _currentGameConfigSectionDescriptor = null; } reader.Close(); return(new FileOperationResult(true)); } catch (System.Exception ex) { return(new FileOperationResult(false, ex.Message)); } }