本文整理汇总了C#中Newtonsoft.Json.Linq.JObject.GetStringValueOnly方法的典型用法代码示例。如果您正苦于以下问题:C# JObject.GetStringValueOnly方法的具体用法?C# JObject.GetStringValueOnly怎么用?C# JObject.GetStringValueOnly使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Newtonsoft.Json.Linq.JObject
的用法示例。
在下文中一共展示了JObject.GetStringValueOnly方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: LoadData
protected override void LoadData(JObject json) {
Name = json.GetStringValueOnly("skinname");
LoadCountry(json);
LoadSkinRelated(json);
if (string.IsNullOrWhiteSpace(Name)) {
// more than usual case
// AddError(AcErrorType.Data_ObjectNameIsMissing);
}
// LoadTags(json);
// LoadDescription(json);
// LoadYear(json);
// LoadVersionInfo(json);
}
示例2: LoadData
protected override void LoadData(JObject json) {
base.LoadData(json);
Brand = json.GetStringValueOnly("brand");
if (string.IsNullOrEmpty(Brand)) {
AddError(AcErrorType.Data_CarBrandIsMissing);
}
if (Country == null && Brand != null) {
Country = AcStringValues.CountryFromBrand(Brand);
}
CarClass = json.GetStringValueOnly("class");
ParentId = json.GetStringValueOnly("parent");
var specsObj = json["specs"] as JObject;
SpecsBhp = specsObj?.GetStringValueOnly("bhp");
SpecsTorque = specsObj?.GetStringValueOnly("torque");
SpecsWeight = specsObj?.GetStringValueOnly("weight");
SpecsTopSpeed = specsObj?.GetStringValueOnly("topspeed");
SpecsAcceleration = specsObj?.GetStringValueOnly("acceleration");
SpecsPwRatio = specsObj?.GetStringValueOnly("pwratio");
SpecsTorqueCurve = new GraphData(json["torqueCurve"] as JArray);
SpecsPowerCurve = new GraphData(json["powerCurve"] as JArray);
}
示例3: LoadSkinRelated
private void LoadSkinRelated(JObject json) {
DriverName = json.GetStringValueOnly("drivername")?.Trim();
Team = json.GetStringValueOnly("team")?.Trim();
SkinNumber = json.GetStringValueOnly("number")?.Trim();
Priority = json.GetIntValueOnly("priority");
}
示例4: LoadVersionInfo
protected void LoadVersionInfo(JObject json) {
Author = json.GetStringValueOnly("author")?.Trim() ?? (TestIfKunos() ? AuthorKunos : null);
Version = json.GetStringValueOnly("version")?.Trim();
Url = json.GetStringValueOnly("url")?.Trim();
if (Version == null && Name != null) {
string name;
Version = AcStringValues.GetVersionFromName(Name, out name);
if (Version != null) {
Name = name;
}
}
}
示例5: LoadDescription
protected void LoadDescription(JObject json) {
Description = AcStringValues.DecodeDescription(json.GetStringValueOnly("description"));
}
示例6: LoadCountry
protected void LoadCountry(JObject json) {
var value = json.GetStringValueOnly("country")?.Trim();
Country = value != null ? AcStringValues.CountryFromTag(value) ?? value :
Tags.Select(AcStringValues.CountryFromTag).FirstOrDefault(x => x != null);
}
示例7: LoadData
protected virtual void LoadData(JObject json) {
Name = json.GetStringValueOnly("name")?.Trim();
if (string.IsNullOrEmpty(Name)) {
AddError(AcErrorType.Data_ObjectNameIsMissing);
}
LoadTags(json);
LoadCountry(json);
LoadDescription(json);
LoadYear(json);
LoadVersionInfo(json);
}
示例8: LoadData
protected override void LoadData(JObject json) {
base.LoadData(json);
if (Version == null && Description != null) {
string description;
Version = AcStringValues.GetVersionFromName(Description, out description);
if (Version != null) {
Description = description;
}
}
City = json.GetStringValueOnly("city");
GeoTags = json.GetGeoTagsValueOnly("geotags");
if (Country == null) {
foreach (var country in Tags.Select(AcStringValues.CountryFromTag).Where(x => x != null)) {
Country = country;
break;
}
}
SpecsLength = json.GetStringValueOnly("length");
SpecsWidth = json.GetStringValueOnly("width");
SpecsPitboxes = json.GetStringValueOnly("pitboxes");
}