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


C# JToken.SelectToken方法代码示例

本文整理汇总了C#中JToken.SelectToken方法的典型用法代码示例。如果您正苦于以下问题:C# JToken.SelectToken方法的具体用法?C# JToken.SelectToken怎么用?C# JToken.SelectToken使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在JToken的用法示例。


在下文中一共展示了JToken.SelectToken方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: ParseJToken

        internal static LastTag ParseJToken(JToken token, string relatedTag = null)
        {
            var name = token.Value<string>("name");
            var url = token.Value<string>("url");

            int? count = null;
            var countToken = token.SelectToken("count");
            if (countToken != null)
            {
                count = countToken.ToObject<int?>();
            }

            bool? streamable = null;
            var streamableToken = token.SelectToken("streamable");
            if (streamableToken != null)
            {
                streamable = Convert.ToBoolean(streamableToken.Value<int>());
            }

            return new LastTag(name, url, count)
            {
                Streamable = streamable,
                RelatedTo = relatedTag
            };
        }
开发者ID:depill,项目名称:lastfm,代码行数:25,代码来源:LastTag.cs

示例2: TwitchFollower

 public TwitchFollower(JToken followerData)
 {
     _createdAt = followerData.SelectToken("created_at").ToString();
     if (followerData.SelectToken("notifications").ToString() == "true")
         _notifications = true;
     _user = new UserObj(followerData.SelectToken("user"));
 }
开发者ID:GlitchHound,项目名称:TwitchLib,代码行数:7,代码来源:TwitchFollower.cs

示例3: Function

        public Function(JToken JSON, bool magicMethod = false)
            : this(magicMethod)
        {
            this.StartLine = Int32.MinValue;
            this.EndLine = Int32.MinValue;
            this.Formats = new List<string>();

            this.Name = (string)JSON.SelectToken(Keys.PHPDefinitionJSONKeys.GeneralKeys.Name);
            this.ParameterCount = (int)JSON.SelectToken(Keys.PHPDefinitionJSONKeys.GeneralKeys.ParameterCount);
            this.ReturnType = (string)JSON.SelectToken(Keys.PHPDefinitionJSONKeys.GeneralKeys.ReturnType);

            var formats = (JArray)JSON.SelectToken(Keys.PHPDefinitionJSONKeys.GeneralKeys.Formats);
            if (formats != null)
            {
                foreach (string format in formats)
                {
                    this.Formats.Add(format);
                }
            }

            var aliasArray = (JArray)JSON.SelectToken(Keys.PHPDefinitionJSONKeys.GeneralKeys.Aliases);
            if(aliasArray != null)
            {
                foreach (string alias in aliasArray)
                {
                    Aliases.Add(alias);
                }
            }
        }
开发者ID:jtvn,项目名称:Eir-CTLLTL,代码行数:29,代码来源:Function.cs

示例4: parseContactFromJToken

        public void parseContactFromJToken(JToken token)
        {
            try
            {
                JToken data = token.SelectToken("gd$name");
                if (data != null)
                {
                    parseName(data);
                }

                data = token.SelectToken("gd$email");
                if (data != null)
                {
                    parseEmail(data);
                }

                data = token.SelectToken("gd$phoneNumber");
                if (data != null)
                {
                    parsePhone(data);
                }
            }
            catch (Exception ex)
            {
                System.Diagnostics.Debug.WriteLine(ex.ToString());
            }
        }
开发者ID:thongvo,项目名称:myfiles,代码行数:27,代码来源:GoogleContact.cs

示例5: Block

 /// <summary>
 /// Block object constructor.
 /// </summary>
 /// <param name="json"></param>
 public Block(JToken json)
 {
     UpdatedAt = Common.DateTimeStringToObject(json.SelectToken("updated_at")?.ToString());
     TimeSinceUpdate = DateTime.UtcNow - UpdatedAt;
     if (json.SelectToken("user") != null)
         User = new User(json.SelectToken("user").ToString());
 }
开发者ID:swiftyspiffy,项目名称:TwitchLib,代码行数:11,代码来源:Block.cs

示例6: PreviewObj

 public PreviewObj(JToken previewData)
 {
     _small = previewData.SelectToken("small").ToString();
     _medium = previewData.SelectToken("medium").ToString();
     _large = previewData.SelectToken("large").ToString();
     _template = previewData.SelectToken("template").ToString();
 }
开发者ID:GlitchHound,项目名称:TwitchLib,代码行数:7,代码来源:TwitchStream.cs

示例7: BoxUrls

 /// <summary>Constructor for BoxUrls.</summary>
 public BoxUrls(JToken j)
 {
     Large = j.SelectToken("large")?.ToString();
     Medium = j.SelectToken("medium")?.ToString();
     Small = j.SelectToken("small")?.ToString();
     Template = j.SelectToken("template")?.ToString();
 }
开发者ID:swiftyspiffy,项目名称:TwitchLib,代码行数:8,代码来源:Game.cs

示例8: YoutubeStats

 public YoutubeStats(JToken youtubeData)
 {
     viewCount = int.Parse(youtubeData.SelectToken("viewCount").ToString());
     commentCount = int.Parse(youtubeData.SelectToken("commentCount").ToString());
     subscriberCount = int.Parse(youtubeData.SelectToken("subscriberCount").ToString());
     videoCount = int.Parse(youtubeData.SelectToken("videoCount").ToString());
 }
开发者ID:swiftyspiffy,项目名称:KrakenBot2,代码行数:7,代码来源:YoutubeStats.cs

示例9: RecentDonation

 public RecentDonation(JToken donationData)
 {
     username = donationData.SelectToken("username").ToString();
     message = donationData.SelectToken("message").ToString();
     date = Convert.ToDateTime(donationData.SelectToken("date").ToString());
     amount = Double.Parse(donationData.SelectToken("amount").ToString());
 }
开发者ID:swiftyspiffy,项目名称:KrakenBot2,代码行数:7,代码来源:RecentDonation.cs

示例10: TokenResponse

        /// <summary>
        /// Construct a new token by parsing activeConfigJson and get the credential.
        /// </summary>
        public TokenResponse(JToken userCredentialJson)
        {
            JToken accessTokenJson = userCredentialJson.SelectToken("access_token");
            JToken tokenExpiryJson = userCredentialJson.SelectToken("token_expiry");

            if (accessTokenJson == null || accessTokenJson.Type != JTokenType.String)
            {
                throw new InvalidDataException("Credential JSON should contain access token key.");
            }

            AccessToken = accessTokenJson.Value<string>();

            // Service account credentials do not expire.
            if (tokenExpiryJson == null || tokenExpiryJson.Type == JTokenType.Null)
            {
                ExpiredTime = DateTime.MaxValue;
            }
            else
            {
                if (tokenExpiryJson.Type != JTokenType.Date)
                {
                    throw new InvalidDataException("Credential JSON contains an invalid token_expiry.");
                }
                ExpiredTime = DateTime.SpecifyKind(tokenExpiryJson.Value<DateTime>(), DateTimeKind.Utc);
            }
        }
开发者ID:GoogleCloudPlatform,项目名称:google-cloud-powershell,代码行数:29,代码来源:TokenResponse.cs

示例11: ChannelHasUserSubscribedResponse

 /// <summary>Constructor for ChannelHasUserSubscribedResponse object.</summary>
 /// <param name="json"></param>
 public ChannelHasUserSubscribedResponse(JToken json)
 {
     Id = json.SelectToken("_id")?.ToString();
     if (json.SelectToken("user") != null)
         User = new User(json.SelectToken("user").ToString());
     if (json.SelectToken("created_at") != null)
         CreatedAt = Common.DateTimeStringToObject(json.SelectToken("created_at").ToString());
 }
开发者ID:swiftyspiffy,项目名称:TwitchLib,代码行数:10,代码来源:ChannelHasUserSubscribedResponse.cs

示例12: Follower

 /// <summary>Follower object constructor.</summary>
 public Follower(JToken followerData)
 {
     CreatedAt = Common.DateTimeStringToObject(followerData.SelectToken("created_at").ToString());
     TimeSinceCreated = DateTime.UtcNow - CreatedAt;
     if (followerData.SelectToken("notifications").ToString() == "true")
         Notifications = true;
     User = new User(followerData.SelectToken("user").ToString());
 }
开发者ID:swiftyspiffy,项目名称:TwitchLib,代码行数:9,代码来源:Follower.cs

示例13: PlatformUser

 public PlatformUser(IPlatformSession session, JToken token)
     : base(session)
 {
     Id = token.SelectToken("id").Value<string>();
     Email = token.SelectToken("email").Value<string>();
     Name = token.SelectToken("name").Value<string>();
     Uuid = token.SelectToken("uuid").Value<string>();
 }
开发者ID:killbug2004,项目名称:WSProf,代码行数:8,代码来源:PlatformUser.cs

示例14: KnowledgeBase

 /// <summary>
 /// Creates a new Knowledge Base
 /// </summary>
 /// <param name="t">JSON Token for the Object that represents the Service</param>
 internal KnowledgeBase(JToken t)
 {
     this._name = (String)t.SelectToken("name");
     foreach (JToken svc in t.SelectToken("kb-services").Children())
     {
         PelletService s = PelletService.CreateService(svc);
         if (s != null) this._services.Add(s);
     }
 }
开发者ID:almostEric,项目名称:DotNetRDF-4.0,代码行数:13,代码来源:KnowledgeBase.cs

示例15: RaffleWin

 public RaffleWin(JToken raffleWinProperties)
 {
     raffleJsonData = raffleWinProperties.ToString();
     winner = raffleWinProperties.SelectToken("winner").ToString();
     winCount = int.Parse(raffleWinProperties.SelectToken("win_count").ToString());
     enterCount = int.Parse(raffleWinProperties.SelectToken("enter_count").ToString());
     claimTime = double.Parse(raffleWinProperties.SelectToken("claim_time").ToString());
     claimTimeAvg = double.Parse(raffleWinProperties.SelectToken("claim_time_avg").ToString());
 }
开发者ID:swiftyspiffy,项目名称:KrakenBot2,代码行数:9,代码来源:RaffleWin.cs


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