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


C# JProperty.Children方法代码示例

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


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

示例1: ImportMessage

	private void ImportMessage (WienerLinienDataModell NewDataModell, JProperty Start)
		{
		foreach (JObject MessageToken in Start.Children())
			{
			foreach (JProperty MessageChildProp in MessageToken.Properties())
				{
				if (MessageChildProp.Name == "value")
					{
					MessageType Output;
					if (Enum.TryParse(MessageChildProp.Value.ToString(), true, out Output))
						NewDataModell.MessType = Output;
					else
						NewDataModell.MessType = MessageType.Error;
					continue;
					}
				if (MessageChildProp.Name == "messageCode")
					{
					NewDataModell.MessageCode = MessageChildProp.Value.ToObject<Int32>();
					continue;
					}
				if (MessageChildProp.Name == "serverTime")
					{
					NewDataModell.ServerTime = MessageChildProp.Value.ToObject<DateTime>();
					continue;
					}
				}
			}
		}
开发者ID:heinzsack,项目名称:DEV,代码行数:28,代码来源:WienerLinienReaderDll.cs

示例2: GetAggFieldType

        private Type GetAggFieldType(JProperty agg)
        {
            var child = agg.Children().FirstOrDefault();
            if (child != null)
            {
                var bucketList = child["buckets"];
                if (bucketList != null)
                {
                    var bucket = bucketList.FirstOrDefault();
                    if (bucketList != null)
                    {
                        return GetFieldType(bucket["key"]);
                    }
                }
                else
                {
                    var value = child["value"];
                    if (value != null)
                    {
                        return GetFieldType(value);
                    }
                }
            }

            return typeof(object);
        }
开发者ID:krisdaniels,项目名称:ElasticConnection,代码行数:26,代码来源:AggregationParser.cs

示例3: ImportData

	private void ImportData (WienerLinienDataModell NewDataModell, JProperty Start)
		{
		foreach (JObject MonitorsChild in Start.Children())	//monitors
			{
			foreach (JProperty MonitorsChildProp in MonitorsChild.Properties())
				{
				String PropMonitorName = MonitorsChildProp.Name;
				if (PropMonitorName == "monitors")
					{
					foreach (JObject Entry in MonitorsChildProp.Values())
						{
						LocationStop ActuallLocationStop = null;
						foreach (JProperty PropEntry in Entry.Properties())
							{
							if (PropEntry.Name == "locationStop")
								{
								ActuallLocationStop = ImportLocationStop(NewDataModell, PropEntry);
								continue;
								}
							if (PropEntry.Name == "lines")
								{
								ImportLines(ActuallLocationStop, PropEntry);
								continue;
								}
							}
						}
					}
				}
			}
		}
开发者ID:heinzsack,项目名称:DEV,代码行数:30,代码来源:WienerLinienReaderDll.cs

示例4: TypeFromGeoJson

        public void TypeFromGeoJson(JProperty json)
        {
            MetaInfo = new MetaInfoCollection();
            foreach (var childJ in json.Children().OfType<JObject>())
            {
                JToken tokenS;
                childJ.TryGetValue("style", out tokenS);
                if (tokenS != null)
                {
                    // First, convert the JSON to XML.
                    var styleNode = JsonConvert.DeserializeXmlNode("{style:" + tokenS + "}");
                    var styleDoc = styleNode.ToXDocument();
                    var xElement = styleDoc.Element(XName.Get("style"));
                    if (xElement != null)
                    {
                        // Convert child nodes to attributes.
                        foreach (var el in xElement.Elements())
                        {
                            xElement.Add(new XAttribute(UppercaseFirst(el.Name), (string)el));
                        }
                        xElement.Elements().Remove();
                        // Parse the style.
                        try
                        {
                            var newStyle = new PoIStyle();
                            newStyle.FromXml(xElement, ".", false); // Do not catch exception.
                            Style = newStyle;
                        }
                        catch
                        {
                            // Ok, keep old style.
                        }
                    }
                }

                JToken tokenM;
                childJ.TryGetValue("propertyTypeData", out tokenM);
                if (tokenM != null)
                {
                    var metaInfos = tokenM.Children();
                    foreach (var metaInfo in metaInfos)
                    {
                        var newMetaInfo = new MetaInfo();
                        newMetaInfo.FromGeoJson(metaInfo.ToString(Formatting.None), false);
                        MetaInfo.Add(newMetaInfo);
                    }
                }
            }
        }
开发者ID:TNOCS,项目名称:csTouch,代码行数:49,代码来源:BaseContent.cs

示例5: ParseUpdate

        /// <summary>
        /// 解析update值
        /// </summary>
        /// <param name="jPropertyUpdateRoot"></param>
        /// <returns></returns>
        Dictionary<string, object> ParseUpdate(JProperty jPropertyUpdateRoot)
        {
            Dictionary<string, object> listData = null;
            foreach (JObject jPropertyObject in jPropertyUpdateRoot.Children())
            {
                listData = ParseJsonStruct(jPropertyObject);
            }

            return listData;
        }
开发者ID:dengswing,项目名称:network,代码行数:15,代码来源:JsonDataManager.cs

示例6: ParseMsg

        /// <summary>
        /// 解析msg值
        /// </summary>
        /// <param name="jPropertyMsgRoot"></param>
        /// <returns></returns>
        List<Dictionary<string, object>> ParseMsg(JProperty jPropertyMsgRoot)
        {
            List<Dictionary<string, object>> msgListData = new List<Dictionary<string, object>>();

            foreach (JArray jMsgItem in jPropertyMsgRoot.Children())
            {
                foreach (JObject jMsgObjectRoot in jMsgItem)
                {
                    msgListData.Add(ParseJsonStruct(jMsgObjectRoot));
                }
            }

            return msgListData;
        }
开发者ID:dengswing,项目名称:network,代码行数:19,代码来源:JsonDataManager.cs

示例7: GetVersion

        private static string GetVersion(JProperty dependency)
        {
            var child = dependency.Children().First();

            if (child.HasValues && child["version"] != null)
            {
                return child["version"].Value<string>();
            }
            else
            {
                try
                {
                    return child.Value<string>();
                }
                catch
                {
                    return string.Empty;
                }
            }
        }
开发者ID:NTaylorMullen,项目名称:JsonVersionModifier,代码行数:20,代码来源:Program.cs

示例8: SetVersion

 private static void SetVersion(string version, JProperty dependency)
 {
     var child = dependency.Children().First();
     if (child.HasValues)
     {
         child["version"] = version;
     }
     else
     {
         dependency.Value = version;
     }
 }
开发者ID:NTaylorMullen,项目名称:JsonVersionModifier,代码行数:12,代码来源:Program.cs


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