예제 #1
0
        /*
         * TODO: bind callbacks to main thread, just like in AWWS
         * a little weird with ICE's callback threads
         * so right now our temporary solution is ContinueWith
         */

        public async Task ServerMain()
        {
            Ice.Communicator communicator = null;
            try {
                var initdat = new Ice.InitializationData();
                initdat.dispatcher = (act, conn) => Task.Run(act); // prevent weird deadlocks
                communicator       = Ice.Util.initialize(initdat);

                #if DEBUG
                var adapter   = communicator.createObjectAdapterWithEndpoints("Callback.Client", "tcp -h 127.0.1.1 -p 31338");
                var rawServer = Murmur.ServerPrxHelper.checkedCast(communicator.stringToProxy("s/1 -t -e 1.1:tcp -h 127.0.0.1 -p 31337"));
                #else
                var adapter   = communicator.createObjectAdapterWithEndpoints("Callback.Client", "tcp -h 127.0.1.2 -p 31338");
                var meta      = Murmur.MetaPrxHelper.checkedCast(communicator.stringToProxy("Meta:tcp -h 127.0.1.1 -p 6502"));
                var rawServer = await FixIce.FromAsync(1, meta.begin_getServer, meta.end_getServer);
                #endif

                Console.Write("Steam user: "******"Steam password: "******"Steam guard code: ");
                    return(Console.ReadLine());
                }, new SteamEventForwarder {
                    Server = server
                }, StashCallback);
                var steamTask = steamListener.Run();

                var cmdmgr             = new CommandManager();
                var contextCallbackMgr = new ContextCallbackManager(steamListener, server, adapter, StashCallback);
                var pluginMan          = new PluginManager(this, steamListener, server, contextCallbackMgr, cmdmgr);
                var asci          = adapter.addWithUUID(new ServerCallback(this, steamListener, server, contextCallbackMgr, cmdmgr));
                var asci2         = adapter.addWithUUID(pluginMan);
                var authenticator = adapter.addWithUUID(new Authenticator(this));
                adapter.activate();

                await server.AddCallback(Murmur.ServerCallbackPrxHelper.uncheckedCast(asci));

                await server.AddCallback(Murmur.ServerCallbackPrxHelper.uncheckedCast(asci2));

                await server.SetAuthenticator(Murmur.ServerAuthenticatorPrxHelper.uncheckedCast(authenticator));

                await UpdateChannelModel(server);

                await Task.Yield();

                Console.WriteLine("server up");

                communicator.waitForShutdown();

                await steamTask;
            } finally {
                //communicator.destroy();
            }
        }
예제 #2
0
        public PluginManager(Fancyauth fancyauth, Steam.SteamListener steamListener, Wrapped.Server wserver, ContextCallbackManager ccmgr, CommandManager cmdmgr)
            : base(fancyauth.StashCallback)
        {
            Fancyauth              = fancyauth;
            SteamListener          = steamListener;
            WServer                = wserver;
            Server                 = new ServerWrapper(steamListener, wserver);
            ContextCallbackManager = ccmgr;
            CommandManager         = cmdmgr;

            var catalog = new AggregateCatalog();

            catalog.Catalogs.Add(new AssemblyCatalog(Assembly.GetExecutingAssembly()));
            if (Directory.Exists("plugins"))
            {
                catalog.Catalogs.Add(new DirectoryCatalog("plugins"));
            }
            var container = new CompositionContainer(catalog);

            container.ComposeParts(this);

            foreach (var plugin in Plugins)
            {
                plugin.Init();
            }
        }
예제 #3
0
 public ServerCallback(Fancyauth fancyauth, Steam.SteamListener steamListener, Server server, ContextCallbackManager contextCallbackMgr, CommandManager cmdmgr)
     : base(fancyauth.StashCallback)
 {
     Fancyauth     = fancyauth;
     SteamListener = steamListener;
     Server        = server;
     CommandMgr    = cmdmgr;
 }