Exemplo n.º 1
0
 /// <summary>
 /// Adds a new command to the Q command queue
 /// </summary>
 /// <param name="command">The command to add</param>
 public void Push(QCommand command)
 {
     foreach (QCommand other in commands) if (command.IsSame(other)) return;
     commands.Enqueue(command);
     Update();
 }
Exemplo n.º 2
0
 /// <summary>
 /// Updates the Q command list
 /// </summary>
 void Update()
 {
     if (current == null && commands.Count != 0)
     {
         current = commands.Dequeue();
         current.OnExecute();
         Irc.SendPrivateMessage(current.Command, "Q", false, false);
     }
     if (OnUpdate != null) OnUpdate.Invoke();
 }
Exemplo n.º 3
0
 /// <summary>
 /// Handles a response from Q
 /// </summary>
 /// <param name="text">The text of the response by Q</param>
 public void OnResponse(string text)
 {
     if (current == null) Program.Log("Unexpected response from Q: " + text);
     else
     {
         if (!current.OnResponse(text))
         {
             current.RaiseFinished();
             current = null;
             Update();
         }
     }
 }
Exemplo n.º 4
0
 /// <summary>
 /// Checks if this command is the same as some other command
 /// </summary>
 /// <param name="other">The other command to check</param>
 /// <returns>True if this command is the same</returns>
 public virtual bool IsSame(QCommand other)
 {
     return Command == other.Command;
 }
Exemplo n.º 5
0
 public PendingUnban(QCommand condition, string mask)
 {
     this.mask = mask;
     condition.OnFinished += new QCommand.OnFinishedDelegate(ExecuteIfTrue);
 }
Exemplo n.º 6
0
 public PendingSetEnforcer(QCommand condition, string mask, BanEnforcement enforcer)
 {
     this.mask = mask;
     this.enforcer = enforcer;
     condition.OnFinished += new QCommand.OnFinishedDelegate(ExecuteIfTrue);
 }
Exemplo n.º 7
0
 public void Add(QCommand command)
 {
     total++;
     count++;
     command.OnFinished += new QCommand.OnFinishedDelegate(Decrement);
 }