本文整理汇总了C#中JObject.ContainsKey方法的典型用法代码示例。如果您正苦于以下问题:C# JObject.ContainsKey方法的具体用法?C# JObject.ContainsKey怎么用?C# JObject.ContainsKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JObject
的用法示例。
在下文中一共展示了JObject.ContainsKey方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: m_gs_DownloadProgress
void m_gs_DownloadProgress(object sender, JObject song, long percentage)
{
if (InvokeRequired)
{
BeginInvoke(new DownloadProgress(m_gs_DownloadProgress), new object[] { sender, song, percentage });
return;
}
log("Downloading " + (string)song["Name"] + " " + percentage + "%");
if (percentage > 90 && !song.ContainsKey("AlreadyTriggered"))
{
song["AlreadyTriggered"] = true;
Dequeue(1);
}
m_updateQueue.Enqueue(song);
}
示例2: _Request
private JObject _Request(string uri, string method, JObject parameters, UploadStringCompletedEventHandler handler, object handlerToken, JObject headerOverride)
{
JObject request = new JObject();
request.Add("parameters", parameters);
JObject header = new JObject();
header.Add("session", m_sid);
header.Add("client", "jsqueue");
header.Add("clientRevision", "20120123.02");
header.Add("privacy", 0);
// Somehow this uuid is important, and I don't really know what it is, the UUID of the JSQueue flash object ?
header.Add("uuid", "E1AA0D1D-86EF-4CE2-AEC9-F70358E2535E");
header.Add("country", m_countryObj);
request.Add("header", header);
request.Add("method", method);
if (headerOverride != null)
{
IDictionaryEnumerator e = headerOverride.GetEnumerator();
while (e.MoveNext())
{
if (header.ContainsKey(e.Key))
header[e.Key] = e.Value;
else
header.Add(e.Key, e.Value);
}
}
string t = GenerateToken(method, (string)header["client"]);
header.Add("token", t);
string requestStr = JSON.JsonEncode(request).Replace("\n", "").Replace(" ", "").Replace("\r", "");
CookieAwareWebClient wc = new CookieAwareWebClient(m_cc);
wc.UploadStringCompleted += handler;
wc.UploadStringAsync(new Uri(uri + method), "POST", requestStr, handlerToken);
RequestSent(this, requestStr);
return request;
}
示例3: DownloadSong
public void DownloadSong(string host, string key, JObject song)
{
if (song.ContainsKey("Percentage"))
{
return;
}
Download d = new Download(new Uri("http://" + host + "/stream.php"), key, m_cc, song);
d.Progress += new EventHandler(d_Progress);
return;
CookieAwareWebClient wc = new CookieAwareWebClient(m_cc);
//!FIXME Segmented downloads
NameValueCollection nvc = new NameValueCollection();
nvc.Add("streamKey", key);
wc.UploadProgressChanged += new UploadProgressChangedEventHandler(wc_UploadProgressChanged);
wc.UploadValuesCompleted += new UploadValuesCompletedEventHandler(wc_DownloadStream);
wc.UploadValuesAsync(new Uri("http://" + host + "/stream.php"), "POST", nvc, song);
}
示例4: Request
/**
* This is the lowest level request method. Use higher level if possible.
*/
public JObject Request(string uri, string method, ClientType client, JObject parameters, JObject headerOverrides, RequestHandler handler, object state)
{
JObject request = new JObject();
request.Add("parameters", parameters);
JObject header = new JObject();
if (m_token != null)
{
string t = GenerateToken(method);
header.Add("token", t);
}
header.Add("session", m_sid);
if (client == ClientType.HTML)
header.Add("client", "htmlshark");
else if (client == ClientType.JSQueue)
header.Add("client", "jsqueue");
else
throw new Exception("ClientType not supported.");
header.Add("clientRevision", "20101012.37");
header.Add("privacy", 0);
// Somehow this uuid is important, and I don't really know what it is, the UUID of the JSQueue flash object ?
header.Add("uuid", "6BFBFCDE-B44F-4EC5-AF69-76CCC4A2DAD0");
header.Add("country", m_countryObj);
request.Add("header", header);
request.Add("method", method);
if (headerOverrides != null)
{
IDictionaryEnumerator e = headerOverrides.GetEnumerator();
while (e.MoveNext())
{
if (header.ContainsKey(e.Key))
header[e.Key] = e.Value;
else
header.Add(e.Key, e.Value);
}
}
string requestStr = request.ToString().Replace("\n", "").Replace(" ", "").Replace("\r", "");
CookieAwareWebClient wc = new CookieAwareWebClient(m_cc);
wc.UploadStringCompleted += new UploadStringCompletedEventHandler(GSRequestHandler);
wc.UploadStringAsync(new Uri(uri + "?" + method), "POST", requestStr, new object[]{ handler, state });
if(RequestSent != null)
RequestSent(this, requestStr);
return request;
}