Skip to content

Commit

Permalink
Merge branch 'dev' of https://github.com/ywmoyue/biliuwp-lite into dev
Browse files Browse the repository at this point in the history
  • Loading branch information
ywmoyue committed Jun 1, 2024
2 parents f19f4c6 + a48d2ca commit f1fff1f
Show file tree
Hide file tree
Showing 25 changed files with 738 additions and 200 deletions.
2 changes: 1 addition & 1 deletion src/BiliLite.UWP/Extensions/ApiModelExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ public static async Task<HttpResults> Request(this ApiModel api, [CallerMemberNa
{
if (api.need_cookie)
{
return await api.url.PostHttpResultsWithCookie(api.body, api.headers);
return await api.url.PostHttpResultsWithCookie(api.body, api.headers, api.ExtraCookies);
}

return await api.url.PostHttpResultsAsync(api.body, api.headers);
Expand Down
9 changes: 5 additions & 4 deletions src/BiliLite.UWP/Extensions/StringExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public static string TraditionalToSimplified(this string input)
/// <returns></returns>
public static RichTextBlock ToRichTextBlock(this string txt, JObject emote, bool isLive = false,
string fontColor = null, string fontWeight = "Normal", string lowProfilePrefix = "",
bool enableVideoSeekTime = false)
string textAlignment = "Left", bool enableVideoSeekTime = false)
{
var input = txt;
try
Expand Down Expand Up @@ -124,12 +124,13 @@ public static RichTextBlock ToRichTextBlock(this string txt, JObject emote, bool
var xaml = string.Format(@"<RichTextBlock HorizontalAlignment=""Stretch"" xmlns=""http://schemas.microsoft.com/winfx/2006/xaml/presentation""
xmlns:x=""http://schemas.microsoft.com/winfx/2006/xaml"" xmlns:d=""http://schemas.microsoft.com/expression/blend/2008""
xmlns:mc = ""http://schemas.openxmlformats.org/markup-compatibility/2006"" LineHeight=""{1}"" {2} {3}>
<Paragraph>{4}{0}</Paragraph>
</RichTextBlock>", input,
<Paragraph {5}>{4}{0}</Paragraph>
</RichTextBlock>", input,
isLive ? 22 : 20,
fontColor == null ? "" : $"Foreground=\"{fontColor}\"",
$"FontWeight=\"{fontWeight}\"",
lowProfilePrefix);
lowProfilePrefix,
$"TextAlignment=\"{textAlignment}\"");
if (!xaml.IsXmlString())
{
throw new CustomizedErrorException("不是有效的xml字符串");
Expand Down
11 changes: 10 additions & 1 deletion src/BiliLite.UWP/Extensions/StringHttpExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ public static async Task<HttpResults> PostHttpResultsAsync(this string url, stri
return httpResult;
}

public static async Task<HttpResults> PostHttpResultsWithCookie(this string url, string body, IDictionary<string, string> headers = null)
public static async Task<HttpResults> PostHttpResultsWithCookie(this string url, string body, IDictionary<string, string> headers = null, IDictionary<string, string> extraCookies = null)
{
try
{
Expand All @@ -223,6 +223,15 @@ public static async Task<HttpResults> PostHttpResultsWithCookie(this string url,
}
cookies = cookieService.Cookies;
var cookiesCollection = cookies.ToDictionary(x => x.Name, x => x.Value);

if (extraCookies != null)
{
foreach (var kvp in extraCookies)
{
cookiesCollection.Add(kvp.Key, kvp.Value);
}
}

return await url.PostHttpResultsAsync(body, headers, cookiesCollection);
}
catch (Exception ex)
Expand Down
30 changes: 29 additions & 1 deletion src/BiliLite.UWP/Models/Common/Enumerates.cs
Original file line number Diff line number Diff line change
Expand Up @@ -361,6 +361,11 @@ public enum MessageType
/// </summary>
GuardBuy,

/// <summary>
/// 新上舰消息, 可区分续费和新人
/// </summary>
GuardBuyNew,

/// <summary>
/// 房间信息更新
/// </summary>
Expand Down Expand Up @@ -409,7 +414,7 @@ public enum MessageType
/// <summary>
/// 直播间等级禁言
/// </summary>
RoomSlient,
ChatLevelMute,
}

public enum MessageDelayType {
Expand Down Expand Up @@ -443,4 +448,27 @@ public enum UserDynamicShowType
Season = 2,
Article = 3
}

/// <summary>
/// 用户大航海等级
/// </summary>
public enum UserCaptainType
{
None = 0,

/// <summary>
/// 总督
/// </summary>
Zongdu = 1,

/// <summary>
/// 提督
/// </summary>
Tidu = 2,

/// <summary>
/// 舰长
/// </summary>
JianZhang = 3,
}
}
29 changes: 21 additions & 8 deletions src/BiliLite.UWP/Models/Common/Live/DanmuMsgModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,23 @@ public class DanmuMsgModel
/// </summary>
public string UserName { get; set; }

private string _userNameColor;
/// <summary>
/// 用户名颜色, 默认灰色
/// </summary>
public string UserNameColor { get; set; } = "#FF808080";
public string UserNameColor
{
get => _userNameColor ??
UserCaptain switch
{
UserCaptainType.JianZhang => "#FF23709E",
UserCaptainType.Tidu => "#FF7B166F",
UserCaptainType.Zongdu => "#FFC01039",
_ => "#FF808080"
};

set => _userNameColor = value;
}

/// <summary>
/// 用户名字重, 默认Normal
Expand Down Expand Up @@ -83,17 +96,17 @@ public class DanmuMsgModel
/// <summary>
/// 勋章等级
/// </summary>
public string MedalLevel { get; set; }
public int MedalLevel { get; set; }

/// <summary>
/// 勋章颜色
/// </summary>
public string MedalColor { get; set; }

/// <summary>
/// 用户上的舰的名称
/// 用户大航海等级
/// </summary>
public string UserCaptain { get; set; }
public UserCaptainType UserCaptain { get; set; }

/// <summary>
/// 用户上的舰的图片
Expand All @@ -102,9 +115,9 @@ public string UserCaptainImage
{
get => UserCaptain switch
{
"舰长" => "ms-appx:///Assets/Live/ic_live_guard_3.png",
"提督" => "ms-appx:///Assets/Live/ic_live_guard_2.png",
"总督" => "ms-appx:///Assets/Live/ic_live_guard_1.png",
UserCaptainType.JianZhang => "ms-appx:///Assets/Live/ic_live_guard_3.png", //舰长
UserCaptainType.Tidu => "ms-appx:///Assets/Live/ic_live_guard_2.png", //提督
UserCaptainType.Zongdu => "ms-appx:///Assets/Live/ic_live_guard_1.png", //总督
_ => null,
};
}
Expand Down
10 changes: 10 additions & 0 deletions src/BiliLite.UWP/Models/Common/Live/GuardBuyMsgModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,15 @@ public Color CardColor
/// 礼物名称
/// </summary>
public string GiftName { get; set; }

/// <summary>
/// 购买的时间单位, 如"月"
/// </summary>
public string Unit { get; set;}

/// <summary>
/// 庆祝消息正文
/// </summary>
public string Message { get; set; }
}
}
2 changes: 1 addition & 1 deletion src/BiliLite.UWP/Models/Common/Live/InteractWordModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ public class InteractWordModel

public string MedalName { get; set; }

public string MedalLevel { get; set; }
public int MedalLevel { get; set; }

public string MedalColor { get; set; }

Expand Down
Loading

0 comments on commit f1fff1f

Please sign in to comment.