mirror of
https://github.com/project-redbud/FunGame-Core.git
synced 2025-04-21 19:49:34 +08:00
更新接口
This commit is contained in:
parent
0c4ea422cf
commit
0b5cbc160b
@ -1,4 +1,5 @@
|
||||
using System;
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
@ -34,5 +35,6 @@ namespace FunGame.Core.Api.Interface
|
||||
public interface ServerInterface
|
||||
{
|
||||
public string DBConnection();
|
||||
public Hashtable GetServerSettings();
|
||||
}
|
||||
}
|
||||
|
@ -90,7 +90,8 @@ namespace FunGame.Core.Api.Model.Enum
|
||||
public enum InterfaceMethod
|
||||
{
|
||||
RemoteServerIP = 1,
|
||||
DBConnection = 2
|
||||
DBConnection = 2,
|
||||
GetServerSettings = 3
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
@ -29,6 +29,7 @@ namespace FunGame.Core.Api.Util
|
||||
*/
|
||||
public const string RemoteServerIP = "RemoteServerIP";
|
||||
public const string DBConnection = "DBConnection";
|
||||
public const string GetServerSettings = "GetServerSettings";
|
||||
|
||||
/// <summary>
|
||||
/// 获取实现类类名(xxInterfaceImpl)
|
||||
@ -57,6 +58,7 @@ namespace FunGame.Core.Api.Util
|
||||
{
|
||||
(int)CommonEnums.InterfaceMethod.RemoteServerIP => RemoteServerIP,
|
||||
(int)CommonEnums.InterfaceMethod.DBConnection => DBConnection,
|
||||
(int)CommonEnums.InterfaceMethod.GetServerSettings => GetServerSettings,
|
||||
_ => "",
|
||||
};
|
||||
}
|
||||
@ -71,7 +73,7 @@ namespace FunGame.Core.Api.Util
|
||||
*/
|
||||
public const string Implement = "Impl"; // 实现类的后缀
|
||||
public static string EXEDocPath = System.Environment.CurrentDirectory.ToString() + "\\"; // 程序目录
|
||||
public static string PluginDocPath = System.Environment.CurrentDirectory + "\\plugins\\"; // 插件目录
|
||||
public static string PluginDocPath = System.Environment.CurrentDirectory.ToString() + "\\plugins\\"; // 插件目录
|
||||
|
||||
////////////////////////////////////////////////////////////////////
|
||||
/////////////// * 下 面 是 工 具 类 实 现 * ////////////////
|
||||
|
@ -12,7 +12,7 @@ namespace FunGame.Core.Api.Util
|
||||
/*
|
||||
* 声明API函数
|
||||
*/
|
||||
public string INIPath;
|
||||
public string INIPath = System.Environment.CurrentDirectory.ToString() + @"\FunGame.ini";
|
||||
[DllImport("kernel32", CharSet = CharSet.Unicode)]
|
||||
private static extern long WritePrivateProfileString(string section, string key, string val, string filePath);
|
||||
[DllImport("kernel32", CharSet = CharSet.Unicode)]
|
||||
@ -22,8 +22,9 @@ namespace FunGame.Core.Api.Util
|
||||
/// 构造函数
|
||||
/// </summary>
|
||||
/// <param name="INIPath">ini文件路径</param>
|
||||
public INIHelper(string INIPath = "./fungame.milimoe")
|
||||
public INIHelper(string INIPath = "")
|
||||
{
|
||||
if (INIPath != "")
|
||||
this.INIPath = INIPath;
|
||||
}
|
||||
|
||||
@ -59,5 +60,35 @@ namespace FunGame.Core.Api.Util
|
||||
{
|
||||
return File.Exists(INIPath);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// 初始化ini文件
|
||||
/// </summary>
|
||||
public void Init()
|
||||
{
|
||||
/**
|
||||
* Server
|
||||
*/
|
||||
WriteINI("Server", "Name", "FunGame Server");
|
||||
WriteINI("Server", "Password", "");
|
||||
WriteINI("Server", "Describe", "Just Another FunGame Server.");
|
||||
WriteINI("Server", "Notice", "This is the FunGame Server's Notice.");
|
||||
WriteINI("Server", "Key", "");
|
||||
WriteINI("Server", "Status", "1");
|
||||
/**
|
||||
* Socket
|
||||
*/
|
||||
WriteINI("Socket", "Port", "22222");
|
||||
WriteINI("Socket", "MaxPlayer", "20");
|
||||
WriteINI("Socket", "MaxConnectFailed", "0");
|
||||
/**
|
||||
* MySQL
|
||||
*/
|
||||
WriteINI("MySQL", "DBServer", "localhost");
|
||||
WriteINI("MySQL", "DBPort", "3306");
|
||||
WriteINI("MySQL", "DBName", "fungame");
|
||||
WriteINI("MySQL", "DBUser", "root");
|
||||
WriteINI("MySQL", "DBPassword", "pass");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user