diff --git a/src/DownKyi.Core/Aria2cNet/Server/AriaServer.cs b/src/DownKyi.Core/Aria2cNet/Server/AriaServer.cs index c78853d..513771d 100644 --- a/src/DownKyi.Core/Aria2cNet/Server/AriaServer.cs +++ b/src/DownKyi.Core/Aria2cNet/Server/AriaServer.cs @@ -65,7 +65,7 @@ namespace DownKyi.Core.Aria2cNet.Server try { var stream = File.Open(logFile, FileMode.Open); - if (stream.Length >= 512 * 1024 * 1024L) + if (stream.Length >= 10 * 1024 * 1024L) { stream.SetLength(0); } diff --git a/src/DownKyi.Core/BiliApi/Cheese/CheeseInfo.cs b/src/DownKyi.Core/BiliApi/Cheese/CheeseInfo.cs index d09b9b2..dc14168 100644 --- a/src/DownKyi.Core/BiliApi/Cheese/CheeseInfo.cs +++ b/src/DownKyi.Core/BiliApi/Cheese/CheeseInfo.cs @@ -27,7 +27,7 @@ namespace DownKyi.Core.BiliApi.Cheese try { - var cheese = JsonConvert.DeserializeObject(response); + CheeseViewOrigin cheese = JsonConvert.DeserializeObject(response); if (cheese != null) { return cheese.Data; } else { return null; } } @@ -54,7 +54,7 @@ namespace DownKyi.Core.BiliApi.Cheese try { - var cheese = JsonConvert.DeserializeObject(response); + CheeseEpisodeListOrigin cheese = JsonConvert.DeserializeObject(response); if (cheese != null) { return cheese.Data; } else { return null; } } diff --git a/src/DownKyi.Core/BiliApi/Users/Models/BangumiFollow.cs b/src/DownKyi.Core/BiliApi/Users/Models/BangumiFollow.cs new file mode 100644 index 0000000..81d9b57 --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/Models/BangumiFollow.cs @@ -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 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 + } +} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/BangumiFollowAreas.cs b/src/DownKyi.Core/BiliApi/Users/Models/BangumiFollowAreas.cs new file mode 100644 index 0000000..56b7135 --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/Models/BangumiFollowAreas.cs @@ -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; } + } +} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/BangumiFollowNewEp.cs b/src/DownKyi.Core/BiliApi/Users/Models/BangumiFollowNewEp.cs new file mode 100644 index 0000000..a3d9060 --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/Models/BangumiFollowNewEp.cs @@ -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; } + } +} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/BangumiFollowOrigin.cs b/src/DownKyi.Core/BiliApi/Users/Models/BangumiFollowOrigin.cs new file mode 100644 index 0000000..8690651 --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/Models/BangumiFollowOrigin.cs @@ -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 List { get; set; } + [JsonProperty("pn")] + public int Pn { get; set; } + [JsonProperty("ps")] + public int Ps { get; set; } + [JsonProperty("total")] + public int Total { get; set; } + } + +} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/BangumiType.cs b/src/DownKyi.Core/BiliApi/Users/Models/BangumiType.cs new file mode 100644 index 0000000..a8480e5 --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/Models/BangumiType.cs @@ -0,0 +1,8 @@ +namespace DownKyi.Core.BiliApi.Users.Models +{ + public enum BangumiType + { + ANIME = 1, // 番剧 + EPISODE = 2 // 剧集、电影 + } +} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/FollowingGroup.cs b/src/DownKyi.Core/BiliApi/Users/Models/FollowingGroup.cs new file mode 100644 index 0000000..22267b3 --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/Models/FollowingGroup.cs @@ -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 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; } + } + +} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/FollowingGroupContent.cs b/src/DownKyi.Core/BiliApi/Users/Models/FollowingGroupContent.cs new file mode 100644 index 0000000..7f1597f --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/Models/FollowingGroupContent.cs @@ -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 Data { get; set; } + } + +} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/FollowingOrder.cs b/src/DownKyi.Core/BiliApi/Users/Models/FollowingOrder.cs new file mode 100644 index 0000000..a480070 --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/Models/FollowingOrder.cs @@ -0,0 +1,8 @@ +namespace DownKyi.Core.BiliApi.Users.Models +{ + public enum FollowingOrder + { + DEFAULT = 1, // 按照关注顺序排列,默认 + ATTENTION // 按照最常访问排列 + } +} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/MyInfo.cs b/src/DownKyi.Core/BiliApi/Users/Models/MyInfo.cs new file mode 100644 index 0000000..0141dcf --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/Models/MyInfo.cs @@ -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; } + } +} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/NicknameStatus.cs b/src/DownKyi.Core/BiliApi/Users/Models/NicknameStatus.cs new file mode 100644 index 0000000..3257b56 --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/Models/NicknameStatus.cs @@ -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; } + } +} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/PublicationOrder.cs b/src/DownKyi.Core/BiliApi/Users/Models/PublicationOrder.cs new file mode 100644 index 0000000..380fa87 --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/Models/PublicationOrder.cs @@ -0,0 +1,9 @@ +namespace DownKyi.Core.BiliApi.Users.Models +{ + public enum PublicationOrder + { + PUBDATE = 1, // 最新发布,默认 + CLICK, // 最多播放 + STOW // 最多收藏 + } +} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/RelationBlack.cs b/src/DownKyi.Core/BiliApi/Users/Models/RelationBlack.cs new file mode 100644 index 0000000..95205cc --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/Models/RelationBlack.cs @@ -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 Data { get; set; } + } +} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/RelationFollow.cs b/src/DownKyi.Core/BiliApi/Users/Models/RelationFollow.cs new file mode 100644 index 0000000..4911ffc --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/Models/RelationFollow.cs @@ -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 List { get; set; } + //[JsonProperty("re_version")] + //public long reVersion { get; set; } + [JsonProperty("total")] + public int Total { get; set; } + } + +} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/RelationFollowInfo.cs b/src/DownKyi.Core/BiliApi/Users/Models/RelationFollowInfo.cs new file mode 100644 index 0000000..0548df8 --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/Models/RelationFollowInfo.cs @@ -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 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 + } +} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/RelationWhisper.cs b/src/DownKyi.Core/BiliApi/Users/Models/RelationWhisper.cs new file mode 100644 index 0000000..19e1b4d --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/Models/RelationWhisper.cs @@ -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 Data { get; set; } + } + +} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpaceChannel.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpaceChannel.cs new file mode 100644 index 0000000..6e7f635 --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/Models/SpaceChannel.cs @@ -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 List { get; set; } + } +} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpaceChannelArchive.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpaceChannelArchive.cs new file mode 100644 index 0000000..8a4a068 --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/Models/SpaceChannelArchive.cs @@ -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 + } +} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpaceChannelArchiveStat.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpaceChannelArchiveStat.cs new file mode 100644 index 0000000..6845276 --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/Models/SpaceChannelArchiveStat.cs @@ -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; } + } +} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpaceChannelList.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpaceChannelList.cs new file mode 100644 index 0000000..d2164f1 --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/Models/SpaceChannelList.cs @@ -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 + } +} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpaceChannelVideo.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpaceChannelVideo.cs new file mode 100644 index 0000000..9c27763 --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/Models/SpaceChannelVideo.cs @@ -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; } + } +} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpaceChannelVideoList.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpaceChannelVideoList.cs new file mode 100644 index 0000000..fed996b --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/Models/SpaceChannelVideoList.cs @@ -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 Archives { get; set; } + } +} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpaceChannelVideoPage.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpaceChannelVideoPage.cs new file mode 100644 index 0000000..5bcd872 --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/Models/SpaceChannelVideoPage.cs @@ -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; } + } +} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpaceCheese.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpaceCheese.cs new file mode 100644 index 0000000..9d0b5d0 --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/Models/SpaceCheese.cs @@ -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; } + } +} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpaceCheeseOrigin.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpaceCheeseOrigin.cs new file mode 100644 index 0000000..36c2ef1 --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/Models/SpaceCheeseOrigin.cs @@ -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 Items { get; set; } + [JsonProperty("page")] + public SpaceCheesePage Page { get; set; } + } +} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpaceCheesePage.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpaceCheesePage.cs new file mode 100644 index 0000000..8ad28d5 --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/Models/SpaceCheesePage.cs @@ -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; } + } +} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpacePublication.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpacePublication.cs new file mode 100644 index 0000000..23f007b --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/Models/SpacePublication.cs @@ -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; } + } + +} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpacePublicationList.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpacePublicationList.cs new file mode 100644 index 0000000..7bf26b8 --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/Models/SpacePublicationList.cs @@ -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 Vlist { get; set; } + } +} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpacePublicationListType.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpacePublicationListType.cs new file mode 100644 index 0000000..6e88c75 --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/Models/SpacePublicationListType.cs @@ -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; } + } +} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpacePublicationListTypeVideoZone.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpacePublicationListTypeVideoZone.cs new file mode 100644 index 0000000..2349c3a --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/Models/SpacePublicationListTypeVideoZone.cs @@ -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; } + } +} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpacePublicationListVideo.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpacePublicationListVideo.cs new file mode 100644 index 0000000..d5b91f7 --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/Models/SpacePublicationListVideo.cs @@ -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; } + } +} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpacePublicationPage.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpacePublicationPage.cs new file mode 100644 index 0000000..0b94e73 --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/Models/SpacePublicationPage.cs @@ -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; } + } +} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpaceSettings.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpaceSettings.cs new file mode 100644 index 0000000..b3fc6af --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/Models/SpaceSettings.cs @@ -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; } + } +} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/SpaceSettingsToutu.cs b/src/DownKyi.Core/BiliApi/Users/Models/SpaceSettingsToutu.cs new file mode 100644 index 0000000..a89c583 --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/Models/SpaceSettingsToutu.cs @@ -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; } + } +} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/UpStat.cs b/src/DownKyi.Core/BiliApi/Users/Models/UpStat.cs new file mode 100644 index 0000000..6cb1d28 --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/Models/UpStat.cs @@ -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; } // 视频/文章播放量 + } +} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/UserInfoForNavigation.cs b/src/DownKyi.Core/BiliApi/Users/Models/UserInfoForNavigation.cs new file mode 100644 index 0000000..0801dd3 --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/Models/UserInfoForNavigation.cs @@ -0,0 +1,108 @@ +using DownKyi.Core.BiliApi.Models; +using Newtonsoft.Json; + +namespace DownKyi.Core.BiliApi.Users.Models +{ + // https://api.bilibili.com/x/web-interface/nav + [JsonObject] + public class UserInfoForNavigationOrigin : BaseModel + { + //[JsonProperty("code")] + //public int Code { get; set; } + [JsonProperty("data")] + public UserInfoForNavigation Data { get; set; } + //[JsonProperty("message")] + //public string Message { get; set; } + //[JsonProperty("ttl")] + //public int Ttl { get; set; } + } + + [JsonObject] + public class UserInfoForNavigation : BaseModel + { + //public int allowance_count { get; set; } + //public int answer_status { get; set; } + //public int email_verified { get; set; } + [JsonProperty("face")] + public string Face { get; set; } + //public bool has_shop { get; set; } + [JsonProperty("isLogin")] + public bool IsLogin { get; set; } + //public NavDataLevelInfo level_info { get; set; } + [JsonProperty("mid")] + public long Mid { get; set; } + //public int mobile_verified { get; set; } + [JsonProperty("money")] + public float Money { get; set; } + //public int moral { get; set; } + //public NavDataOfficial official { get; set; } + //public NavDataOfficialVerify officialVerify { get; set; } + //public NavDataPendant pendant { get; set; } + //public int scores { get; set; } + //public string shop_url { get; set; } + [JsonProperty("uname")] + public string Name { get; set; } + //public long vipDueDate { get; set; } + [JsonProperty("vipStatus")] + public int VipStatus { get; set; } + //public int vipType { get; set; } + //public int vip_avatar_subscript { get; set; } + //public NavDataVipLabel vip_label { get; set; } + //public string vip_nickname_color { get; set; } + //public int vip_pay_type { get; set; } + //public int vip_theme_type { get; set; } + [JsonProperty("wallet")] + public UserInfoWallet Wallet { get; set; } + } + + //public class NavDataLevelInfo + //{ + // public int current_exp { get; set; } + // public int current_level { get; set; } + // public int current_min { get; set; } + // //public int next_exp { get; set; } // 当等级为6时,next_exp为string类型,值为"--" + //} + + //public class NavDataOfficial + //{ + // public string desc { get; set; } + // public int role { get; set; } + // public string title { get; set; } + // public int type { get; set; } + //} + + //public class NavDataOfficialVerify + //{ + // public string desc { get; set; } + // public int type { get; set; } + //} + + //public class NavDataPendant + //{ + // public int expire { get; set; } + // public string image { get; set; } + // public string image_enhance { get; set; } + // public string name { get; set; } + // public int pid { get; set; } + //} + + //public class NavDataVipLabel + //{ + // public string label_theme { get; set; } + // public string path { get; set; } + // public string text { get; set; } + //} + + [JsonObject] + public class UserInfoWallet : BaseModel + { + [JsonProperty("bcoin_balance")] + public float BcoinBalance { get; set; } + [JsonProperty("coupon_balance")] + public float CouponBalance { get; set; } + [JsonProperty("coupon_due_time")] + public long CouponDueTime { get; set; } + [JsonProperty("mid")] + public long Mid { get; set; } + } +} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/UserInfoForSpace.cs b/src/DownKyi.Core/BiliApi/Users/Models/UserInfoForSpace.cs new file mode 100644 index 0000000..4545d56 --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/Models/UserInfoForSpace.cs @@ -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; } + // ... + } + +} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/UserInfoLevelExp.cs b/src/DownKyi.Core/BiliApi/Users/Models/UserInfoLevelExp.cs new file mode 100644 index 0000000..ba8193d --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/Models/UserInfoLevelExp.cs @@ -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; } + } +} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/UserInfoVip.cs b/src/DownKyi.Core/BiliApi/Users/Models/UserInfoVip.cs new file mode 100644 index 0000000..0ece787 --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/Models/UserInfoVip.cs @@ -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 + } + +} diff --git a/src/DownKyi.Core/BiliApi/Users/Models/UserRelationStat.cs b/src/DownKyi.Core/BiliApi/Users/Models/UserRelationStat.cs new file mode 100644 index 0000000..076e4c4 --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/Models/UserRelationStat.cs @@ -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; } // 粉丝数 + } +} diff --git a/src/DownKyi.Core/BiliApi/Users/Nickname.cs b/src/DownKyi.Core/BiliApi/Users/Nickname.cs new file mode 100644 index 0000000..80da154 --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/Nickname.cs @@ -0,0 +1,38 @@ +using DownKyi.Core.BiliApi.Users.Models; +using DownKyi.Core.Logging; +using Newtonsoft.Json; +using System; + +namespace DownKyi.Core.BiliApi.Users +{ + /// + /// 用户昵称 + /// + public class Nickname + { + /// + /// 检查昵称 + /// + /// + /// + 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(response); + return nickname; + } + catch (Exception e) + { + Utils.Debugging.Console.PrintLine("CheckNickname()发生异常: {0}", e); + LogManager.Error("Nickname", e); + return null; + } + } + + } +} diff --git a/src/DownKyi.Core/BiliApi/Users/UserInfo.cs b/src/DownKyi.Core/BiliApi/Users/UserInfo.cs new file mode 100644 index 0000000..30971a0 --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/UserInfo.cs @@ -0,0 +1,89 @@ +using DownKyi.Core.BiliApi.Users.Models; +using DownKyi.Core.Logging; +using Newtonsoft.Json; +using System; + +namespace DownKyi.Core.BiliApi.Users +{ + /// + /// 用户基本信息 + /// + public static class UserInfo + { + /// + /// 导航栏用户信息 + /// + /// + 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(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; + } + } + + /// + /// 用户空间详细信息 + /// + /// + /// + 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(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; + } + } + + /// + /// 本用户详细信息 + /// + /// + 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(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; + } + } + + } +} diff --git a/src/DownKyi.Core/BiliApi/Users/UserRelation.cs b/src/DownKyi.Core/BiliApi/Users/UserRelation.cs new file mode 100644 index 0000000..d6c4c96 --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/UserRelation.cs @@ -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 +{ + /// + /// 用户关系相关 + /// + public static class UserRelation + { + + /// + /// 查询用户粉丝明细 + /// + /// 目标用户UID + /// 页码 + /// 每页项数 + /// + 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(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; + } + } + + /// + /// 查询用户所有的粉丝明细 + /// + /// 目标用户UID + /// + public static List GetAllFollowers(long mid) + { + List result = new List(); + + 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; + } + + /// + /// 查询用户关注明细 + /// + /// 目标用户UID + /// 页码 + /// 每页项数 + /// 排序方式 + /// + 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(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; + } + } + + /// + /// 查询用户所有的关注明细 + /// + /// 目标用户UID + /// 排序方式 + /// + public static List GetAllFollowings(long mid, FollowingOrder order = FollowingOrder.DEFAULT) + { + List result = new List(); + + 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; + } + + /// + /// 查询悄悄关注明细 + /// + /// 页码 + /// 每页项数 + /// + public static List 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(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; + } + } + + /// + /// 查询黑名单明细 + /// + /// 页码 + /// 每页项数 + /// + public static List 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(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 关注分组相关,只能查询当前登录账户的信息 + + /// + /// 查询关注分组列表 + /// + /// + public static List 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(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; + } + } + + /// + /// 查询关注分组明细 + /// + /// 分组ID + /// 页数 + /// 每页项数 + /// 排序方式 + /// + public static List 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(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; + } + } + + /// + /// 查询所有的关注分组明细 + /// + /// 分组ID + /// 排序方式 + /// + public static List GetAllFollowingGroupContent(int tagId, FollowingOrder order = FollowingOrder.DEFAULT) + { + List result = new List(); + + 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 + + } +} diff --git a/src/DownKyi.Core/BiliApi/Users/UserSpace.cs b/src/DownKyi.Core/BiliApi/Users/UserSpace.cs new file mode 100644 index 0000000..ce85ee6 --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/UserSpace.cs @@ -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 +{ + /// + /// 用户空间信息 + /// + public static class UserSpace + { + /// + /// 查询空间设置 + /// + /// + /// + 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(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 投稿 + + /// + /// 获取用户投稿视频的所有分区 + /// + /// 用户id + /// + public static List GetPublicationType(long mid) + { + int pn = 1; + int ps = 1; + SpacePublicationList publication = GetPublication(mid, pn, ps); + return GetPublicationType(publication); + } + + /// + /// 获取用户投稿视频的所有分区 + /// + /// 用户id + /// + public static List GetPublicationType(SpacePublicationList publication) + { + if (publication == null || publication.Tlist == null) + { + return null; + } + + List result = new List(); + JObject typeList = JObject.Parse(publication.Tlist.ToString("N")); + foreach (KeyValuePair item in typeList) + { + SpacePublicationListTypeVideoZone value = JsonConvert.DeserializeObject(item.Value.ToString()); + result.Add(value); + } + return result; + } + + /// + /// 查询用户所有的投稿视频明细 + /// + /// 用户id + /// 排序 + /// 视频分区 + /// 搜索关键词 + /// + public static List GetAllPublication(long mid, int tid = 0, PublicationOrder order = PublicationOrder.PUBDATE, string keyword = "") + { + List result = new List(); + + 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; + } + + /// + /// 查询用户投稿视频明细 + /// + /// 用户id + /// 页码 + /// 每页的视频数 + /// 排序 + /// 视频分区 + /// 搜索关键词 + /// + 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(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 频道 + + /// + /// 查询用户频道列表 + /// + /// 用户id + /// + public static List 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(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; + } + } + + /// + /// 查询用户频道中的所有视频 + /// + /// + /// + /// + public static List GetAllChannelVideoList(long mid, long cid) + { + List result = new List(); + + int i = 0; + while (true) + { + i++; + int ps = 100; + + List data = GetChannelVideoList(mid, cid, i, ps); + if (data == null || data.Count == 0) + { break; } + + result.AddRange(data); + } + return result; + } + + /// + /// 查询用户频道中的视频 + /// + /// + /// + /// + /// + /// + public static List 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(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 课程 + + /// + /// 查询用户发布的课程列表 + /// + /// 目标用户UID + /// 页码 + /// 每页项数 + /// + public static List 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(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; + } + } + + /// + /// 查询用户发布的所有课程列表 + /// + /// 目标用户UID + /// + public static List GetAllCheese(long mid) + { + List result = new List(); + + int i = 0; + while (true) + { + i++; + int ps = 50; + + List data = GetCheese(mid, i, ps); + if (data == null || data.Count == 0) + { break; } + + result.AddRange(data); + } + return result; + } + + #endregion + + #region 订阅 + + /// + /// 查询用户追番(追剧)明细 + /// + /// 目标用户UID + /// 查询类型 + /// 页码 + /// 每页项数 + /// + 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(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; + } + } + + /// + /// 查询用户所有的追番(追剧)明细 + /// + /// 目标用户UID + /// 查询类型 + /// + public static List GetAllBangumiFollow(long mid, BangumiType type) + { + List result = new List(); + + 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 + + } +} diff --git a/src/DownKyi.Core/BiliApi/Users/UserStatus.cs b/src/DownKyi.Core/BiliApi/Users/UserStatus.cs new file mode 100644 index 0000000..a1485db --- /dev/null +++ b/src/DownKyi.Core/BiliApi/Users/UserStatus.cs @@ -0,0 +1,66 @@ +using DownKyi.Core.BiliApi.Users.Models; +using DownKyi.Core.Logging; +using Newtonsoft.Json; +using System; + +namespace DownKyi.Core.BiliApi.Users +{ + /// + /// 用户状态数 + /// + public static class UserStatus + { + /// + /// 关系状态数 + /// + /// + /// + 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(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; + } + } + + /// + /// UP主状态数 + /// + /// 注:该接口需要任意用户登录,否则不会返回任何数据 + /// + /// + /// + 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(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; + } + } + + } +} diff --git a/src/DownKyi.Core/BiliApi/Zone/VideoZone.cs b/src/DownKyi.Core/BiliApi/Zone/VideoZone.cs index 038a120..0ebd65e 100644 --- a/src/DownKyi.Core/BiliApi/Zone/VideoZone.cs +++ b/src/DownKyi.Core/BiliApi/Zone/VideoZone.cs @@ -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)); //具有一定制作程度的动画或静画的二次创作视频 diff --git a/src/DownKyi.Core/Danmaku2Ass/Display.cs b/src/DownKyi.Core/Danmaku2Ass/Display.cs index e83f48f..6e26576 100644 --- a/src/DownKyi.Core/Danmaku2Ass/Display.cs +++ b/src/DownKyi.Core/Danmaku2Ass/Display.cs @@ -204,7 +204,7 @@ namespace DownKyi.Core.Danmaku2Ass { public TopDisplay(Config config, Danmaku danmaku) : base(config, danmaku) { - Console.WriteLine("TopDisplay constructor."); + //Console.WriteLine("TopDisplay constructor."); } /// @@ -226,7 +226,7 @@ namespace DownKyi.Core.Danmaku2Ass { public BottomDisplay(Config config, Danmaku danmaku) : base(config, danmaku) { - Console.WriteLine("BottomDisplay constructor."); + //Console.WriteLine("BottomDisplay constructor."); } /// @@ -253,7 +253,7 @@ namespace DownKyi.Core.Danmaku2Ass public ScrollDisplay(Config config, Danmaku danmaku) : base() { - Console.WriteLine("ScrollDisplay constructor."); + //Console.WriteLine("ScrollDisplay constructor."); Config = config; Danmaku = danmaku; diff --git a/src/DownKyi.Core/Danmaku2Ass/Producer.cs b/src/DownKyi.Core/Danmaku2Ass/Producer.cs index 42e0ae3..068c1a0 100644 --- a/src/DownKyi.Core/Danmaku2Ass/Producer.cs +++ b/src/DownKyi.Core/Danmaku2Ass/Producer.cs @@ -49,16 +49,16 @@ namespace DownKyi.Core.Danmaku2Ass public void ApplyFilter() { Dictionary filterDetail = new Dictionary() { - { "top_filter",0}, - { "bottom_filter",0}, - { "scroll_filter",0}, + { "top_filter", 0}, + { "bottom_filter", 0}, + { "scroll_filter", 0}, //{ "custom_filter",0} }; List danmakus = Danmakus; //string[] orders = { "top_filter", "bottom_filter", "scroll_filter", "custom_filter" }; string[] orders = { "top_filter", "bottom_filter", "scroll_filter" }; - foreach (var name in orders) + foreach (string name in orders) { Filter filter; try diff --git a/src/DownKyi.Core/DownKyi.Core.csproj b/src/DownKyi.Core/DownKyi.Core.csproj index 52019d0..a5cb204 100644 --- a/src/DownKyi.Core/DownKyi.Core.csproj +++ b/src/DownKyi.Core/DownKyi.Core.csproj @@ -153,19 +153,61 @@ - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/DownKyi/DownKyi.csproj b/src/DownKyi/DownKyi.csproj index 73f09d2..d3f6769 100644 --- a/src/DownKyi/DownKyi.csproj +++ b/src/DownKyi/DownKyi.csproj @@ -93,8 +93,10 @@ + + @@ -459,6 +461,19 @@ + + + + + + + + + + + + + PreserveNewest diff --git a/src/DownKyi/Images/ButtonIcon.cs b/src/DownKyi/Images/ButtonIcon.cs index d747936..e4a3c8a 100644 --- a/src/DownKyi/Images/ButtonIcon.cs +++ b/src/DownKyi/Images/ButtonIcon.cs @@ -69,6 +69,17 @@ Fill = "#FF000000" }; + Trash = new VectorImage + { + Height = 20, + Width = 20, + Data = @"M683 85 q0 -27 -20.5 -55 q-20.5 -28 -65.5 -30 l-170 0 q-39 1 -62 23.5 q-23 22.5 -24 61.5 l-341 0 l0 86 l1024 0 l0 -86 + l-341 0 ZM341 256 l86 0 l0 597 l-86 0 l0 -597 ZM597 256 l86 0 l0 597 l-86 0 l0 -597 ZM853 853 q0 39 -23 62 + q-23 23 -62 24 l-512 0 q-39 -1 -62 -24 q-23 -23 -23 -62 l0 -597 l-86 0 l0 597 q2 73 50.5 121 q48.5 48 120.5 50 l512 0 + q72 -2 120.5 -50 q48.5 -48 50.5 -121 l0 -597 l-86 0 l0 597 Z", + Fill = "#FF000000" + }; + Delete = new VectorImage { Height = 18, @@ -103,6 +114,30 @@ Fill = "#FF000000" }; + Retry = new VectorImage + { + Height = 20, + Width = 20, + Data = @"M536.69 128.65 q-161.14 5.2 -270.3 113.71 q-109.15 108.5 -113.05 269.64 q3.9 161.14 113.05 269.64 + q109.16 108.5 270.3 113.71 q101.36 -1.3 185.82 -47.43 q84.47 -46.13 140.35 -129.3 q6.5 -14.3 22.09 -24.7 + q15.6 -10.39 31.19 -10.39 q28.59 0 47.44 18.85 q18.84 18.85 20.14 48.74 q0 11.69 -5.2 20.79 q0 3.9 0 7.8 l-3.9 5.19 + q-72.77 111.76 -185.82 174.78 q-113.06 63.03 -246.91 64.33 q-102.66 0 -196.22 -38.34 q-93.57 -38.33 -166.34 -111.11 + q-72.77 -72.77 -111.1 -166.34 q-38.33 -93.56 -38.33 -196.22 q0 -102.66 38.33 -196.23 q38.34 -93.56 111.1 -166.33 + q72.77 -72.77 166.34 -111.1 q93.56 -38.34 196.22 -38.34 q92.26 0 176.73 31.19 q84.47 31.19 152.04 89.66 l0 -25.99 + q1.3 -27.29 18.2 -44.83 q16.89 -17.54 42.88 -17.54 q25.99 0 44.18 18.19 q18.19 18.19 18.19 44.18 l0 189.73 + q0 24.69 -18.19 42.88 q-18.19 18.19 -42.88 18.19 l-191.03 0 q-24.69 0 -42.88 -18.19 q-18.2 -18.19 -18.2 -42.88 + q0 -28.59 16.25 -47.43 q16.25 -18.84 44.84 -20.13 l37.69 0 q-51.98 -42.89 -114.36 -65.63 q-62.38 -22.74 -128.65 -22.74 Z", + Fill = "#FF000000" + }; + + Folder = new VectorImage + { + Height = 16, + Width = 20, + Data = @"M18,2H10L8,0H2A2,2,0,0,0,0,2V14a2,2,0,0,0,2,2H18a2,2,0,0,0,2-2V4A2,2,0,0,0,18,2Zm0,12H2V4H18Z", + Fill = "#FF000000" + }; + } public VectorImage GeneralSearch { get; private set; } @@ -110,9 +145,12 @@ public VectorImage DownloadManage { get; private set; } public VectorImage Toolbox { get; private set; } + public VectorImage Trash { get; private set; } public VectorImage Delete { get; private set; } public VectorImage Start { get; private set; } public VectorImage Pause { get; private set; } + public VectorImage Retry { get; private set; } + public VectorImage Folder { get; private set; } } } diff --git a/src/DownKyi/Images/NavigationIcon.cs b/src/DownKyi/Images/NavigationIcon.cs index bdbe329..235d37a 100644 --- a/src/DownKyi/Images/NavigationIcon.cs +++ b/src/DownKyi/Images/NavigationIcon.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; } } } diff --git a/src/DownKyi/Images/NormalIcon.cs b/src/DownKyi/Images/NormalIcon.cs index d785fc1..d1388b3 100644 --- a/src/DownKyi/Images/NormalIcon.cs +++ b/src/DownKyi/Images/NormalIcon.cs @@ -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" + }; + + Subscription = 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 Subscription { get; private set; } + public VectorImage ToView { get; private set; } + public VectorImage History { get; private set; } } } diff --git a/src/DownKyi/Languages/Default.xaml b/src/DownKyi/Languages/Default.xaml index 565c157..2362811 100644 --- a/src/DownKyi/Languages/Default.xaml +++ b/src/DownKyi/Languages/Default.xaml @@ -32,6 +32,25 @@ 登录成功!(3秒后自动回到主页) 未保存登录信息!(3秒后自动回到主页) + + 我的个人空间 + 退出登录 + 请稍等,马上就好~ + 等级 + 关注数 + 悄悄关注数 + 粉丝数 + 黑名单数 + 节操值 + 封禁状态 + 收藏夹 + 我的订阅 + 稍后再看 + 历史记录 + + 正常 + 封停 + 复制封面图片 复制封面URL @@ -84,6 +103,7 @@ 混流中…… 暂停中…… 等待中…… + 下载失败 正在下载 个视频! @@ -97,6 +117,13 @@ 按序号排序 清空所有记录 + 开始 + 暂停 + 重试 + 移除 + 打开文件夹 + 播放 + 按回车键应用设置 @@ -213,7 +240,7 @@ 提取视频 - 收藏夹 + 收藏夹 个内容 diff --git a/src/DownKyi/Resources/backgound/9-绿荫秘境.png b/src/DownKyi/Resources/backgound/9-绿荫秘境.png new file mode 100644 index 0000000..dcc5c10 Binary files /dev/null and b/src/DownKyi/Resources/backgound/9-绿荫秘境.png differ diff --git a/src/DownKyi/Resources/level/lv0.png b/src/DownKyi/Resources/level/lv0.png new file mode 100644 index 0000000..e7a5ae1 Binary files /dev/null and b/src/DownKyi/Resources/level/lv0.png differ diff --git a/src/DownKyi/Resources/level/lv1.png b/src/DownKyi/Resources/level/lv1.png new file mode 100644 index 0000000..510b9b2 Binary files /dev/null and b/src/DownKyi/Resources/level/lv1.png differ diff --git a/src/DownKyi/Resources/level/lv2.png b/src/DownKyi/Resources/level/lv2.png new file mode 100644 index 0000000..bf66798 Binary files /dev/null and b/src/DownKyi/Resources/level/lv2.png differ diff --git a/src/DownKyi/Resources/level/lv3.png b/src/DownKyi/Resources/level/lv3.png new file mode 100644 index 0000000..f08ca24 Binary files /dev/null and b/src/DownKyi/Resources/level/lv3.png differ diff --git a/src/DownKyi/Resources/level/lv4.png b/src/DownKyi/Resources/level/lv4.png new file mode 100644 index 0000000..1e09484 Binary files /dev/null and b/src/DownKyi/Resources/level/lv4.png differ diff --git a/src/DownKyi/Resources/level/lv5.png b/src/DownKyi/Resources/level/lv5.png new file mode 100644 index 0000000..8276e09 Binary files /dev/null and b/src/DownKyi/Resources/level/lv5.png differ diff --git a/src/DownKyi/Resources/level/lv6.png b/src/DownKyi/Resources/level/lv6.png new file mode 100644 index 0000000..f2e6645 Binary files /dev/null and b/src/DownKyi/Resources/level/lv6.png differ diff --git a/src/DownKyi/Resources/level/lv7.png b/src/DownKyi/Resources/level/lv7.png new file mode 100644 index 0000000..224ff01 Binary files /dev/null and b/src/DownKyi/Resources/level/lv7.png differ diff --git a/src/DownKyi/Resources/level/lv8.png b/src/DownKyi/Resources/level/lv8.png new file mode 100644 index 0000000..9eca702 Binary files /dev/null and b/src/DownKyi/Resources/level/lv8.png differ diff --git a/src/DownKyi/Resources/level/lv9.png b/src/DownKyi/Resources/level/lv9.png new file mode 100644 index 0000000..8aac354 Binary files /dev/null and b/src/DownKyi/Resources/level/lv9.png differ diff --git a/src/DownKyi/Resources/sex/female.png b/src/DownKyi/Resources/sex/female.png new file mode 100644 index 0000000..abffaa5 Binary files /dev/null and b/src/DownKyi/Resources/sex/female.png differ diff --git a/src/DownKyi/Resources/sex/male.png b/src/DownKyi/Resources/sex/male.png new file mode 100644 index 0000000..3c3044c Binary files /dev/null and b/src/DownKyi/Resources/sex/male.png differ diff --git a/src/DownKyi/Services/Download/AriaDownloadService.cs b/src/DownKyi/Services/Download/AriaDownloadService.cs index 31885ac..3cf1351 100644 --- a/src/DownKyi/Services/Download/AriaDownloadService.cs +++ b/src/DownKyi/Services/Download/AriaDownloadService.cs @@ -11,6 +11,7 @@ using DownKyi.Core.Logging; using DownKyi.Core.Settings; using DownKyi.Core.Storage; using DownKyi.Core.Utils; +using DownKyi.Images; using DownKyi.Models; using DownKyi.Utils; using DownKyi.ViewModels.DownloadManager; @@ -145,7 +146,6 @@ namespace DownKyi.Services.Download case DownloadResult.SUCCESS: return Path.Combine(path, fileName); case DownloadResult.FAILED: - return null; case DownloadResult.ABORT: return null; default: @@ -394,7 +394,30 @@ namespace DownKyi.Services.Download // 保存数据 foreach (DownloadingItem item in downloadingList) { - item.Downloading.DownloadStatus = DownloadStatus.WAIT_FOR_DOWNLOAD; + switch (item.Downloading.DownloadStatus) + { + case DownloadStatus.NOT_STARTED: + break; + case DownloadStatus.WAIT_FOR_DOWNLOAD: + break; + case DownloadStatus.PAUSE_STARTED: + break; + case DownloadStatus.PAUSE: + break; + case DownloadStatus.DOWNLOADING: + // TODO 添加设置让用户选择重启后是否自动开始下载 + item.Downloading.DownloadStatus = DownloadStatus.WAIT_FOR_DOWNLOAD; + item.Downloading.DownloadStatus = DownloadStatus.PAUSE; + break; + case DownloadStatus.DOWNLOAD_SUCCEED: + case DownloadStatus.DOWNLOAD_FAILED: + break; + default: + break; + } + + item.Progress = 0; + downloadStorageService.UpdateDownloading(item); } foreach (DownloadedItem item in downloadedList) @@ -494,6 +517,12 @@ namespace DownKyi.Services.Download // 暂停 Pause(downloading); + // 是否存在 + var isExist = IsExist(downloading); + if (!isExist.Result) + { + return; + } // 设置下载状态 downloading.Downloading.DownloadStatus = DownloadStatus.DOWNLOADING; @@ -507,6 +536,12 @@ namespace DownKyi.Services.Download // 暂停 Pause(downloading); + // 是否存在 + isExist = IsExist(downloading); + if (!isExist.Result) + { + return; + } string videoUid = null; // 如果需要下载视频 @@ -517,6 +552,12 @@ namespace DownKyi.Services.Download // 暂停 Pause(downloading); + // 是否存在 + isExist = IsExist(downloading); + if (!isExist.Result) + { + return; + } string outputDanmaku = null; // 如果需要下载弹幕 @@ -527,6 +568,12 @@ namespace DownKyi.Services.Download // 暂停 Pause(downloading); + // 是否存在 + isExist = IsExist(downloading); + if (!isExist.Result) + { + return; + } List outputSubtitles = null; // 如果需要下载字幕 @@ -537,6 +584,12 @@ namespace DownKyi.Services.Download // 暂停 Pause(downloading); + // 是否存在 + isExist = IsExist(downloading); + if (!isExist.Result) + { + return; + } string outputCover = null; // 如果需要下载封面 @@ -552,6 +605,12 @@ namespace DownKyi.Services.Download // 暂停 Pause(downloading); + // 是否存在 + isExist = IsExist(downloading); + if (!isExist.Result) + { + return; + } // 混流 string outputMedia = string.Empty; @@ -561,9 +620,16 @@ namespace DownKyi.Services.Download } // 暂停 - Pause(downloading); + //Pause(downloading); + // 是否存在 + isExist = IsExist(downloading); + if (!isExist.Result) + { + return; + } // 检测音频、视频是否下载成功 + bool isMediaSuccess = true; if (downloading.DownloadBase.NeedDownloadContent["downloadAudio"] || downloading.DownloadBase.NeedDownloadContent["downloadVideo"]) { // 只有下载音频不下载视频时才输出aac @@ -571,16 +637,31 @@ namespace DownKyi.Services.Download if (File.Exists(outputMedia)) { // 成功 + isMediaSuccess = true; + } + else + { + isMediaSuccess = false; } } // 检测弹幕是否下载成功 - if (downloading.DownloadBase.NeedDownloadContent["downloadDanmaku"] && File.Exists(outputDanmaku)) + bool isDanmakuSuccess = true; + if (downloading.DownloadBase.NeedDownloadContent["downloadDanmaku"]) { - // 成功 + if (File.Exists(outputDanmaku)) + { + // 成功 + isDanmakuSuccess = true; + } + else + { + isDanmakuSuccess = false; + } } // 检测字幕是否下载成功 + bool isSubtitleSuccess = true; if (downloading.DownloadBase.NeedDownloadContent["downloadSubtitle"]) { if (outputSubtitles == null) @@ -591,25 +672,44 @@ namespace DownKyi.Services.Download { foreach (string subtitle in outputSubtitles) { - if (File.Exists(subtitle)) + if (!File.Exists(subtitle)) { - // 成功 + // 如果有一个不存在则失败 + isSubtitleSuccess = false; } } } } // 检测封面是否下载成功 - if (downloading.DownloadBase.NeedDownloadContent["downloadCover"] && File.Exists(outputCover)) + bool isCover = true; + if (downloading.DownloadBase.NeedDownloadContent["downloadCover"]) { - // 成功 + if (File.Exists(outputCover)) + { + // 成功 + isCover = true; + } + else + { + isCover = false; + } + } + + if (!isMediaSuccess || !isDanmakuSuccess || !isSubtitleSuccess || !isCover) + { + downloading.DownloadStatusTitle = DictionaryResource.GetString("DownloadFailed"); + downloading.DownloadContent = string.Empty; + downloading.DownloadingFileSize = string.Empty; + downloading.SpeedDisplay = string.Empty; + + downloading.Downloading.DownloadStatus = DownloadStatus.DOWNLOAD_FAILED; + downloading.StartOrPause = ButtonIcon.Instance().Retry; + downloading.StartOrPause.Fill = DictionaryResource.GetColor("ColorPrimary"); + return; } - // TODO - // 将下载结果写入数据库 - // 包括下载请求的DownloadingItem对象, - // 下载结果是否成功等 - // 对是否成功的判断:只要outputMedia存在则成功,否则失败 + // 下载完成后处理 Downloaded downloaded = new Downloaded { @@ -690,6 +790,34 @@ namespace DownKyi.Services.Download downloading.DownloadStatusTitle = oldStatus; } + /// + /// 是否存在于下载列表中 + /// + /// + /// + private async Task IsExist(DownloadingItem downloading) + { + bool isExist = downloadingList.Contains(downloading); + if (isExist) + { + return true; + } + else + { + // 先恢复为waiting状态,暂停状态下Remove会导致文件重新下载,原因暂不清楚 + await AriaClient.UnpauseAsync(downloading.Downloading.Gid); + // 移除下载项 + var ariaRemove = await AriaClient.RemoveAsync(downloading.Downloading.Gid); + if (ariaRemove == null || ariaRemove.Result == downloading.Downloading.Gid) + { + // 从内存中删除下载项 + await AriaClient.RemoveDownloadResultAsync(downloading.Downloading.Gid); + } + + return false; + } + } + /// /// 启动Aria服务器 /// @@ -724,13 +852,6 @@ namespace DownKyi.Services.Download var task = await AriaServer.StartServerAsync(config); if (task) { Console.WriteLine("Start ServerAsync Completed"); } Console.WriteLine("Start ServerAsync end"); - - // 恢复所有下载 - //var ariaPause = await AriaClient.UnpauseAllAsync(); - //if (ariaPause != null) - //{ - // Core.Utils.Debugging.Console.PrintLine(ariaPause.ToString()); - //} } /// diff --git a/src/DownKyi/Services/SearchService.cs b/src/DownKyi/Services/SearchService.cs new file mode 100644 index 0000000..f1426da --- /dev/null +++ b/src/DownKyi/Services/SearchService.cs @@ -0,0 +1,104 @@ +using DownKyi.Core.BiliApi.BiliUtils; +using DownKyi.Utils; +using DownKyi.ViewModels; +using Prism.Events; + +namespace DownKyi.Services +{ + public class SearchService + { + /// + /// 解析支持的输入 + /// + /// + /// + /// + /// + public bool BiliInput(string input, string parentViewName, IEventAggregator eventAggregator) + { + // 视频 + if (ParseEntrance.IsAvId(input)) + { + NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, parentViewName, $"{ParseEntrance.VideoUrl}{input.ToLower()}"); + } + else if (ParseEntrance.IsAvUrl(input)) + { + NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, parentViewName, input); + } + else if (ParseEntrance.IsBvId(input)) + { + NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, parentViewName, $"{ParseEntrance.VideoUrl}{input}"); + } + else if (ParseEntrance.IsBvUrl(input)) + { + NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, parentViewName, input); + } + // 番剧(电影、电视剧) + else if (ParseEntrance.IsBangumiSeasonId(input)) + { + NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, parentViewName, $"{ParseEntrance.BangumiUrl}{input.ToLower()}"); + } + else if (ParseEntrance.IsBangumiSeasonUrl(input)) + { + NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, parentViewName, input); + } + else if (ParseEntrance.IsBangumiEpisodeId(input)) + { + NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, parentViewName, $"{ParseEntrance.BangumiUrl}{input.ToLower()}"); + } + else if (ParseEntrance.IsBangumiEpisodeUrl(input)) + { + NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, parentViewName, input); + } + else if (ParseEntrance.IsBangumiMediaId(input)) + { + NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, parentViewName, $"{ParseEntrance.BangumiMediaUrl}{input.ToLower()}"); + } + else if (ParseEntrance.IsBangumiMediaUrl(input)) + { + NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, parentViewName, input); + } + // 课程 + else if (ParseEntrance.IsCheeseSeasonUrl(input) || ParseEntrance.IsCheeseEpisodeUrl(input)) + { + NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, parentViewName, input); + } + // 用户(参数传入mid) + else if (ParseEntrance.IsUserId(input)) + { + NavigateToView.NavigateToViewUserSpace(eventAggregator, ViewIndexViewModel.Tag, ParseEntrance.GetUserId(input)); + } + else if (ParseEntrance.IsUserUrl(input)) + { + NavigateToView.NavigateToViewUserSpace(eventAggregator, ViewIndexViewModel.Tag, ParseEntrance.GetUserId(input)); + } + // 收藏夹 + else if (ParseEntrance.IsFavoritesId(input)) + { + NavigateToView.NavigationView(eventAggregator, ViewPublicFavoritesViewModel.Tag, parentViewName, ParseEntrance.GetFavoritesId(input)); + } + else if (ParseEntrance.IsFavoritesUrl(input)) + { + NavigateToView.NavigationView(eventAggregator, ViewPublicFavoritesViewModel.Tag, parentViewName, ParseEntrance.GetFavoritesId(input)); + } + else + { + return false; + } + return true; + } + + /// + /// 搜索关键词 + /// + /// + /// + /// + public void SearchKey(string key, string parentViewName, IEventAggregator eventAggregator) + { + // TODO + } + + + } +} diff --git a/src/DownKyi/Themes/ColorBrush.xaml b/src/DownKyi/Themes/ColorBrush.xaml index 181e106..3d1c458 100644 --- a/src/DownKyi/Themes/ColorBrush.xaml +++ b/src/DownKyi/Themes/ColorBrush.xaml @@ -14,10 +14,15 @@ + + + + + @@ -30,14 +35,20 @@ + + + + + + @@ -45,4 +56,6 @@ + + \ No newline at end of file diff --git a/src/DownKyi/Themes/Colors/ColorDefault.xaml b/src/DownKyi/Themes/Colors/ColorDefault.xaml index 7ce177c..1c38497 100644 --- a/src/DownKyi/Themes/Colors/ColorDefault.xaml +++ b/src/DownKyi/Themes/Colors/ColorDefault.xaml @@ -14,10 +14,15 @@ #FFE81123 #FFF1707A + #FFFF4D3C + #FF00A1D6 #C800A1D6 #7F00A1D6 #3300A1D6 + + #FFFB7299 + #FF00A1D6 #FFFFFFFF #FFFFFFFF @@ -30,14 +35,20 @@ #33BDBDBD #7F000000 + #33999999 #FFF4F4F4 #FFF4F4F4 + #FF999999 #7F999999 + #FFE4E4E4 + #FFF3CB85 + #7FD0D0D0 + #7FFFFFFF #7FD0D0D0 white @@ -45,4 +56,6 @@ #FF999999 #FF757575 + #FFFFAE00 + \ No newline at end of file diff --git a/src/DownKyi/Utils/DictionaryResource.cs b/src/DownKyi/Utils/DictionaryResource.cs index a6fa53c..4d9b8a8 100644 --- a/src/DownKyi/Utils/DictionaryResource.cs +++ b/src/DownKyi/Utils/DictionaryResource.cs @@ -15,9 +15,6 @@ namespace DownKyi.Utils /// 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(); } diff --git a/src/DownKyi/ViewModels/DownloadManager/DownloadedItem.cs b/src/DownKyi/ViewModels/DownloadManager/DownloadedItem.cs index 5149d28..0da70a4 100644 --- a/src/DownKyi/ViewModels/DownloadManager/DownloadedItem.cs +++ b/src/DownKyi/ViewModels/DownloadManager/DownloadedItem.cs @@ -1,5 +1,6 @@ using DownKyi.Images; using DownKyi.Models; +using DownKyi.Utils; using Prism.Commands; using System.IO; @@ -9,6 +10,17 @@ namespace DownKyi.ViewModels.DownloadManager { public DownloadedItem() : base() { + // 打开文件夹按钮 + OpenFolder = ButtonIcon.Instance().Folder; + OpenFolder.Fill = DictionaryResource.GetColor("ColorPrimary"); + + // 打开视频按钮 + OpenVideo = ButtonIcon.Instance().Start; + OpenVideo.Fill = DictionaryResource.GetColor("ColorPrimary"); + + // 删除按钮 + RemoveVideo = ButtonIcon.Instance().Trash; + RemoveVideo.Fill = DictionaryResource.GetColor("ColorWarning"); } // model数据 @@ -73,9 +85,10 @@ namespace DownKyi.ViewModels.DownloadManager private void ExecuteOpenFolderCommand() { string videoPath = $"{DownloadBase.FilePath}.mp4"; - if (File.Exists(videoPath)) + FileInfo fileInfo = new FileInfo(videoPath); + if (File.Exists(fileInfo.FullName)) { - System.Diagnostics.Process.Start("Explorer", "/select," + videoPath); + System.Diagnostics.Process.Start("Explorer", "/select," + fileInfo.FullName); } else { @@ -93,9 +106,10 @@ namespace DownKyi.ViewModels.DownloadManager private void ExecuteOpenVideoCommand() { string videoPath = $"{DownloadBase.FilePath}.mp4"; - if (File.Exists(videoPath)) + var fileInfo = new FileInfo(videoPath); + if (File.Exists(fileInfo.FullName)) { - System.Diagnostics.Process.Start(videoPath); + System.Diagnostics.Process.Start(fileInfo.FullName); } else { diff --git a/src/DownKyi/ViewModels/DownloadManager/DownloadingItem.cs b/src/DownKyi/ViewModels/DownloadManager/DownloadingItem.cs index e727366..899df6f 100644 --- a/src/DownKyi/ViewModels/DownloadManager/DownloadingItem.cs +++ b/src/DownKyi/ViewModels/DownloadManager/DownloadingItem.cs @@ -20,7 +20,42 @@ namespace DownKyi.ViewModels.DownloadManager } // model数据 - public Downloading Downloading { get; set; } + private Downloading downloading; + public Downloading Downloading + { + get { return downloading; } + set + { + downloading = value; + + switch (value.DownloadStatus) + { + case DownloadStatus.NOT_STARTED: + case DownloadStatus.WAIT_FOR_DOWNLOAD: + StartOrPause = ButtonIcon.Instance().Pause; + break; + case DownloadStatus.PAUSE_STARTED: + StartOrPause = ButtonIcon.Instance().Start; + break; + case DownloadStatus.PAUSE: + StartOrPause = ButtonIcon.Instance().Start; + break; + case DownloadStatus.DOWNLOADING: + StartOrPause = ButtonIcon.Instance().Pause; + break; + case DownloadStatus.DOWNLOAD_SUCCEED: + // 下载成功后会从下载列表中删除 + // 不会出现此分支 + break; + case DownloadStatus.DOWNLOAD_FAILED: + StartOrPause = ButtonIcon.Instance().Retry; + break; + default: + break; + } + StartOrPause.Fill = DictionaryResource.GetColor("ColorPrimary"); + } + } // 视频流链接 public PlayUrl PlayUrl { get; set; } @@ -80,6 +115,13 @@ namespace DownKyi.ViewModels.DownloadManager } } + // 操作提示 + private string operationTip; + public string OperationTip + { + get => operationTip; + set => SetProperty(ref operationTip, value); + } #region 控制按钮 @@ -87,7 +129,14 @@ namespace DownKyi.ViewModels.DownloadManager public VectorImage StartOrPause { get => startOrPause; - set => SetProperty(ref startOrPause, value); + set + { + SetProperty(ref startOrPause, value); + + OperationTip = value.Equals(ButtonIcon.Instance().Start) ? DictionaryResource.GetString("StartDownload") + : value.Equals(ButtonIcon.Instance().Pause) ? DictionaryResource.GetString("PauseDownload") + : value.Equals(ButtonIcon.Instance().Retry) ? DictionaryResource.GetString("RetryDownload") : null; + } } private VectorImage delete; diff --git a/src/DownKyi/ViewModels/DownloadManager/ViewDownloadFinishedViewModel.cs b/src/DownKyi/ViewModels/DownloadManager/ViewDownloadFinishedViewModel.cs index 492cf1d..614e524 100644 --- a/src/DownKyi/ViewModels/DownloadManager/ViewDownloadFinishedViewModel.cs +++ b/src/DownKyi/ViewModels/DownloadManager/ViewDownloadFinishedViewModel.cs @@ -18,12 +18,34 @@ namespace DownKyi.ViewModels.DownloadManager set => SetProperty(ref downloadedList, value); } + private int finishedSortBy; + public int FinishedSortBy + { + get => finishedSortBy; + set => SetProperty(ref finishedSortBy, value); + } + #endregion public ViewDownloadFinishedViewModel(IEventAggregator eventAggregator) : base(eventAggregator) { // 初始化DownloadedList DownloadedList = App.DownloadedList; + + DownloadFinishedSort finishedSort = SettingsManager.GetInstance().GetDownloadFinishedSort(); + switch (finishedSort) + { + case DownloadFinishedSort.DOWNLOAD: + FinishedSortBy = 0; + break; + case DownloadFinishedSort.NUMBER: + FinishedSortBy = 1; + break; + default: + FinishedSortBy = 0; + break; + } + App.SortDownloadedList(finishedSort); } #region 命令申明 @@ -42,11 +64,20 @@ namespace DownKyi.ViewModels.DownloadManager switch (index) { - case 1: + case 0: App.SortDownloadedList(DownloadFinishedSort.DOWNLOAD); + // 更新设置 + SettingsManager.GetInstance().SetDownloadFinishedSort(DownloadFinishedSort.DOWNLOAD); break; - case 2: + case 1: App.SortDownloadedList(DownloadFinishedSort.NUMBER); + // 更新设置 + SettingsManager.GetInstance().SetDownloadFinishedSort(DownloadFinishedSort.NUMBER); + break; + default: + App.SortDownloadedList(DownloadFinishedSort.DOWNLOAD); + // 更新设置 + SettingsManager.GetInstance().SetDownloadFinishedSort(DownloadFinishedSort.DOWNLOAD); break; } } @@ -60,6 +91,7 @@ namespace DownKyi.ViewModels.DownloadManager /// private void ExecuteClearAllDownloadedCommand() { + DownloadedList.Clear(); } #endregion diff --git a/src/DownKyi/ViewModels/DownloadManager/ViewDownloadingViewModel.cs b/src/DownKyi/ViewModels/DownloadManager/ViewDownloadingViewModel.cs index d4bc070..1985f53 100644 --- a/src/DownKyi/ViewModels/DownloadManager/ViewDownloadingViewModel.cs +++ b/src/DownKyi/ViewModels/DownloadManager/ViewDownloadingViewModel.cs @@ -46,6 +46,8 @@ namespace DownKyi.ViewModels.DownloadManager case DownloadStatus.NOT_STARTED: case DownloadStatus.WAIT_FOR_DOWNLOAD: downloading.Downloading.DownloadStatus = DownloadStatus.PAUSE_STARTED; + downloading.StartOrPause = ButtonIcon.Instance().Start; + downloading.StartOrPause.Fill = DictionaryResource.GetColor("ColorPrimary"); break; case DownloadStatus.PAUSE_STARTED: break; @@ -53,6 +55,8 @@ namespace DownKyi.ViewModels.DownloadManager break; case DownloadStatus.DOWNLOADING: downloading.Downloading.DownloadStatus = DownloadStatus.PAUSE; + downloading.StartOrPause = ButtonIcon.Instance().Start; + downloading.StartOrPause.Fill = DictionaryResource.GetColor("ColorPrimary"); break; case DownloadStatus.DOWNLOAD_SUCCEED: // 下载成功后会从下载列表中删除 @@ -63,9 +67,6 @@ namespace DownKyi.ViewModels.DownloadManager default: break; } - - downloading.StartOrPause = ButtonIcon.Instance().Start; - downloading.StartOrPause.Fill = DictionaryResource.GetColor("ColorPrimary"); } } diff --git a/src/DownKyi/ViewModels/MainWindowViewModel.cs b/src/DownKyi/ViewModels/MainWindowViewModel.cs index 5167f55..c806981 100644 --- a/src/DownKyi/ViewModels/MainWindowViewModel.cs +++ b/src/DownKyi/ViewModels/MainWindowViewModel.cs @@ -1,8 +1,8 @@ -using DownKyi.Core.BiliApi.BiliUtils; -using DownKyi.Core.Logging; +using DownKyi.Core.Logging; using DownKyi.Core.Settings; using DownKyi.Events; using DownKyi.Images; +using DownKyi.Services; using DownKyi.Utils; using Prism.Commands; using Prism.Events; @@ -353,71 +353,8 @@ namespace DownKyi.ViewModels return; } - // 视频 - if (ParseEntrance.IsAvId(input)) - { - NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, ViewIndexViewModel.Tag, $"{ParseEntrance.VideoUrl}{input.ToLower()}"); - } - else if (ParseEntrance.IsAvUrl(input)) - { - NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, ViewIndexViewModel.Tag, input); - } - else if (ParseEntrance.IsBvId(input)) - { - NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, ViewIndexViewModel.Tag, $"{ParseEntrance.VideoUrl}{input}"); - } - else if (ParseEntrance.IsBvUrl(input)) - { - NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, ViewIndexViewModel.Tag, input); - } - // 番剧(电影、电视剧) - else if (ParseEntrance.IsBangumiSeasonId(input)) - { - NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, ViewIndexViewModel.Tag, $"{ParseEntrance.BangumiUrl}{input.ToLower()}"); - } - else if (ParseEntrance.IsBangumiSeasonUrl(input)) - { - NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, ViewIndexViewModel.Tag, input); - } - else if (ParseEntrance.IsBangumiEpisodeId(input)) - { - NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, ViewIndexViewModel.Tag, $"{ParseEntrance.BangumiUrl}{input.ToLower()}"); - } - else if (ParseEntrance.IsBangumiEpisodeUrl(input)) - { - NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, ViewIndexViewModel.Tag, input); - } - else if (ParseEntrance.IsBangumiMediaId(input)) - { - NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, ViewIndexViewModel.Tag, $"{ParseEntrance.BangumiMediaUrl}{input.ToLower()}"); - } - else if (ParseEntrance.IsBangumiMediaUrl(input)) - { - NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, ViewIndexViewModel.Tag, input); - } - // 课程 - else if (ParseEntrance.IsCheeseSeasonUrl(input) || ParseEntrance.IsCheeseEpisodeUrl(input)) - { - NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, ViewIndexViewModel.Tag, input); - } - // 用户(参数传入mid) - else if (ParseEntrance.IsUserId(input)) - { - NavigateToView.NavigateToViewUserSpace(eventAggregator, ViewIndexViewModel.Tag, ParseEntrance.GetUserId(input)); - } - else if (ParseEntrance.IsUserUrl(input)) - { - NavigateToView.NavigateToViewUserSpace(eventAggregator, ViewIndexViewModel.Tag, ParseEntrance.GetUserId(input)); - } - // 收藏夹 - else if (ParseEntrance.IsFavoritesId(input)) - { - NavigateToView.NavigationView(eventAggregator, ViewPublicFavoritesViewModel.Tag, ViewIndexViewModel.Tag, ParseEntrance.GetFavoritesId(input)); - } - else if (ParseEntrance.IsFavoritesUrl(input)) - { - NavigateToView.NavigationView(eventAggregator, ViewPublicFavoritesViewModel.Tag, ViewIndexViewModel.Tag, ParseEntrance.GetFavoritesId(input)); - } + SearchService searchService = new SearchService(); + searchService.BiliInput(input, ViewIndexViewModel.Tag, eventAggregator); } #endregion diff --git a/src/DownKyi/ViewModels/PageViewModels/SpaceItem.cs b/src/DownKyi/ViewModels/PageViewModels/SpaceItem.cs new file mode 100644 index 0000000..091cb9f --- /dev/null +++ b/src/DownKyi/ViewModels/PageViewModels/SpaceItem.cs @@ -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); + } + } +} diff --git a/src/DownKyi/ViewModels/ViewIndexViewModel.cs b/src/DownKyi/ViewModels/ViewIndexViewModel.cs index 5cc547d..c052ef1 100644 --- a/src/DownKyi/ViewModels/ViewIndexViewModel.cs +++ b/src/DownKyi/ViewModels/ViewIndexViewModel.cs @@ -1,10 +1,10 @@ -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; using DownKyi.Core.Storage; using DownKyi.Images; +using DownKyi.Services; using DownKyi.Utils; using Prism.Commands; using Prism.Events; @@ -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 属性初始化 @@ -223,74 +222,12 @@ namespace DownKyi.ViewModels LogManager.Debug(Tag, $"InputText: {InputText}"); - // 视频 - if (ParseEntrance.IsAvId(InputText)) - { - NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, Tag, $"{ParseEntrance.VideoUrl}{InputText.ToLower()}"); - } - else if (ParseEntrance.IsAvUrl(InputText)) - { - NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, Tag, InputText); - } - else if (ParseEntrance.IsBvId(InputText)) - { - NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, Tag, $"{ParseEntrance.VideoUrl}{InputText}"); - } - else if (ParseEntrance.IsBvUrl(InputText)) - { - NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, Tag, InputText); - } - // 番剧(电影、电视剧) - else if (ParseEntrance.IsBangumiSeasonId(InputText)) - { - NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, Tag, $"{ParseEntrance.BangumiUrl}{InputText.ToLower()}"); - } - else if (ParseEntrance.IsBangumiSeasonUrl(InputText)) - { - NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, Tag, InputText); - } - else if (ParseEntrance.IsBangumiEpisodeId(InputText)) - { - NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, Tag, $"{ParseEntrance.BangumiUrl}{InputText.ToLower()}"); - } - else if (ParseEntrance.IsBangumiEpisodeUrl(InputText)) - { - NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, Tag, InputText); - } - else if (ParseEntrance.IsBangumiMediaId(InputText)) - { - NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, Tag, $"{ParseEntrance.BangumiMediaUrl}{InputText.ToLower()}"); - } - else if (ParseEntrance.IsBangumiMediaUrl(InputText)) - { - NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, Tag, InputText); - } - // 课程 - else if (ParseEntrance.IsCheeseSeasonUrl(InputText) || ParseEntrance.IsCheeseEpisodeUrl(InputText)) - { - NavigateToView.NavigationView(eventAggregator, ViewVideoDetailViewModel.Tag, Tag, InputText); - } - // 用户(参数传入mid) - else if (ParseEntrance.IsUserId(InputText)) - { - NavigateToView.NavigateToViewUserSpace(eventAggregator, Tag, ParseEntrance.GetUserId(InputText)); - } - else if (ParseEntrance.IsUserUrl(InputText)) - { - NavigateToView.NavigateToViewUserSpace(eventAggregator, Tag, ParseEntrance.GetUserId(InputText)); - } - // 收藏夹 - else if (ParseEntrance.IsFavoritesId(InputText)) - { - NavigateToView.NavigationView(eventAggregator, ViewPublicFavoritesViewModel.Tag, Tag, ParseEntrance.GetFavoritesId(InputText)); - } - else if (ParseEntrance.IsFavoritesUrl(InputText)) - { - NavigateToView.NavigationView(eventAggregator, ViewPublicFavoritesViewModel.Tag, Tag, ParseEntrance.GetFavoritesId(InputText)); - } - // TODO 关键词搜索 - else + SearchService searchService = new SearchService(); + bool isSupport = searchService.BiliInput(InputText, Tag, eventAggregator); + if (!isSupport) { + // 关键词搜索 + searchService.SearchKey(InputText, Tag, eventAggregator); } InputText = string.Empty; @@ -315,7 +252,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 diff --git a/src/DownKyi/ViewModels/ViewMySpaceViewModel.cs b/src/DownKyi/ViewModels/ViewMySpaceViewModel.cs index 8348413..59c5022 100644 --- a/src/DownKyi/ViewModels/ViewMySpaceViewModel.cs +++ b/src/DownKyi/ViewModels/ViewMySpaceViewModel.cs @@ -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,553 @@ 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 statusList; + public ObservableCollection StatusList + { + get => statusList; + set => SetProperty(ref statusList, value); + } + + private ObservableCollection packageList; + public ObservableCollection 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(); + PackageList = new ObservableCollection(); + + #endregion + } + + #region 命令申明 + + // 返回事件 + private DelegateCommand backSpaceCommand; + public DelegateCommand BackSpaceCommand => backSpaceCommand ?? (backSpaceCommand = new DelegateCommand(ExecuteBackSpace)); + + /// + /// 返回事件 + /// + private void ExecuteBackSpace() + { + NavigationParam parameter = new NavigationParam + { + ViewName = ParentView, + ParentViewName = null, + Parameter = null + }; + eventAggregator.GetEvent().Publish(parameter); + } + + // 退出登录事件 + private DelegateCommand logoutCommand; + public DelegateCommand LogoutCommand => logoutCommand ?? (logoutCommand = new DelegateCommand(ExecuteLogoutCommand)); + + /// + /// 退出登录事件 + /// + private void ExecuteLogoutCommand() + { + // 注销 + LoginHelper.Logout(); + + // 返回上一页 + NavigationParam parameter = new NavigationParam + { + ViewName = ParentView, + ParentViewName = null, + Parameter = "logout" + }; + eventAggregator.GetEvent().Publish(parameter); + } + + // 页面选择事件 + private DelegateCommand packageListCommand; + public DelegateCommand PackageListCommand => packageListCommand ?? (packageListCommand = new DelegateCommand(ExecutePackageListCommand)); + + /// + /// 页面选择事件 + /// + /// + 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 + + /// + /// 初始化页面 + /// + 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 = DictionaryResource.GetString("Following"), Subtitle = "--" }); + StatusList.Add(new SpaceItem { Title = DictionaryResource.GetString("Whisper"), Subtitle = "--" }); + StatusList.Add(new SpaceItem { Title = DictionaryResource.GetString("Follower"), Subtitle = "--" }); + StatusList.Add(new SpaceItem { Title = DictionaryResource.GetString("Black"), Subtitle = "--" }); + StatusList.Add(new SpaceItem { Title = DictionaryResource.GetString("Moral"), Subtitle = "--" }); + StatusList.Add(new SpaceItem { Title = DictionaryResource.GetString("Silence"), Subtitle = "N/A" }); + + PackageList.Clear(); + PackageList.Add(new SpaceItem { Image = NormalIcon.Instance().FavoriteOutline, Title = DictionaryResource.GetString("Favorites") }); + PackageList.Add(new SpaceItem { Image = NormalIcon.Instance().Subscription, Title = DictionaryResource.GetString("Subscription") }); + PackageList.Add(new SpaceItem { Image = NormalIcon.Instance().ToView, Title = DictionaryResource.GetString("ToView") }); + PackageList.Add(new SpaceItem { Image = NormalIcon.Instance().History, Title = DictionaryResource.GetString("History") }); + NormalIcon.Instance().FavoriteOutline.Fill = DictionaryResource.GetColor("ColorPrimary"); + NormalIcon.Instance().Subscription.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; + } + + /// + /// 更新用户信息 + /// + 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 = DictionaryResource.GetString("Normal"); + } + else if (myInfo.Silence == 1) + { + StatusList[5].Subtitle = DictionaryResource.GetString("Ban"); + } + } + 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(); + } + }); + } /// @@ -34,6 +587,9 @@ namespace DownKyi.ViewModels return; } mid = parameter; + + InitView(); + UpdateSpaceInfo(); } } diff --git a/src/DownKyi/ViewModels/ViewVideoDetailViewModel.cs b/src/DownKyi/ViewModels/ViewVideoDetailViewModel.cs index 11486e3..3937afb 100644 --- a/src/DownKyi/ViewModels/ViewVideoDetailViewModel.cs +++ b/src/DownKyi/ViewModels/ViewVideoDetailViewModel.cs @@ -114,6 +114,7 @@ namespace DownKyi.ViewModels #region 属性初始化 + // 初始化loading gif Loading = new GifImage(Properties.Resources.loading); Loading.StartAnimate(); LoadingVisibility = Visibility.Collapsed; diff --git a/src/DownKyi/Views/DownloadManager/ViewDownloadFinished.xaml b/src/DownKyi/Views/DownloadManager/ViewDownloadFinished.xaml index 49b63b6..27bbf81 100644 --- a/src/DownKyi/Views/DownloadManager/ViewDownloadFinished.xaml +++ b/src/DownKyi/Views/DownloadManager/ViewDownloadFinished.xaml @@ -100,68 +100,56 @@ - - - - - - - + Command="{Binding OpenFolderCommand}" + Style="{StaticResource ImageBtnStyle}" + ToolTip="{DynamicResource OpenFolder}"> + + Stretch="Uniform" /> - + - - - - - - - + Command="{Binding OpenVideoCommand}" + Style="{StaticResource ImageBtnStyle}" + ToolTip="{DynamicResource OpenVideo}"> + + Stretch="Uniform" /> - + - - - - - - - + Command="{Binding RemoveVideoCommand}" + Style="{StaticResource ImageBtnStyle}" + ToolTip="{DynamicResource DeleteDownload}"> + + Stretch="Uniform" /> - + @@ -257,14 +245,15 @@ Grid.Column="1" Width="120" HorizontalAlignment="Left" - VerticalAlignment="Center"> + VerticalAlignment="Center" + SelectedIndex="{Binding FinishedSortBy}"> - - + + - - - - - - - + Command="{Binding DeleteCommand}" + Style="{StaticResource ImageBtnStyle}" + ToolTip="{DynamicResource DeleteDownload}"> + + Stretch="Uniform" /> - + diff --git a/src/DownKyi/Views/ViewMySpace.xaml b/src/DownKyi/Views/ViewMySpace.xaml index 6f40d3f..409c3b9 100644 --- a/src/DownKyi/Views/ViewMySpace.xaml +++ b/src/DownKyi/Views/ViewMySpace.xaml @@ -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"> + + + + - 我的用户空间 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/src/DownKyi/Views/ViewPublicFavorites.xaml b/src/DownKyi/Views/ViewPublicFavorites.xaml index 83caaf9..3d4944b 100644 --- a/src/DownKyi/Views/ViewPublicFavorites.xaml +++ b/src/DownKyi/Views/ViewPublicFavorites.xaml @@ -40,7 +40,7 @@ VerticalAlignment="Center" FontSize="16" Foreground="{DynamicResource BrushTextDark}" - Text="{DynamicResource Favorites}" /> + Text="{DynamicResource PublicFavorites}" />