Пример #1
0
        private IInventoryStorage _storage; // per-user specific storage reference

        public InventoryAPI(ArgvConfigSource options)
        {
            options.AddSwitch("Inventory", "local", "l");
            string useLocal = options.Configs["Inventory"].Get("local");

            if (useLocal != null)   // any value include "" will do
            {
                _cluster    = Properties.LocalSettings.Default.cassandraCluster;
                _connstring = Properties.LocalSettings.Default.coreConnStr;
                m_log.Warn("Using LOCAL settings.");
            }


            try
            {
                _cassandraStorage = new InventoryStorage(_cluster);
                _legacy           = new LegacyMysqlInventoryStorage(_connstring);
                _selector         = new CassandraMigrationProviderSelector(true, _connstring, _cassandraStorage, _legacy);
                m_log.InfoFormat("Cassandra support on '{0}' enabled and ready.", _cluster);
            }
            catch (Exception e)
            {
                m_log.ErrorFormat("Unable to connect to cassandra cluster: {0}", e);
            }
        }
        private GroupLoader()
        {
            var dir = System.IO.Path.GetDirectoryName(Assembly.GetExecutingAssembly().Location);

            IniConfigSource config   = new IniConfigSource(System.IO.Path.Combine(dir, "Halcyon.ini"));
            var             settings = new ConfigSettings();

            settings.SettingsFile = config.Configs;

            Data.Assets.Stratus.Config.Settings.Instance.DisableWritebackCache = true;
            _stratus = new Data.Assets.Stratus.StratusAssetClient();
            _stratus.Initialize(settings);
            _stratus.Start();

            _legacyInv   = new LegacyMysqlInventoryStorage(Properties.Settings.Default.CoreConnStr);
            _inv         = new InventoryStorage(Properties.Settings.Default.InventoryCluster);
            _invSelector = new CassandraMigrationProviderSelector(Properties.Settings.Default.MigrationActive,
                                                                  Properties.Settings.Default.CoreConnStr, _inv, _legacyInv);
        }