using System.Application.Models;
using System.Xml.Serialization;
using static System.Application.SteamApiUrls;
namespace System.Application.Models
{
[XmlRoot("profile")]
public class SteamUser
{
public SteamUser()
{
}
public SteamUser(string vdfstring)
{
OriginVdfString = vdfstring;
}
public string? SteamId3 { get; set; }
public long SteamId3_Int => (SteamId64 >> 0) & 0xFFFFFFFF;
public string? SteamId32 { get; set; }
public long SteamId32_Int { get; set; }
[XmlElement("steamID64")]
public long SteamId64 { get; set; }
///
/// 个人资料链接
///
public string ProfileUrl => string.Format(STEAM_PROFILES_URL, SteamId64);
///
/// 在线状态
///
[XmlElement("onlineState")]
public string? OnlineState { get; set; }
public string? IPCountry { get; set; }
///
/// 公开状态
/// friendsonly
/// public
///
[XmlElement("privacyState")]
public string? PrivacyState { get; set; }
[XmlElement("avatarIcon")]
public string? AvatarIcon { get; set; }
[XmlElement("avatarMedium")]
public string? AvatarMedium { get; set; }
[XmlElement("avatarFull")]
public string? AvatarFull { get; set; }
///
/// 昵称
///
[XmlElement("steamID")]
public string? SteamID { get; set; }
///
/// 昵称
///
public string? SteamNickName => string.IsNullOrEmpty(SteamID) ? PersonaName : SteamID;
///
/// 从 Valve Data File 读取到的用户名
///
public string? PersonaName { get; set; }
///
/// 用户名
///
public string? AccountName { get; set; }
///
/// 是否记住密码
///
public bool RememberPassword { get; set; }
///
/// 密码
///
public string? PassWord { get; set; }
///
/// 最后登录时间戳
///
public long Timestamp { get; set; }
///
/// 最后登录时间
///
public DateTime LastLoginTime { get; set; }
///
/// 最近登录
///
public bool MostRecent { get; set; }
///
/// 离线模式
///
public bool WantsOfflineMode { get; set; }
///
/// 忽略离线模式警告弹窗
///
public bool SkipOfflineModeWarning { get; set; }
///
/// 备注
///
public string? Remark { get; set; }
///
/// 来源 Valve Data File 字符串
///
public string? OriginVdfString { get; set; }
///
/// 导出 Valve Data File 配置字符串
///
public string CurrentVdfString =>
"\"" + SteamId64 + "\"\n{\n" +
"\t\t\"AccountName\"\t\t\"" + AccountName + "\"\n" +
"\t\t\"PersonaName\"\t\t\"" + PersonaName + "\"\n" +
"\t\t\"RememberPassword\"\t\t\"" + Convert.ToByte(RememberPassword) + "\"\n" +
"\t\t\"MostRecent\"\t\t\"" + Convert.ToByte(MostRecent) + "\"\n" +
"\t\t\"WantsOfflineMode\"\t\t\"" + Convert.ToByte(WantsOfflineMode) + "\"\n" +
"\t\t\"SkipOfflineModeWarning\"\t\t\"" + Convert.ToByte(SkipOfflineModeWarning) + "\"\n" +
"\t\t\"Timestamp\"\t\t\"" + Timestamp + "\"\n}";
}
}