FunGame-Core/Api/Utility/StringExtension.cs
milimoe 2827c53d14
补全数据库表、查询常量类 (#118)
* 补充数据库表

* 更新sqlite

* 添加商店相关的数据库常量类

* add Update_UpdateRoomMaster

* 修改常量类

* 添加  NOTICE 文件

* 添加市场、报价、库存的数据库常量类

* 优化表结构和查询常量类

* 添加 UserCenter 和 Inventory 相关枚举;数据表和 Query 常量类修改

* 添加报价的核心操作

* 涉及库存的物品获取应该使用 Guid 而不是 ItemId

---------

Co-authored-by: yeziuku <yezi@wrss.org>
2025-04-04 23:39:49 +08:00

29 lines
914 B
C#
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

namespace Milimoe.FunGame.Core.Api.Utility
{
/// <summary>
/// 为字符串string添加扩展方法
/// </summary>
public static class StringExtension
{
/// <summary>
/// 使用 HMAC-SHA512 算法对文本进行加密<para/>
/// </summary>
/// <param name="text">需要加密的文本</param>
/// <param name="key">用于加密的秘钥</param>
/// <returns>加密后的 HMAC-SHA512 哈希值</returns>
public static string Encrypt(this string text, string key)
{
return Encryption.HmacSha512(text, key.ToLower());
}
public static bool EqualsGuid(this string str, object? value)
{
if (str.ToLower().Replace("-", "").Equals(value?.ToString()?.ToLower().Replace("-", "")))
{
return true;
}
return false;
}
}
}