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


C# JToken.Values方法代码示例

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


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

示例1: GetTask

 private ITask GetTask(JToken token)
 {
     var taskName = token.Values<JProperty>().SingleOrDefault(i => i.Name == "TaskName").Value.ToString();
     if (string.IsNullOrWhiteSpace(taskName)) return null;
     var taskType = _taskMapper[taskName];
     if (taskType == null) return null;
     return GetTask(token, taskType);
 }
开发者ID:marinoscar,项目名称:Automator,代码行数:8,代码来源:TaskLoader.cs

示例2: Load

 private void Load(JToken jToken)
 {
     foreach (JToken token in jToken.Values())
     {
         if (token.Type == JTokenType.String)
         {
             var key = ConfigurationPath.Combine(GetPathTokens(token.Path));
             Data[key] = ((JValue)token).Value as string;
         } else
         {
             Load(token);
         }
     }
 }
开发者ID:watson-developer-cloud,项目名称:visual-recognition-aspnet,代码行数:14,代码来源:VcapServicesConfigurationProvider.cs

示例3: ReadJsonLeaf

 private string ReadJsonLeaf(JToken jToken)
 {
     if (jToken.HasValues)
     {
         foreach (JToken value in jToken.Values())
         {
             return ReadJsonLeaf(value);
         }
     }
     else
     {
         if (jToken is JValue)
         {
             JValue jValue = (JValue)jToken;
             return jValue.Value.ToString();
         }
     }
     return string.Empty;
 }
开发者ID:dsgouda,项目名称:buildtools,代码行数:19,代码来源:GetRuntimeJsonValues.cs

示例4: GetQueryToken

        private static JToken GetQueryToken(JToken root)
        {
            if (!root.HasValues) return null;

            return root["query"] ?? root.Values().Select(GetQueryToken).FirstOrDefault(query => query != null);
        }
开发者ID:rsage,项目名称:DwAuthDemo,代码行数:6,代码来源:EsProxyController.cs

示例5: RecursiveTree

 static void RecursiveTree(String path, JToken Tree, ShaTree ThisShaTree, String repo)
 {
     Directory.CreateDirectory(path);
     foreach (JProperty fileProp in Tree.Values<JProperty>())
     {
         JToken file = fileProp.Value;
         if ((String)file["type"] == "tree")
         {
             if (!ThisShaTree.SubTrees.ContainsKey((String)file["path"]))
             {
                 ThisShaTree.SubTrees.Add((String)file["path"], new ShaTree());
             }
             RecursiveTree(path + "\\" + (String)file["path"], file["tree"], ThisShaTree.SubTrees[(String)file["path"]], repo);
         }
         else
         {
             if (((String)file["path"])[0] != '.')
             {
                 if (!ThisShaTree.FileShas.ContainsKey((String)file["path"]))
                 {
                     ThisShaTree.FileShas.Add((String)file["path"], "");
                 }
                 if (ThisShaTree.FileShas[(String)file["path"]] != (String)file["sha"])
                 {
                     ThisShaTree.FileShas[(String)file["path"]] = (String)file["sha"];
                     UpdateFile(path + "\\" + (String)file["path"], repo, (String)file["sha"]);
                     InnerSpace.Echo((String)file["path"] + " Downloaded");
                 }
             }
         }
     }
 }
开发者ID:VendanAndrews,项目名称:CombotPatcher,代码行数:32,代码来源:GithubPatcher.cs

示例6: ParseProtocol

 private List<String> ParseProtocol(JToken protocols)
 {
     return protocols.Values<String>().ToList();
 }
开发者ID:pilight,项目名称:windows-phone-gui,代码行数:4,代码来源:MainViewModel.cs

示例7: ParseId

 private Dictionary<String, String> ParseId(JToken ids)
 {
     Dictionary<String, String> returnValues = new Dictionary<String, String>();
     foreach (JProperty id in ids.Values())
     {
         returnValues.Add(id.Name, (String)id.Value);
     }
     return returnValues;
 }
开发者ID:pilight,项目名称:windows-phone-gui,代码行数:9,代码来源:MainViewModel.cs

示例8: decipherAreasJSON

        /*
         * Gets all the sub-categories (or topics?) of jt, and hangs them under node?
         */
        //private static void decipherAreasJSON(JToken jt, Node node)
        private static void decipherAreasJSON(JToken jt, Category group)
        {
            if (jt is JProperty)
            {
                if (jt.ToObject<JProperty>().Name != IFIXIT_CATEGORY_OBJECT_KEY)
                {
            //                    Debug.WriteLine(" " + jt.ToObject<JProperty>().Name);

                    // since it's not a device, it must be a group
                    //Node curr = new Node(jt.ToObject<JProperty>().Name, new List<Node>());
                    Category curr = new Category(jt.ToObject<JProperty>().Name);

                    //FIXME this is where we add to the 1:M, right?
                    //group.Categories.Add(curr);
                    group.AddCategory(curr);
                    curr.Parent = group;
                    curr.parentName = group.Name;
                    if (jt.HasValues)
                    {
                        IJEnumerable<JToken> values = jt.Values();
                        foreach (JToken val in values)
                        {
                            decipherAreasJSON(val, curr);
                        }
                    }
                }
                // these are devices
                else
                {
                    IJEnumerable<JToken> devs = jt.Values();
                    foreach (JToken dev in devs)
                    {
                        Topic d = new Topic();
                        d.Name = dev.ToString();
                        /*
                        if (group.Devices == null)
                        {
                            group.Devices = new List<Topic>();
                        }
                         */
                        //group.Topics.Add(d);
                        group.AddTopic(d);
                        d.Parent = group;
                        d.parentName = group.Name;

                        //node.getChildrenList().Add(new Node(dev.ToString(), null));
            //                        Debug.WriteLine("  " + dev.ToString());
                    }
                }
            }
            else
            {
                // can currently safely ignore anything in this category
            //                Debug.WriteLine("\n" + jt.ToString() + " not a property\n");
            }
        }
开发者ID:mdabbagh88,项目名称:iFixit-WP,代码行数:60,代码来源:iFixitJSONHelper.cs

示例9: GetName

 private string GetName(JToken token)
 {
     if (token.Type == JTokenType.Object)
         return token.Values<JProperty>().FirstOrDefault(i => i.Name == "TaskCaption").Value.ToString();
     if (token.Type == JTokenType.Property)
     {
         var prop = (JProperty)token;
         if (IsTokenScalarValue(prop.Value))
             return string.Format("{0}: {1}", prop.Name, prop.Value.ToString());
         else
             return prop.Name;
     }
     return token.ToString();
 }
开发者ID:marinoscar,项目名称:Automator,代码行数:14,代码来源:MainForm.cs

示例10: LoadExtenders

		/// <summary>
		/// Loads the extenders from the JSON token provided
		/// </summary>
		/// <param name="extendersJson">The JSON token from which to load the extenders</param>
		/// <returns></returns>
		private static IList<ExtenderConfig> LoadExtenders(JToken extendersJson)
		{
			var extenders = new List<ExtenderConfig>();

			// Make sure we have something to work with
			if (extendersJson != null)
			{
				// If it is an array, iterate over it and create a new
				//  extender config for each entry
				if (extendersJson.Type == JTokenType.Array)
				{
					foreach (var extenderJson in extendersJson.Values())
					{
						extenders.Add(new ExtenderConfig(extenderJson));
					}
				}
				// If it is a single item, instantiate that
				else
				{
					extenders.Add(new ExtenderConfig(extendersJson));
				}
			}

			// Return what we got, if anything
			return extenders;
		}
开发者ID:ivanpointer,项目名称:NuLog,代码行数:31,代码来源:LoggingConfig.cs

示例11: LoadStaticMetaDataProviders

		/// <summary>
		/// Loads the static meta data providers from the configuration JSON token provided
		/// </summary>
		/// <param name="staticMetaDataProvidersJson">The JSON token containing the static meta data providers</param>
		/// <returns>A list of names of static meta data providers</returns>
		private static IList<string> LoadStaticMetaDataProviders(JToken staticMetaDataProvidersJson)
		{
			return staticMetaDataProvidersJson != null && staticMetaDataProvidersJson.Type == JTokenType.Array
				? staticMetaDataProvidersJson.Values<string>().ToList<string>()
				: new List<string>();
		}
开发者ID:ivanpointer,项目名称:NuLog,代码行数:11,代码来源:LoggingConfig.cs

示例12: LoadConfigurationExtenders

		/// <summary>
		/// Loads the configuration extenders from the configuration JSON token provided
		/// </summary>
		/// <param name="configExtendersJson">The JSON token containing the configuration extenders</param>
		/// <returns>A list of names of configuration extenders</returns>
		private static IList<string> LoadConfigurationExtenders(JToken configExtendersJson)
		{
			return configExtendersJson != null && configExtendersJson.Type == JTokenType.Array
				? configExtendersJson.Values<string>().ToList<string>()
				: new List<string>();
		}
开发者ID:ivanpointer,项目名称:NuLog,代码行数:11,代码来源:LoggingConfig.cs

示例13: getTags

        /// <summary>
        /// Get the tags in a token that contains tags
        /// This is used to get message tags and description tags
        /// </summary>
        /// <param name="token">The description token</param>
        private static IList<SWTag> getTags(JToken token)
        {
            if (!tokenHasValue(token)) return null;

              IList<SWTag> result = new List<SWTag>();
              foreach (JToken tagToken in token.Values())
              {
            // Handle both types of description tags we going to get
            // Sometime its an object, others its an array
            if (tagToken is JArray)
              foreach (JToken innerToken in tagToken)
            result.Add(getTagFromToken(innerToken));
            else
              result.Add(getTagFromToken(tagToken));
              }

              // Sort the tags in desending offset order to aid replacement
              if (result.Count > 0)
            return result.OrderByDescending(x => x.Offset).ToList();
              return null;
        }
开发者ID:DracoLi,项目名称:SwipperPlus,代码行数:26,代码来源:FacebookParser.cs


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