示例#1
0
        public static void StartSingleProcess(Assembly[] asmList, List <RuntimeConfig> cfgList, Action init)
        {
            Environment.SetEnvironmentVariable("AppName", "Login.App");

#if !CLIENT
            Global.Init(null, asmList);

            init();

            Host host = null;

            string localAddrV4 = "";
            if (Global.Config.InternalIP == "auto")
            {
                localAddrV4 = Basic.GetLocalIPv4(NetworkInterfaceType.Ethernet);
            }

            host = Host.Create("Login.App", "0.0.0.0", Global.Config.ExternalIP, 17777, false);
            foreach (var cfg in cfgList)
            {
                foreach (var aName in cfg.DefaultActorNames)
                {
                    host.CreateActorLocally(aName, aName);
                }
            }

            HostHelper.RunThread(host);
#endif
        }
示例#2
0
        public static void StartMultiProcess(Assembly[] asmList, RuntimeConfig cfg, Action init)
        {
            Environment.SetEnvironmentVariable("AppName", cfg.AppName);

#if !CLIENT
            Global.Init(cfg, asmList);

            init();

            Host host = null;


            string appName = Environment.GetEnvironmentVariable("AppName");

            if (host == null)
            {
                //if(cfg.InternalIp == "auto")
                //var localAddrV4 = Basic.GetLocalIPv4(NetworkInterfaceType.Ethernet);
                host = Host.Create(cfg.AppName, cfg.InternalIP, cfg.ExternalIP, cfg.Port, false);
            }

            foreach (var aName in cfg.DefaultActorNames)
            {
                host.CreateActorLocally(aName, aName);
            }

            HostHelper.RunThread(host);
#endif
        }
示例#3
0
        public static void Start(Assembly[] asmList, List <RuntimeConfig> cfgList, Action init, bool isMultiProcess = false)
        {
            Global.Init(asmList);

            init();

            Host c = null;

            if (!isMultiProcess || cfgList == null)
            {
                var    cfg         = Global.Config;
                string localAddrV4 = "";
                if (cfg.InternalIp == "auto")
                {
                    localAddrV4 = Basic.GetLocalIPv4(NetworkInterfaceType.Ethernet);
                }
                c = Host.Create("App", localAddrV4, cfg.ExternalIp, 17777, false);

                foreach (var aName in cfg.DefaultActorNames)
                {
                    c.CreateActor(aName, aName);
                }
            }
            else
            {
                foreach (var cfg in cfgList)
                {
                    string appName = Environment.GetEnvironmentVariable("AppName");
                    if (!isMultiProcess)
                    {
                        foreach (var aName in cfg.DefaultActorNames)
                        {
                            c.CreateActor(aName, aName);
                        }
                    }
                    else
                    {
                        if (appName != cfg.AppName)
                        {
                            continue;
                        }
                        if (c == null)
                        {
                            //if(cfg.InternalIp == "auto")
                            //var localAddrV4 = Basic.GetLocalIPv4(NetworkInterfaceType.Ethernet);
                            c = Host.Create(cfg.AppName, cfg.InternalIp, cfg.ExternalIp, cfg.Port, false);
                        }
                        foreach (var aName in cfg.DefaultActorNames)
                        {
                            c.CreateActor(aName, aName);
                        }
                    }
                }
            }

            HostHelper.RunThread(c);
        }
示例#4
0
文件: Bootstrap.cs 项目: sekkit/Fenix
        public static void StartMultiProcess(Assembly[] asmList, RuntimeConfig cfg, Action init, List <RuntimeConfig> allCfgs)
        {
            Environment.SetEnvironmentVariable("AppName", cfg.AppName);

#if !CLIENT
            Global.SingleProcessMode = false;
            Global.Init(cfg, asmList);

            init();

            string appName = Environment.GetEnvironmentVariable("AppName");

            Host host = Host.Create(cfg.AppName, cfg.InternalIP, cfg.ExternalIP, cfg.Port, false);

            foreach (var aName in cfg.DefaultActorNames)
            {
                host.CreateActorLocally(aName, aName);
            }

            HostHelper.RunThread(host, allCfgs);
#endif
        }