SuperSocket命令程序集定义

是的,SuperSocket是用反射来查找哪些公开的类实现了基本的命令接口,但是它只在你的AppServer类定义的程序集中查找。

举例来说, 你的 AppServer 定义在程序集 GameServer.dll 中, 但是你的 ADD 命令是定义在程序集 BasicModules.dll 中:

GameServer.dll

    + MyGameServer.cs

BasicModules.dll

    + ADD.cs

默认的, 命令 "ADD" 将不会被加载到游戏服务器实例。 如果你想要加载该命令, 你如要在配置中添加程序集 BasicModules.dll 到命令程序集列表之中:

<?xml version="1.0" encoding="utf-8" ?>

<configuration>

    <configSections>

        <section name="superSocket" type="SuperSocket.SocketEngine.Configuration.SocketServiceConfig, SuperSocket.SocketEngine"/>

    </configSections>

    <appSettings>

        <add key="ServiceName" value="BroardcastService"/>

    </appSettings>

    <superSocket>

        <servers>

            <server name="SampleServer"

                    serverType="GameServer.MyGameServer, GameServer"

                    ip="Any" port="2012">

              <commandAssemblies>

                <add assembly="BasicModules"></add>

              </commandAssemblies>

            </server>

        </servers>

    </superSocket>

    <startup>

        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0" />

    </startup>

</configuration>

当然你也可以在配置中添加多个命令程序集。

posted @ 2019-07-03 15:35  樊伟胜  阅读(264)  评论(0编辑  收藏  举报