mirror of
https://github.com/project-redbud/FunGame-Server.git
synced 2025-12-05 00:06:03 +00:00
词法修正和代码清理 (#54)
This commit is contained in:
parent
ca27d7776d
commit
ffa839e9f1
@ -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);
|
||||
|
||||
@ -16,7 +16,7 @@ HTTPListener? WebSocketListener = null;
|
||||
ServerHelper.WriteLine("正在读取配置文件并初始化服务 . . .");
|
||||
|
||||
// 检查是否存在配置文件
|
||||
if (!INIHelper.ExistINIFile())
|
||||
if (!INIHelper.INIFileExists())
|
||||
{
|
||||
ServerHelper.WriteLine("未检测到配置文件,将自动创建配置文件 . . .");
|
||||
INIHelper.Init(Config.FunGameType);
|
||||
|
||||
@ -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");
|
||||
}
|
||||
|
||||
@ -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 + " 邮箱已被注册");
|
||||
|
||||
@ -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>
|
||||
|
||||
@ -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))
|
||||
{
|
||||
|
||||
@ -37,7 +37,7 @@ try
|
||||
ServerHelper.WriteLine("正在读取配置文件并初始化服务 . . .");
|
||||
|
||||
// 检查是否存在配置文件
|
||||
if (!INIHelper.ExistINIFile())
|
||||
if (!INIHelper.INIFileExists())
|
||||
{
|
||||
ServerHelper.WriteLine("未检测到配置文件,将自动创建配置文件 . . .");
|
||||
INIHelper.Init(Config.FunGameType);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user