本文整理匯總了C#中Newtonsoft.Json.Linq.JValue.Value方法的典型用法代碼示例。如果您正苦於以下問題:C# JValue.Value方法的具體用法?C# JValue.Value怎麽用?C# JValue.Value使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Newtonsoft.Json.Linq.JValue
的用法示例。
在下文中一共展示了JValue.Value方法的3個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: FirebasePriority
internal FirebasePriority(JValue priority)
{
if (priority == null || priority.Type == JTokenType.Null)
{
Type = PriorityType.None;
return;
}
switch (priority.Type)
{
case JTokenType.None:
Type = PriorityType.None;
return;
case JTokenType.Integer:
case JTokenType.Float:
Type = PriorityType.Numeric;
_fp = priority.Value<float>();
return;
case JTokenType.String:
int value;
if (int.TryParse(priority.Value<string>(), out value))
{
Type = PriorityType.Numeric;
_fp = value;
}
else
{
Type = PriorityType.String;
_sp = priority.Value<string>();
}
return;
default:
throw new Exception(string.Format("Unable to load priority of type: {0}", priority.Type));
}
}
示例2: RefreshAccessToken
public void RefreshAccessToken()
{
var p = new Dictionary<string, string> ();
p.Add ("client_id", chromeSettings.ClientId);
p.Add ("client_secret", chromeSettings.ClientSecret);
p.Add ("refresh_token", chromeSettings.RefreshToken);
p.Add("grant_type", "refresh_token");
var response = http.PostAsync (chromeSettings.AuthUrl, new FormUrlEncodedContent (p)).Result;
var result = response.Content.ReadAsStringAsync ().Result;
var json = JObject.Parse(result);
this.AccessToken = json["access_token"].ToString();
JToken expiresJson = new JValue(3400);
json.TryGetValue("expires_in", out expiresJson);
this.Expires = DateTime.UtcNow.AddSeconds(expiresJson.Value<int>());
http.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer", this.AccessToken);
}
示例3: EncryptJsonValue
private static void EncryptJsonValue(JsonPasswordCrypto cryptoHandler, JValue valueToEncrypt)
{
var value = valueToEncrypt.Value<string>();
var encryptedValue = cryptoHandler.Encrypt(value);
valueToEncrypt.Replace(JObject.FromObject(encryptedValue));
}