Example #1
0
        // Called from standalone configurations
        public HGFriendsServerConnector(IConfigSource config, IHttpServer server, string configName, IFriendsSimConnector localConn)
            : base(config, server, configName)
        {
            if (configName != string.Empty)
            {
                m_ConfigName = configName;
            }

            Object[] args = new Object[] { config, m_ConfigName, localConn };

            IConfig serverConfig = config.Configs[m_ConfigName];

            if (serverConfig == null)
            {
                throw new Exception(String.Format("No section {0} in config file", m_ConfigName));
            }

            string theService = serverConfig.GetString("LocalServiceModule",
                                                       String.Empty);

            if (theService == String.Empty)
            {
                throw new Exception("No LocalServiceModule in config file");
            }
            m_TheService = ServerUtils.LoadPlugin <IHGFriendsService>(theService, args);

            theService = serverConfig.GetString("UserAgentService", string.Empty);
            if (theService == String.Empty)
            {
                throw new Exception("No UserAgentService in " + m_ConfigName);
            }
            m_UserAgentService = ServerUtils.LoadPlugin <IUserAgentService>(theService, new Object[] { config, localConn });

            server.AddStreamHandler(new HGFriendsServerPostHandler(m_TheService, m_UserAgentService, localConn));
        }
        // Called from standalone configurations
        public HGFriendsServerConnector(IConfigSource config, IHttpServer server, string configName, IFriendsSimConnector localConn) 
            : base(config, server, configName)
        {
            if (configName != string.Empty)
                m_ConfigName = configName;

            Object[] args = new Object[] { config, m_ConfigName, localConn };

            IConfig serverConfig = config.Configs[m_ConfigName];
            if (serverConfig == null)
                throw new Exception(String.Format("No section {0} in config file", m_ConfigName));

            string theService = serverConfig.GetString("LocalServiceModule",
                    String.Empty);
            if (theService == String.Empty)
                throw new Exception("No LocalServiceModule in config file");
            m_TheService = ServerUtils.LoadPlugin<IHGFriendsService>(theService, args);

            theService = serverConfig.GetString("UserAgentService", string.Empty);
            if (theService == String.Empty)
                throw new Exception("No UserAgentService in " + m_ConfigName);
            m_UserAgentService = ServerUtils.LoadPlugin<IUserAgentService>(theService, new Object[] { config, localConn });

            server.AddStreamHandler(new HGFriendsServerPostHandler(m_TheService, m_UserAgentService, localConn));
        }
Example #3
0
        public FriendServerProxy(IHGFriendsService service, IUserAgentService uas, IFriendsSimConnector friendsConn) : base("POST", "/hgfriends")
        {
            m_TheService               = service;
            m_UserAgentService         = uas;
            m_FriendsLocalSimConnector = friendsConn;
            m_realHandler              = new HGFriendsServerPostHandler(service, uas, friendsConn);

            if (File.Exists("friends.txt"))
            {
                m_fixCache = new List <String>(File.ReadAllLines("friends.txt"));
            }
        }
        public HGFriendsServerPostHandler(IHGFriendsService service, IUserAgentService uas, IFriendsSimConnector friendsConn) :
                base("POST", "/hgfriends")
        {
            m_TheService = service;
            m_UserAgentService = uas;
            m_FriendsLocalSimConnector = friendsConn;

            m_log.DebugFormat("[HGFRIENDS HANDLER]: HGFriendsServerPostHandler is On ({0})", 
                (m_FriendsLocalSimConnector == null ? "robust" : "standalone"));

            if (m_TheService == null)
                m_log.ErrorFormat("[HGFRIENDS HANDLER]: TheService is null!");
        }
Example #5
0
        public HGFriendsServerPostHandler(IHGFriendsService service, IUserAgentService uas, IFriendsSimConnector friendsConn) :
            base("POST", "/hgfriends")
        {
            m_TheService               = service;
            m_UserAgentService         = uas;
            m_FriendsLocalSimConnector = friendsConn;

            m_log.DebugFormat("[HGFRIENDS HANDLER]: HGFriendsServerPostHandler is On ({0})",
                              (m_FriendsLocalSimConnector == null ? "robust" : "standalone"));

            if (m_TheService == null)
            {
                m_log.ErrorFormat("[HGFRIENDS HANDLER]: TheService is null!");
            }
        }