本文整理汇总了C#中JToken.Value方法的典型用法代码示例。如果您正苦于以下问题:C# JToken.Value方法的具体用法?C# JToken.Value怎么用?C# JToken.Value使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JToken
的用法示例。
在下文中一共展示了JToken.Value方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: City
public City(JToken JasonCity)
{
string NLength = JasonCity.Value<string>("name");
Name = (NLength.Length > 30) ? NLength.Substring(0, 25) + "." : NLength;
Region = JasonCity.Value<string>("adminName1");
Country = JasonCity.Value<string>("countryName");
}
示例2: ParseJToken
internal static LastTag ParseJToken(JToken token, string relatedTag = null)
{
var name = token.Value<string>("name");
var url = token.Value<string>("url");
int? count = null;
var countToken = token.SelectToken("count");
if (countToken != null)
{
count = countToken.ToObject<int?>();
}
bool? streamable = null;
var streamableToken = token.SelectToken("streamable");
if (streamableToken != null)
{
streamable = Convert.ToBoolean(streamableToken.Value<int>());
}
return new LastTag(name, url, count)
{
Streamable = streamable,
RelatedTo = relatedTag
};
}
示例3: SkillData
public readonly int Type; // 动画编号
#endregion Fields
#region Constructors
public SkillData(JToken jt)
{
string key = "";
try
{
this.SkillId = int.Parse(jt.Value<string>(key = "SkillId"));
var av = jt.Value<string>(key = "AffectValue").Split('_');
var avl = new List<int>();
foreach (var i in av) {
avl.Add(int.Parse(i));
}
this.AffectValue = avl.ToArray();
this.Desc = jt.Value<string>(key = "Desc");
this.AffectValue2 = int.Parse(jt.Value<string>(key = "AffectValue2"));
this.LanchType = int.Parse(jt.Value<string>(key = "LanchType"));
this.Name = jt.Value<string>(key = "Name");
this.SkillCategory = int.Parse(jt.Value<string>(key = "SkillCategory"));
this.LanchCondition = int.Parse(jt.Value<string>(key = "LanchCondition"));
this.Type = int.Parse(jt.Value<string>(key = "Type"));
this.LanchConditionValue = int.Parse(jt.Value<string>(key = "LanchConditionValue"));
this.AffectType = int.Parse(jt.Value<string>(key = "AffectType"));
}
catch (Exception e)
{
throw new Exception("载入数据失败。SkillId="+SkillId+", "+ key + "="+ jt.Value<string>(key)+"\n"+e.Message);
}
}
示例4: OnJsonArrived
public void OnJsonArrived(JToken pJson)
{
if (m_canvasWindow.InvokeRequired) {
m_canvasWindow.Invoke(new AsyncTcpClient.JsonHandler(OnJsonArrived), pJson);
}
else {
string func = pJson.Value<string>("func");
switch (func) {
case "credentials":
my_room = pJson.Value<string>("room");
my_name = pJson.Value<string>("user");
break;
case "user_quit":
RemoveUser(pJson.Value<string>("user"));
break;
case "user_join":
AddUser(pJson.Value<string>("user"));
break;
default:
Execute(pJson.Value<string>("user"), pJson);
break;
}
}
}
示例5: ParseMarketDepthEntry
private static MarketDepth ParseMarketDepthEntry(JToken depth)
{
decimal quantity = ParseCurrencyObject(depth.Value<JObject>("quantity"));
decimal price = ParseCurrencyObject(depth.Value<JObject>("price"));
return new MarketDepth(price, quantity);
}
示例6: Tag
public Tag(JToken json, ForrstClient client)
: base(client)
{
this.ID = json.Value<int>("id");
this.Name = json.Value<string>("name");
this.Uri = new Uri(ForrstClient.BaseUri, json.Value<string>("posts_url"));
}
示例7: VisitToken
private void VisitToken(JToken token)
{
switch (token.Type)
{
case JTokenType.Object:
VisitJObject(token.Value<JObject>());
break;
case JTokenType.Array:
VisitArray(token.Value<JArray>());
break;
case JTokenType.Integer:
case JTokenType.Float:
case JTokenType.String:
case JTokenType.Boolean:
case JTokenType.Bytes:
case JTokenType.Raw:
case JTokenType.Null:
VisitPrimitive(token);
break;
default:
throw new FormatException(Resources.FormatError_UnsupportedJSONToken(
_reader.TokenType,
_reader.Path,
_reader.LineNumber,
_reader.LinePosition));
}
}
示例8: Load
public static User Load(JToken json, ISite campfireSite)
{
return new User
{
Name = json.Value<string>("name"),
ID = json.Value<int>("id")
};
}
示例9: FromJToken
/// <summary>
/// Creates a Genre from a JSON Object
/// </summary>
/// <param name="item">The item.</param>
/// <param name="settings">The settings.</param>
/// <returns>
/// A Genre object
/// </returns>
internal static Language FromJToken(JToken item, IMusicClientSettings settings)
{
return new Language()
{
Id = item.Value<string>("id"),
Name = item.Value<string>("name"),
};
}
示例10: FromJToken
/// <summary>
/// Creates a Price from a JSON Object
/// </summary>
/// <param name="item">The item.</param>
/// <returns>A Price object</returns>
internal static Price FromJToken(JToken item)
{
return new Price()
{
Value = item.Value<double>("value"),
Currency = item.Value<string>("currency")
};
}
示例11: ParseJToken
internal static LastStation ParseJToken(JToken token)
{
var s = new LastStation();
s.Name = token.Value<string>("name");
s.Url = new Uri(token.Value<string>("url"), UriKind.Absolute);
return s;
}
示例12: FromJson
/// <summary>
/// Creates a Post from json.
/// </summary>
/// <param name="json">The json.</param>
/// <returns>A Post object</returns>
internal static Post FromJson(JToken json)
{
return new Post()
{
Description = App.StripHtml(json.Value<string>("description")),
Name = App.StripHtml(json.Value<string>("title")),
Link = new Uri(json.Value<string>("url"))
};
}
示例13: FromJson
/// <summary>
/// Creates a Site from json.
/// </summary>
/// <param name="json">The json.</param>
/// <returns>A Site object</returns>
internal static Site FromJson(JToken json)
{
return new Site()
{
Id = json.Value<string>("id"),
Name = json.Value<string>("title"),
Link = new Uri(json.Value<string>("url"))
};
}
示例14: LoadMe
public static User LoadMe(JToken json, ISite campfireSite)
{
return new User
{
ID = json.Value<int>("id"),
Name = json.Value<string>("name"),
ApiToken = json.Value<string>("api_auth_token")
};
}
示例15: ToConfig
public IStorageProviderConfig ToConfig(JToken config) {
string fromConfigName = config.Value<string>("from");
string toConfigName = config.Value<string>("to");
var from = configStore.GetConfig(fromConfigName);
var to = configStore.GetConfig(toConfigName);
return new MigrationProviderConfig(from, to);
}