本文整理汇总了C#中JObject.GetEnumerator方法的典型用法代码示例。如果您正苦于以下问题:C# JObject.GetEnumerator方法的具体用法?C# JObject.GetEnumerator怎么用?C# JObject.GetEnumerator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JObject
的用法示例。
在下文中一共展示了JObject.GetEnumerator方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: _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;
}
示例2: 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;
}