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

This commit is contained in:
milimoe 2025-11-23 02:18:24 +08:00 committed by GitHub
parent 774e26240b
commit 080d546a97
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
23 changed files with 42 additions and 45 deletions

View File

@ -110,7 +110,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
} }
// 确保目录存在 // 确保目录存在
ExistsDirectoryAndCreate(novelName); DirectoryExistsAndCreate(novelName);
// 复制文件内容 // 复制文件内容
string json = File.ReadAllText(path, General.DefaultEncoding); string json = File.ReadAllText(path, General.DefaultEncoding);
@ -276,7 +276,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
/// </summary> /// </summary>
/// <param name="novelName"></param> /// <param name="novelName"></param>
/// <returns></returns> /// <returns></returns>
public static bool ExistsDirectory(string novelName) public static bool DirectoryExists(string novelName)
{ {
string dpath = $@"{AppDomain.CurrentDomain.BaseDirectory}{RootPath}/{novelName}"; string dpath = $@"{AppDomain.CurrentDomain.BaseDirectory}{RootPath}/{novelName}";
return Directory.Exists(dpath); return Directory.Exists(dpath);
@ -287,7 +287,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
/// </summary> /// </summary>
/// <param name="novelName"></param> /// <param name="novelName"></param>
/// <returns></returns> /// <returns></returns>
public static bool ExistsDirectoryAndCreate(string novelName) public static bool DirectoryExistsAndCreate(string novelName)
{ {
string dpath = $@"{AppDomain.CurrentDomain.BaseDirectory}{RootPath}/{novelName}"; string dpath = $@"{AppDomain.CurrentDomain.BaseDirectory}{RootPath}/{novelName}";
bool result = Directory.Exists(dpath); bool result = Directory.Exists(dpath);
@ -304,7 +304,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
/// <param name="novelName"></param> /// <param name="novelName"></param>
/// <param name="fileName"></param> /// <param name="fileName"></param>
/// <returns></returns> /// <returns></returns>
public static bool ExistsFile(string novelName, string fileName) public static bool FileExists(string novelName, string fileName)
{ {
string dpath = $@"{AppDomain.CurrentDomain.BaseDirectory}{RootPath}/{novelName}"; string dpath = $@"{AppDomain.CurrentDomain.BaseDirectory}{RootPath}/{novelName}";
string fpath = $@"{dpath}/{fileName}.json"; string fpath = $@"{dpath}/{fileName}.json";

View File

@ -15,7 +15,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
/// </summary> /// </summary>
/// <param name="single">单例对象</param> /// <param name="single">单例对象</param>
/// <returns></returns> /// <returns></returns>
public static bool IsExist(object single) public static bool Exists(object single)
{ {
Type type = single.GetType(); Type type = single.GetType();
string name = type.FullName ?? type.ToString(); string name = type.FullName ?? type.ToString();

View File

@ -51,7 +51,7 @@ namespace Milimoe.FunGame.Core.Api.Utility
/// </summary> /// </summary>
/// <param name="FileName">文件名缺省为FunGame.ini</param> /// <param name="FileName">文件名缺省为FunGame.ini</param>
/// <returns>是否存在</returns> /// <returns>是否存在</returns>
public static bool ExistINIFile(string FileName = DefaultFileName) => File.Exists($@"{AppDomain.CurrentDomain.BaseDirectory}{FileName}"); public static bool INIFileExists(string FileName = DefaultFileName) => File.Exists($@"{AppDomain.CurrentDomain.BaseDirectory}{FileName}");
/// <summary> /// <summary>
/// 初始化ini模板文件 /// 初始化ini模板文件

View File

@ -1,7 +1,6 @@
using System.Text; using System.Text;
using Milimoe.FunGame.Core.Interface.Entity; using Milimoe.FunGame.Core.Interface.Entity;
using Milimoe.FunGame.Core.Library.Constant; using Milimoe.FunGame.Core.Library.Constant;
using Milimoe.FunGame.Core.Model;
namespace Milimoe.FunGame.Core.Entity namespace Milimoe.FunGame.Core.Entity
{ {

View File

@ -1,5 +1,4 @@
using System.Collections.Generic; using System.Text;
using System.Text;
using Milimoe.FunGame.Core.Api.Utility; using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Interface.Base; using Milimoe.FunGame.Core.Interface.Base;
using Milimoe.FunGame.Core.Interface.Entity; using Milimoe.FunGame.Core.Interface.Entity;

View File

@ -1,5 +1,4 @@
using System.Collections.Generic; using System.Text;
using System.Text;
using Milimoe.FunGame.Core.Api.Utility; using Milimoe.FunGame.Core.Api.Utility;
using Milimoe.FunGame.Core.Interface.Base; using Milimoe.FunGame.Core.Interface.Base;
using Milimoe.FunGame.Core.Interface.Entity; using Milimoe.FunGame.Core.Interface.Entity;

View File

@ -48,7 +48,7 @@ namespace Milimoe.FunGame.Core.Library.Constant
Fail, Fail,
NotFound, NotFound,
SQLError, SQLError,
IsExist Exists
} }
public enum MailSendResult public enum MailSendResult

View File

@ -23,7 +23,7 @@ namespace Milimoe.FunGame.Core.Library.SQLScript.Entity
public const string Select_Rooms = $"{Command_Select} {TableName}.{Command_All}, {UserQuery.TableName}.{UserQuery.Column_Username} {Command_As} {Column_RoomMasterName} " + public const string Select_Rooms = $"{Command_Select} {TableName}.{Command_All}, {UserQuery.TableName}.{UserQuery.Column_Username} {Command_As} {Column_RoomMasterName} " +
$"{Command_From} {TableName} {Command_LeftJoin} {UserQuery.TableName} {Command_On} {UserQuery.TableName}.{UserQuery.Column_Id} = {TableName}.{Column_RoomMaster}"; $"{Command_From} {TableName} {Command_LeftJoin} {UserQuery.TableName} {Command_On} {UserQuery.TableName}.{UserQuery.Column_Id} = {TableName}.{Column_RoomMaster}";
public static string Select_IsExistRoom(SQLHelper SQLHelper, string Roomid) public static string Select_RoomByRoomId(SQLHelper SQLHelper, string Roomid)
{ {
SQLHelper.Parameters["@Roomid"] = Roomid; SQLHelper.Parameters["@Roomid"] = Roomid;
return $"{Command_Select} {Command_All} {Command_From} {TableName} {Command_Where} {Column_Roomid} = @Roomid"; return $"{Command_Select} {Command_All} {Command_From} {TableName} {Command_Where} {Column_Roomid} = @Roomid";

View File

@ -33,13 +33,13 @@ namespace Milimoe.FunGame.Core.Library.SQLScript.Entity
return $"{Select_Users} {Command_Where} {Column_Id} = @Id"; return $"{Select_Users} {Command_Where} {Column_Id} = @Id";
} }
public static string Select_IsExistEmail(SQLHelper SQLHelper, string Email) public static string Select_UserByEmail(SQLHelper SQLHelper, string Email)
{ {
SQLHelper.Parameters["@Email"] = Email; SQLHelper.Parameters["@Email"] = Email;
return $"{Select_Users} {Command_Where} {Column_Email} = @Email"; return $"{Select_Users} {Command_Where} {Column_Email} = @Email";
} }
public static string Select_IsExistUsername(SQLHelper SQLHelper, string Username) public static string Select_UserByUsername(SQLHelper SQLHelper, string Username)
{ {
SQLHelper.Parameters["@Username"] = Username; SQLHelper.Parameters["@Username"] = Username;
return $"{Select_Users} {Command_Where} {Column_Username} = @Username"; return $"{Select_Users} {Command_Where} {Column_Username} = @Username";

View File

@ -98,7 +98,7 @@ namespace Milimoe.FunGame.Core.Model
public Room GetRoom(string roomid) => _List.TryGetValue(roomid, out Room? room) ? room : General.HallInstance; public Room GetRoom(string roomid) => _List.TryGetValue(roomid, out Room? room) ? room : General.HallInstance;
public bool IsExist(string roomid) => _List.ContainsKey(roomid); public bool Exists(string roomid) => _List.ContainsKey(roomid);
public void SetRoomMaster(string roomid, User user) public void SetRoomMaster(string roomid, User user)
{ {