diff --git a/FunGame.Core.Api/Interface/Interface.cs b/FunGame.Core.Api/Interface/Interface.cs
index 23955b2..75d68c1 100644
--- a/FunGame.Core.Api/Interface/Interface.cs
+++ b/FunGame.Core.Api/Interface/Interface.cs
@@ -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();
}
}
diff --git a/FunGame.Core.Api/Model/Enum/CommonEnums.cs b/FunGame.Core.Api/Model/Enum/CommonEnums.cs
index 1dcf206..e85c056 100644
--- a/FunGame.Core.Api/Model/Enum/CommonEnums.cs
+++ b/FunGame.Core.Api/Model/Enum/CommonEnums.cs
@@ -90,7 +90,8 @@ namespace FunGame.Core.Api.Model.Enum
public enum InterfaceMethod
{
RemoteServerIP = 1,
- DBConnection = 2
+ DBConnection = 2,
+ GetServerSettings = 3
}
#endregion
diff --git a/FunGame.Core.Api/Util/AssemblyHelper.cs b/FunGame.Core.Api/Util/AssemblyHelper.cs
index a17b116..ff6bcd2 100644
--- a/FunGame.Core.Api/Util/AssemblyHelper.cs
+++ b/FunGame.Core.Api/Util/AssemblyHelper.cs
@@ -29,6 +29,7 @@ namespace FunGame.Core.Api.Util
*/
public const string RemoteServerIP = "RemoteServerIP";
public const string DBConnection = "DBConnection";
+ public const string GetServerSettings = "GetServerSettings";
///
/// 获取实现类类名(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\\"; // 插件目录
////////////////////////////////////////////////////////////////////
/////////////// * 下 面 是 工 具 类 实 现 * ////////////////
diff --git a/FunGame.Core.Api/Util/INIHelper.cs b/FunGame.Core.Api/Util/INIHelper.cs
index 7ee2a9b..997b0aa 100644
--- a/FunGame.Core.Api/Util/INIHelper.cs
+++ b/FunGame.Core.Api/Util/INIHelper.cs
@@ -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,9 +22,10 @@ namespace FunGame.Core.Api.Util
/// 构造函数
///
/// ini文件路径
- public INIHelper(string INIPath = "./fungame.milimoe")
+ public INIHelper(string INIPath = "")
{
- this.INIPath = INIPath;
+ if (INIPath != "")
+ this.INIPath = INIPath;
}
///
@@ -59,5 +60,35 @@ namespace FunGame.Core.Api.Util
{
return File.Exists(INIPath);
}
+
+ ///
+ /// 初始化ini文件
+ ///
+ 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");
+ }
}
}