当前位置: 首页>>代码示例>>C#>>正文


C# JObject.ContainsKey方法代码示例

本文整理汇总了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);
        }
开发者ID:engina,项目名称:SharkIT,代码行数:17,代码来源:Main.cs

示例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;
        }
开发者ID:engina,项目名称:SharkIT,代码行数:37,代码来源:GS.cs

示例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);
 }
开发者ID:engina,项目名称:SharkIT,代码行数:17,代码来源:GS.cs

示例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;
        }
开发者ID:engina,项目名称:SharkIT,代码行数:49,代码来源:Session.cs


注:本文中的JObject.ContainsKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。