本文整理汇总了C#中JsonObject.GetInt64方法的典型用法代码示例。如果您正苦于以下问题:C# JsonObject.GetInt64方法的具体用法?C# JsonObject.GetInt64怎么用?C# JsonObject.GetInt64使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JsonObject
的用法示例。
在下文中一共展示了JsonObject.GetInt64方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Parse
/// <summary>
/// Gets an instance of <code>TwitterIdsCollection</code> from the specified <var>JsonObject</var>.
/// </summary>
/// <param name="obj">The instance of <code>JsonObject</code> to parse.</param>
public static TwitterIdsCollection Parse(JsonObject obj) {
if (obj == null) return null;
return new TwitterIdsCollection(obj) {
Ids = obj.GetArray("ids").For((array, index) => array.GetInt64(index)),
NextCursor = obj.GetInt64("next_cursor"),
PreviousCursor = obj.GetInt64("previous_cursor")
};
}
示例2: Parse
/// <summary>
/// Gets an instance of <code>TwitterUserCollection</code> from the specified <code>JsonObject</code>.
/// </summary>
/// <param name="obj">The instance of <code>JsonObject</code> to parse.</param>
public static TwitterUserCollection Parse(JsonObject obj) {
if (obj == null) return null;
return new TwitterUserCollection(obj) {
Users = obj.GetArray("users", TwitterUser.Parse),
NextCursor = obj.GetInt64("next_cursor"),
PreviousCursor = obj.GetInt64("previous_cursor")
};
}
示例3: Parse
/// <summary>
/// Gets a comment from the specified <var>JsonObject</var>.
/// </summary>
/// <param name="obj">The instance of <var>JsonObject</var> to parse.</param>
public static InstagramComment Parse(JsonObject obj) {
if (obj == null) return null;
return new InstagramComment(obj) {
Id = obj.GetInt64("id"),
Created = SocialUtils.GetDateTimeFromUnixTime(obj.GetInt64("created_time")),
Text = obj.GetString("text"),
User = InstagramUserSummary.Parse(obj.GetObject("from"))
};
}
示例4: Parse
public static TwitterSearchTweetsMetaData Parse(JsonObject obj) {
return new TwitterSearchTweetsMetaData(obj) {
CompletedIn = obj.GetFloat("completed_in"),
MaxId = obj.GetInt64("max_id"),
Query = obj.GetString("query"),
RefreshUrl = obj.GetString("refresh_url"),
Count = obj.GetInt32("count"),
SinceId = obj.GetInt64("since_id")
};
}
示例5: 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")
};
}
示例6: Parse
/// <summary>
/// Gets an instance of <code>YouTubeVideoStatistics</code> from the specified <code>JsonObject</code>.
/// </summary>
/// <param name="obj">The instance of <code>JsonObject</code> to parse.</param>
public static YouTubeVideoStatistics Parse(JsonObject obj) {
if (obj == null) return null;
return new YouTubeVideoStatistics(obj) {
ViewCount = obj.GetInt64("viewCount"),
LikeCount = obj.GetInt64("likeCount"),
DislikeCount = obj.GetInt64("dislikeCount"),
FavoriteCount = obj.GetInt64("favoriteCount"),
CommentCount = obj.GetInt64("commentCount")
};
}
示例7: Parse
/// <summary>
/// Gets an instance of <code>FacebookDebugTokenData</code> from the specified <var>JsonObject</var>.
/// </summary>
/// <param name="obj">The instance of <code>JsonObject</code> to parse.</param>
public static FacebookDebugTokenData Parse(JsonObject obj) {
// Check if NULL
if (obj == null) return null;
// If an access token doesn't have an expire date, it may be specified as "0". In other scenarios, the
// property is not present at all. In either case, we should set the "ExpiresAt" property to "NULL".
DateTime? expiresAt = null;
if (obj.HasValue("expires_at")) {
int value = obj.GetInt32("expires_at");
if (value > 0) expiresAt = SocialUtils.GetDateTimeFromUnixTime(value);
}
// Parse the array of scopes
FacebookScope[] scopes = (
from name in obj.GetArray<string>("scopes") ?? new string[0]
select FacebookScope.GetScope(name) ?? new FacebookScope(name)
).ToArray();
// Initialize the instance of FacebookDebugTokenData
return new FacebookDebugTokenData(obj) {
AppId = obj.GetInt64("app_id"),
Application = obj.GetString("application"),
ExpiresAt = expiresAt,
IsValid = obj.GetBoolean("is_valid"),
IssuedAt = obj.HasValue("issued_at") ? (DateTime?) obj.GetDateTimeFromUnixTimestamp("issued_at") : null,
UserId = obj.GetString("user_id"),
Scopes = scopes
};
}
示例8: Parse
/// <summary>
/// Gets a user from the specified <var>JsonObject</var>.
/// </summary>
/// <param name="obj">The instance of <var>JsonObject</var> to parse.</param>
public static InstagramUserSummary Parse(JsonObject obj) {
if (obj == null) return null;
string fullname = obj.GetString("full_name");
return new InstagramUserSummary(obj) {
Id = obj.GetInt64("id"),
Username = obj.GetString("username"),
FullName = String.IsNullOrEmpty(fullname) ? null : fullname,
ProfilePicture = obj.GetString("profile_picture")
};
}
示例9: Parse
public static TwitterMentionEntity Parse(JsonObject mention) {
return new TwitterMentionEntity {
UserId = mention.GetInt64("id"),
UserIdStr = mention.GetString("id_str"),
ScreenName = mention.GetString("screen_name"),
Name = mention.GetString("name"),
StartIndex = mention.GetArray("indices").GetInt32(0),
EndIndex = mention.GetArray("indices").GetInt32(1)
};
}
示例10: Parse
public static TwitterMediaEntity Parse(JsonObject entity) {
return new TwitterMediaEntity {
Id = entity.GetInt64("id"),
IdStr = entity.GetString("id_str"),
StartIndex = entity.GetArray("indices").GetInt32(0),
EndIndex = entity.GetArray("indices").GetInt32(1),
MediaUrl = entity.GetString("media_url"),
MediaUrlHttps = entity.GetString("media_url_https"),
Url = entity.GetString("url"),
DisplayUrl = entity.GetString("display_url"),
ExpandedUrl = entity.GetString("expanded_url"),
Type = entity.GetString("type")
};
}
示例11: Parse
/// <summary>
/// Gets a user from the specified <var>JsonObject</var>.
/// </summary>
/// <param name="obj">The instance of <var>JsonObject</var> to parse.</param>
public static InstagramUser Parse(JsonObject obj) {
if (obj == null) return null;
string fullname = obj.GetString("full_name");
string picture = obj.GetString("profile_picture");
string website = obj.GetString("website");
string bio = obj.GetString("bio");
return new InstagramUser(obj) {
Id = obj.GetInt64("id"),
Username = obj.GetString("username"),
FullName = String.IsNullOrEmpty(fullname) ? null : fullname,
ProfilePicture = String.IsNullOrEmpty(picture) ? null : picture,
Website = String.IsNullOrEmpty(website) ? null : website,
Bio = String.IsNullOrEmpty(bio) ? null : bio,
Counts = obj.GetObject("counts", InstagramUserCounts.Parse)
};
}
示例12: Parse
/// <summary>
/// Gets an instance of <code>FacebookApp</code> from the specified <code>JsonObject</code>.
/// </summary>
/// <param name="obj">The instance of <code>JsonObject</code> to parse.</param>
public static FacebookApp Parse(JsonObject obj) {
if (obj == null) return null;
return new FacebookApp(obj) {
Id = obj.GetInt64("id"),
Name = obj.GetString("name"),
Description = obj.GetString("description"),
Category = obj.GetString("category"),
SubCategory = obj.GetString("subcategory"),
Link = obj.GetString("link"),
Namespace = obj.GetString("namespace"),
IconUrl = obj.GetString("icon_url"),
LogoUrl = obj.GetString("logo_url"),
DailyActiveUsers = obj.HasValue("weekly_active_users") ? (int?)obj.GetInt32("weekly_active_users") : null,
WeeklyActiveUsers = obj.HasValue("weekly_active_users") ? (int?)obj.GetInt32("weekly_active_users") : null,
MonthlyActiveUsers = obj.HasValue("monthly_active_users") ? (int?)obj.GetInt32("monthly_active_users") : null,
DailyActiveUserRank = obj.HasValue("daily_active_users_rank") ? (int?)obj.GetInt32("daily_active_users_rank") : null,
MontlyActiveUserRank = obj.HasValue("monthly_active_users_rank") ? (int?)obj.GetInt32("monthly_active_users_rank") : null,
};
}
示例13: 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")
};
}
示例14: Parse
/// <summary>
/// Gets a media from the specified <var>JsonObject</var>.
/// </summary>
/// <param name="obj">The instance of <var>JsonObject</var> to parse.</param>
public static InstagramMedia Parse(JsonObject obj) {
if (obj == null) return null;
JsonObject comments = obj.GetObject("comments");
JsonObject likes = obj.GetObject("likes");
string type = obj.GetString("type");
InstagramMedia media = null;
if (type == "image") {
media = new InstagramImage(obj);
} else if (type == "video") {
media = new InstagramVideo(obj) {
Videos = obj.GetObject("videos", InstagramVideoSummary.Parse)
};
}
if (media != null) {
media.Id = obj.GetString("id");
media.Type = type;
media.Tags = obj.GetArray("tags").Cast<string>();
media.Created = SocialUtils.GetDateTimeFromUnixTime(obj.GetInt64("created_time"));
media.Link = obj.GetString("link");
media.Filter = obj.GetString("filter");
media.CommentCount = comments.GetInt32("count");
media.Comments = comments.GetArray("data", InstagramComment.Parse);
media.LikeCount = likes.GetInt32("count");
media.Likes = likes.GetArray("data", InstagramUserSummary.Parse);
media.Images = obj.GetObject("images", InstagramImageSummary.Parse);
media.Caption = obj.GetObject("caption", InstagramComment.Parse);
media.User = obj.GetObject("user", InstagramUser.Parse);
media.Location = obj.GetObject("location", InstagramLocation.Parse);
media.UsersInPhoto = obj.GetArray("users_in_photo", InstagramTaggedUser.Parse);
}
return media;
}
示例15: Parse
/// <summary>
/// Gets an instance of <code>TwitterStatusMessage</code> from the specified <code>JsonObject</code>.
/// </summary>
/// <param name="obj">The instance of <code>JsonObject</code> to parse.</param>
public static TwitterStatusMessage Parse(JsonObject obj) {
TwitterStatusMessage msg = new TwitterStatusMessage(obj) {
Id = obj.GetInt64("id"),
Text = obj.GetString("text"),
Source = obj.GetString("source"),
IsTruncated = obj.GetBoolean("truncated")
};
// Twitter has some strange date formats
msg.CreatedAt = TwitterUtils.ParseDateTimeUtc(obj.GetString("created_at"));
// Parse the reply information
if (obj.HasValue("in_reply_to_status_id")) {
msg.InReplyTo = new TwitterReplyTo {
StatusId = obj.GetInt64("in_reply_to_status_id"),
StatusIdStr = obj.GetString("in_reply_to_status_id_str"),
UserId = obj.GetInt64("in_reply_to_user_id"),
UserIdStr = obj.GetString("in_reply_to_user_id_str"),
ScreenName = obj.GetString("in_reply_to_screen_name")
};
}
msg.RetweetCount = obj.GetInt32("retweet_count");
msg.FavoriteCount = obj.GetInt32("favorite_count");
// Related to the authenticating user
msg.HasFavorited = obj.GetBoolean("favorited");
msg.HasRetweeted = obj.GetBoolean("retweeted");
// Parse the entities (if any)
msg.Entities = obj.GetObject("entities", TwitterStatusMessageEntities.Parse);
// For some weird reason Twitter flips the coordinates by writing longitude before latitude
// See: https://dev.twitter.com/docs/platform-objects/tweets#obj-coordinates)
msg.Coordinates = obj.GetObject("coordinates", TwitterCoordinates.Parse);
// See: https://dev.twitter.com/docs/platform-objects/tweets#obj-contributors
/*if (tweet.contributors != null) {
List<TwitterContributor> contributors = new List<TwitterContributor>();
foreach (dynamic contributor in tweet.contributors) {
contributors.Add(new TwitterContributor {
UserId = contributor.id,
ScreenName = contributor.screen_name
});
}
msg.Contributors = contributors.ToArray();
}*/
msg.User = obj.GetObject("user", TwitterUser.Parse);
msg.Place = obj.GetObject("place", TwitterPlace.Parse);
msg.IsPossiblyOffensive = obj.GetBoolean("possibly_sensitive");
msg.Language = obj.GetString("lang");
return msg;
}