完成我的用户空间页面设计

croire 3 years ago
parent fd7fabeaba
commit fcf388870f

@ -27,7 +27,7 @@ namespace DownKyi.Core.BiliApi.Cheese
try
{
var cheese = JsonConvert.DeserializeObject<CheeseViewOrigin>(response);
CheeseViewOrigin cheese = JsonConvert.DeserializeObject<CheeseViewOrigin>(response);
if (cheese != null) { return cheese.Data; }
else { return null; }
}
@ -54,7 +54,7 @@ namespace DownKyi.Core.BiliApi.Cheese
try
{
var cheese = JsonConvert.DeserializeObject<CheeseEpisodeListOrigin>(response);
CheeseEpisodeListOrigin cheese = JsonConvert.DeserializeObject<CheeseEpisodeListOrigin>(response);
if (cheese != null) { return cheese.Data; }
else { return null; }
}

@ -1,40 +0,0 @@
using DownKyi.Core.BiliApi.Login.Models;
using DownKyi.Core.Logging;
using Newtonsoft.Json;
using System;
namespace DownKyi.Core.BiliApi.Login
{
/// <summary>
/// 登录基本信息
/// </summary>
public static class LoginInfo
{
/// <summary>
/// 导航栏用户信息
/// </summary>
/// <returns></returns>
public static UserInfoForNavigation GetUserInfoForNavigation()
{
string url = "https://api.bilibili.com/x/web-interface/nav";
string referer = "https://www.bilibili.com";
string response = WebClient.RequestWeb(url, referer);
try
{
var userInfo = JsonConvert.DeserializeObject<UserInfoForNavigationOrigin>(response);
if (userInfo == null || userInfo.Data == null) { return null; }
if (userInfo.Data.IsLogin) { return userInfo.Data; }
else { return null; }
}
catch (Exception e)
{
Utils.Debugging.Console.PrintLine("GetUserInfoForNavigation()发生异常: {0}", e);
LogManager.Error("LoginInfo", e);
return null;
}
}
}
}

@ -0,0 +1,76 @@
using DownKyi.Core.BiliApi.Models;
using Newtonsoft.Json;
using System.Collections.Generic;
namespace DownKyi.Core.BiliApi.Users.Models
{
public class BangumiFollow : BaseModel
{
[JsonProperty("season_id")]
public long SeasonId { get; set; }
[JsonProperty("media_id")]
public long MediaId { get; set; }
[JsonProperty("season_type")]
public int SeasonType { get; set; }
[JsonProperty("season_type_name")]
public string SeasonTypeName { get; set; }
[JsonProperty("title")]
public string Title { get; set; }
[JsonProperty("cover")]
public string Cover { get; set; }
[JsonProperty("total_count")]
public int TotalCount { get; set; }
// is_finish
// is_started
// is_play
[JsonProperty("badge")]
public string Badge { get; set; }
[JsonProperty("badge_type")]
public int BadgeType { get; set; }
// rights
// stat
[JsonProperty("new_ep")]
public BangumiFollowNewEp NewEp { get; set; }
// rating
// square_cover
[JsonProperty("season_status")]
public int SeasonStatus { get; set; }
[JsonProperty("season_title")]
public string SeasonTitle { get; set; }
[JsonProperty("badge_ep")]
public string BadgeEp { get; set; }
// media_attr
// season_attr
[JsonProperty("evaluate")]
public string Evaluate { get; set; }
[JsonProperty("areas")]
public List<BangumiFollowAreas> Areas { get; set; }
[JsonProperty("subtitle")]
public string Subtitle { get; set; }
[JsonProperty("first_ep")]
public long FirstEp { get; set; }
// can_watch
// series
// publish
// mode
// section
[JsonProperty("url")]
public string Url { get; set; }
// badge_info
// first_ep_info
// formal_ep_count
// short_url
// badge_infos
// season_version
// horizontal_cover_16_9
// horizontal_cover_16_10
// subtitle_14
// viewable_crowd_type
// producers
// follow_status
// is_new
[JsonProperty("progress")]
public string Progress { get; set; }
// both_follow
}
}

@ -0,0 +1,13 @@
using DownKyi.Core.BiliApi.Models;
using Newtonsoft.Json;
namespace DownKyi.Core.BiliApi.Users.Models
{
public class BangumiFollowAreas : BaseModel
{
[JsonProperty("id")]
public int Id { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
}
}

@ -0,0 +1,23 @@
using DownKyi.Core.BiliApi.Models;
using Newtonsoft.Json;
namespace DownKyi.Core.BiliApi.Users.Models
{
public class BangumiFollowNewEp : BaseModel
{
[JsonProperty("id")]
public long Id { get; set; }
[JsonProperty("index_show")]
public string IndexShow { get; set; }
[JsonProperty("cover")]
public string Cover { get; set; }
[JsonProperty("title")]
public string Title { get; set; }
[JsonProperty("long_title")]
public string LongTitle { get; set; }
[JsonProperty("pub_time")]
public string PubTime { get; set; }
[JsonProperty("duration")]
public long Duration { get; set; }
}
}

@ -0,0 +1,26 @@
using DownKyi.Core.BiliApi.Models;
using Newtonsoft.Json;
using System.Collections.Generic;
namespace DownKyi.Core.BiliApi.Users.Models
{
// https://api.bilibili.com/x/space/bangumi/follow/list?vmid={mid}&type={type:D}&pn={pn}&ps={ps}
public class BangumiFollowOrigin : BaseModel
{
[JsonProperty("data")]
public BangumiFollowData Data { get; set; }
}
public class BangumiFollowData : BaseModel
{
[JsonProperty("list")]
public List<BangumiFollow> List { get; set; }
[JsonProperty("pn")]
public int Pn { get; set; }
[JsonProperty("ps")]
public int Ps { get; set; }
[JsonProperty("total")]
public int Total { get; set; }
}
}

@ -0,0 +1,8 @@
namespace DownKyi.Core.BiliApi.Users.Models
{
public enum BangumiType
{
ANIME = 1, // 番剧
EPISODE = 2 // 剧集、电影
}
}

@ -0,0 +1,26 @@
using DownKyi.Core.BiliApi.Models;
using Newtonsoft.Json;
using System.Collections.Generic;
namespace DownKyi.Core.BiliApi.Users.Models
{
// https://api.bilibili.com/x/relation/tags
public class FollowingGroupOrigin : BaseModel
{
[JsonProperty("data")]
public List<FollowingGroup> Data { get; set; }
}
public class FollowingGroup : BaseModel
{
[JsonProperty("tagid")]
public int TagId { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("tip")]
public string Tip { get; set; }
}
}

@ -0,0 +1,14 @@
using DownKyi.Core.BiliApi.Models;
using Newtonsoft.Json;
using System.Collections.Generic;
namespace DownKyi.Core.BiliApi.Users.Models
{
// https://api.bilibili.com/x/relation/tag?tagid={tagId}&pn={pn}&ps={ps}&order_type={orderType}
public class FollowingGroupContent : BaseModel
{
[JsonProperty("data")]
public List<RelationFollowInfo> Data { get; set; }
}
}

@ -0,0 +1,8 @@
namespace DownKyi.Core.BiliApi.Users.Models
{
public enum FollowingOrder
{
DEFAULT = 1, // 按照关注顺序排列,默认
ATTENTION // 按照最常访问排列
}
}

@ -0,0 +1,75 @@
using DownKyi.Core.BiliApi.Models;
using Newtonsoft.Json;
namespace DownKyi.Core.BiliApi.Users.Models
{
// https://api.bilibili.com/x/space/myinfo
public class MyInfoOrigin : BaseModel
{
//[JsonProperty("code")]
//public int Code { get; set; }
//[JsonProperty("message")]
//public string Message { get; set; }
//[JsonProperty("ttl")]
//public int Ttl { get; set; }
[JsonProperty("data")]
public MyInfo Data { get; set; }
}
public class MyInfo : BaseModel
{
[JsonProperty("mid")]
public long Mid { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("sex")]
public string Sex { get; set; }
[JsonProperty("face")]
public string Face { get; set; }
[JsonProperty("sign")]
public string Sign { get; set; }
// rank
[JsonProperty("level")]
public int Level { get; set; }
// jointime
[JsonProperty("moral")]
public int Moral { get; set; }
[JsonProperty("silence")]
public int Silence { get; set; }
[JsonProperty("email_status")]
public int EmailStatus { get; set; }
[JsonProperty("tel_status")]
public int TelStatus { get; set; }
[JsonProperty("identification")]
public int Identification { get; set; }
[JsonProperty("vip")]
public UserInfoVip Vip { get; set; }
// pendant
// nameplate
// official
[JsonProperty("birthday")]
public long Birthday { get; set; }
[JsonProperty("is_tourist")]
public int IsTourist { get; set; }
[JsonProperty("is_fake_account")]
public int IsFakeAccount { get; set; }
[JsonProperty("pin_prompting")]
public int PinPrompting { get; set; }
[JsonProperty("is_deleted")]
public int IsDeleted { get; set; }
// in_reg_audit
// is_rip_user
// profession
// face_nft
// face_nft_new
// is_senior_member
[JsonProperty("level_exp")]
public UserInfoLevelExp LevelExp { get; set; }
[JsonProperty("coins")]
public float Coins { get; set; }
[JsonProperty("following")]
public int Following { get; set; }
[JsonProperty("follower")]
public int Follower { get; set; }
}
}

@ -0,0 +1,14 @@
using DownKyi.Core.BiliApi.Models;
using Newtonsoft.Json;
namespace DownKyi.Core.BiliApi.Users.Models
{
// https://api.bilibili.com/x/relation/stat?nickName={nickName}
public class NicknameStatus : BaseModel
{
[JsonProperty("code")]
public int Code { get; set; }
[JsonProperty("message")]
public string Message { get; set; }
}
}

@ -0,0 +1,9 @@
namespace DownKyi.Core.BiliApi.Users.Models
{
public enum PublicationOrder
{
PUBDATE = 1, // 最新发布,默认
CLICK, // 最多播放
STOW // 最多收藏
}
}

@ -0,0 +1,13 @@
using DownKyi.Core.BiliApi.Models;
using Newtonsoft.Json;
using System.Collections.Generic;
namespace DownKyi.Core.BiliApi.Users.Models
{
// https://api.bilibili.com/x/relation/blacks?pn={pn}&ps={ps}
public class RelationBlack : BaseModel
{
[JsonProperty("data")]
public List<RelationFollowInfo> Data { get; set; }
}
}

@ -0,0 +1,25 @@
using DownKyi.Core.BiliApi.Models;
using Newtonsoft.Json;
using System.Collections.Generic;
namespace DownKyi.Core.BiliApi.Users.Models
{
// https://api.bilibili.com/x/relation/followers?vmid={mid}&pn={pn}&ps={ps}
// https://api.bilibili.com/x/relation/followings?vmid={mid}&pn={pn}&ps={ps}&order_type={orderType}
public class RelationFollowOrigin : BaseModel
{
[JsonProperty("data")]
public RelationFollow Data { get; set; }
}
public class RelationFollow : BaseModel
{
[JsonProperty("list")]
public List<RelationFollowInfo> List { get; set; }
//[JsonProperty("re_version")]
//public long reVersion { get; set; }
[JsonProperty("total")]
public int Total { get; set; }
}
}

@ -0,0 +1,29 @@
using DownKyi.Core.BiliApi.Models;
using Newtonsoft.Json;
using System.Collections.Generic;
namespace DownKyi.Core.BiliApi.Users.Models
{
public class RelationFollowInfo : BaseModel
{
[JsonProperty("mid")]
public long Mid { get; set; }
[JsonProperty("attribute")]
public int Attribute { get; set; }
[JsonProperty("mtime")]
public long Mtime { get; set; }
[JsonProperty("tag")]
public List<long> Tag { get; set; }
[JsonProperty("special")]
public int Special { get; set; }
// contract_info
[JsonProperty("uname")]
public string Name { get; set; }
[JsonProperty("face")]
public string Face { get; set; }
[JsonProperty("sign")]
public string Sign { get; set; }
// official_verify
// vip
}
}

@ -0,0 +1,14 @@
using DownKyi.Core.BiliApi.Models;
using Newtonsoft.Json;
using System.Collections.Generic;
namespace DownKyi.Core.BiliApi.Users.Models
{
// https://api.bilibili.com/x/relation/whispers?pn={pn}&ps={ps}
public class RelationWhisper : BaseModel
{
[JsonProperty("data")]
public List<RelationFollowInfo> Data { get; set; }
}
}

@ -0,0 +1,21 @@
using DownKyi.Core.BiliApi.Models;
using Newtonsoft.Json;
using System.Collections.Generic;
namespace DownKyi.Core.BiliApi.Users.Models
{
// https://api.bilibili.com/x/space/channel/list?mid={mid}
public class SpaceChannelOrigin : BaseModel
{
[JsonProperty("data")]
public SpaceChannel Data { get; set; }
}
public class SpaceChannel : BaseModel
{
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("list")]
public List<SpaceChannelList> List { get; set; }
}
}

@ -0,0 +1,47 @@
using DownKyi.Core.BiliApi.Models;
using Newtonsoft.Json;
namespace DownKyi.Core.BiliApi.Users.Models
{
public class SpaceChannelArchive : BaseModel
{
[JsonProperty("aid")]
public long Aid { get; set; }
// videos
[JsonProperty("tid")]
public int Tid { get; set; }
[JsonProperty("tname")]
public string Tname { get; set; }
// copyright
[JsonProperty("pic")]
public string Pic { get; set; }
[JsonProperty("title")]
public string Title { get; set; }
[JsonProperty("pubdate")]
public long Pubdate { get; set; }
[JsonProperty("ctime")]
public long Ctime { get; set; }
[JsonProperty("desc")]
public string Desc { get; set; }
// state
[JsonProperty("duration")]
public long Duration { get; set; }
// mission_id
// rights
[JsonProperty("owner")]
public VideoOwner Owner { get; set; }
[JsonProperty("stat")]
public SpaceChannelArchiveStat Stat { get; set; }
// dynamic
[JsonProperty("cid")]
public long Cid { get; set; }
[JsonProperty("dimension")]
public Dimension Dimension { get; set; }
// season_id
// short_link_v2
[JsonProperty("bvid")]
public string Bvid { get; set; }
// inter_video
// is_live_playback
}
}

@ -0,0 +1,31 @@
using DownKyi.Core.BiliApi.Models;
using Newtonsoft.Json;
namespace DownKyi.Core.BiliApi.Users.Models
{
public class SpaceChannelArchiveStat : BaseModel
{
[JsonProperty("aid")]
public long Aid { get; set; }
[JsonProperty("view")]
public long View { get; set; }
[JsonProperty("danmaku")]
public long Danmaku { get; set; }
[JsonProperty("reply")]
public long Reply { get; set; }
[JsonProperty("favorite")]
public long Favorite { get; set; }
[JsonProperty("coin")]
public long Coin { get; set; }
[JsonProperty("share")]
public long Share { get; set; }
[JsonProperty("now_rank")]
public long NowRank { get; set; }
[JsonProperty("his_rank")]
public long HisRank { get; set; }
[JsonProperty("like")]
public long Like { get; set; }
[JsonProperty("dislike")]
public long Dislike { get; set; }
}
}

@ -0,0 +1,24 @@
using DownKyi.Core.BiliApi.Models;
using Newtonsoft.Json;
namespace DownKyi.Core.BiliApi.Users.Models
{
public class SpaceChannelList : BaseModel
{
[JsonProperty("cid")]
public long Cid { get; set; }
[JsonProperty("mid")]
public long Mid { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("intro")]
public string Intro { get; set; }
[JsonProperty("mtime")]
public long Mtime { get; set; }
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("cover")]
public string Cover { get; set; }
// is_live_playback
}
}

@ -0,0 +1,21 @@
using DownKyi.Core.BiliApi.Models;
using Newtonsoft.Json;
namespace DownKyi.Core.BiliApi.Users.Models
{
// https://api.bilibili.com/x/space/channel/video?mid={mid}&cid={cid}&pn={pn}&ps={ps}
public class SpaceChannelVideoOrigin : BaseModel
{
[JsonProperty("data")]
public SpaceChannelVideo Data { get; set; }
}
public class SpaceChannelVideo : BaseModel
{
// episodic_button
[JsonProperty("list")]
public SpaceChannelVideoList List { get; set; }
[JsonProperty("page")]
public SpaceChannelVideoPage Page { get; set; }
}
}

@ -0,0 +1,27 @@
using DownKyi.Core.BiliApi.Models;
using Newtonsoft.Json;
using System.Collections.Generic;
namespace DownKyi.Core.BiliApi.Users.Models
{
public class SpaceChannelVideoList : BaseModel
{
[JsonProperty("cid")]
public long Cid { get; set; }
[JsonProperty("mid")]
public long Mid { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("intro")]
public string Intro { get; set; }
[JsonProperty("mtime")]
public long Mtime { get; set; }
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("cover")]
public string Cover { get; set; }
// is_live_playback
[JsonProperty("archives")]
public List<SpaceChannelArchive> Archives { get; set; }
}
}

@ -0,0 +1,15 @@
using DownKyi.Core.BiliApi.Models;
using Newtonsoft.Json;
namespace DownKyi.Core.BiliApi.Users.Models
{
public class SpaceChannelVideoPage : BaseModel
{
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("num")]
public int Num { get; set; }
[JsonProperty("size")]
public int Size { get; set; }
}
}

@ -0,0 +1,27 @@
using DownKyi.Core.BiliApi.Models;
using Newtonsoft.Json;
namespace DownKyi.Core.BiliApi.Users.Models
{
public class SpaceCheese : BaseModel
{
[JsonProperty("cover")]
public string Cover { get; set; }
[JsonProperty("ep_count")]
public int EpCount { get; set; }
[JsonProperty("link")]
public string Link { get; set; }
[JsonProperty("page")]
public int Page { get; set; }
[JsonProperty("play")]
public int Play { get; set; }
[JsonProperty("season_id")]
public long SeasonId { get; set; }
[JsonProperty("status")]
public string Status { get; set; }
[JsonProperty("subtitle")]
public string SubTitle { get; set; }
[JsonProperty("title")]
public string Title { get; set; }
}
}

@ -0,0 +1,21 @@
using DownKyi.Core.BiliApi.Models;
using Newtonsoft.Json;
using System.Collections.Generic;
namespace DownKyi.Core.BiliApi.Users.Models
{
// https://api.bilibili.com/pugv/app/web/season/page?mid={mid}&pn={pn}&ps={ps}
public class SpaceCheeseOrigin : BaseModel
{
[JsonProperty("data")]
public SpaceCheeseData Data { get; set; }
}
public class SpaceCheeseData : BaseModel
{
[JsonProperty("items")]
public List<SpaceCheese> Items { get; set; }
[JsonProperty("page")]
public SpaceCheesePage Page { get; set; }
}
}

@ -0,0 +1,17 @@
using DownKyi.Core.BiliApi.Models;
using Newtonsoft.Json;
namespace DownKyi.Core.BiliApi.Users.Models
{
public class SpaceCheesePage : BaseModel
{
[JsonProperty("next")]
public bool Next { get; set; }
[JsonProperty("num")]
public int Num { get; set; }
[JsonProperty("size")]
public int Size { get; set; }
[JsonProperty("total")]
public int Total { get; set; }
}
}

@ -0,0 +1,21 @@
using DownKyi.Core.BiliApi.Models;
using Newtonsoft.Json;
namespace DownKyi.Core.BiliApi.Users.Models
{
// https://api.bilibili.com/x/space/arc/search
public class SpacePublicationOrigin : BaseModel
{
[JsonProperty("data")]
public SpacePublication Data { get; set; }
}
public class SpacePublication : BaseModel
{
[JsonProperty("list")]
public SpacePublicationList List { get; set; }
[JsonProperty("page")]
public SpacePublicationPage Page { get; set; }
}
}

@ -0,0 +1,14 @@
using DownKyi.Core.BiliApi.Models;
using Newtonsoft.Json;
using System.Collections.Generic;
namespace DownKyi.Core.BiliApi.Users.Models
{
public class SpacePublicationList : BaseModel
{
[JsonProperty("tlist")]
public SpacePublicationListType Tlist { get; set; }
[JsonProperty("vlist")]
public List<SpacePublicationListVideo> Vlist { get; set; }
}
}

@ -0,0 +1,51 @@
using DownKyi.Core.BiliApi.Models;
using Newtonsoft.Json;
namespace DownKyi.Core.BiliApi.Users.Models
{
public class SpacePublicationListType : BaseModel
{
[JsonProperty("1")]
public SpacePublicationListTypeVideoZone Douga { get; set; }
[JsonProperty("13")]
public SpacePublicationListTypeVideoZone Anime { get; set; }
[JsonProperty("167")]
public SpacePublicationListTypeVideoZone Guochuang { get; set; }
[JsonProperty("3")]
public SpacePublicationListTypeVideoZone Music { get; set; }
[JsonProperty("129")]
public SpacePublicationListTypeVideoZone Dance { get; set; }
[JsonProperty("4")]
public SpacePublicationListTypeVideoZone Game { get; set; }
[JsonProperty("36")]
public SpacePublicationListTypeVideoZone Technology { get; set; }
[JsonProperty("188")]
public SpacePublicationListTypeVideoZone Digital { get; set; }
[JsonProperty("224")]
public SpacePublicationListTypeVideoZone Sports { get; set; }
[JsonProperty("223")]
public SpacePublicationListTypeVideoZone Car { get; set; }
[JsonProperty("160")]
public SpacePublicationListTypeVideoZone Life { get; set; }
[JsonProperty("211")]
public SpacePublicationListTypeVideoZone Food { get; set; }
[JsonProperty("217")]
public SpacePublicationListTypeVideoZone Animal { get; set; }
[JsonProperty("119")]
public SpacePublicationListTypeVideoZone Kichiku { get; set; }
[JsonProperty("155")]
public SpacePublicationListTypeVideoZone Fashion { get; set; }
[JsonProperty("202")]
public SpacePublicationListTypeVideoZone Information { get; set; }
[JsonProperty("5")]
public SpacePublicationListTypeVideoZone Ent { get; set; }
[JsonProperty("181")]
public SpacePublicationListTypeVideoZone Cinephile { get; set; }
[JsonProperty("177")]
public SpacePublicationListTypeVideoZone Documentary { get; set; }
[JsonProperty("23")]
public SpacePublicationListTypeVideoZone Movie { get; set; }
[JsonProperty("11")]
public SpacePublicationListTypeVideoZone Tv { get; set; }
}
}

@ -0,0 +1,15 @@
using DownKyi.Core.BiliApi.Models;
using Newtonsoft.Json;
namespace DownKyi.Core.BiliApi.Users.Models
{
public class SpacePublicationListTypeVideoZone : BaseModel
{
[JsonProperty("tid")]
public int Tid { get; set; }
[JsonProperty("count")]
public int Count { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
}
}

@ -0,0 +1,51 @@
using DownKyi.Core.BiliApi.Models;
using Newtonsoft.Json;
namespace DownKyi.Core.BiliApi.Users.Models
{
public class SpacePublicationListVideo : BaseModel
{
//[JsonProperty("comment")]
//public int Comment { get; set; }
[JsonProperty("typeid")]
public int Typeid { get; set; }
[JsonProperty("play")]
public int Play { get; set; }
[JsonProperty("pic")]
public string Pic { get; set; }
//[JsonProperty("subtitle")]
//public string Subtitle { get; set; }
//[JsonProperty("description")]
//public string Description { get; set; }
//[JsonProperty("copyright")]
//public string Copyright { get; set; }
[JsonProperty("title")]
public string Title { get; set; }
//[JsonProperty("review")]
//public int Review { get; set; }
//[JsonProperty("author")]
//public string Author { get; set; }
[JsonProperty("mid")]
public long Mid { get; set; }
[JsonProperty("created")]
public long Created { get; set; }
[JsonProperty("length")]
public string Length { get; set; }
//[JsonProperty("video_review")]
//public int VideoReview { get; set; }
[JsonProperty("aid")]
public long Aid { get; set; }
[JsonProperty("bvid")]
public string Bvid { get; set; }
//[JsonProperty("hide_click")]
//public bool HideClick { get; set; }
//[JsonProperty("is_pay")]
//public int IsPay { get; set; }
//[JsonProperty("is_union_video")]
//public int IsUnionVideo { get; set; }
//[JsonProperty("is_steins_gate")]
//public int IsSteinsGate { get; set; }
//[JsonProperty("is_live_playback")]
//public int IsLivePlayback { get; set; }
}
}

@ -0,0 +1,15 @@
using DownKyi.Core.BiliApi.Models;
using Newtonsoft.Json;
namespace DownKyi.Core.BiliApi.Users.Models
{
public class SpacePublicationPage : BaseModel
{
[JsonProperty("pn")]
public int Pn { get; set; }
[JsonProperty("ps")]
public int Ps { get; set; }
[JsonProperty("count")]
public int Count { get; set; }
}
}

@ -0,0 +1,21 @@
using DownKyi.Core.BiliApi.Models;
using Newtonsoft.Json;
namespace DownKyi.Core.BiliApi.Users.Models
{
// https://space.bilibili.com/ajax/settings/getSettings?mid={mid}
public class SpaceSettingsOrigin : BaseModel
{
[JsonProperty("status")]
public bool Status { get; set; }
[JsonProperty("data")]
public SpaceSettings Data { get; set; }
}
public class SpaceSettings : BaseModel
{
// ...
[JsonProperty("toutu")]
public SpaceSettingsToutu Toutu { get; set; }
}
}

@ -0,0 +1,27 @@
using DownKyi.Core.BiliApi.Models;
using Newtonsoft.Json;
namespace DownKyi.Core.BiliApi.Users.Models
{
public class SpaceSettingsToutu : BaseModel
{
[JsonProperty("sid")]
public int Sid { get; set; }
[JsonProperty("expire")]
public long Expire { get; set; }
[JsonProperty("s_img")]
public string Simg { get; set; } // 完整url为http://i0.hdslb.com/+相对路径
[JsonProperty("l_img")]
public string Limg { get; set; } // 完整url为http://i0.hdslb.com/+相对路径
[JsonProperty("android_img")]
public string AndroidImg { get; set; }
[JsonProperty("iphone_img")]
public string IphoneImg { get; set; }
[JsonProperty("ipad_img")]
public string IpadImg { get; set; }
[JsonProperty("thumbnail_img")]
public string ThumbnailImg { get; set; }
[JsonProperty("platform")]
public int Platform { get; set; }
}
}

@ -0,0 +1,28 @@
using DownKyi.Core.BiliApi.Models;
using Newtonsoft.Json;
namespace DownKyi.Core.BiliApi.Users.Models
{
// https://api.bilibili.com/x/space/upstat?mid={mid}
public class UpStatOrigin : BaseModel
{
[JsonProperty("data")]
public UpStat Data { get; set; }
}
public class UpStat : BaseModel
{
[JsonProperty("archive")]
public UpStatArchive Archive { get; set; }
[JsonProperty("article")]
public UpStatArchive Article { get; set; }
[JsonProperty("likes")]
public long Likes { get; set; }
}
public class UpStatArchive : BaseModel
{
[JsonProperty("view")]
public long View { get; set; } // 视频/文章播放量
}
}

@ -1,7 +1,7 @@
using DownKyi.Core.BiliApi.Models;
using Newtonsoft.Json;
namespace DownKyi.Core.BiliApi.Login.Models
namespace DownKyi.Core.BiliApi.Users.Models
{
// https://api.bilibili.com/x/web-interface/nav
[JsonObject]

@ -0,0 +1,55 @@
using DownKyi.Core.BiliApi.Models;
using Newtonsoft.Json;
namespace DownKyi.Core.BiliApi.Users.Models
{
// https://api.bilibili.com/x/space/acc/info?mid={mid}
public class UserInfoForSpaceOrigin : BaseModel
{
//[JsonProperty("code")]
//public int Code { get; set; }
//[JsonProperty("message")]
//public string Message { get; set; }
//[JsonProperty("ttl")]
//public int Ttl { get; set; }
[JsonProperty("data")]
public UserInfoForSpace Data { get; set; }
}
public class UserInfoForSpace : BaseModel
{
[JsonProperty("mid")]
public long Mid { get; set; }
[JsonProperty("name")]
public string Name { get; set; }
[JsonProperty("sex")]
public string Sex { get; set; }
[JsonProperty("face")]
public string Face { get; set; }
// face_nft
[JsonProperty("sign")]
public string Sign { get; set; }
// rank
[JsonProperty("level")]
public int Level { get; set; }
// jointime
// moral
// silence
// coins
//[JsonProperty("fans_badge")]
//public bool FansBadge { get; set; }
// fans_medal
// official
[JsonProperty("vip")]
public UserInfoVip Vip { get; set; }
// pendant
// nameplate
// user_honour_info
[JsonProperty("is_followed")]
public bool IsFollowed { get; set; }
[JsonProperty("top_photo")]
public string TopPhoto { get; set; }
// ...
}
}

@ -0,0 +1,17 @@
using DownKyi.Core.BiliApi.Models;
using Newtonsoft.Json;
namespace DownKyi.Core.BiliApi.Users.Models
{
public class UserInfoLevelExp : BaseModel
{
[JsonProperty("current_level")]
public int CurrentLevel { get; set; }
[JsonProperty("current_min")]
public int CurrentMin { get; set; }
[JsonProperty("current_exp")]
public int CurrentExp { get; set; }
[JsonProperty("next_exp")]
public int NextExp { get; set; }
}
}

@ -0,0 +1,41 @@
using DownKyi.Core.BiliApi.Models;
using Newtonsoft.Json;
namespace DownKyi.Core.BiliApi.Users.Models
{
public class UserInfoVip : BaseModel
{
[JsonProperty("type")]
public int Type { get; set; }
[JsonProperty("status")]
public int Status { get; set; }
[JsonProperty("due_date")]
public long DueDate { get; set; }
// vip_pay_type
// theme_type
[JsonProperty("label")]
public UserInfoVipLabel Label { get; set; }
[JsonProperty("avatar_subscript")]
public int AvatarSubscript { get; set; }
[JsonProperty("nickname_color")]
public string NicknameColor { get; set; }
// role
[JsonProperty("avatar_subscript_url")]
public string AvatarSubscriptUrl { get; set; }
}
public class UserInfoVipLabel : BaseModel
{
// path
[JsonProperty("text")]
public string Text { get; set; }
[JsonProperty("label_theme")]
public string LabelTheme { get; set; }
[JsonProperty("text_color")]
public string TextColor { get; set; }
// bg_style
// bg_color
// border_color
}
}

@ -0,0 +1,26 @@
using DownKyi.Core.BiliApi.Models;
using Newtonsoft.Json;
namespace DownKyi.Core.BiliApi.Users.Models
{
// https://api.bilibili.com/x/relation/stat?vmid={mid}
public class UserRelationStatOrigin : BaseModel
{
[JsonProperty("data")]
public UserRelationStat Data { get; set; }
}
public class UserRelationStat : BaseModel
{
[JsonProperty("mid")]
public long Mid { get; set; }
[JsonProperty("following")]
public long Following { get; set; } // 关注数
[JsonProperty("whisper")]
public long Whisper { get; set; }
[JsonProperty("black")]
public long Black { get; set; }
[JsonProperty("follower")]
public long Follower { get; set; } // 粉丝数
}
}

@ -0,0 +1,38 @@
using DownKyi.Core.BiliApi.Users.Models;
using DownKyi.Core.Logging;
using Newtonsoft.Json;
using System;
namespace DownKyi.Core.BiliApi.Users
{
/// <summary>
/// 用户昵称
/// </summary>
public class Nickname
{
/// <summary>
/// 检查昵称
/// </summary>
/// <param name="nickName"></param>
/// <returns></returns>
public static NicknameStatus CheckNickname(string nickName)
{
string url = $"https://api.bilibili.com/x/relation/stat?nickName={nickName}";
string referer = "https://www.bilibili.com";
string response = WebClient.RequestWeb(url, referer);
try
{
NicknameStatus nickname = JsonConvert.DeserializeObject<NicknameStatus>(response);
return nickname;
}
catch (Exception e)
{
Utils.Debugging.Console.PrintLine("CheckNickname()发生异常: {0}", e);
LogManager.Error("Nickname", e);
return null;
}
}
}
}

@ -0,0 +1,89 @@
using DownKyi.Core.BiliApi.Users.Models;
using DownKyi.Core.Logging;
using Newtonsoft.Json;
using System;
namespace DownKyi.Core.BiliApi.Users
{
/// <summary>
/// 用户基本信息
/// </summary>
public static class UserInfo
{
/// <summary>
/// 导航栏用户信息
/// </summary>
/// <returns></returns>
public static UserInfoForNavigation GetUserInfoForNavigation()
{
string url = "https://api.bilibili.com/x/web-interface/nav";
string referer = "https://www.bilibili.com";
string response = WebClient.RequestWeb(url, referer);
try
{
UserInfoForNavigationOrigin userInfo = JsonConvert.DeserializeObject<UserInfoForNavigationOrigin>(response);
if (userInfo == null || userInfo.Data == null) { return null; }
if (userInfo.Data.IsLogin) { return userInfo.Data; }
else { return null; }
}
catch (Exception e)
{
Utils.Debugging.Console.PrintLine("GetUserInfoForNavigation()发生异常: {0}", e);
LogManager.Error("UserInfo", e);
return null;
}
}
/// <summary>
/// 用户空间详细信息
/// </summary>
/// <param name="mid"></param>
/// <returns></returns>
public static UserInfoForSpace GetUserInfoForSpace(long mid)
{
string url = $"https://api.bilibili.com/x/space/acc/info?mid={mid}";
string referer = "https://www.bilibili.com";
string response = WebClient.RequestWeb(url, referer);
try
{
UserInfoForSpaceOrigin spaceInfo = JsonConvert.DeserializeObject<UserInfoForSpaceOrigin>(response);
if (spaceInfo == null || spaceInfo.Data == null) { return null; }
return spaceInfo.Data;
}
catch (Exception e)
{
Utils.Debugging.Console.PrintLine("GetInfoForSpace()发生异常: {0}", e);
LogManager.Error("UserInfo", e);
return null;
}
}
/// <summary>
/// 本用户详细信息
/// </summary>
/// <returns></returns>
public static MyInfo GetMyInfo()
{
string url = "https://api.bilibili.com/x/space/myinfo";
string referer = "https://www.bilibili.com";
string response = WebClient.RequestWeb(url, referer);
try
{
MyInfoOrigin myInfo = JsonConvert.DeserializeObject<MyInfoOrigin>(response);
if (myInfo == null || myInfo.Data == null) { return null; }
return myInfo.Data;
}
catch (Exception e)
{
Utils.Debugging.Console.PrintLine("GetMyInfo()发生异常: {0}", e);
LogManager.Error("UserInfo", e);
return null;
}
}
}
}

@ -0,0 +1,268 @@
using DownKyi.Core.BiliApi.Users.Models;
using DownKyi.Core.Logging;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
namespace DownKyi.Core.BiliApi.Users
{
/// <summary>
/// 用户关系相关
/// </summary>
public static class UserRelation
{
/// <summary>
/// 查询用户粉丝明细
/// </summary>
/// <param name="mid">目标用户UID</param>
/// <param name="pn">页码</param>
/// <param name="ps">每页项数</param>
/// <returns></returns>
public static RelationFollow GetFollowers(long mid, int pn, int ps)
{
string url = $"https://api.bilibili.com/x/relation/followers?vmid={mid}&pn={pn}&ps={ps}";
string referer = "https://www.bilibili.com";
string response = WebClient.RequestWeb(url, referer);
try
{
RelationFollowOrigin relationFollower = JsonConvert.DeserializeObject<RelationFollowOrigin>(response);
if (relationFollower == null || relationFollower.Data == null) { return null; }
return relationFollower.Data;
}
catch (Exception e)
{
Utils.Debugging.Console.PrintLine("GetFollowers()发生异常: {0}", e);
LogManager.Error("UserRelation", e);
return null;
}
}
/// <summary>
/// 查询用户所有的粉丝明细
/// </summary>
/// <param name="mid">目标用户UID</param>
/// <returns></returns>
public static List<RelationFollowInfo> GetAllFollowers(long mid)
{
List<RelationFollowInfo> result = new List<RelationFollowInfo>();
int i = 0;
while (true)
{
i++;
int ps = 50;
RelationFollow data = GetFollowers(mid, i, ps);
if (data == null || data.List == null || data.List.Count == 0)
{ break; }
result.AddRange(data.List);
}
return result;
}
/// <summary>
/// 查询用户关注明细
/// </summary>
/// <param name="mid">目标用户UID</param>
/// <param name="pn">页码</param>
/// <param name="ps">每页项数</param>
/// <param name="order">排序方式</param>
/// <returns></returns>
public static RelationFollow GetFollowings(long mid, int pn, int ps, FollowingOrder order = FollowingOrder.DEFAULT)
{
string orderType = "";
if (order == FollowingOrder.ATTENTION)
{
orderType = "attention";
}
string url = $"https://api.bilibili.com/x/relation/followings?vmid={mid}&pn={pn}&ps={ps}&order_type={orderType}";
string referer = "https://www.bilibili.com";
string response = WebClient.RequestWeb(url, referer);
try
{
RelationFollowOrigin relationFollower = JsonConvert.DeserializeObject<RelationFollowOrigin>(response);
if (relationFollower == null || relationFollower.Data == null) { return null; }
return relationFollower.Data;
}
catch (Exception e)
{
Utils.Debugging.Console.PrintLine("GetFollowings()发生异常: {0}", e);
LogManager.Error("UserRelation", e);
return null;
}
}
/// <summary>
/// 查询用户所有的关注明细
/// </summary>
/// <param name="mid">目标用户UID</param>
/// <param name="order">排序方式</param>
/// <returns></returns>
public static List<RelationFollowInfo> GetAllFollowings(long mid, FollowingOrder order = FollowingOrder.DEFAULT)
{
List<RelationFollowInfo> result = new List<RelationFollowInfo>();
int i = 0;
while (true)
{
i++;
int ps = 50;
RelationFollow data = GetFollowings(mid, i, ps, order);
if (data == null || data.List == null || data.List.Count == 0)
{ break; }
result.AddRange(data.List);
}
return result;
}
/// <summary>
/// 查询悄悄关注明细
/// </summary>
/// <param name="pn">页码</param>
/// <param name="ps">每页项数</param>
/// <returns></returns>
public static List<RelationFollowInfo> GetWhispers(int pn, int ps)
{
string url = $"https://api.bilibili.com/x/relation/whispers?pn={pn}&ps={ps}";
string referer = "https://www.bilibili.com";
string response = WebClient.RequestWeb(url, referer);
try
{
RelationWhisper relationWhisper = JsonConvert.DeserializeObject<RelationWhisper>(response);
if (relationWhisper == null || relationWhisper.Data == null) { return null; }
return relationWhisper.Data;
}
catch (Exception e)
{
Utils.Debugging.Console.PrintLine("GetWhispers()发生异常: {0}", e);
LogManager.Error("UserRelation", e);
return null;
}
}
/// <summary>
/// 查询黑名单明细
/// </summary>
/// <param name="pn">页码</param>
/// <param name="ps">每页项数</param>
/// <returns></returns>
public static List<RelationFollowInfo> GetBlacks(int pn, int ps)
{
string url = $"https://api.bilibili.com/x/relation/blacks?pn={pn}&ps={ps}";
string referer = "https://www.bilibili.com";
string response = WebClient.RequestWeb(url, referer);
try
{
RelationBlack relationBlack = JsonConvert.DeserializeObject<RelationBlack>(response);
if (relationBlack == null || relationBlack.Data == null) { return null; }
return relationBlack.Data;
}
catch (Exception e)
{
Utils.Debugging.Console.PrintLine("GetBlacks()发生异常: {0}", e);
LogManager.Error("UserRelation", e);
return null;
}
}
#region 关注分组相关,只能查询当前登录账户的信息
/// <summary>
/// 查询关注分组列表
/// </summary>
/// <returns></returns>
public static List<FollowingGroup> GetFollowingGroup()
{
string url = $"https://api.bilibili.com/x/relation/tags";
string referer = "https://www.bilibili.com";
string response = WebClient.RequestWeb(url, referer);
try
{
var followingGroup = JsonConvert.DeserializeObject<FollowingGroupOrigin>(response);
if (followingGroup == null || followingGroup.Data == null) { return null; }
return followingGroup.Data;
}
catch (Exception e)
{
Utils.Debugging.Console.PrintLine("GetFollowingGroup()发生异常: {0}", e);
LogManager.Error("UserRelation", e);
return null;
}
}
/// <summary>
/// 查询关注分组明细
/// </summary>
/// <param name="tagId">分组ID</param>
/// <param name="pn">页数</param>
/// <param name="ps">每页项数</param>
/// <param name="order">排序方式</param>
/// <returns></returns>
public static List<RelationFollowInfo> GetFollowingGroupContent(int tagId, int pn, int ps, FollowingOrder order = FollowingOrder.DEFAULT)
{
string orderType = "";
if (order == FollowingOrder.ATTENTION)
{
orderType = "attention";
}
string url = $"https://api.bilibili.com/x/relation/tag?tagid={tagId}&pn={pn}&ps={ps}&order_type={orderType}";
string referer = "https://www.bilibili.com";
string response = WebClient.RequestWeb(url, referer);
try
{
FollowingGroupContent content = JsonConvert.DeserializeObject<FollowingGroupContent>(response);
if (content == null || content.Data == null) { return null; }
return content.Data;
}
catch (Exception e)
{
Utils.Debugging.Console.PrintLine("GetFollowingGroupContent()发生异常: {0}", e);
LogManager.Error("UserRelation", e);
return null;
}
}
/// <summary>
/// 查询所有的关注分组明细
/// </summary>
/// <param name="tagId">分组ID</param>
/// <param name="order">排序方式</param>
/// <returns></returns>
public static List<RelationFollowInfo> GetAllFollowingGroupContent(int tagId, FollowingOrder order = FollowingOrder.DEFAULT)
{
List<RelationFollowInfo> result = new List<RelationFollowInfo>();
int i = 0;
while (true)
{
i++;
int ps = 50;
var data = GetFollowingGroupContent(tagId, i, ps, order);
if (data == null || data.Count == 0)
{ break; }
result.AddRange(data);
}
return result;
}
#endregion
}
}

@ -0,0 +1,348 @@
using DownKyi.Core.BiliApi.Users.Models;
using DownKyi.Core.Logging;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
using System;
using System.Collections.Generic;
namespace DownKyi.Core.BiliApi.Users
{
/// <summary>
/// 用户空间信息
/// </summary>
public static class UserSpace
{
/// <summary>
/// 查询空间设置
/// </summary>
/// <param name="mid"></param>
/// <returns></returns>
public static SpaceSettings GetSpaceSettings(long mid)
{
string url = $"https://space.bilibili.com/ajax/settings/getSettings?mid={mid}";
string referer = "https://www.bilibili.com";
string response = WebClient.RequestWeb(url, referer);
try
{
SpaceSettingsOrigin settings = JsonConvert.DeserializeObject<SpaceSettingsOrigin>(response);
if (settings == null || settings.Data == null || !settings.Status) { return null; }
return settings.Data;
}
catch (Exception e)
{
Utils.Debugging.Console.PrintLine("GetSpaceSettings()发生异常: {0}", e);
LogManager.Error("UserSpace", e);
return null;
}
}
#region 投稿
/// <summary>
/// 获取用户投稿视频的所有分区
/// </summary>
/// <param name="mid">用户id</param>
/// <returns></returns>
public static List<SpacePublicationListTypeVideoZone> GetPublicationType(long mid)
{
int pn = 1;
int ps = 1;
SpacePublicationList publication = GetPublication(mid, pn, ps);
return GetPublicationType(publication);
}
/// <summary>
/// 获取用户投稿视频的所有分区
/// </summary>
/// <param name="mid">用户id</param>
/// <returns></returns>
public static List<SpacePublicationListTypeVideoZone> GetPublicationType(SpacePublicationList publication)
{
if (publication == null || publication.Tlist == null)
{
return null;
}
List<SpacePublicationListTypeVideoZone> result = new List<SpacePublicationListTypeVideoZone>();
JObject typeList = JObject.Parse(publication.Tlist.ToString("N"));
foreach (KeyValuePair<string, JToken> item in typeList)
{
SpacePublicationListTypeVideoZone value = JsonConvert.DeserializeObject<SpacePublicationListTypeVideoZone>(item.Value.ToString());
result.Add(value);
}
return result;
}
/// <summary>
/// 查询用户所有的投稿视频明细
/// </summary>
/// <param name="mid">用户id</param>
/// <param name="order">排序</param>
/// <param name="tid">视频分区</param>
/// <param name="keyword">搜索关键词</param>
/// <returns></returns>
public static List<SpacePublicationListVideo> GetAllPublication(long mid, int tid = 0, PublicationOrder order = PublicationOrder.PUBDATE, string keyword = "")
{
List<SpacePublicationListVideo> result = new List<SpacePublicationListVideo>();
int i = 0;
while (true)
{
i++;
int ps = 100;
SpacePublicationList data = GetPublication(mid, i, ps, tid, order, keyword);
if (data == null || data.Vlist == null || data.Vlist.Count == 0)
{ break; }
result.AddRange(data.Vlist);
}
return result;
}
/// <summary>
/// 查询用户投稿视频明细
/// </summary>
/// <param name="mid">用户id</param>
/// <param name="pn">页码</param>
/// <param name="ps">每页的视频数</param>
/// <param name="order">排序</param>
/// <param name="tid">视频分区</param>
/// <param name="keyword">搜索关键词</param>
/// <returns></returns>
public static SpacePublicationList GetPublication(long mid, int pn, int ps, int tid = 0, PublicationOrder order = PublicationOrder.PUBDATE, string keyword = "")
{
string url = $"https://api.bilibili.com/x/space/arc/search?mid={mid}&pn={pn}&ps={ps}&order={order.ToString("G").ToLower()}&tid={tid}&keyword={keyword}";
string referer = "https://www.bilibili.com";
string response = WebClient.RequestWeb(url, referer);
try
{
// 忽略play的值为“--”时的类型错误
JsonSerializerSettings settings = new JsonSerializerSettings
{
Error = (sender, args) =>
{
if (Equals(args.ErrorContext.Member, "play") &&
args.ErrorContext.OriginalObject.GetType() == typeof(SpacePublicationListVideo))
{
args.ErrorContext.Handled = true;
}
}
};
SpacePublicationOrigin spacePublication = JsonConvert.DeserializeObject<SpacePublicationOrigin>(response, settings);
if (spacePublication == null || spacePublication.Data == null) { return null; }
return spacePublication.Data.List;
}
catch (Exception e)
{
Utils.Debugging.Console.PrintLine("GetPublication()发生异常: {0}", e);
LogManager.Error("UserSpace", e);
return null;
}
}
#endregion
#region 频道
/// <summary>
/// 查询用户频道列表
/// </summary>
/// <param name="mid">用户id</param>
/// <returns></returns>
public static List<SpaceChannelList> GetChannelList(long mid)
{
string url = $"https://api.bilibili.com/x/space/channel/list?mid={mid}";
string referer = "https://www.bilibili.com";
string response = WebClient.RequestWeb(url, referer);
try
{
SpaceChannelOrigin spaceChannel = JsonConvert.DeserializeObject<SpaceChannelOrigin>(response);
if (spaceChannel == null || spaceChannel.Data == null) { return null; }
return spaceChannel.Data.List;
}
catch (Exception e)
{
Utils.Debugging.Console.PrintLine("GetChannelList()发生异常: {0}", e);
LogManager.Error("UserSpace", e);
return null;
}
}
/// <summary>
/// 查询用户频道中的所有视频
/// </summary>
/// <param name="mid"></param>
/// <param name="cid"></param>
/// <returns></returns>
public static List<SpaceChannelArchive> GetAllChannelVideoList(long mid, long cid)
{
List<SpaceChannelArchive> result = new List<SpaceChannelArchive>();
int i = 0;
while (true)
{
i++;
int ps = 100;
List<SpaceChannelArchive> data = GetChannelVideoList(mid, cid, i, ps);
if (data == null || data.Count == 0)
{ break; }
result.AddRange(data);
}
return result;
}
/// <summary>
/// 查询用户频道中的视频
/// </summary>
/// <param name="mid"></param>
/// <param name="cid"></param>
/// <param name="pn"></param>
/// <param name="ps"></param>
/// <returns></returns>
public static List<SpaceChannelArchive> GetChannelVideoList(long mid, long cid, int pn, int ps)
{
string url = $"https://api.bilibili.com/x/space/channel/video?mid={mid}&cid={cid}&pn={pn}&ps={ps}";
string referer = "https://www.bilibili.com";
string response = WebClient.RequestWeb(url, referer);
try
{
SpaceChannelVideoOrigin spaceChannelVideo = JsonConvert.DeserializeObject<SpaceChannelVideoOrigin>(response);
if (spaceChannelVideo == null || spaceChannelVideo.Data == null || spaceChannelVideo.Data.List == null)
{ return null; }
return spaceChannelVideo.Data.List.Archives;
}
catch (Exception e)
{
Utils.Debugging.Console.PrintLine("GetChannelVideoList()发生异常: {0}", e);
LogManager.Error("UserSpace", e);
return null;
}
}
#endregion
#region 课程
/// <summary>
/// 查询用户发布的课程列表
/// </summary>
/// <param name="mid">目标用户UID</param>
/// <param name="pn">页码</param>
/// <param name="ps">每页项数</param>
/// <returns></returns>
public static List<SpaceCheese> GetCheese(long mid, int pn, int ps)
{
string url = $"https://api.bilibili.com/pugv/app/web/season/page?mid={mid}&pn={pn}&ps={ps}";
string referer = "https://www.bilibili.com";
string response = WebClient.RequestWeb(url, referer);
try
{
SpaceCheeseOrigin cheese = JsonConvert.DeserializeObject<SpaceCheeseOrigin>(response);
if (cheese == null || cheese.Data == null || cheese.Data.Items == null)
{ return null; }
return cheese.Data.Items;
}
catch (Exception e)
{
Utils.Debugging.Console.PrintLine("GetCheese()发生异常: {0}", e);
LogManager.Error("UserSpace", e);
return null;
}
}
/// <summary>
/// 查询用户发布的所有课程列表
/// </summary>
/// <param name="mid">目标用户UID</param>
/// <returns></returns>
public static List<SpaceCheese> GetAllCheese(long mid)
{
List<SpaceCheese> result = new List<SpaceCheese>();
int i = 0;
while (true)
{
i++;
int ps = 50;
List<SpaceCheese> data = GetCheese(mid, i, ps);
if (data == null || data.Count == 0)
{ break; }
result.AddRange(data);
}
return result;
}
#endregion
#region 订阅
/// <summary>
/// 查询用户追番(追剧)明细
/// </summary>
/// <param name="mid">目标用户UID</param>
/// <param name="type">查询类型</param>
/// <param name="pn">页码</param>
/// <param name="ps">每页项数</param>
/// <returns></returns>
public static BangumiFollowData GetBangumiFollow(long mid, BangumiType type, int pn, int ps)
{
string url = $"https://api.bilibili.com/x/space/bangumi/follow/list?vmid={mid}&type={type:D}&pn={pn}&ps={ps}";
string referer = "https://www.bilibili.com";
string response = WebClient.RequestWeb(url, referer);
try
{
BangumiFollowOrigin bangumiFollow = JsonConvert.DeserializeObject<BangumiFollowOrigin>(response);
if (bangumiFollow == null || bangumiFollow.Data == null)
{ return null; }
return bangumiFollow.Data;
}
catch (Exception e)
{
Utils.Debugging.Console.PrintLine("GetBangumiFollow()发生异常: {0}", e);
LogManager.Error("UserSpace", e);
return null;
}
}
/// <summary>
/// 查询用户所有的追番(追剧)明细
/// </summary>
/// <param name="mid">目标用户UID</param>
/// <param name="type">查询类型</param>
/// <returns></returns>
public static List<BangumiFollow> GetAllBangumiFollow(long mid, BangumiType type)
{
List<BangumiFollow> result = new List<BangumiFollow>();
int i = 0;
while (true)
{
i++;
int ps = 30;
BangumiFollowData data = GetBangumiFollow(mid, type, i, ps);
if (data == null || data.List == null || data.List.Count == 0)
{ break; }
result.AddRange(data.List);
}
return result;
}
#endregion
}
}

@ -0,0 +1,66 @@
using DownKyi.Core.BiliApi.Users.Models;
using DownKyi.Core.Logging;
using Newtonsoft.Json;
using System;
namespace DownKyi.Core.BiliApi.Users
{
/// <summary>
/// 用户状态数
/// </summary>
public static class UserStatus
{
/// <summary>
/// 关系状态数
/// </summary>
/// <param name="mid"></param>
/// <returns></returns>
public static UserRelationStat GetUserRelationStat(long mid)
{
string url = $"https://api.bilibili.com/x/relation/stat?vmid={mid}";
string referer = "https://www.bilibili.com";
string response = WebClient.RequestWeb(url, referer);
try
{
UserRelationStatOrigin userRelationStat = JsonConvert.DeserializeObject<UserRelationStatOrigin>(response);
if (userRelationStat == null || userRelationStat.Data == null) { return null; }
return userRelationStat.Data;
}
catch (Exception e)
{
Utils.Debugging.Console.PrintLine("GetUserRelationStat()发生异常: {0}", e);
LogManager.Error("UserStatus", e);
return null;
}
}
/// <summary>
/// UP主状态数
///
/// 注:该接口需要任意用户登录,否则不会返回任何数据
/// </summary>
/// <param name="mid"></param>
/// <returns></returns>
public static UpStat GetUpStat(long mid)
{
string url = $"https://api.bilibili.com/x/space/upstat?mid={mid}";
string referer = "https://www.bilibili.com";
string response = WebClient.RequestWeb(url, referer);
try
{
UpStatOrigin upStat = JsonConvert.DeserializeObject<UpStatOrigin>(response);
if (upStat == null || upStat.Data == null) { return null; }
return upStat.Data;
}
catch (Exception e)
{
Utils.Debugging.Console.PrintLine("GetUpStat()发生异常: {0}", e);
LogManager.Error("UserStatus", e);
return null;
}
}
}
}

@ -27,6 +27,8 @@ namespace DownKyi.Core.BiliApi.Zone
private VideoZone()
{
// SpacePublicationListType类需要同步更新
//动画
zones.Add(new ZoneAttr(1, "douga", "动画")); // 主分区
zones.Add(new ZoneAttr(24, "mad", "MAD·AMV", 1)); //具有一定制作程度的动画或静画的二次创作视频

@ -153,19 +153,61 @@
<Compile Include="BiliApi\Favorites\Models\MediaStatus.cs" />
<Compile Include="BiliApi\Login\LoginHelper.cs" />
<Compile Include="BiliApi\Models\BaseModel.cs" />
<Compile Include="BiliApi\Login\LoginInfo.cs" />
<Compile Include="BiliApi\BiliUtils\BvId.cs" />
<Compile Include="BiliApi\BiliUtils\DanmakuSender.cs" />
<Compile Include="BiliApi\Login\LoginQR.cs" />
<Compile Include="BiliApi\Login\Models\LoginStatus.cs" />
<Compile Include="BiliApi\Login\Models\LoginUrl.cs" />
<Compile Include="BiliApi\Login\Models\UserInfoForNavigation.cs" />
<Compile Include="BiliApi\Users\Models\BangumiFollow.cs" />
<Compile Include="BiliApi\Users\Models\BangumiFollowAreas.cs" />
<Compile Include="BiliApi\Users\Models\BangumiFollowNewEp.cs" />
<Compile Include="BiliApi\Users\Models\BangumiFollowOrigin.cs" />
<Compile Include="BiliApi\Users\Models\BangumiType.cs" />
<Compile Include="BiliApi\Users\Models\FollowingGroup.cs" />
<Compile Include="BiliApi\Users\Models\FollowingGroupContent.cs" />
<Compile Include="BiliApi\Users\Models\FollowingOrder.cs" />
<Compile Include="BiliApi\Users\Models\MyInfo.cs" />
<Compile Include="BiliApi\Users\Models\NicknameStatus.cs" />
<Compile Include="BiliApi\Users\Models\PublicationOrder.cs" />
<Compile Include="BiliApi\Users\Models\RelationBlack.cs" />
<Compile Include="BiliApi\Users\Models\RelationFollow.cs" />
<Compile Include="BiliApi\Users\Models\RelationFollowInfo.cs" />
<Compile Include="BiliApi\Users\Models\RelationWhisper.cs" />
<Compile Include="BiliApi\Users\Models\SpaceChannel.cs" />
<Compile Include="BiliApi\Users\Models\SpaceChannelArchive.cs" />
<Compile Include="BiliApi\Users\Models\SpaceChannelArchiveStat.cs" />
<Compile Include="BiliApi\Users\Models\SpaceChannelList.cs" />
<Compile Include="BiliApi\Users\Models\SpaceChannelVideo.cs" />
<Compile Include="BiliApi\Users\Models\SpaceChannelVideoList.cs" />
<Compile Include="BiliApi\Users\Models\SpaceChannelVideoPage.cs" />
<Compile Include="BiliApi\Users\Models\SpaceCheese.cs" />
<Compile Include="BiliApi\Users\Models\SpaceCheeseOrigin.cs" />
<Compile Include="BiliApi\Users\Models\SpaceCheesePage.cs" />
<Compile Include="BiliApi\Users\Models\SpacePublication.cs" />
<Compile Include="BiliApi\Users\Models\SpacePublicationList.cs" />
<Compile Include="BiliApi\Users\Models\SpacePublicationListType.cs" />
<Compile Include="BiliApi\Users\Models\SpacePublicationListTypeVideoZone.cs" />
<Compile Include="BiliApi\Users\Models\SpacePublicationListVideo.cs" />
<Compile Include="BiliApi\Users\Models\SpacePublicationPage.cs" />
<Compile Include="BiliApi\Users\Models\SpaceSettings.cs" />
<Compile Include="BiliApi\Users\Models\SpaceSettingsToutu.cs" />
<Compile Include="BiliApi\Users\Models\UpStat.cs" />
<Compile Include="BiliApi\Users\Models\UserInfoForNavigation.cs" />
<Compile Include="BiliApi\Models\Dimension.cs" />
<Compile Include="BiliApi\Models\Json\SubRipText.cs" />
<Compile Include="BiliApi\Models\Json\Subtitle.cs" />
<Compile Include="BiliApi\Models\Json\SubtitleJson.cs" />
<Compile Include="BiliApi\Models\VideoOwner.cs" />
<Compile Include="BiliApi\protobuf\bilibili\community\service\dm\v1\Dm.cs" />
<Compile Include="BiliApi\Users\Models\UserInfoForSpace.cs" />
<Compile Include="BiliApi\Users\Models\UserInfoLevelExp.cs" />
<Compile Include="BiliApi\Users\Models\UserInfoVip.cs" />
<Compile Include="BiliApi\Users\Models\UserRelationStat.cs" />
<Compile Include="BiliApi\Users\Nickname.cs" />
<Compile Include="BiliApi\Users\UserInfo.cs" />
<Compile Include="BiliApi\Users\UserRelation.cs" />
<Compile Include="BiliApi\Users\UserSpace.cs" />
<Compile Include="BiliApi\Users\UserStatus.cs" />
<Compile Include="BiliApi\VideoStream\Models\PlayerV2.cs" />
<Compile Include="BiliApi\VideoStream\Models\PlayUrl.cs" />
<Compile Include="BiliApi\VideoStream\Models\PlayUrlDash.cs" />

@ -95,6 +95,7 @@
<Compile Include="Services\Download\DownloadStorageService.cs" />
<Compile Include="ViewModels\PageViewModels\Favorites.cs" />
<Compile Include="ViewModels\PageViewModels\FavoritesMedia.cs" />
<Compile Include="ViewModels\PageViewModels\SpaceItem.cs" />
<Compile Include="ViewModels\Settings\DisplayFileNamePart.cs" />
<Compile Include="Models\ParseScopeDisplay.cs" />
<Compile Include="ViewModels\PageViewModels\TabHeader.cs" />

@ -22,8 +22,25 @@
0s.49-1.28 0-1.77L9.38 12l7.25-7.25c.48-.48.48-1.28-.01-1.76z",
Fill = "#FF000000"
};
Logout = new VectorImage
{
Height = 18.75,//100,
Width = 24,//128,
Data = @"M21.5,11.3l-2.8-2.7c-0.2-0.2-0.2-0.4-0.2-0.7c0.1-0.3,0.2-0.4,0.5-0.5c0.3-0.1,0.5,0,0.7,0.2l4,3.9
c0.1,0.1,0.2,0.3,0.2,0.5c0,0.2-0.1,0.4-0.2,0.5l-4,3.9c-0.2,0.2-0.4,0.2-0.7,0.2c-0.3-0.1-0.4-0.2-0.5-0.5c-0.1-0.3,0-0.5,0.2-0.7
l2.8-2.7h-8.7c-0.2,0-0.4-0.1-0.5-0.2c-0.1-0.1-0.2-0.3-0.2-0.5c0-0.2,0.1-0.4,0.2-0.5c0.1-0.1,0.3-0.2,0.5-0.2
C12.8,11.3,21.5,11.3,21.5,11.3z M16,18.2c0-0.2,0.1-0.4,0.2-0.5c0.1-0.1,0.3-0.2,0.5-0.2c0.2,0,0.4,0.1,0.5,0.2
c0.1,0.1,0.2,0.3,0.2,0.5v0.4c0,0.8-0.3,1.5-0.9,2c-0.6,0.5-1.2,0.8-2,0.8H2.9c-0.8,0-1.5-0.3-2-0.8S0,19.3,0,18.5V5.4
c0-0.8,0.3-1.5,0.8-2s1.2-0.8,2-0.8h11.7c0.8,0,1.5,0.3,2,0.8c0.5,0.5,0.8,1.2,0.8,2v0.4c0,0.3-0.1,0.5-0.4,0.6
c-0.2,0.1-0.5,0.1-0.7,0C16.1,6.3,16,6.1,16,5.8V5.4c0-0.4-0.1-0.7-0.4-1c-0.3-0.3-0.6-0.4-1-0.4H2.9c-0.4,0-0.7,0.1-1,0.4
C1.6,4.7,1.4,5,1.4,5.4v13.1c0,0.4,0.2,0.7,0.4,1c0.3,0.3,0.6,0.4,1,0.4h11.7c0.4,0,0.7-0.1,1-0.4c0.3-0.3,0.4-0.6,0.4-1L16,18.2
L16,18.2z",
Fill = "#FF000000"
};
}
public VectorImage ArrowBack { get; private set; }
public VectorImage Logout { get; private set; }
}
}

@ -106,6 +106,139 @@
Fill = "#FF000000"
};
CoinIcon = new VectorImage
{
Height = 20,
Width = 20,
Data = @"M473.7 358.8 l0 -54.42 l-129.01 0 q-16.12 0 -27.21 -11.09 q-11.09 -11.09 -11.09 -27.72 q0 -16.63 11.09 -27.21
q11.09 -10.58 27.21 -11.59 l334.62 0 q22.17 1.01 32.76 20.16 q10.58 19.15 0 37.8 q-10.59 18.64 -32.76 19.65 l-129.01 0
l0 54.42 q93.73 16.13 153.7 83.66 q59.97 67.52 61.98 163.27 l0 23.18 q-1 17.14 -11.59 27.72 q-10.59 10.58 -27.22 10.58
q-16.63 0 -27.72 -10.58 q-11.08 -10.58 -11.08 -27.72 l0 -23.18 q-1.01 -62.49 -39.31 -108.35 q-38.3 -45.86 -98.77 -59.96
l0 332.6 q0 16.12 -11.09 27.2 q-11.08 11.09 -27.21 11.09 q-16.13 0 -27.22 -11.09 q-11.08 -11.08 -11.08 -27.2 l0 -332.6
q-60.47 14.11 -98.77 59.96 q-38.3 45.86 -39.31 108.35 l0 23.18 q0 17.14 -11.09 27.72 q-11.08 10.58 -27.71 10.58
q-16.63 0 -27.21 -10.58 q-10.59 -10.58 -11.59 -27.72 l0 -23.18 q2.01 -95.75 61.98 -163.27 q59.97 -67.53 153.7 -83.66
ZM512 1024 q-217.7 -6.05 -361.82 -150.17 q-144.13 -144.13 -150.18 -361.83 q6.05 -217.7 150.18 -361.82
q144.13 -144.13 361.82 -150.18 q217.7 6.05 361.83 150.18 q144.13 144.13 150.17 361.82 q-6.05 217.7 -150.17 361.83
q-144.13 144.13 -361.83 150.17 ZM512 946.39 q184.44 -5.04 306.89 -127.5 q122.46 -122.45 127.5 -306.89
q-5.04 -184.44 -127.5 -306.89 q-122.45 -122.46 -306.89 -127.5 q-184.44 5.04 -306.89 127.5 q-122.46 122.45 -127.5 306.89
q5.04 184.44 127.5 306.89 q122.45 122.46 306.89 127.5 Z",
Fill = "#FF000000"
};
MoneyIcon = new VectorImage
{
Height = 20,
Width = 20,
Data = @"M409.2 444.47 l138.08 0 q28.22 -1.01 46.36 -19.15 q18.14 -18.14 18.14 -45.85 q0 -27.72 -18.14 -46.36
q-18.14 -18.65 -46.36 -19.66 l-129.01 0 q-4.03 0 -6.55 3.03 q-2.52 3.02 -2.52 6.04 l0 121.95 ZM658.14 469.67
q48.38 30.24 68.03 80.63 q19.66 50.39 4.03 105.32 q-15.63 54.93 -58.96 87.18 q-43.34 32.25 -99.78 33.25 l-153.19 0
q-36.29 -1 -60.98 -25.19 q-24.69 -24.19 -25.7 -61.48 l0 -366.87 q1.01 -36.28 25.7 -60.47 q24.69 -24.19 60.98 -25.2
l129.01 0 q42.33 0 76.6 21.67 q34.26 21.67 52.41 59.47 q18.14 37.79 13.11 78.11 q-5.04 40.31 -31.25 73.57 ZM571.46 522.08
l-162.26 0 l0 167.31 q1 9.07 9.07 9.07 l153.19 0 q36.29 -1.01 60.48 -26.21 q24.19 -25.2 24.19 -61.99 q0 -36.79 -24.19 -61.48
q-24.19 -24.7 -60.48 -26.71 ZM512 1024 q-217.7 -6.05 -361.82 -150.17 q-144.13 -144.13 -150.18 -361.83
q6.05 -217.7 150.18 -361.82 q144.13 -144.13 361.82 -150.18 q217.7 6.05 361.83 150.18 q144.13 144.13 150.17 361.82
q-6.05 217.7 -150.17 361.83 q-144.13 144.13 -361.83 150.17 ZM512 946.39 q184.44 -5.04 306.89 -127.5
q122.46 -122.45 127.5 -306.89 q-5.04 -184.44 -127.5 -306.89 q-122.45 -122.46 -306.89 -127.5 q-184.44 5.04 -306.89 127.5
q-122.46 122.45 -127.5 306.89 q5.04 184.44 127.5 306.89 q122.45 122.46 306.89 127.5 Z",
Fill = "#FF000000"
};
BindingEmail = new VectorImage
{
Height = 20,
Width = 20,
Data = @"M512 1024 q-218 -5 -362.5 -149.5 q-144.5 -144.5 -149.5 -362.5 q5 -218 149.5 -362.5 q144.5 -144.5 362.5 -149.5
q218 5 362.5 149.5 q144.5 144.5 149.5 362.5 q-5 218 -149.5 362.5 q-144.5 144.5 -362.5 149.5 ZM282 278 l214 164
q8 6 16 6 q8 0 16 -6 l214 -164 l0 257 l-230 77 l-230 -77 l0 -257 ZM305 232 q7 -2 15 -2 l384 0 q8 0 15 2 q-3 2 -5 4
l-202 154 l-202 -154 q-2 -2 -5 -4 ZM794 518 l0 -262 q-1 -34 -27 -55 q-26 -21 -63 -22 l-384 0 q-37 1 -63 22
q-26 21 -27 55 l0 262 l-9 -3 q-25 -8 -46 7 q-21 15 -21 41 l0 154 q1 43 29.5 72 q28.5 29 72.5 30 l512 0 q44 -1 72.5 -30
q28.5 -29 29.5 -72 l0 -154 q0 -26 -21 -41 q-21 -15 -46 -7 l-9 3 ZM205 563 l307 103 l307 -103 l0 154 q0 21 -15 36
q-15 15 -36 15 l-512 0 q-22 -1 -36.5 -15 q-14.5 -14 -14.5 -36 l0 -154 Z",
Fill = "#FF000000"
};
BindingPhone = new VectorImage
{
Height = 20,
Width = 20,
Data = @"M512 1024 q-218 -5 -362.5 -149.5 q-144.5 -144.5 -149.5 -362.5 q5 -218 149.5 -362.5 q144.5 -144.5 362.5 -149.5
q218 5 362.5 149.5 q144.5 144.5 149.5 362.5 q-5 218 -149.5 362.5 q-144.5 144.5 -362.5 149.5 ZM307 614 l0 -307
l410 0 l0 461 q0 21 -15 36 q-15 15 -36 15 l-308 0 q-21 0 -35.5 -14.5 q-14.5 -14.5 -15.5 -36.5 l0 -102 l333 0
q11 -1 18 -8 q7 -7 7 -18 q0 -11 -7 -18 q-7 -7 -18 -8 l-333 0 ZM307 256 q0 -21 15 -36 q15 -15 36 -15 l308 0
q21 0 36 15 q15 15 15 36 l-410 0 ZM358 154 q-43 1 -72 29.5 q-29 28.5 -30 72.5 l0 512 q1 44 30 72.5 q29 28.5 72 29.5
l308 0 q43 -1 72 -29.5 q29 -28.5 30 -72.5 l0 -512 q-1 -44 -30 -72.5 q-29 -28.5 -72 -29.5 l-308 0 ZM512 794
q22 -1 36.5 -15.5 q14.5 -14.5 14.5 -36 q0 -21.5 -14.5 -36 q-14.5 -14.5 -36.5 -14.5 q-22 0 -36.5 14.5 q-14.5 14.5 -14.5 36
q0 21.5 14.5 36 q14.5 14.5 36.5 15.5 Z",
Fill = "#FF000000"
};
FavoriteOutline = new VectorImage
{
Height = 24,
Width = 24,
Data = @"M755.8 1021.89 q-13.98 -1 -28.45 -4.5 q-14.47 -3.5 -29.45 -8.49 l-146.74 -76.87 q-18.97 -13.97 -39.93 -13.97
q-20.97 0 -35.94 13.97 l-146.75 76.87 q-33.94 14.97 -69.38 12.98 q-35.44 -2 -65.39 -25.96 q-23.96 -19.96 -35.44 -49.41
q-11.48 -29.45 -2.5 -59.4 l31.95 -184.68 q3.99 -22.96 -3.49 -40.43 q-7.49 -17.47 -22.47 -36.43 l-126.77 -133.77
q-24.96 -19.96 -32.45 -50.41 q-7.49 -30.45 6.49 -64.39 q9.98 -28.95 34.94 -49.91 q24.96 -20.97 54.9 -26.96
l171.71 -24.95 q19.96 -1 36.93 -12.98 q16.97 -11.98 26.95 -31.94 l69.88 -159.73 q14.98 -33.94 45.42 -53.91
q30.44 -19.97 69.38 -15.97 q34.94 0 60.39 20.96 q25.45 20.96 35.44 55.9 l76.86 152.74 q9.98 18.96 26.96 32.44
q16.98 13.48 36.93 18.47 l172.7 25.95 q28.95 4.99 51.91 22.96 q22.96 17.97 36.93 46.92 q9.99 28.95 5 59.89
q-5 30.95 -23.96 54.91 l-127.78 133.77 q-14.97 14.97 -22.46 33.94 q-7.49 18.97 -3.49 42.92 l31.94 184.68
q4.99 34.94 -8.49 65.39 q-13.48 30.45 -42.43 50.41 q-13.98 8.98 -32.44 13.98 q-18.47 5 -37.44 5 ZM513.22 817.24
q23.96 0 46.92 5.99 q22.96 5.99 42.93 19.97 l139.75 75.87 q9.99 4.99 15.48 2.99 q5.49 -2 10.48 -2.49
q4.99 -0.5 7.99 -4.99 q3 -4.5 -2 -14.48 l-31.95 -184.68 q-4.99 -47.92 6.49 -87.35 q11.48 -39.43 44.42 -72.37
l127.78 -133.77 q3.99 -4.99 2.5 -9.98 q-1.5 -4.99 -2 -9.48 q-0.5 -4.5 -4.49 -5.49 q-3.99 -1 -8.99 -1 l-171.7 -24.96
q-43.92 -5.99 -79.86 -32.44 q-35.94 -26.45 -60.89 -70.38 l-69.88 -159.72 q0 -8.99 -4 -10.98 q-4 -2 -8.99 -2
q-4.99 0 -9.48 2 q-4.49 1.99 -9.48 10.98 l-69.88 159.72 q-24.96 43.92 -61.39 70.38 q-36.44 26.45 -79.37 32.44
l-172.7 24.96 q-4.99 0 -8.48 3.99 q-3.5 3.99 -3.99 8.98 q-0.49 5 0.5 8.99 q1 3.99 5.99 3.99 l127.78 133.77
q32.94 33.94 44.42 71.88 q11.48 37.93 6.49 80.85 l-25.95 185.68 q0 4.99 1 9.49 q1 4.5 5.99 9.49 q5 4.99 13.48 4.99
q8.49 0 18.47 -4.99 l139.76 -76.87 q10.98 -4.99 31.44 -11.48 q20.47 -6.49 45.42 -7.49 Z",
Fill = "#FF000000"
};
BangumiFollow = new VectorImage
{
Height = 24,
Width = 24,
Data = @"M512 945.07 q-6.15 0 -13.53 -2.46 q-7.39 -2.46 -13.54 -4.92 q-43.07 -32 -190.74 -153.83 q-147.67 -121.83 -211.65 -200.59
q-51.69 -68.91 -67.69 -119.97 q-16 -51.06 -14.77 -116.29 q3.69 -146.44 91.06 -244.88 q87.37 -98.45 220.27 -102.14
q56.6 0 107.67 20.3 q51.07 20.3 92.91 58.46 q41.84 -38.15 92.91 -58.46 q51.07 -20.3 107.67 -20.3
q132.9 3.69 220.27 102.14 q87.37 98.45 91.06 244.88 q1.23 61.53 -14.76 113.21 q-16 51.68 -67.68 123.05
q-63.98 76.3 -212.88 199.36 q-148.9 123.06 -189.51 155.06 q-6.15 2.46 -13.54 4.92 q-7.38 2.46 -13.53 2.46 ZM322.49 78.76
q-97.21 3.69 -168.58 85.52 q-71.37 81.83 -75.07 197.5 q-1.23 35.69 8 79.99 q9.23 44.3 51.07 105.83 q44.3 52.91 163.66 148.9
l210.43 169.81 l210.43 -169.81 q119.36 -95.99 163.66 -148.9 q43.07 -61.53 52.3 -107.06 q9.23 -45.53 6.77 -78.76
q-3.7 -115.67 -75.07 -197.5 q-71.37 -81.83 -168.58 -85.52 q-49.23 0 -87.38 21.53 q-38.14 21.53 -78.75 57.21
q-11.07 8.62 -17.23 10.47 q-6.15 1.84 -6.15 1.84 l-4.92 -1.23 q-6.16 -1.23 -14.77 -7.39 q-43.07 -35.68 -81.83 -58.44
q-38.76 -22.77 -87.99 -23.99 Z",
Fill = "#FF000000"
};
Toview = new VectorImage
{
Height = 24,
Width = 24,
Data = @"M837.18 92.91 q38.96 1 65.44 27.48 q26.48 26.48 27.48 65.43 l0 651.36 q-1 39.96 -27.48 65.94
q-26.48 25.98 -65.44 26.98 l-651.36 0 q-38.96 -1 -65.43 -26.98 q-26.48 -25.98 -27.48 -65.94 l0 -651.36
q1 -38.96 27.48 -65.43 q26.48 -26.48 65.43 -27.48 l651.36 0 ZM837.18 0 l-651.36 0 q-78.92 2 -131.37 54.45
q-52.45 52.45 -54.45 131.37 l0 651.36 q2 78.93 54.45 131.38 q52.45 52.44 131.37 54.44 l651.36 0 q78.93 -2 131.88 -54.44
q52.94 -52.45 54.94 -131.38 l0 -651.36 q-3 -78.92 -55.44 -131.37 q-52.45 -52.45 -131.38 -54.45 ZM697.32 744.27
q-12.99 0 -24.98 -7.99 l-242.76 -159.84 q-20.98 -13.99 -20.98 -38.96 l0 -278.73 q0 -19.98 12.99 -33.47
q12.99 -13.49 32.97 -13.49 q19.98 0 32.96 13.49 q12.99 13.49 13.99 33.47 l0 252.75 l221.78 143.86
q17.99 7.99 24.98 24.98 q6.99 16.99 0 35.96 q-6.99 14.99 -20.98 22.48 q-13.99 7.49 -29.97 5.49 Z",
Fill = "#FF000000"
};
History = new VectorImage
{
Height = 24,
Width = 24,
Data = @"M512 0 q-217 6 -361.5 150.5 q-144.5 144.5 -150.5 361.5 q6 217 150.5 361.5 q144.5 144.5 361.5 150.5
q217 -6 361.5 -150.5 q144.5 -144.5 150.5 -361.5 q-6 -217 -150.5 -361.5 q-144.5 -144.5 -361.5 -150.5 ZM512 939
q-183 -5 -302.5 -124.5 q-119.5 -119.5 -124.5 -302.5 q5 -183 124.5 -302.5 q119.5 -119.5 302.5 -124.5
q183 5 302.5 124.5 q119.5 119.5 124.5 302.5 q-5 183 -124.5 302.5 q-119.5 119.5 -302.5 124.5 ZM512 256
l-85 0 l0 341 l341 0 l0 -85 l-256 0 l0 -256 Z",
Fill = "#FF000000"
};
}
public VectorImage Play { get; private set; }
@ -117,5 +250,15 @@
public VectorImage Folder { get; private set; }
public VectorImage Downloading { get; private set; }
public VectorImage DownloadFinished { get; private set; }
public VectorImage CoinIcon { get; private set; }
public VectorImage MoneyIcon { get; private set; }
public VectorImage BindingEmail { get; private set; }
public VectorImage BindingPhone { get; private set; }
public VectorImage FavoriteOutline { get; private set; }
public VectorImage BangumiFollow { get; private set; }
public VectorImage Toview { get; private set; }
public VectorImage History { get; private set; }
}
}

@ -32,6 +32,12 @@
<system:String x:Key="LoginSuccessful">登录成功!(3秒后自动回到主页)</system:String>
<system:String x:Key="LoginFailed">未保存登录信息!(3秒后自动回到主页)</system:String>
<!-- MySpace -->
<system:String x:Key="MySpace">我的个人空间</system:String>
<system:String x:Key="Logout">退出登录</system:String>
<system:String x:Key="MySpaceWait">请稍等,马上就好~</system:String>
<system:String x:Key="Level">等级</system:String>
<!-- VideoDetail -->
<system:String x:Key="CopyCover">复制封面图片</system:String>
<system:String x:Key="CopyCoverUrl">复制封面URL</system:String>

@ -18,6 +18,9 @@
<SolidColorBrush x:Key="BrushPrimaryTranslucent" Color="{DynamicResource ColorPrimaryTranslucent}" />
<SolidColorBrush x:Key="BrushPrimaryTranslucent2" Color="{DynamicResource ColorPrimaryTranslucent2}" />
<SolidColorBrush x:Key="BrushPrimaryTranslucent3" Color="{DynamicResource ColorPrimaryTranslucent3}" />
<SolidColorBrush x:Key="BrushSecond" Color="{DynamicResource ColorSecond}" />
<SolidColorBrush x:Key="BrushForeground" Color="{DynamicResource ColorForeground}" />
<SolidColorBrush x:Key="BrushBackground" Color="{DynamicResource ColorBackground}" />
<SolidColorBrush x:Key="BrushForegroundDark" Color="{DynamicResource ColorForegroundDark}" />
@ -30,14 +33,20 @@
<SolidColorBrush x:Key="BrushBackgroundGreyTranslucent3" Color="{DynamicResource ColorBackgroundGreyTranslucent3}" />
<SolidColorBrush x:Key="BrushMask" Color="{DynamicResource ColorMask}" />
<SolidColorBrush x:Key="BrushMask100" Color="{DynamicResource ColorMask100}" />
<SolidColorBrush x:Key="BrushTabHeaderGrey" Color="{DynamicResource ColorTabHeaderGrey}" />
<SolidColorBrush x:Key="BrushHeaderGrey" Color="{DynamicResource ColorHeaderGrey}" />
<SolidColorBrush x:Key="BrushBorder" Color="{DynamicResource ColorBorder}" />
<SolidColorBrush x:Key="BrushBorderTranslucent" Color="{DynamicResource ColorBorderTranslucent}" />
<SolidColorBrush x:Key="BrushProgressTrack" Color="{DynamicResource ColorProgressTrack}" />
<SolidColorBrush x:Key="BrushProgressIndicator" Color="{DynamicResource ColorProgressIndicator}" />
<SolidColorBrush x:Key="BrushImageBorder" Color="{DynamicResource ColorImageBorder}" />
<SolidColorBrush x:Key="BrushImageBorder2" Color="{DynamicResource ColorImageBorder2}" />
<SolidColorBrush x:Key="BrushImageBackground" Color="{DynamicResource ColorImageBackground}" />
<SolidColorBrush x:Key="BrushText" Color="{DynamicResource ColorText}" />
@ -45,4 +54,6 @@
<SolidColorBrush x:Key="BrushTextGrey" Color="{DynamicResource ColorTextGrey}" />
<SolidColorBrush x:Key="BrushTextGrey2" Color="{DynamicResource ColorTextGrey2}" />
<SolidColorBrush x:Key="BrushMoney" Color="{DynamicResource ColorMoney}" />
</ResourceDictionary>

@ -18,6 +18,9 @@
<Color x:Key="ColorPrimaryTranslucent">#C800A1D6</Color>
<Color x:Key="ColorPrimaryTranslucent2">#7F00A1D6</Color>
<Color x:Key="ColorPrimaryTranslucent3">#3300A1D6</Color>
<Color x:Key="ColorSecond">#FFFB7299</Color>
<Color x:Key="ColorForeground">#FF00A1D6</Color>
<Color x:Key="ColorBackground">#FFFFFFFF</Color>
<Color x:Key="ColorForegroundDark">#FFFFFFFF</Color>
@ -30,14 +33,20 @@
<Color x:Key="ColorBackgroundGreyTranslucent3">#33BDBDBD</Color>
<Color x:Key="ColorMask">#7F000000</Color>
<Color x:Key="ColorMask100">#33999999</Color>
<Color x:Key="ColorTabHeaderGrey">#FFF4F4F4</Color>
<Color x:Key="ColorHeaderGrey">#FFF4F4F4</Color>
<Color x:Key="ColorBorder">#FF999999</Color>
<Color x:Key="ColorBorderTranslucent">#7F999999</Color>
<Color x:Key="ColorProgressTrack">#FFE4E4E4</Color>
<Color x:Key="ColorProgressIndicator">#FFF3CB85</Color>
<Color x:Key="ColorImageBorder">#7FD0D0D0</Color>
<Color x:Key="ColorImageBorder2">#7FFFFFFF</Color>
<Color x:Key="ColorImageBackground">#7FD0D0D0</Color>
<Color x:Key="ColorText">white</Color>
@ -45,4 +54,6 @@
<Color x:Key="ColorTextGrey">#FF999999</Color>
<Color x:Key="ColorTextGrey2">#FF757575</Color>
<Color x:Key="ColorMoney">#FFFFAE00</Color>
</ResourceDictionary>

@ -15,9 +15,6 @@ namespace DownKyi.Utils
/// <returns></returns>
public static string GetColor(string resourceKey)
{
//Color color = (Color)Application.Current.Resources[resourceKey];
//return color.ToString();
return Application.Current == null ? "#00000000" : ((Color)Application.Current.Resources[resourceKey]).ToString();
}

@ -0,0 +1,29 @@
using DownKyi.Images;
using Prism.Mvvm;
namespace DownKyi.ViewModels.PageViewModels
{
public class SpaceItem : BindableBase
{
private VectorImage image;
public VectorImage Image
{
get => image;
set => SetProperty(ref image, value);
}
private string title;
public string Title
{
get => title;
set => SetProperty(ref title, value);
}
private string subtitle;
public string Subtitle
{
get => subtitle;
set => SetProperty(ref subtitle, value);
}
}
}

@ -1,5 +1,5 @@
using DownKyi.Core.BiliApi.BiliUtils;
using DownKyi.Core.BiliApi.Login;
using DownKyi.Core.BiliApi.Users;
using DownKyi.Core.Logging;
using DownKyi.Core.Settings;
using DownKyi.Core.Settings.Models;
@ -26,69 +26,68 @@ namespace DownKyi.ViewModels
private Visibility loginPanelVisibility;
public Visibility LoginPanelVisibility
{
get { return loginPanelVisibility; }
set { SetProperty(ref loginPanelVisibility, value); }
get => loginPanelVisibility;
set => SetProperty(ref loginPanelVisibility, value);
}
private string userName;
public string UserName
{
get { return userName; }
set { SetProperty(ref userName, value); }
get => userName;
set => SetProperty(ref userName, value);
}
private BitmapImage header;
public BitmapImage Header
{
get { return header; }
set { SetProperty(ref header, value); }
get => header;
set => SetProperty(ref header, value);
}
private VectorImage textLogo;
public VectorImage TextLogo
{
get { return textLogo; }
set { SetProperty(ref textLogo, value); }
get => textLogo;
set => SetProperty(ref textLogo, value);
}
private string inputText;
public string InputText
{
get { return inputText; }
set { SetProperty(ref inputText, value); }
get => inputText;
set => SetProperty(ref inputText, value);
}
private VectorImage generalSearch;
public VectorImage GeneralSearch
{
get { return generalSearch; }
set { SetProperty(ref generalSearch, value); }
get => generalSearch;
set => SetProperty(ref generalSearch, value);
}
private VectorImage settings;
public VectorImage Settings
{
get { return settings; }
set { SetProperty(ref settings, value); }
get => settings;
set => SetProperty(ref settings, value);
}
private VectorImage downloadManager;
public VectorImage DownloadManager
{
get { return downloadManager; }
set { SetProperty(ref downloadManager, value); }
get => downloadManager;
set => SetProperty(ref downloadManager, value);
}
private VectorImage toolbox;
public VectorImage Toolbox
{
get { return toolbox; }
set { SetProperty(ref toolbox, value); }
get => toolbox;
set => SetProperty(ref toolbox, value);
}
#endregion
public ViewIndexViewModel(IEventAggregator eventAggregator) : base(eventAggregator)
{
#region 属性初始化
@ -315,7 +314,7 @@ namespace DownKyi.ViewModels
await Task.Run(new Action(() =>
{
// 获取用户信息
var userInfo = LoginInfo.GetUserInfoForNavigation();
var userInfo = UserInfo.GetUserInfoForNavigation();
if (userInfo != null)
{
SettingsManager.GetInstance().SetUserInfo(new UserInfoSettings

@ -1,10 +1,20 @@
using Prism.Commands;
using DownKyi.Core.BiliApi.Login;
using DownKyi.Core.BiliApi.Users;
using DownKyi.Core.BiliApi.Users.Models;
using DownKyi.Core.Storage;
using DownKyi.CustomControl;
using DownKyi.Events;
using DownKyi.Images;
using DownKyi.Utils;
using DownKyi.ViewModels.PageViewModels;
using Prism.Commands;
using Prism.Events;
using Prism.Mvvm;
using Prism.Regions;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Collections.ObjectModel;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Media.Imaging;
namespace DownKyi.ViewModels
{
@ -13,10 +23,549 @@ namespace DownKyi.ViewModels
public const string Tag = "PageMySpace";
// mid
private long mid;
private long mid = -1;
#region 页面属性申明
private VectorImage arrowBack;
public VectorImage ArrowBack
{
get => arrowBack;
set => SetProperty(ref arrowBack, value);
}
private VectorImage logout;
public VectorImage Logout
{
get => logout;
set => SetProperty(ref logout, value);
}
private GifImage loading;
public GifImage Loading
{
get => loading;
set => SetProperty(ref loading, value);
}
private Visibility noDataVisibility;
public Visibility NoDataVisibility
{
get => noDataVisibility;
set => SetProperty(ref noDataVisibility, value);
}
private Visibility loadingVisibility;
public Visibility LoadingVisibility
{
get => loadingVisibility;
set => SetProperty(ref loadingVisibility, value);
}
private Visibility viewVisibility;
public Visibility ViewVisibility
{
get => viewVisibility;
set => SetProperty(ref viewVisibility, value);
}
private Visibility contentVisibility;
public Visibility ContentVisibility
{
get => contentVisibility;
set => SetProperty(ref contentVisibility, value);
}
private string topNavigationBg;
public string TopNavigationBg
{
get => topNavigationBg;
set => SetProperty(ref topNavigationBg, value);
}
private BitmapImage background;
public BitmapImage Background
{
get => background;
set => SetProperty(ref background, value);
}
private BitmapImage header;
public BitmapImage Header
{
get => header;
set => SetProperty(ref header, value);
}
private string userName;
public string UserName
{
get => userName;
set => SetProperty(ref userName, value);
}
private BitmapImage sex;
public BitmapImage Sex
{
get => sex;
set => SetProperty(ref sex, value);
}
private BitmapImage level;
public BitmapImage Level
{
get => level;
set => SetProperty(ref level, value);
}
private Visibility vipTypeVisibility;
public Visibility VipTypeVisibility
{
get => vipTypeVisibility;
set => SetProperty(ref vipTypeVisibility, value);
}
private string vipType;
public string VipType
{
get => vipType;
set => SetProperty(ref vipType, value);
}
private string sign;
public string Sign
{
get => sign;
set => SetProperty(ref sign, value);
}
private VectorImage coinIcon;
public VectorImage CoinIcon
{
get => coinIcon;
set => SetProperty(ref coinIcon, value);
}
private string coin;
public string Coin
{
get => coin;
set => SetProperty(ref coin, value);
}
private VectorImage moneyIcon;
public VectorImage MoneyIcon
{
get => moneyIcon;
set => SetProperty(ref moneyIcon, value);
}
private string money;
public string Money
{
get => money;
set => SetProperty(ref money, value);
}
private VectorImage bindingEmail;
public VectorImage BindingEmail
{
get => bindingEmail;
set => SetProperty(ref bindingEmail, value);
}
private Visibility bindingEmailVisibility;
public Visibility BindingEmailVisibility
{
get => bindingEmailVisibility;
set => SetProperty(ref bindingEmailVisibility, value);
}
private VectorImage bindingPhone;
public VectorImage BindingPhone
{
get => bindingPhone;
set => SetProperty(ref bindingPhone, value);
}
private Visibility bindingPhoneVisibility;
public Visibility BindingPhoneVisibility
{
get => bindingPhoneVisibility;
set => SetProperty(ref bindingPhoneVisibility, value);
}
private string levelText;
public string LevelText
{
get => levelText;
set => SetProperty(ref levelText, value);
}
private string currentExp;
public string CurrentExp
{
get => currentExp;
set => SetProperty(ref currentExp, value);
}
private int expProgress;
public int ExpProgress
{
get => expProgress;
set => SetProperty(ref expProgress, value);
}
private int maxExp;
public int MaxExp
{
get => maxExp;
set => SetProperty(ref maxExp, value);
}
private ObservableCollection<SpaceItem> statusList;
public ObservableCollection<SpaceItem> StatusList
{
get => statusList;
set => SetProperty(ref statusList, value);
}
private ObservableCollection<SpaceItem> packageList;
public ObservableCollection<SpaceItem> PackageList
{
get => packageList;
set => SetProperty(ref packageList, value);
}
private int selectedPackage;
public int SelectedPackage
{
get => selectedPackage;
set => SetProperty(ref selectedPackage, value);
}
#endregion
public ViewMySpaceViewModel(IEventAggregator eventAggregator) : base(eventAggregator)
{
#region 属性初始化
// 返回按钮
ArrowBack = NavigationIcon.Instance().ArrowBack;
ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark");
// 退出登录按钮
Logout = NavigationIcon.Instance().Logout;
Logout.Fill = DictionaryResource.GetColor("ColorTextDark");
// 初始化loading gif
Loading = new GifImage(Properties.Resources.loading);
Loading.StartAnimate();
TopNavigationBg = "#00FFFFFF"; // 透明
// B站图标
CoinIcon = NormalIcon.Instance().CoinIcon;
CoinIcon.Fill = DictionaryResource.GetColor("ColorPrimary");
MoneyIcon = NormalIcon.Instance().MoneyIcon;
MoneyIcon.Fill = DictionaryResource.GetColor("ColorMoney");
BindingEmail = NormalIcon.Instance().BindingEmail;
BindingEmail.Fill = DictionaryResource.GetColor("ColorPrimary");
BindingPhone = NormalIcon.Instance().BindingPhone;
BindingPhone.Fill = DictionaryResource.GetColor("ColorPrimary");
StatusList = new ObservableCollection<SpaceItem>();
PackageList = new ObservableCollection<SpaceItem>();
#endregion
}
#region 命令申明
// 返回事件
private DelegateCommand backSpaceCommand;
public DelegateCommand BackSpaceCommand => backSpaceCommand ?? (backSpaceCommand = new DelegateCommand(ExecuteBackSpace));
/// <summary>
/// 返回事件
/// </summary>
private void ExecuteBackSpace()
{
NavigationParam parameter = new NavigationParam
{
ViewName = ParentView,
ParentViewName = null,
Parameter = null
};
eventAggregator.GetEvent<NavigationEvent>().Publish(parameter);
}
// 退出登录事件
private DelegateCommand logoutCommand;
public DelegateCommand LogoutCommand => logoutCommand ?? (logoutCommand = new DelegateCommand(ExecuteLogoutCommand));
/// <summary>
/// 退出登录事件
/// </summary>
private void ExecuteLogoutCommand()
{
// 注销
LoginHelper.Logout();
// 返回上一页
NavigationParam parameter = new NavigationParam
{
ViewName = ParentView,
ParentViewName = null,
Parameter = "logout"
};
eventAggregator.GetEvent<NavigationEvent>().Publish(parameter);
}
// 页面选择事件
private DelegateCommand packageListCommand;
public DelegateCommand PackageListCommand => packageListCommand ?? (packageListCommand = new DelegateCommand(ExecutePackageListCommand));
/// <summary>
/// 页面选择事件
/// </summary>
/// <param name="parameter"></param>
private void ExecutePackageListCommand()
{
if (SelectedPackage == -1)
{
return;
}
switch (SelectedPackage)
{
case 0:
Console.WriteLine(SelectedPackage);
break;
case 1:
Console.WriteLine(SelectedPackage);
break;
case 2:
Console.WriteLine(SelectedPackage);
break;
case 3:
Console.WriteLine(SelectedPackage);
break;
default:
break;
}
SelectedPackage = -1;
}
#endregion
/// <summary>
/// 初始化页面
/// </summary>
private void InitView()
{
TopNavigationBg = "#00FFFFFF"; // 透明
ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark");
Logout.Fill = DictionaryResource.GetColor("ColorTextDark");
Background = null;
Header = null;
UserName = "";
Sex = null;
Level = null;
VipTypeVisibility = Visibility.Collapsed;
VipType = "";
Sign = "";
Coin = "0.0";
Money = "0.0";
LevelText = "";
CurrentExp = "--/--";
StatusList.Clear();
StatusList.Add(new SpaceItem { Title = "关注数", Subtitle = "--" });
StatusList.Add(new SpaceItem { Title = "悄悄关注数", Subtitle = "--" });
StatusList.Add(new SpaceItem { Title = "粉丝数", Subtitle = "--" });
StatusList.Add(new SpaceItem { Title = "黑名单数", Subtitle = "--" });
StatusList.Add(new SpaceItem { Title = "节操值", Subtitle = "--" });
StatusList.Add(new SpaceItem { Title = "封禁状态", Subtitle = "N/A" });
PackageList.Clear();
PackageList.Add(new SpaceItem { Image = NormalIcon.Instance().FavoriteOutline, Title = "收藏夹" });
PackageList.Add(new SpaceItem { Image = NormalIcon.Instance().BangumiFollow, Title = "我的订阅" });
PackageList.Add(new SpaceItem { Image = NormalIcon.Instance().Toview, Title = "稍后再看" });
PackageList.Add(new SpaceItem { Image = NormalIcon.Instance().History, Title = "历史记录" });
NormalIcon.Instance().FavoriteOutline.Fill = DictionaryResource.GetColor("ColorPrimary");
NormalIcon.Instance().BangumiFollow.Fill = DictionaryResource.GetColor("ColorPrimary");
NormalIcon.Instance().Toview.Fill = DictionaryResource.GetColor("ColorPrimary");
NormalIcon.Instance().History.Fill = DictionaryResource.GetColor("ColorPrimary");
SelectedPackage = -1;
ContentVisibility = Visibility.Collapsed;
ViewVisibility = Visibility.Collapsed;
LoadingVisibility = Visibility.Visible;
NoDataVisibility = Visibility.Collapsed;
}
/// <summary>
/// 更新用户信息
/// </summary>
private async void UpdateSpaceInfo()
{
bool isNoData = true;
Uri toutuUri = null;
string headerUri = null;
Uri sexUri = null;
Uri levelUri = null;
await Task.Run(() =>
{
// 背景图片
SpaceSettings spaceSettings = UserSpace.GetSpaceSettings(mid);
if (spaceSettings != null)
{
StorageCover storageCover = new StorageCover();
string toutu = storageCover.GetCover($"https://i0.hdslb.com/{spaceSettings.Toutu.Limg}");
toutuUri = new Uri(toutu);
}
else
{
toutuUri = new Uri("pack://application:,,,/Resources/backgound/9-绿荫秘境.png");
}
// 我的用户信息
MyInfo myInfo = UserInfo.GetMyInfo();
if (myInfo != null)
{
isNoData = false;
// 头像
StorageHeader storageHeader = new StorageHeader();
headerUri = storageHeader.GetHeader(mid, myInfo.Name, myInfo.Face);
// 用户名
UserName = myInfo.Name;
// 性别
if (myInfo.Sex == "男")
{
sexUri = new Uri($"pack://application:,,,/Resources/sex/male.png");
}
else if (myInfo.Sex == "女")
{
sexUri = new Uri($"pack://application:,,,/Resources/sex/female.png");
}
// 显示vip信息
if (myInfo.Vip.Label.Text == null || myInfo.Vip.Label.Text == "")
{
VipTypeVisibility = Visibility.Collapsed;
}
else
{
VipTypeVisibility = Visibility.Visible;
VipType = myInfo.Vip.Label.Text;
}
// 等级
levelUri = new Uri($"pack://application:,,,/Resources/level/lv{myInfo.Level}.png");
// 签名
Sign = myInfo.Sign;
// 绑定邮箱&手机
if (myInfo.EmailStatus == 0)
{ BindingEmailVisibility = Visibility.Collapsed; }
if (myInfo.TelStatus == 0)
{ BindingPhoneVisibility = Visibility.Collapsed; }
// 等级
LevelText = $"{DictionaryResource.GetString("Level")}{myInfo.LevelExp.CurrentLevel}";
if (myInfo.LevelExp.NextExp == -1)
{
CurrentExp = $"{myInfo.LevelExp.CurrentExp}/--";
}
else
{
CurrentExp = $"{myInfo.LevelExp.CurrentExp}/{myInfo.LevelExp.NextExp}";
}
// 经验
MaxExp = myInfo.LevelExp.NextExp;
ExpProgress = myInfo.LevelExp.CurrentExp;
// 节操值
StatusList[4].Subtitle = myInfo.Moral.ToString();
// 封禁状态
if (myInfo.Silence == 0)
{ StatusList[5].Subtitle = "正常"; }
else if (myInfo.Silence == 1)
{ StatusList[5].Subtitle = "封停"; }
}
else
{
// 没有数据
isNoData = true;
}
});
if (isNoData)
{
TopNavigationBg = "#00FFFFFF"; // 透明
ArrowBack.Fill = DictionaryResource.GetColor("ColorTextDark");
Logout.Fill = DictionaryResource.GetColor("ColorTextDark");
Background = null;
ViewVisibility = Visibility.Collapsed;
LoadingVisibility = Visibility.Collapsed;
NoDataVisibility = Visibility.Visible;
return;
}
else
{
// 头像
StorageHeader storageHeader = new StorageHeader();
Header = storageHeader.GetHeaderThumbnail(headerUri, 64, 64);
// 性别
Sex = new BitmapImage(sexUri);
// 等级
Level = new BitmapImage(levelUri);
ArrowBack.Fill = DictionaryResource.GetColor("ColorText");
Logout.Fill = DictionaryResource.GetColor("ColorText");
TopNavigationBg = DictionaryResource.GetColor("ColorMask100");
Background = new BitmapImage(toutuUri);
ViewVisibility = Visibility.Visible;
LoadingVisibility = Visibility.Collapsed;
NoDataVisibility = Visibility.Collapsed;
}
await Task.Run(() =>
{
// 导航栏信息
UserInfoForNavigation navData = UserInfo.GetUserInfoForNavigation();
if (navData != null)
{
ContentVisibility = Visibility.Visible;
// 硬币
Coin = navData.Money == 0 ? "0.0" : navData.Money.ToString("F1");
// B币
Money = navData.Wallet.BcoinBalance == 0 ? "0.0" : navData.Wallet.BcoinBalance.ToString("F1");
}
//用户的关系状态数
UserRelationStat relationStat = UserStatus.GetUserRelationStat(mid);
if (relationStat != null)
{
// 关注数
StatusList[0].Subtitle = relationStat.Following.ToString();
// 悄悄关注数
StatusList[1].Subtitle = relationStat.Whisper.ToString();
// 粉丝数
StatusList[2].Subtitle = relationStat.Follower.ToString();
// 黑名单数
StatusList[3].Subtitle = relationStat.Black.ToString();
}
});
}
/// <summary>
@ -34,6 +583,9 @@ namespace DownKyi.ViewModels
return;
}
mid = parameter;
InitView();
UpdateSpaceInfo();
}
}

@ -114,6 +114,7 @@ namespace DownKyi.ViewModels
#region 属性初始化
// 初始化loading gif
Loading = new GifImage(Properties.Resources.loading);
Loading.StartAnimate();
LoadingVisibility = Visibility.Collapsed;

@ -2,9 +2,422 @@
x:Class="DownKyi.Views.ViewMySpace"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:i="http://schemas.microsoft.com/xaml/behaviors"
xmlns:prism="http://prismlibrary.com/"
prism:ViewModelLocator.AutoWireViewModel="True">
<UserControl.Resources>
<Style x:Key="SpaceStyle" TargetType="{x:Type ListBox}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBox}">
<Border
Padding="50,0"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
BorderThickness="{TemplateBinding BorderThickness}">
<UniformGrid Columns="6" IsItemsHost="True" />
</Border>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<Grid>
<TextBlock>我的用户空间</TextBlock>
<Grid Visibility="{Binding ViewVisibility}">
<Grid.RowDefinitions>
<RowDefinition Height="300" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Image
Grid.Row="0"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Source="{Binding Background}"
Stretch="UniformToFill" />
<Grid Grid.Row="0" VerticalAlignment="Bottom">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="20" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<Image
Grid.Column="0"
Width="64"
Height="64"
Source="{Binding Header}">
<Image.Clip>
<!-- 设置图像如何显示 -->
<EllipseGeometry
Center="32,32"
RadiusX="32"
RadiusY="32" />
</Image.Clip>
</Image>
<!-- 添加一个圆框在头像上,做边框 -->
<Ellipse
Grid.Column="0"
Width="66"
Height="66"
HorizontalAlignment="Center"
VerticalAlignment="Center"
Stroke="{DynamicResource BrushImageBorder2}"
StrokeThickness="2" />
<Grid Grid.Column="1">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel
Grid.Row="0"
VerticalAlignment="Center"
Orientation="Horizontal">
<TextBlock
FontSize="20"
FontWeight="Bold"
Foreground="{DynamicResource BrushText}"
Text="{Binding UserName}" />
<Image
Width="18"
Height="18"
Margin="5,0,0,0"
Source="{Binding Sex}" />
<Image
Width="28"
Height="16"
Margin="5,0,0,0"
Source="{Binding Level}" />
<Border
Height="17"
Margin="5,0,0,0"
Padding="5,0"
Background="{DynamicResource BrushSecond}"
CornerRadius="3"
Visibility="{Binding VipTypeVisibility}">
<TextBlock
VerticalAlignment="Center"
FontSize="10"
Foreground="{DynamicResource BrushText}"
Text="{Binding VipType}" />
</Border>
</StackPanel>
<TextBlock
Grid.Row="1"
VerticalAlignment="Center"
FontSize="14"
Foreground="{DynamicResource BrushText}"
Text="{Binding Sign}" />
</Grid>
</Grid>
<!-- 内容 -->
<Grid Grid.Row="1" Visibility="{Binding ContentVisibility}">
<Grid.RowDefinitions>
<RowDefinition Height="2*" />
<RowDefinition Height="3*" />
<RowDefinition Height="3*" />
<RowDefinition Height="1*" />
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<StackPanel
Grid.Row="0"
Margin="20,20,0,0"
VerticalAlignment="Top"
Orientation="Horizontal">
<!-- 硬币&B币 -->
<ContentControl Width="20" Height="20">
<Path
Width="{Binding CoinIcon.Width}"
Height="{Binding CoinIcon.Height}"
Data="{Binding CoinIcon.Data}"
Fill="{Binding CoinIcon.Fill}"
Stretch="Uniform" />
</ContentControl>
<TextBlock
Margin="5,0,0,0"
VerticalAlignment="Center"
Text="{Binding Coin}" />
<ContentControl
Width="20"
Height="20"
Margin="20,0,0,0">
<Path
Width="{Binding MoneyIcon.Width}"
Height="{Binding MoneyIcon.Height}"
Data="{Binding MoneyIcon.Data}"
Fill="{Binding MoneyIcon.Fill}"
Stretch="Uniform" />
</ContentControl>
<TextBlock
Margin="5,0,0,0"
VerticalAlignment="Center"
Text="{Binding Money}" />
<!-- 绑定邮箱&手机 -->
<ContentControl
Width="20"
Height="20"
Margin="20,0,0,0"
ToolTip="已绑定邮箱">
<Path
Width="{Binding BindingEmail.Width}"
Height="{Binding BindingEmail.Height}"
Data="{Binding BindingEmail.Data}"
Fill="{Binding BindingEmail.Fill}"
Stretch="Uniform" />
</ContentControl>
<ContentControl
Width="20"
Height="20"
Margin="5,0,0,0"
ToolTip="已绑定手机">
<Path
Width="{Binding BindingPhone.Width}"
Height="{Binding BindingPhone.Height}"
Data="{Binding BindingPhone.Data}"
Fill="{Binding BindingPhone.Fill}"
Stretch="Uniform" />
</ContentControl>
</StackPanel>
<!-- 等级 -->
<StackPanel
Grid.Column="2"
Margin="20,20,20,0"
Orientation="Vertical">
<Grid>
<TextBlock
HorizontalAlignment="Left"
VerticalAlignment="Center"
FontSize="16"
Foreground="{DynamicResource BrushTextDark}"
Text="{Binding LevelText}" />
<TextBlock
HorizontalAlignment="Right"
VerticalAlignment="Center"
FontSize="12"
Foreground="{DynamicResource BrushTextGrey}"
Text="{Binding CurrentExp}" />
</Grid>
<ProgressBar
Name="nameExpProgress"
Height="2"
Margin="0,5,0,0"
BorderBrush="{x:Null}"
BorderThickness="0"
Maximum="{Binding MaxExp}"
Minimum="0"
Value="{Binding ExpProgress}">
<ProgressBar.Style>
<Style TargetType="{x:Type ProgressBar}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate>
<Grid>
<Border
Name="PART_Track"
Background="{DynamicResource BrushProgressTrack}"
BorderThickness="0" />
<Border
Name="PART_Indicator"
HorizontalAlignment="Left"
Background="{DynamicResource BrushProgressIndicator}"
BorderThickness="0" />
</Grid>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ProgressBar.Style>
</ProgressBar>
</StackPanel>
</Grid>
<ListBox
Grid.Row="1"
BorderBrush="{x:Null}"
BorderThickness="0"
ItemsSource="{Binding StatusList}"
SelectionMode="Single"
Style="{StaticResource SpaceStyle}">
<ListBox.ItemContainerStyle>
<Style TargetType="{x:Type ListBoxItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<StackPanel
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Vertical">
<TextBlock
HorizontalAlignment="Center"
FontSize="16"
Foreground="{DynamicResource BrushTextDark}"
Text="{Binding Subtitle}" />
<TextBlock
Margin="0,15,0,0"
HorizontalAlignment="Center"
FontSize="14"
Foreground="{DynamicResource BrushTextGrey}"
Text="{Binding Title}" />
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.ItemContainerStyle>
</ListBox>
<ListBox
x:Name="namePackageList"
Grid.Row="2"
BorderBrush="{x:Null}"
BorderThickness="0"
ItemsSource="{Binding PackageList}"
SelectedIndex="{Binding SelectedPackage}"
SelectionMode="Single"
Style="{StaticResource SpaceStyle}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction Command="{Binding PackageListCommand}" />
</i:EventTrigger>
</i:Interaction.Triggers>
<ListBox.ItemContainerStyle>
<Style TargetType="{x:Type ListBoxItem}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ListBoxItem}">
<StackPanel
HorizontalAlignment="Center"
VerticalAlignment="Center"
Cursor="Hand"
Orientation="Vertical">
<Border
Width="24"
Height="24"
Background="{DynamicResource BrushBackground}">
<Path
Width="{Binding Image.Width}"
Height="{Binding Image.Height}"
Data="{Binding Image.Data}"
Fill="{Binding Image.Fill}"
Stretch="Uniform" />
</Border>
<TextBlock
Margin="0,15,0,0"
VerticalAlignment="Center"
FontSize="14"
Foreground="{DynamicResource BrushTextGrey}"
Text="{Binding Title}" />
</StackPanel>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ListBox.ItemContainerStyle>
</ListBox>
</Grid>
</Grid>
<!-- 加载gif -->
<StackPanel
HorizontalAlignment="Center"
VerticalAlignment="Center"
Orientation="Vertical"
Visibility="{Binding LoadingVisibility}">
<ContentControl
Width="40"
Height="40"
Content="{Binding Loading}" />
<TextBlock
Margin="0,10,0,0"
FontSize="14"
Foreground="{DynamicResource BrushTextDark}"
Text="{DynamicResource MySpaceWait}" />
</StackPanel>
<!-- 没有数据提示 -->
<Image
Width="256"
Height="256"
Source="/DownKyi;component/Resources/no-data.png"
Visibility="{Binding NoDataVisibility}" />
<!-- 顶部导航 -->
<Grid VerticalAlignment="Top" Background="{Binding TopNavigationBg}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="150" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="150" />
</Grid.ColumnDefinitions>
<Button
Grid.Column="0"
Margin="10,5,0,5"
HorizontalAlignment="Left"
VerticalAlignment="Center"
Command="{Binding BackSpaceCommand}"
Style="{StaticResource ImageBtnStyle}">
<StackPanel Orientation="Horizontal">
<ContentControl Width="24" Height="24">
<Path
Width="{Binding ArrowBack.Width}"
Height="{Binding ArrowBack.Height}"
Data="{Binding ArrowBack.Data}"
Fill="{Binding ArrowBack.Fill}"
Stretch="None" />
</ContentControl>
<TextBlock
VerticalAlignment="Center"
FontSize="16"
Foreground="{Binding ArrowBack.Fill}"
Text="{DynamicResource MySpace}" />
</StackPanel>
</Button>
<Button
Grid.Column="2"
Margin="0,5,10,5"
HorizontalAlignment="Right"
VerticalAlignment="Center"
Command="{Binding LogoutCommand}"
Style="{StaticResource ImageBtnStyle}">
<StackPanel Orientation="Horizontal">
<TextBlock
Margin="10,0"
VerticalAlignment="Center"
FontSize="16"
Foreground="{Binding Logout.Fill}"
Text="{DynamicResource Logout}" />
<ContentControl Width="24" Height="24">
<Path
Width="{Binding Logout.Width}"
Height="{Binding Logout.Height}"
Data="{Binding Logout.Data}"
Fill="{Binding Logout.Fill}"
Stretch="Uniform" />
</ContentControl>
</StackPanel>
</Button>
</Grid>
</Grid>
</UserControl>

Loading…
Cancel
Save