本文整理汇总了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>();
}
示例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>();
}
示例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;
}
示例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;
}
示例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;
}