词法修正和代码清理 (#54)

This commit is contained in:
milimoe 2025-11-26 00:44:29 +08:00 committed by GitHub
parent ca27d7776d
commit ffa839e9f1
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
7 changed files with 15 additions and 15 deletions

View File

@ -315,7 +315,7 @@ namespace Milimoe.FunGame.Server.Controller
if (SQLHelper.Result == SQLResult.Success)
{
ServerHelper.WriteLine("[CreateRoom] Master: " + user.Username + " RoomID: " + roomid);
DataRow? dr = SQLHelper.ExecuteDataRow(RoomQuery.Select_IsExistRoom(SQLHelper, roomid));
DataRow? dr = SQLHelper.ExecuteDataRow(RoomQuery.Select_RoomByRoomId(SQLHelper, roomid));
if (dr != null)
{
room = Factory.GetRoom(dr, user);
@ -355,7 +355,7 @@ namespace Milimoe.FunGame.Server.Controller
string roomid = DataRequest.GetDictionaryJsonObject<string>(requestData, "roomid") ?? "-1";
bool isMaster = DataRequest.GetDictionaryJsonObject<bool>(requestData, "isMaster");
if (roomid != "-1" && FunGameSystem.RoomList.IsExist(roomid))
if (roomid != "-1" && FunGameSystem.RoomList.Exists(roomid))
{
Room room = FunGameSystem.RoomList[roomid];
RoomEventArgs eventArgs = new(room);
@ -403,7 +403,7 @@ namespace Milimoe.FunGame.Server.Controller
}
else if (SQLHelper != null)
{
SQLHelper.ExecuteDataSet(RoomQuery.Select_IsExistRoom(SQLHelper, roomid));
SQLHelper.ExecuteDataSet(RoomQuery.Select_RoomByRoomId(SQLHelper, roomid));
if (SQLHelper.Success)
{
FunGameSystem.RoomList.IntoRoom(roomid, Server.User);
@ -897,7 +897,7 @@ namespace Milimoe.FunGame.Server.Controller
string newModule = DataRequest.GetDictionaryJsonObject<string>(requestData, "module") ?? "";
string newMap = DataRequest.GetDictionaryJsonObject<string>(requestData, "map") ?? "";
User user = Server.User;
if (roomid != "-1" && FunGameSystem.RoomList.IsExist(roomid))
if (roomid != "-1" && FunGameSystem.RoomList.Exists(roomid))
{
Room room = FunGameSystem.RoomList[roomid];
RoomEventArgs eventArgs = new(room);
@ -973,7 +973,7 @@ namespace Milimoe.FunGame.Server.Controller
string roomid = DataRequest.GetDictionaryJsonObject<string>(requestData, "roomid") ?? "-1";
User newMaster = DataRequest.GetDictionaryJsonObject<User>(requestData, "newMaster") ?? Factory.GetUser();
if (roomid != "-1" && FunGameSystem.RoomList.IsExist(roomid) && newMaster.Id != 0)
if (roomid != "-1" && FunGameSystem.RoomList.Exists(roomid) && newMaster.Id != 0)
{
Room room = FunGameSystem.RoomList[roomid];
RoomEventArgs eventArgs = new(room);

View File

@ -16,7 +16,7 @@ HTTPListener? WebSocketListener = null;
ServerHelper.WriteLine("正在读取配置文件并初始化服务 . . .");
// 检查是否存在配置文件
if (!INIHelper.ExistINIFile())
if (!INIHelper.INIFileExists())
{
ServerHelper.WriteLine("未检测到配置文件,将自动创建配置文件 . . .");
INIHelper.Init(Config.FunGameType);

View File

@ -20,7 +20,7 @@ namespace Milimoe.FunGame.Server.Models
{
if (Name == "" && DataSource == "" && Port == "" && DataBase == "" && User == "" && Password == "")
{
if (INIHelper.ExistINIFile())
if (INIHelper.INIFileExists())
{
DataSource = INIHelper.ReadINI("MySQL", "DBServer");
Port = INIHelper.ReadINI("MySQL", "DBPort");
@ -41,7 +41,7 @@ namespace Milimoe.FunGame.Server.Models
{
if (DataSource == "")
{
if (INIHelper.ExistINIFile())
if (INIHelper.INIFileExists())
{
DataSource = INIHelper.ReadINI("SQLite", "DataSource");
}

View File

@ -73,7 +73,7 @@ namespace Milimoe.FunGame.Server.Services
internal static (string Msg, RegInvokeType Type, bool Success) HandleNoVerifyCode(SQLHelper sqlHelper, MailSender? mailSender, string username, string email, string clientName)
{
// 先检查账号是否重复
sqlHelper.ExecuteDataSet(UserQuery.Select_IsExistUsername(sqlHelper, username));
sqlHelper.ExecuteDataSet(UserQuery.Select_UserByUsername(sqlHelper, username));
if (sqlHelper.Result == SQLResult.Success)
{
ServerHelper.WriteLine(clientName + " 账号已被注册");
@ -81,7 +81,7 @@ namespace Milimoe.FunGame.Server.Services
}
// 检查邮箱是否重复
sqlHelper.ExecuteDataSet(UserQuery.Select_IsExistEmail(sqlHelper, email));
sqlHelper.ExecuteDataSet(UserQuery.Select_UserByEmail(sqlHelper, email));
if (sqlHelper.Result == SQLResult.Success)
{
ServerHelper.WriteLine(clientName + " 邮箱已被注册");

View File

@ -85,7 +85,7 @@ namespace Milimoe.FunGame.Server.Services
SQLMode.SQLite => new SQLiteHelper(),
_ => null,
});
if (INIHelper.ExistINIFile())
if (INIHelper.INIFileExists())
{
string useMySQL = INIHelper.ReadINI("MySQL", "UseMySQL").Trim();
string useSQLite = INIHelper.ReadINI("SQLite", "UseSQLite").Trim();
@ -238,7 +238,7 @@ namespace Milimoe.FunGame.Server.Services
ServerHelper.Error(e);
}
}
/// <summary>
/// Web API 启动完成回调
/// </summary>

View File

@ -148,7 +148,7 @@ namespace Milimoe.FunGame.Server.Services
private static Hashtable GetServerSettingHashtable()
{
Hashtable settings = [];
if (INIHelper.ExistINIFile())
if (INIHelper.INIFileExists())
{
settings.Add("LogLevel", INIHelper.ReadINI("Console", "LogLevel"));
settings.Add("Name", INIHelper.ReadINI("Server", "Name"));
@ -260,7 +260,7 @@ namespace Milimoe.FunGame.Server.Services
{
if (SenderMailAddress == "" && SenderName == "" && SenderPassword == "" && SmtpHost == "")
{
if (INIHelper.ExistINIFile())
if (INIHelper.INIFileExists())
{
if (bool.TryParse(INIHelper.ReadINI("Mailer", "UseMailSender").ToLower(), out bool use))
{

View File

@ -37,7 +37,7 @@ try
ServerHelper.WriteLine("正在读取配置文件并初始化服务 . . .");
// 检查是否存在配置文件
if (!INIHelper.ExistINIFile())
if (!INIHelper.INIFileExists())
{
ServerHelper.WriteLine("未检测到配置文件,将自动创建配置文件 . . .");
INIHelper.Init(Config.FunGameType);