2013-12-19 23:51:20 +08:00
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
|
|
|
|
|
namespace WinAlfred.Plugin
|
|
|
|
|
{
|
|
|
|
|
public class Query
|
|
|
|
|
{
|
|
|
|
|
public string RawQuery { get; set; }
|
|
|
|
|
public string ActionName { get; private set; }
|
|
|
|
|
public List<string> ActionParameters { get; private set; }
|
|
|
|
|
|
|
|
|
|
public Query(string rawQuery)
|
|
|
|
|
{
|
|
|
|
|
RawQuery = rawQuery;
|
2013-12-20 19:38:10 +08:00
|
|
|
|
ActionParameters = new List<string>();
|
2013-12-19 23:51:20 +08:00
|
|
|
|
ParseQuery();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private void ParseQuery()
|
|
|
|
|
{
|
2013-12-20 19:38:10 +08:00
|
|
|
|
if (string.IsNullOrEmpty(RawQuery)) return;
|
|
|
|
|
|
|
|
|
|
string[] strings = RawQuery.Split(' ');
|
|
|
|
|
ActionName = strings[0];
|
|
|
|
|
if (strings.Length > 1)
|
|
|
|
|
{
|
|
|
|
|
for (int i = 1; i < strings.Length; i++)
|
|
|
|
|
{
|
|
|
|
|
ActionParameters.Add(strings[i]);
|
|
|
|
|
}
|
|
|
|
|
}
|
2013-12-19 23:51:20 +08:00
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|