142 lines
4.4 KiB
C#
Executable File
142 lines
4.4 KiB
C#
Executable File
using System.Linq;
|
|
using Gallery.Illust;
|
|
|
|
namespace Gallery.Utils
|
|
{
|
|
public class IllustRankingData
|
|
{
|
|
public Content[] contents;
|
|
public string mode;
|
|
public string content;
|
|
public int page;
|
|
public string prev;
|
|
public string next;
|
|
public string date;
|
|
public string prev_date;
|
|
public string next_date;
|
|
public int rank_total;
|
|
|
|
public class Content
|
|
{
|
|
public string title;
|
|
public string date;
|
|
public string[] tags;
|
|
public string url;
|
|
public string illust_type;
|
|
public string illust_book_style;
|
|
public string illust_page_count;
|
|
public string user_name;
|
|
public string profile_img;
|
|
public ContentType illust_content_type;
|
|
public object illust_series; // bool, Series
|
|
public long illust_id;
|
|
public int width;
|
|
public int height;
|
|
public long user_id;
|
|
public int rank;
|
|
public int yes_rank;
|
|
public int rating_count;
|
|
public int view_count;
|
|
public long illust_upload_timestamp;
|
|
public string attr;
|
|
public bool is_bookmarked;
|
|
public bool bookmarkable;
|
|
public string bookmark_id;
|
|
public string bookmark_illust_restrict;
|
|
|
|
public class ContentType
|
|
{
|
|
public int sexual;
|
|
public bool lo;
|
|
public bool grotesque;
|
|
public bool violent;
|
|
public bool homosexual;
|
|
public bool drug;
|
|
public bool thoughts;
|
|
public bool antisocial;
|
|
public bool religion;
|
|
public bool original;
|
|
public bool furry;
|
|
public bool bl;
|
|
public bool yuri;
|
|
}
|
|
|
|
public class Series
|
|
{
|
|
public string illust_series_caption;
|
|
public string illust_series_content_count;
|
|
public string illust_series_content_illust_id;
|
|
public string illust_series_content_order;
|
|
public string illust_series_create_datetime;
|
|
public string illust_series_id;
|
|
public string illust_series_title;
|
|
public string illust_series_user_id;
|
|
public string page_url;
|
|
}
|
|
|
|
public IllustItem ConvertToItem()
|
|
{
|
|
if (!int.TryParse(illust_page_count, out int count))
|
|
{
|
|
count = 1;
|
|
}
|
|
if (!int.TryParse(illust_type, out int type))
|
|
{
|
|
type = 0;
|
|
}
|
|
bool restrict;
|
|
if (tags != null && tags.Contains("R-18"))
|
|
{
|
|
restrict = true;
|
|
}
|
|
else
|
|
{
|
|
restrict = false;
|
|
}
|
|
return new IllustItem
|
|
{
|
|
Id = illust_id.ToString(),
|
|
BookmarkId = bookmark_id,
|
|
Title = title,
|
|
Rank = rank,
|
|
IllustType = (IllustType)type,
|
|
ImageUrl = url,
|
|
IsRestrict = restrict,
|
|
Tags = tags ?? new string[0],
|
|
ProfileUrl = profile_img,
|
|
UserId = user_id.ToString(),
|
|
UserName = user_name,
|
|
Width = width,
|
|
Height = height,
|
|
PageCount = count,
|
|
|
|
YesRank = yes_rank,
|
|
RatingCount = rating_count,
|
|
ViewCount = view_count,
|
|
UploadTimestamp = illust_upload_timestamp
|
|
};
|
|
}
|
|
}
|
|
}
|
|
|
|
public class IllustGlobalData
|
|
{
|
|
public string token;
|
|
public string oneSignalAppId;
|
|
public UserData userData;
|
|
|
|
public class UserData
|
|
{
|
|
public string id;
|
|
public string pixivId;
|
|
public string name;
|
|
public string profileImg;
|
|
public string profileImgBig;
|
|
public bool premium;
|
|
public int xRestrict;
|
|
public bool adult;
|
|
public bool safeMode;
|
|
}
|
|
}
|
|
}
|