docs: 补全 C# XML 文档注释,覆盖所有公开与内部成员
为 14 个项目中缺少 XML 注释的类、接口、方法、属性、字段、record、 枚举等成员补全中文文档注释。接口方法在接口层定义完整注释,实现类 使用 <inheritdoc /> 引用。私有辅助方法结合业务语义编写注释。 扫描结果:missing-csharp-docs.txt 缺失项归零。 构建结果:0 警告,0 错误。 Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>
This commit is contained in:
@@ -7,8 +7,12 @@ using System.Net.Sockets;
|
||||
|
||||
namespace FileShare_Services.Services.QrCode
|
||||
{
|
||||
/// <summary>
|
||||
/// 二维码生成服务,获取局域网 IP 并生成 PNG 格式的访问二维码。
|
||||
/// </summary>
|
||||
public sealed class QrCodeService : IQrCodeService
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public Task<object?> GenerateQrCodeAsync(ServiceEndpointContext ctx)
|
||||
{
|
||||
var ip = GetLanIpAddress();
|
||||
@@ -20,6 +24,11 @@ namespace FileShare_Services.Services.QrCode
|
||||
return Task.FromResult<object?>(ResponseHelper.Ok(new QrCodeResponse(url, base64)));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 使用 QRCoder 库生成指定内容的二维码,输出为 Base64 编码的 PNG data URI。
|
||||
/// </summary>
|
||||
/// <param name="content">二维码编码内容。</param>
|
||||
/// <returns>data URI 格式的 Base64 PNG 字符串。</returns>
|
||||
private static string GeneratePngBase64(string content)
|
||||
{
|
||||
using var generator = new QRCodeGenerator();
|
||||
@@ -29,6 +38,10 @@ namespace FileShare_Services.Services.QrCode
|
||||
return $"data:image/png;base64,{Convert.ToBase64String(bytes)}";
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 获取本机第一个可用的局域网 IPv4 地址,排除回环地址和 APIPA 地址(169.254.x.x)。
|
||||
/// </summary>
|
||||
/// <returns>局域网 IP 地址字符串,无可用地址时返回 null。</returns>
|
||||
private static string? GetLanIpAddress()
|
||||
{
|
||||
return NetworkInterface.GetAllNetworkInterfaces()
|
||||
|
||||
Reference in New Issue
Block a user