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


C# Newtonsoft.SelectToken方法代码示例

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


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

示例1: PlatformPositionalCommentInfo

 public PlatformPositionalCommentInfo(Newtonsoft.Json.Linq.JToken content)
 {
     this.Height = content.SelectToken("height").Value<int>();
     this.Width= content.SelectToken("width").Value<int>();
     this.XPosition = content.SelectToken("x_position").Value<int>();
     this.YPosition = content.SelectToken("y_position").Value<int>();
 }
开发者ID:killbug2004,项目名称:WSProf,代码行数:7,代码来源:PlatformPositionalCommentInfo.cs

示例2: PlatformNotification

 public PlatformNotification(IPlatformSession session, IPlatformUser user, Newtonsoft.Json.Linq.JToken token)
     : base(session, user)
 {
     this.Id = token.SelectToken("id").Value<string>();
     this.Noun = token.SelectToken("noun").Value<string>();
     this.Verb = token.SelectToken("verb").Value<string>();
     this.CreatorUuid = token.SelectToken("creator").SelectToken("uuid").Value<string>();
 }
开发者ID:killbug2004,项目名称:WSProf,代码行数:8,代码来源:PlatformNotification.cs

示例3: GetShipFromFDevIDs

        public EDDN.ShipyardObject GetShipFromFDevIDs(SQL.Datasets.dsEliteDB.tbshipyardbaseDataTable basedata, Newtonsoft.Json.Linq.JToken shipyardItem, bool param1)
        {
            EDDN.ShipyardObject shipyardObject = null;  
            String skuString = null;

            try
            {
               
                if(shipyardItem != null)
                { 
                    if (shipyardItem.SelectToken("id", false) == null)
                        throw new NotSupportedException(String.Format("Missing id : {0}", shipyardItem));

                    SQL.Datasets.dsEliteDB.tbshipyardbaseRow itemData = basedata.FindByid((Int32)shipyardItem.SelectToken("id", false));

                    if(itemData != null)
                    {
                        shipyardObject = new EDDN.ShipyardObject();

                        shipyardObject.Id         = itemData.id;
                        shipyardObject.Name       = itemData.name;
                        shipyardObject.BaseValue  = shipyardItem.SelectToken("basevalue").ToString();
                        shipyardObject.Sku        = skuString = (shipyardItem.SelectToken("sku", false) ?? "").ToString();

                        if(shipyardItem.SelectToken("unavailableReason", false) != null)
                            shipyardObject.UnavailableReason = shipyardItem.SelectToken("unavailableReason", false).ToString();

                        if(shipyardItem.SelectToken("factionId", false) != null)
                            shipyardObject.FactionID = shipyardItem.SelectToken("factionId", false).ToString();

                        if(shipyardItem.SelectToken("requiredRank", false) != null)
                            shipyardObject.RequiredRank = shipyardItem.SelectToken("requiredRank", false).ToString();
                    }
                    else
                        throw new NotSupportedException(String.Format("{0}: Unknown ship", shipyardItem));

                }
                else
                    Debug.Print("!");

                return shipyardObject;

            }
            catch (NotSupportedException ex)
            {
                Program.MainLog.Log(String.Format("Converting error: {0}", ex.Message));
            }
            catch (Exception ex)
            {
                throw new Exception("Error while converting companion data to shipyard object", ex);
            }

            return null;
        }
开发者ID:Duke-Jones,项目名称:ED-IBE,代码行数:54,代码来源:CompanionConverter.cs

示例4: GetOutfittingFromFDevIDs

        public EDDN.OutfittingObject GetOutfittingFromFDevIDs(SQL.Datasets.dsEliteDB.tboutfittingbaseDataTable basedata,  Newtonsoft.Json.Linq.JToken outfittingItem, bool param1)
        {
            EDDN.OutfittingObject outfitting = null;
            List<String> nameParts;
            String nameFull;

            try
            {
               
                if(outfittingItem != null)
                { 
                    if(outfittingItem.SelectToken("id", false) == null)
                        throw new NotSupportedException(String.Format("Missing id : {0}", outfittingItem.ToString()));

                    nameFull  = outfittingItem.SelectToken("name", false).ToString().ToLower();
                    nameParts = nameFull.Split(new char[] {'_'}).ToList();

                    if (!ignoreStuff.Contains(nameParts[0]))
                    {
                        SQL.Datasets.dsEliteDB.tboutfittingbaseRow itemData = basedata.FindByid((Int32)outfittingItem.SelectToken("id", false));

                        if(itemData != null)
                        {
                            outfitting = new EDDN.OutfittingObject();

                            outfitting.Id               = itemData.id;
                            outfitting.Category         = itemData.category;
                            outfitting.Name             = itemData.name;
                            outfitting.Mount            = itemData.mount;
                            outfitting.Guidance         = itemData.guidance.ToNString();
                            outfitting.Ship             = itemData.ship.ToNString();
                            outfitting.Class            = itemData._class;
                            outfitting.Rating           = itemData.rating;
                            outfitting.Entitlement      = itemData.entitlement;
                        }
                        else
                            throw new NotSupportedException(String.Format("Unknown id : {0}", outfittingItem.ToString()));
                    }
                }

            }
            catch (NotSupportedException ex)
            {
                Program.MainLog.Log(String.Format("Converting error: {0}", ex.Message));
            }
            catch (Exception ex)
            {
                throw new Exception("Error while converting companion data to shipyard object", ex);
            }

            return outfitting;

        }
开发者ID:Duke-Jones,项目名称:ED-IBE,代码行数:53,代码来源:CompanionConverter.cs

示例5: GetCommodityFromFDevIDs

        public EDDN.CommodityObject GetCommodityFromFDevIDs(IBE.SQL.Datasets.dsEliteDB.tbcommoditybaseDataTable basedata, Newtonsoft.Json.Linq.JToken commodityItem, bool param1)
        {
            EDDN.CommodityObject commodityObject = null;  
            String skuString = null;

            try
            {
               
                if(commodityItem != null)
                { 
                    if (commodityItem.SelectToken("id", false) == null)
                        throw new NotSupportedException(String.Format("Missing id : {0}", commodityItem));

                    SQL.Datasets.dsEliteDB.tbcommoditybaseRow itemData = basedata.FindByid((Int32)commodityItem.SelectToken("id", false));

                    if(itemData != null)
                    {
                        commodityObject = new EDDN.CommodityObject();

                        commodityObject.Id         = itemData.id;
                        commodityObject.Name       = itemData.name;
                        commodityObject.Category   = itemData.category;
                        commodityObject.Average    = itemData.average;
                    }
                    else
                        throw new NotSupportedException(String.Format("Unknown commodity : {0}", commodityItem));

                }
                else
                    Debug.Print("!");

                return commodityObject;

            }
            catch (NotSupportedException ex)
            {
                Program.MainLog.Log(String.Format("Converting error: {0}", ex.Message));
            }
            catch (Exception ex)
            {
                throw new Exception("Error while converting companion data to commodity object", ex);
            }

            return null;
        }
开发者ID:Duke-Jones,项目名称:ED-IBE,代码行数:45,代码来源:CompanionConverter.cs


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