private ChoiceCommand ParseChoiceCommand(ICharReader reader) { var choices = new List <string>(); for (var choice = reader.ReadUntilAny('|'); choice != null; choice = reader.ReadUntilAny('|')) { choices.Add(choice); } return(new ChoiceCommand(choices)); }
private Command ParseTextCommand(ICharReader reader) { string text = reader.ReadUntilAny('\n'); if (text == null) { return(new TextCommand("", TextOptions.AwaitInput)); } switch (text[0]) { case '~': return(new TextCommand("", TextOptions.None)); case '!': return(new AwaitInputCommand()); case '@': return(new TextCommand(text.Substring(1), TextOptions.None)); } return(new TextCommand(text, TextOptions.AwaitInput)); }
private Command ParseNextCommand(ICharReader reader) { string name = reader.ReadUntilAny(delimiters); if ((name == null) || (name[0] == '#')) { return(new SkipCommand()); } switch (name) { case "bgload": return(this.ParseBackgroundLoadCommand(reader)); case "setimg": return(this.ParseSetImageCommand(reader)); case "sound": return(this.ParseSoundCommand(reader)); case "music": return(this.ParseMusicCommand(reader)); case "text": return(this.ParseTextCommand(reader)); case "choice": return(this.ParseChoiceCommand(reader)); case "setvar": return(this.ParseLocalVariableCommand(reader)); case "gsetvar": return(this.ParseGlobalVariableCommand(reader)); case "if": return(this.ParseIfCommand(reader)); case "fi": return(new FiCommand()); case "jump": return(this.ParseJumpCommand(reader)); case "delay": return(this.ParseDelayCommand(reader)); case "random": return(this.ParseRandomCommand(reader)); case "label": return(this.ParseLabelCommand(reader)); case "goto": return(this.ParseGoToCommand(reader)); case "cleartext": return(new ClearTextCommand()); case "endscript": return(new EndScriptCommand()); default: return(new SkipCommand()); } }