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


C# JToken.Value方法代码示例

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


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

示例1: City

 public City(JToken JasonCity)
 {
     string NLength = JasonCity.Value<string>("name");
     Name = (NLength.Length > 30) ? NLength.Substring(0, 25) + "." : NLength;
     Region = JasonCity.Value<string>("adminName1");
     Country = JasonCity.Value<string>("countryName");
 }
开发者ID:Marco30,项目名称:Mv222fp-1DV449-Webbteknik-II,代码行数:7,代码来源:City.cs

示例2: 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

示例3: SkillData

        public readonly int Type; //  动画编号

        #endregion Fields

        #region Constructors

        public SkillData(JToken jt)
        {
            string key = "";
            try
            {
                this.SkillId = int.Parse(jt.Value<string>(key = "SkillId"));
                var av = jt.Value<string>(key = "AffectValue").Split('_');
                var avl = new List<int>();
                foreach (var i in av) {
                    avl.Add(int.Parse(i));
                }
                this.AffectValue = avl.ToArray();
                this.Desc = jt.Value<string>(key = "Desc");
                this.AffectValue2 = int.Parse(jt.Value<string>(key = "AffectValue2"));
                this.LanchType = int.Parse(jt.Value<string>(key = "LanchType"));
                this.Name = jt.Value<string>(key = "Name");
                this.SkillCategory = int.Parse(jt.Value<string>(key = "SkillCategory"));
                this.LanchCondition = int.Parse(jt.Value<string>(key = "LanchCondition"));
                this.Type = int.Parse(jt.Value<string>(key = "Type"));
                this.LanchConditionValue = int.Parse(jt.Value<string>(key = "LanchConditionValue"));
                this.AffectType = int.Parse(jt.Value<string>(key = "AffectType"));
            }
            catch (Exception e)
            {
                throw new Exception("载入数据失败。SkillId="+SkillId+", "+ key + "="+ jt.Value<string>(key)+"\n"+e.Message);
            }
        }
开发者ID:tlos142857,项目名称:MKHXPedia,代码行数:33,代码来源:SkillData.cs

示例4: OnJsonArrived

        public void OnJsonArrived(JToken pJson)
        {
            if (m_canvasWindow.InvokeRequired) {
                m_canvasWindow.Invoke(new AsyncTcpClient.JsonHandler(OnJsonArrived), pJson);
            }
            else {
                string func = pJson.Value<string>("func");

                switch (func) {
                    case "credentials":
                    my_room = pJson.Value<string>("room");
                    my_name = pJson.Value<string>("user");
                    break;
                    case "user_quit":
                    RemoveUser(pJson.Value<string>("user"));
                    break;
                    case "user_join":
                    AddUser(pJson.Value<string>("user"));
                    break;
                    default:
                    Execute(pJson.Value<string>("user"), pJson);
                    break;
                }
            }
        }
开发者ID:substans,项目名称:AwesomeCanvas,代码行数:25,代码来源:Controller.cs

示例5: ParseMarketDepthEntry

        private static MarketDepth ParseMarketDepthEntry(JToken depth)
        {
            decimal quantity = ParseCurrencyObject(depth.Value<JObject>("quantity"));
            decimal price = ParseCurrencyObject(depth.Value<JObject>("price"));

            return new MarketDepth(price, quantity);
        }
开发者ID:dxzcc,项目名称:ncrypto-currency-exchange,代码行数:7,代码来源:VoSParsers.cs

示例6: Tag

 public Tag(JToken json, ForrstClient client)
     : base(client)
 {
     this.ID = json.Value<int>("id");
     this.Name = json.Value<string>("name");
     this.Uri = new Uri(ForrstClient.BaseUri, json.Value<string>("posts_url"));
 }
开发者ID:elektrowolf,项目名称:Forrst-API,代码行数:7,代码来源:Tag.cs

示例7: VisitToken

        private void VisitToken(JToken token)
        {
            switch (token.Type)
            {
                case JTokenType.Object:
                    VisitJObject(token.Value<JObject>());
                    break;

                case JTokenType.Array:
                    VisitArray(token.Value<JArray>());
                    break;

                case JTokenType.Integer:
                case JTokenType.Float:
                case JTokenType.String:
                case JTokenType.Boolean:
                case JTokenType.Bytes:
                case JTokenType.Raw:
                case JTokenType.Null:
                    VisitPrimitive(token);
                    break;

                default:
                    throw new FormatException(Resources.FormatError_UnsupportedJSONToken(
                        _reader.TokenType,
                        _reader.Path,
                        _reader.LineNumber,
                        _reader.LinePosition));
            }
        }
开发者ID:leloulight,项目名称:Configuration,代码行数:30,代码来源:JsonConfigurationFileParser.cs

示例8: Load

 public static User Load(JToken json, ISite campfireSite)
 {
     return new User
         {
             Name = json.Value<string>("name"),
             ID = json.Value<int>("id")
         };
 }
开发者ID:ngoossens,项目名称:matches.net,代码行数:8,代码来源:User.cs

示例9: FromJToken

 /// <summary>
 /// Creates a Genre from a JSON Object
 /// </summary>
 /// <param name="item">The item.</param>
 /// <param name="settings">The settings.</param>
 /// <returns>
 /// A Genre object
 /// </returns>
 internal static Language FromJToken(JToken item, IMusicClientSettings settings)
 {
     return new Language()
     {
         Id = item.Value<string>("id"),
         Name = item.Value<string>("name"),
     };
 }
开发者ID:ni3bobade,项目名称:.net-sdk,代码行数:16,代码来源:Language.cs

示例10: FromJToken

 /// <summary>
 /// Creates a Price from a JSON Object
 /// </summary>
 /// <param name="item">The item.</param>
 /// <returns>A Price object</returns>
 internal static Price FromJToken(JToken item)
 {
     return new Price()
     {
         Value = item.Value<double>("value"),
         Currency = item.Value<string>("currency")
     };
 }
开发者ID:NaveenSelvaraj,项目名称:wp-api-client,代码行数:13,代码来源:Price.cs

示例11: ParseJToken

        internal static LastStation ParseJToken(JToken token)
        {
            var s = new LastStation();

            s.Name = token.Value<string>("name");
            s.Url = new Uri(token.Value<string>("url"), UriKind.Absolute);

            return s;
        }
开发者ID:roberdjp,项目名称:lastfm,代码行数:9,代码来源:LastStation.cs

示例12: FromJson

 /// <summary>
 /// Creates a Post from json.
 /// </summary>
 /// <param name="json">The json.</param>
 /// <returns>A Post object</returns>
 internal static Post FromJson(JToken json)
 {
     return new Post()
     {
         Description = App.StripHtml(json.Value<string>("description")),
         Name = App.StripHtml(json.Value<string>("title")),
         Link = new Uri(json.Value<string>("url"))
     };
 }
开发者ID:srgb,项目名称:Shuffler.fm,代码行数:14,代码来源:Post.cs

示例13: FromJson

 /// <summary>
 /// Creates a Site from json.
 /// </summary>
 /// <param name="json">The json.</param>
 /// <returns>A Site object</returns>
 internal static Site FromJson(JToken json)
 {
     return new Site()
     {
         Id = json.Value<string>("id"),
         Name = json.Value<string>("title"),
         Link = new Uri(json.Value<string>("url"))
     };
 }
开发者ID:srgb,项目名称:Shuffler.fm,代码行数:14,代码来源:Site.cs

示例14: LoadMe

 public static User LoadMe(JToken json, ISite campfireSite)
 {
     return new User
         {
             ID = json.Value<int>("id"),
             Name = json.Value<string>("name"),
             ApiToken = json.Value<string>("api_auth_token")
         };
 }
开发者ID:ngoossens,项目名称:matches.net,代码行数:9,代码来源:User.cs

示例15: ToConfig

        public IStorageProviderConfig ToConfig(JToken config) {
            string fromConfigName = config.Value<string>("from");
            string toConfigName = config.Value<string>("to");

            var from = configStore.GetConfig(fromConfigName);
            var to = configStore.GetConfig(toConfigName);

            return new MigrationProviderConfig(from, to);
        }
开发者ID:visualeyes,项目名称:cabinet,代码行数:9,代码来源:MigratorProviderConfigConverter.cs


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