using System; namespace AsterNET.FastAGI.Command { /// /// Sets the priority for continuation upon exiting the application.
/// Since Asterisk 1.2 SetPriorityCommand also supports labels. ///
public class SetPriorityCommand : AGICommand { /// The priority or label for continuation upon exiting the application. private string priorityOrLabel; /// /// Get/Set the priority or label for continuation upon exiting the application. /// public int Priority { get { try { return Int32.Parse(this.priorityOrLabel); } catch {} return 0; } set { this.priorityOrLabel = value.ToString(); } } /// /// Get/Set the label for continuation upon exiting the application. /// public string Label { get { return this.priorityOrLabel; } set { this.priorityOrLabel = value; } } /// /// Creates a new SetPriorityCommand. /// /// the priority for continuation upon exiting the application. public SetPriorityCommand(int priority) { this.priorityOrLabel = priority.ToString(); } /// /// Creates a new SetPriorityCommand. /// /// the label for continuation upon exiting the application. public SetPriorityCommand(string label) { this.priorityOrLabel = label; } public override string BuildCommand() { return "SET PRIORITY " + EscapeAndQuote(priorityOrLabel); } } }