OMEconomy.OMBase.CommunicationHelpers.CommunicationHelpers C# (CSharp) Method

CommunicationHelpers() public method

public CommunicationHelpers ( Nini config, String moduleName, String moduleVersion ) : System
config Nini
moduleName String
moduleVersion String
return System
        public CommunicationHelpers(Nini.Config.IConfigSource config, String moduleName, String moduleVersion)
        {
            try {
                Nini.Config.IConfig startupConfig = config.Configs["OpenMetaverseEconomy"];
                m_gatewayEnvironment = startupConfig.GetString("OMBaseEnvironment", "TEST");
                m_initURL = startupConfig.GetString("OMEconomyInitialize", String.Empty);
                m_gridShortName = startupConfig.GetString("GridShortName", String.Empty);
                m_gridURL = config.Configs["GridService"].GetString("GridServerURI", String.Empty);

                if(m_gridShortName == String.Empty || m_initURL == String.Empty) {
                    m_log.Error("[" + moduleName + "]: GridShortName or OMEconomyInitialize not set");
                    return;
                }

                #if DEBUG
                    m_log.Debug(String.Format("[OMECONOMY] getGatewayURL({0}, {1}, {2}, {3})", m_initURL, moduleName, moduleVersion, m_gatewayEnvironment));
                #endif

                Dictionary<string, string> d = new Dictionary<string, string>();
                d.Add("moduleName", moduleName);
                d.Add("moduleVersion", moduleVersion);
                //d.Add("gridShortName", m_gridShortName);
                d.Add("gatewayEnvironment", m_gatewayEnvironment);

                m_gatewayURL = m_initURL; //use to obtain the real gatewayURL;
                Dictionary<string, string> response = DoRequestDictionary(d);
                if (response != null)
                {
                    m_gatewayURL = (string)response["gatewayURL"];

                    if(m_gatewayURL != m_initURL && m_gatewayURL != null)
                    {
                        m_log.Info("[" + moduleName + "]: GatewayURL: " + m_gatewayURL);
                    }
                    else
                    {
                        m_log.Error("[" + moduleName + "]: Could not set the GatewayURL - Please restart or contact the module vendor");
                    }
                }
                else
                {
                    m_gatewayURL = null;
                    m_log.Error("[" + moduleName + "]: Could not retrieve GatewayURL");
                }

            } catch(Exception e) {
                m_log.Error("[OMBASE]: " + e);
            }
        }