本文整理汇总了C#中JsonObject.GetBoolean方法的典型用法代码示例。如果您正苦于以下问题:C# JsonObject.GetBoolean方法的具体用法?C# JsonObject.GetBoolean怎么用?C# JsonObject.GetBoolean使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JsonObject
的用法示例。
在下文中一共展示了JsonObject.GetBoolean方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Parse
public static FacebookParking Parse(JsonObject obj) {
if (obj == null) return null;
return new FacebookParking(obj) {
Street = obj.GetBoolean("street"),
Lot = obj.GetBoolean("lot"),
Valet = obj.GetBoolean("valet")
};
}
示例2: Parse
public static GitHubEmail Parse(JsonObject obj) {
if (obj == null) return null;
return new GitHubEmail(obj) {
Email = obj.GetString("email"),
IsVerified = obj.GetBoolean("verified"),
IsPrimary = obj.GetBoolean("primary")
};
}
示例3: Parse
public static FacebookPaymentOptions Parse(JsonObject obj) {
if (obj == null) return null;
return new FacebookPaymentOptions(obj) {
AmericanExpress = obj.GetBoolean("amex"),
CashOnly = obj.GetBoolean("cash_only"),
Discover = obj.GetBoolean("discover"),
MasterCard = obj.GetBoolean("mastercard"),
Visa = obj.GetBoolean("visa")
};
}
示例4: Parse
public static FacebookRestaurantSpecialties Parse(JsonObject obj) {
if (obj == null) return null;
return new FacebookRestaurantSpecialties(obj) {
Coffee = obj.GetBoolean("coffee"),
Drinks = obj.GetBoolean("drinks"),
Breakfast = obj.GetBoolean("breakfast"),
Dinner = obj.GetBoolean("dinner"),
Lunch = obj.GetBoolean("lunch")
};
}
示例5: Parse
public static FacebookComment Parse(JsonObject obj) {
if (obj == null) return null;
return new FacebookComment(obj) {
Id = obj.GetString("id"),
From = obj.GetObject("from", FacebookFrom.Parse),
Message = obj.GetString("message"),
CanRemove = obj.GetBoolean("can_remove"),
CreatedTime = obj.GetDateTime("created_time"),
LikeCount = obj.GetInt32("like_count"),
UserLikes = obj.GetBoolean("user_likes")
};
}
示例6: Parse
public static GitHubUserSummary Parse(JsonObject obj) {
if (obj == null) return null;
string strType = obj.GetString("type");
GitHubUserType type;
switch (strType) {
case "User": type = GitHubUserType.User; break;
case "Organization": type = GitHubUserType.Organization; break;
default: throw new Exception("Unknown user type \"" + strType + "\".");
}
return new GitHubUserSummary(obj) {
Login = obj.GetString("login"),
Id = obj.GetInt32("id"),
AvatarUrl = obj.GetString("avatar_url"),
Url = obj.GetString("url"),
HtmlUrl = obj.GetString("html_url"),
FollowersUrl = obj.GetString("followers_url"),
FollowingUrl = obj.GetString("following_url"),
GistsUrl = obj.GetString("gists_url"),
StarredUrl = obj.GetString("starred_url"),
SubscriptionsUrl = obj.GetString("subscriptions_url"),
OrganizationsUrl = obj.GetString("organizations_url"),
ReposUrl = obj.GetString("repos_url"),
EventsUrl = obj.GetString("events_url"),
ReceivedEventsUrl = obj.GetString("received_events_url"),
Type = type,
IsSiteAdmin = obj.GetBoolean("site_admin")
};
}
示例7: Parse
public static FacebookRestaurantServices Parse(JsonObject obj) {
if (obj == null) return null;
return new FacebookRestaurantServices(obj) {
Kids = obj.GetBoolean("kids"),
Delivery = obj.GetBoolean("delivery"),
Walkins = obj.GetBoolean("walkins"),
Catering = obj.GetBoolean("catering"),
Reserve = obj.GetBoolean("reserve"),
Groups = obj.GetBoolean("groups"),
Waiter = obj.GetBoolean("waiter"),
Outdoor = obj.GetBoolean("outdoor"),
Takeout = obj.GetBoolean("takeout")
};
}
示例8: Parse
/// <summary>
/// Gets an instance of <code>YouTubeVideoContentDetails</code> from the specified
/// <var>JsonObject</var>.
/// </summary>
/// <param name="obj">The instance of <code>JsonObject</code> to parse.</param>
public static YouTubeVideoContentDetails Parse(JsonObject obj) {
if (obj == null) return null;
return new YouTubeVideoContentDetails(obj) {
Duration = YouTubeVideoDuration.Parse(obj.GetString("duration")),
Dimension = obj.GetString("dimension"),
Definition = obj.GetString("definition"),
Caption = obj.GetString("caption"),
IsLicensedContent = obj.GetBoolean("licensedContent")
};
}
示例9: Parse
/// <summary>
/// Gets an instance of <code>YouTubeChannelStatistics</code> from the specified <code>JsonObject</code>.
/// </summary>
/// <param name="obj">The instance of <code>JsonObject</code> to parse.</param>
public static YouTubeChannelStatistics Parse(JsonObject obj) {
if (obj == null) return null;
return new YouTubeChannelStatistics(obj) {
ViewCount = obj.GetInt64("viewCount"),
CommentCount = obj.GetInt64("commentCount"),
SubscriberCount = obj.GetInt64("subscriberCount"),
HiddenSubscriberCount = obj.GetBoolean("hiddenSubscriberCount"),
VideoCount = obj.GetInt64("videoCount")
};
}
示例10: Parse
/// <summary>
/// Gets a user from the specified <code>JsonObject</code>.
/// </summary>
/// <param name="obj">The object to parse.</param>
public static BitBucketUser Parse(JsonObject obj) {
if (obj == null) return null;
return new BitBucketUser(obj) {
Username = obj.GetString("username"),
FirstName = obj.GetString("first_name"),
LastName = obj.GetString("last_name"),
DisplayName = obj.GetString("display_name"),
IsTeam = obj.GetBoolean("is_team"),
Avatar = obj.GetString("avatar"),
ResourceUri = obj.GetString("resource_uri")
};
}
示例11: Parse
public static FacebookEvent Parse(JsonObject obj) {
return new FacebookEvent {
Id = obj.GetLong("id"),
Name = obj.GetString("name"),
Description = obj.GetString("description"),
StartTime = obj.GetDateTime("start_time"),
EndTime = obj.HasValue("end_time") ? (DateTime?) obj.GetDateTime("end_time") : null,
TimeZone = obj.GetString("timezone"),
IsDateOnly = obj.HasValue("is_date_only") && obj.GetBoolean("is_date_only"),
Location = obj.GetString("location"),
Privacy = obj.GetString("privacy"),
UpdatedTime = obj.GetDateTime("updated_time")
};
}
示例12: Parse
public static FacebookMeResponse Parse(JsonObject obj) {
if (obj == null) return null;
if (obj.HasValue("error")) throw obj.GetObject("error", FacebookException.Parse);
return new FacebookMeResponse {
Id = obj.GetLong("id"),
Name = obj.GetString("name"),
FirstName = obj.GetString("first_name"),
LastName = obj.GetString("last_name"),
Link = obj.GetString("link"),
UserName = obj.GetString("username"),
Gender = obj.GetString("gender"),
TimeZone = obj.HasValue("timezone") ? (int?) obj.GetInt("timezone") : null,
Locale = obj.GetString("locale"),
IsVerified = obj.HasValue("verified") ? (bool?) obj.GetBoolean("verified") : null,
UpdatedTime = obj.GetDateTime("updated_time")
};
}
示例13: Parse
/// <summary>
/// Gets an instance of <code>SlackUser</code> from the specified <code>JsonObject</code>.
/// </summary>
/// <param name="obj">The instance of <code>JsonObject</code> to parse.</param>
public static SlackUser Parse(JsonObject obj) {
if (obj == null) return null;
return new SlackUser(obj) {
Id = obj.GetString("id"),
Name = obj.GetString("name"),
IsDeleted = obj.GetBoolean("deleted"),
Color = obj.GetString("color"),
RealName = obj.GetString("real_name"),
TimeZone = obj.GetString("tz"),
TimeZoneLabel = obj.GetString("tz_label"),
TimeZoneOffset = obj.GetDouble("tz_offset", TimeSpan.FromSeconds),
Profile = obj.GetObject("profile", SlackUserProfile.Parse),
IsAdmin = obj.GetBoolean("is_admin"),
IsOwner = obj.GetBoolean("is_owner"),
IsPrimaryOwner = obj.GetBoolean("is_primary_owner"),
IsRestricted = obj.GetBoolean("is_restricted"),
IsUltraRestricted = obj.GetBoolean("is_ultra_restricted"),
IsBot = obj.GetBoolean("is_bot"),
HasFiles = obj.GetBoolean("has_files"),
Has2Fa = obj.GetBoolean("has_2fa"),
Presence = obj.GetEnum("presence", SlackPresence.Unspecified)
};
}
示例14: Parse
/// <summary>
/// Gets an instance of <code>BitBucketUserRepository</code> from the specified <code>JsonObject</code>.
/// </summary>
/// <param name="obj">The instance of <code>JsonObject</code> to parse.</param>
public static BitBucketUserRepository Parse(JsonObject obj) {
if (obj == null) return null;
return new BitBucketUserRepository(obj) {
Type = obj.GetString("scm"),
HasWiki = obj.GetBoolean("has_wiki"),
NoForks = obj.GetBoolean("no_forks"),
Owner = obj.GetString("owner"),
Logo = obj.GetString("logo"),
Size = obj.GetInt64("size"),
IsReadOnly = obj.GetBoolean("read_only"),
CreatedOn = obj.GetDateTime("utc_created_on"),
Website = obj.GetString("website"),
Description = obj.GetString("description"),
HasIssues = obj.GetBoolean("has_issues"),
IsFork = obj.GetBoolean("is_fork"),
Slug = obj.GetString("slug"),
IsPrivate = obj.GetBoolean("is_private"),
Name = obj.GetString("name"),
Language = obj.GetString("language"),
LastUpdated = obj.GetDateTime("utc_last_updated"),
Creator = obj.GetString("creator")
};
}
示例15: Parse
/// <summary>
/// Gets an instance of <code>YouTubeVideoStatus</code> from the specified <code>JsonObject</code>.
/// </summary>
/// <param name="obj">The instance of <code>JsonObject</code> to parse.</param>
public static YouTubeVideoStatus Parse(JsonObject obj) {
if (obj == null) return null;
// Parse the upload status
YouTubeVideoUploadStatus uploadStatus;
string strUploadStatus = obj.GetString("uploadStatus");
if (!Enum.TryParse(strUploadStatus, true, out uploadStatus)) {
throw new Exception("Unknown upload status \"" + strUploadStatus + "\" - please create an issue so it can be fixed https://github.com/abjerner/Skybrud.Social/issues/new");
}
YouTubeVideoFailureReason? failureReason = null;
if (obj.HasValue("failureReason")) {
YouTubeVideoFailureReason reason;
string strReason = obj.GetString("failureReason");
if (Enum.TryParse(strReason, out reason)) {
failureReason = reason;
} else {
throw new Exception("Unknown failure reason \"" + strReason + "\" - please create an issue so it can be fixed https://github.com/abjerner/Skybrud.Social/issues/new");
}
}
YouTubeVideoRejectionReason? rejectionReason = null;
if (obj.HasValue("rejectionReason")) {
YouTubeVideoRejectionReason reason;
string strReason = obj.GetString("rejectionReason");
if (Enum.TryParse(strReason, out reason)) {
rejectionReason = reason;
} else {
throw new Exception("Unknown rejection reason \"" + strReason + "\" - please create an issue so it can be fixed https://github.com/abjerner/Skybrud.Social/issues/new");
}
}
// Parse the privacy status
YouTubePrivacyStatus privacyStatus;
string strPrivacyStatus = obj.GetString("privacyStatus");
if (!Enum.TryParse(strPrivacyStatus, true, out privacyStatus)) {
throw new Exception("Unknown privacy status \"" + strPrivacyStatus + "\" - please create an issue so it can be fixed https://github.com/abjerner/Skybrud.Social/issues/new");
}
// Parse the privacy status
YouTubeVideoLicense videoLicense;
string strLicense = obj.GetString("license");
if (!Enum.TryParse(strLicense, true, out videoLicense)) {
throw new Exception("Unknown license \"" + strLicense + "\" - please create an issue so it can be fixed https://github.com/abjerner/Skybrud.Social/issues/new");
}
return new YouTubeVideoStatus(obj) {
UploadStatus = uploadStatus,
PrivacyStatus = privacyStatus,
FailureReason = failureReason,
RejectionReason = rejectionReason,
License = videoLicense,
IsEmbeddable = obj.GetBoolean("embeddable"),
PublicStatsViewable = obj.GetBoolean("publicStatsViewable")
};
}