mirror of
https://github.com/project-redbud/FunGame-Core.git
synced 2025-04-22 03:59:35 +08:00
更新接口
This commit is contained in:
parent
0c4ea422cf
commit
0b5cbc160b
@ -1,4 +1,5 @@
|
|||||||
using System;
|
using System;
|
||||||
|
using System.Collections;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
@ -34,5 +35,6 @@ namespace FunGame.Core.Api.Interface
|
|||||||
public interface ServerInterface
|
public interface ServerInterface
|
||||||
{
|
{
|
||||||
public string DBConnection();
|
public string DBConnection();
|
||||||
|
public Hashtable GetServerSettings();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -90,7 +90,8 @@ namespace FunGame.Core.Api.Model.Enum
|
|||||||
public enum InterfaceMethod
|
public enum InterfaceMethod
|
||||||
{
|
{
|
||||||
RemoteServerIP = 1,
|
RemoteServerIP = 1,
|
||||||
DBConnection = 2
|
DBConnection = 2,
|
||||||
|
GetServerSettings = 3
|
||||||
}
|
}
|
||||||
|
|
||||||
#endregion
|
#endregion
|
||||||
|
@ -29,6 +29,7 @@ namespace FunGame.Core.Api.Util
|
|||||||
*/
|
*/
|
||||||
public const string RemoteServerIP = "RemoteServerIP";
|
public const string RemoteServerIP = "RemoteServerIP";
|
||||||
public const string DBConnection = "DBConnection";
|
public const string DBConnection = "DBConnection";
|
||||||
|
public const string GetServerSettings = "GetServerSettings";
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// 获取实现类类名(xxInterfaceImpl)
|
/// 获取实现类类名(xxInterfaceImpl)
|
||||||
@ -57,6 +58,7 @@ namespace FunGame.Core.Api.Util
|
|||||||
{
|
{
|
||||||
(int)CommonEnums.InterfaceMethod.RemoteServerIP => RemoteServerIP,
|
(int)CommonEnums.InterfaceMethod.RemoteServerIP => RemoteServerIP,
|
||||||
(int)CommonEnums.InterfaceMethod.DBConnection => DBConnection,
|
(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 const string Implement = "Impl"; // 实现类的后缀
|
||||||
public static string EXEDocPath = System.Environment.CurrentDirectory.ToString() + "\\"; // 程序目录
|
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函数
|
* 声明API函数
|
||||||
*/
|
*/
|
||||||
public string INIPath;
|
public string INIPath = System.Environment.CurrentDirectory.ToString() + @"\FunGame.ini";
|
||||||
[DllImport("kernel32", CharSet = CharSet.Unicode)]
|
[DllImport("kernel32", CharSet = CharSet.Unicode)]
|
||||||
private static extern long WritePrivateProfileString(string section, string key, string val, string filePath);
|
private static extern long WritePrivateProfileString(string section, string key, string val, string filePath);
|
||||||
[DllImport("kernel32", CharSet = CharSet.Unicode)]
|
[DllImport("kernel32", CharSet = CharSet.Unicode)]
|
||||||
@ -22,9 +22,10 @@ namespace FunGame.Core.Api.Util
|
|||||||
/// 构造函数
|
/// 构造函数
|
||||||
/// </summary>
|
/// </summary>
|
||||||
/// <param name="INIPath">ini文件路径</param>
|
/// <param name="INIPath">ini文件路径</param>
|
||||||
public INIHelper(string INIPath = "./fungame.milimoe")
|
public INIHelper(string INIPath = "")
|
||||||
{
|
{
|
||||||
this.INIPath = INIPath;
|
if (INIPath != "")
|
||||||
|
this.INIPath = INIPath;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -59,5 +60,35 @@ namespace FunGame.Core.Api.Util
|
|||||||
{
|
{
|
||||||
return File.Exists(INIPath);
|
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