示例#1
0
        private void init()
        {
#if USENOSQL
            string playerdbfile = Path.Combine(STOREPATH, PLAYER_DB);
            string campaigndbfile = Path.Combine(STOREPATH, CAMPAIGN_DB);

            m_playerDb = RaptorDB<string>.Open(playerdbfile, false);
            m_campaignDb = RaptorDB<string>.Open(campaigndbfile, true);

            if (m_campaignDb.Count() > 0)
            {
                for (int i = 0; i < m_campaignDb.Count(); i++)
                {
                    string campaignStr = m_campaignDb.FetchRecordString(i);
                    string campaignKey = campaignStr.Split('#')[0];
                    string dbfilepath = campaignStr.Split('#')[1];

                    CampaignDatabaseRaptorDb db = new CampaignDatabaseRaptorDb();
                    db.CampaignKey = campaignKey;
                    db.StorePath = dbfilepath;
                    db.init();

                    m_dictRunningCampaigns.Add(campaignKey, (ICampaignDatabase)db);
                }
            }
#endif

        }
示例#2
0
 public void Init()
 {
     var storePath = _parameters.Keys.Contains("file") ? Convert.ToString(_parameters.GetValuesForKey("file").First()):DefaultFileName;
       if (!Path.IsPathRooted(storePath)) storePath = DataPath.Combine(storePath);
       _storeFile = new FileInfo(storePath);
       _logger.NoticeFormat("Opening [{0}] Store...", _storeFile);
       _db = RaptorDB<string>.Open(_storeFile.FullName, false);
 }
示例#3
0
        public RaptorDBServer(int port, string DataPath)
        {
            _path = Directory.GetCurrentDirectory();
            AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
            AppDomain.CurrentDomain.ProcessExit += new EventHandler(CurrentDomain_ProcessExit);
            _server = new NetworkServer();

            _raptor = RaptorDB.Open(DataPath);
            register = _raptor.GetType().GetMethod("RegisterView", BindingFlags.Instance | BindingFlags.Public);
            save = _raptor.GetType().GetMethod("Save", BindingFlags.Instance | BindingFlags.Public);
            Initialize();
            _server.Start(port, processpayload);
        }
        public static List<object> Sum_Products_based_on_filter(RaptorDB.Common.IRaptorDB rap, string filter)
        {
            var q = rap.Query<RaptorDBTest1Views.SalesItemRowsView.RowSchema>(filter);

            var res = from x in q.Rows
                      group x by x.Product into g
                      select new SumType //avoid annonymous types
                      {
                          Product = g.Key,
                          TotalPrice = g.Sum(p => p.Price),
                          TotalQTY = g.Sum(p => p.QTY)
                      };

            return res.ToList<object>();
        }
        public RaptorDBServer(int port, string DataPath)
        {
            _path = Directory.GetCurrentDirectory();
            AppDomain.CurrentDomain.AssemblyResolve += new ResolveEventHandler(CurrentDomain_AssemblyResolve);
            _server = new NetworkServer();

            if (_S == "/")// unix system
                _datapath = DataPath.Replace("\\", "/");
            else
                _datapath = DataPath;

            if (_datapath.EndsWith(_S) == false)
                _datapath += _S;

            _raptor = RaptorDB.Open(DataPath);
            register = _raptor.GetType().GetMethod("RegisterView", BindingFlags.Instance | BindingFlags.Public);
            save = _raptor.GetType().GetMethod("Save", BindingFlags.Instance | BindingFlags.Public);
            Initialize();
            _server.Start(port, processpayload);
        }
示例#6
0
 public AIEngine(GameMaster master)
 {
     Master = master;
     DB = RaptorDB<string>.Open (System.IO.Path.GetFullPath (DB_PATH), false);
 }
示例#7
0
 public void init()
 {
     string dbFilePath = Path.Combine(m_strDbStorePath, m_strCampaignKey);
     m_db = new RaptorDB<string>(dbFilePath, false);
 }