- 修改 `MainWindow.xaml.cs` 中的登录响应逻辑,确保获取 `token` 并检查聊天消息状态。 - 更改 `chatclient.csproj` 的目标框架为 `net8.0-windows7.0`,并设置调试类型为 `embedded`。 - 在 `App.config` 中添加用户设置配置,支持聊天信息保存上限。 - 新增 `User` 类于 `ChatData.cs`,存储用户信息。 - 在 `Program.cs` 中实现客户端连接的锁定机制,确保线程安全。 - 修正 `log4net.config` 中的日志文件路径格式。 - 新增 `Settings1.Designer.cs` 和 `Settings1.settings` 文件以管理用户设置。
61 lines
2.1 KiB
C#
61 lines
2.1 KiB
C#
using System.Security.RightsManagement;
|
|
|
|
namespace chatclient.Data
|
|
{
|
|
internal class Server
|
|
{
|
|
public const string ServerUrl = "http://127.0.0.1:5001";
|
|
//public const string ServerIP = "175.24.191.172";
|
|
public const string ServerIP = "127.0.0.1";
|
|
public const int ServerPort = 52006;
|
|
}
|
|
internal class LoginData
|
|
{
|
|
public string? type { get; set; } = null;
|
|
public string? username { get; set; } = null;
|
|
public string? password { get; set; } = null;
|
|
public string? token { get; set; } = null;
|
|
}
|
|
internal class LoginResultData
|
|
{
|
|
public string? status { get; set; }
|
|
public string? message { get; set; }
|
|
public string? token { get; set; }
|
|
public string? username { get; set; }
|
|
public string? userid { get; set; } = "Unid";
|
|
}
|
|
internal class SignData
|
|
{
|
|
public string? type { get; set; } = null;
|
|
public string? username { get; set; } = null;
|
|
public string? password { get; set; } = null;
|
|
}
|
|
internal class SignResultData
|
|
{
|
|
public string? status { get; set; } = null;
|
|
public string? message { get; set; } = null;
|
|
}
|
|
internal class RegisterData
|
|
{
|
|
public string? type { get; set; }
|
|
}
|
|
internal class ChatRegisterData
|
|
{
|
|
public string? user { get; set; } = "Unnamed";
|
|
public required string userid { get; set; } = "Unid";
|
|
public string? status { get; set; } = null;
|
|
public string? message { get; set; } = null;
|
|
public string? avatar { get; set; } = null;
|
|
public MessageType? msgtype { get; set; } = MessageType.Text;
|
|
public DateTime? timestamp { get; set; } = DateTime.Now;
|
|
}
|
|
internal class ChatData
|
|
{
|
|
public required string type { get; set; } = "chat";
|
|
public required string message { get; set; } = "message";
|
|
public MessageType? msgtype { get; set; } = MessageType.Text;
|
|
public required string userid { get; set; } = "Unid";
|
|
public string? token { get; set; } = null; // 添加token字段
|
|
}
|
|
}
|