Exemple #1
0
        public FriendsServiceBase(IConfigSource config)
            : base(config)
        {
            string dllName    = String.Empty;
            string connString = String.Empty;

            //
            // Try reading the [FriendsService] section first, if it exists
            //
            IConfig friendsConfig = config.Configs["FriendsService"];

            if (friendsConfig != null)
            {
                dllName    = friendsConfig.GetString("StorageProvider", dllName);
                connString = friendsConfig.GetString("ConnectionString", connString);
            }

            //
            // Try reading the [DatabaseService] section, if it exists
            //
            IConfig dbConfig = config.Configs["DatabaseService"];

            if (dbConfig != null)
            {
                if (dllName == String.Empty)
                {
                    dllName = dbConfig.GetString("StorageProvider", String.Empty);
                }
                if (connString == String.Empty)
                {
                    connString = dbConfig.GetString("ConnectionString", String.Empty);
                }
            }

            //
            // We tried, but this doesn't exist. We can't proceed.
            //
            if (String.Empty.Equals(dllName))
            {
                throw new Exception("No StorageProvider configured");
            }

            string realm = "Friends";

            if (friendsConfig != null)
            {
                realm = friendsConfig.GetString("Realm", realm);
            }

            m_Database = LoadPlugin <IFriendsData>(dllName, new Object[] { connString, realm });
            if (m_Database == null)
            {
                throw new Exception(
                          string.Format(
                              "Could not find a storage interface {0} in the given StorageProvider {1}", "IFriendsData", dllName));
            }
        }
        public void Initialize(IConfigSource config, IRegistryCore registry)
        {
            string dllName = String.Empty;
            string connString = String.Empty;

            //
            // Try reading the [FriendsService] section first, if it exists
            //
            IConfig friendsConfig = config.Configs["FriendsService"];
            if (friendsConfig != null)
            {
                dllName = friendsConfig.GetString("StorageProvider", dllName);
                connString = friendsConfig.GetString("ConnectionString", connString);
            }

            //
            // Try reading the [DatabaseService] section, if it exists
            //
            IConfig dbConfig = config.Configs["DatabaseService"];
            if (dbConfig != null)
            {
                if (dllName == String.Empty)
                    dllName = dbConfig.GetString("StorageProvider", String.Empty);
                if (connString == String.Empty)
                    connString = dbConfig.GetString("ConnectionString", String.Empty);
            }

            //
            // We tried, but this doesn't exist. We can't proceed.
            //
            if (String.Empty.Equals(dllName))
                throw new Exception("No StorageProvider configured");

            ///This was decamel-cased, and it will break MONO appearently as MySQL on MONO cares about case.
            string realm = "Friends";
            if (friendsConfig != null)
                realm = friendsConfig.GetString("Realm", realm);

            m_Database = AuroraModuleLoader.LoadPlugin<IFriendsData>(dllName, new Object[] { connString, realm });
            if (m_Database == null)
            {
                throw new Exception(
                    string.Format(
                        "Could not find a storage interface {0} in the given StorageProvider {1}", "IFriendsData", dllName));
            }
            registry.RegisterModuleInterface<IFriendsService>(this);
        }
        public FriendsServiceBase(IConfigSource config) : base(config)
        {
            string dllName = String.Empty;
            string connString = String.Empty;

            //
            // Try reading the [FriendsService] section first, if it exists
            //
            IConfig friendsConfig = config.Configs["FriendsService"];
            if (friendsConfig != null)
            {
                dllName = friendsConfig.GetString("StorageProvider", dllName);
                connString = friendsConfig.GetString("ConnectionString", connString);
            }

            //
            // Try reading the [DatabaseService] section, if it exists
            //
            IConfig dbConfig = config.Configs["DatabaseService"];
            if (dbConfig != null)
            {
                if (dllName == String.Empty)
                    dllName = dbConfig.GetString("StorageProvider", String.Empty);
                if (connString == String.Empty)
                    connString = dbConfig.GetString("ConnectionString", String.Empty);
            }

            //
            // We tried, but this doesn't exist. We can't proceed.
            //
            if (String.Empty.Equals(dllName))
                throw new Exception("No StorageProvider configured");

            string realm = "Friends";
            if (friendsConfig != null)
                realm = friendsConfig.GetString("Realm", realm);

            m_Database = LoadPlugin<IFriendsData>(dllName, new Object[] { connString, realm });
            if (m_Database == null)
            {
                throw new Exception(
                    string.Format(
                        "Could not find a storage interface {0} in the given StorageProvider {1}", "IFriendsData", dllName));
            }
        }
 public virtual void Start(IConfigSource config, IRegistryCore registry)
 {
     m_Database = Framework.Utilities.DataManager.RequestPlugin<IFriendsData>();
 }
 public virtual void Start (IConfigSource config, IRegistryCore registry)
 {
     m_Database = Aurora.DataManager.DataManager.RequestPlugin<IFriendsData> ();
 }
Exemple #6
0
 public virtual void Start(IConfigSource config, IRegistryCore registry)
 {
     m_Database = Framework.Utilities.DataManager.RequestPlugin <IFriendsData>();
 }
Exemple #7
0
 public void Start(IConfigSource config, IRegistryCore registry)
 {
     m_Database = Aurora.DataManager.DataManager.RequestPlugin <IFriendsData> ();
 }