using System;
using System.Linq;
using System.Windows.Media;
namespace RuriLib.LS
{
///
/// Parses a DELETE command.
///
class DeleteParser
{
///
/// Gets the Action that needs to be executed.
///
/// The data line to parse
/// The BotData needed for variable replacement
/// The Action to execute
public static Action Parse(string line, BotData data)
{
var input = line.Trim();
var field = LineParser.ParseToken(ref input, TokenType.Parameter, true).ToUpper();
return new Action(() =>
{
var name = "";
Condition cond = Condition.EqualTo;
switch (field)
{
case "COOKIE":
if(LineParser.Lookahead(ref input) == TokenType.Parameter)
cond = (Condition)LineParser.ParseEnum(ref input, "TYPE", typeof(Condition));
name = LineParser.ParseLiteral(ref input, "NAME");
for (int i=0; i