private bool parseAnim(GasParser parser, bool isAnim) { GasParam filename = new GasParam(); GasParam moving = new GasParam(); GasParam percent = new GasParam(); if (parser.ReadString(out filename.StringValue) == false) { return(false); } if (parser.ReadBoolean(out moving.BooleanValue) == false) { moving.BooleanValue = false; } if (parser.ReadInteger(out percent.IntegerValue) == false) { percent.IntegerValue = 100; } GasScriptLine line; line.Command = (isAnim ? GasCommand.Anim : GasCommand.OneOf); line.Params = new GasParam[] { filename, moving, percent }; _lines.Add(line); return(true); }
private bool parseWait(GasParser parser) { GasParam min = new GasParam(); GasParam max = new GasParam(); GasParam percent = new GasParam(); if (parser.ReadInteger(out min.IntegerValue) == false) { return(false); } if (parser.ReadInteger(out max.IntegerValue) == false) { max.IntegerValue = 0; } if (parser.ReadInteger(out percent.IntegerValue) == false) { percent.IntegerValue = 100; } GasScriptLine line; line.Command = GasCommand.Wait; line.Params = new GasParam[] { min, max, percent }; _lines.Add(line); return(true); }
private void parse(string gas) { GasParser parser = new GasParser(gas); while (true) { string command; if (parser.ReadString(out command)) { // figure out which command this is if (command.Equals("Anim", StringComparison.OrdinalIgnoreCase)) { parseAnim(parser, true); } else if (command.Equals("OneOf", StringComparison.OrdinalIgnoreCase)) { parseAnim(parser, false); } else if (command.Equals("Wait", StringComparison.OrdinalIgnoreCase)) { parseWait(parser); } else if (command.Equals("Loop", StringComparison.OrdinalIgnoreCase)) { GasScriptLine line; line.Command = GasCommand.Loop; line.Params = null; _lines.Add(line); } } if (parser.NextMeaningfulLine()) { break; } } }