Пример #1
0
            ///<summary>
            /// Get League string, see enum LeagueTypeReq
            ///</summary>
            // [Obsolete("Use CoCMediaSet, CoCMediaSetInfo")]
            public static string _GetLeague(stSqlite.Wrapper dbMgr, string leagueId, stCoCAPI.CoCAPI.CoCEnum.LeagueTypeReq type)
            {
                string field  = "",
                       league = "none";

                if (string.IsNullOrWhiteSpace(leagueId))
                {
                    return(league);
                }
                switch (type)
                {
                case stCoCAPI.CoCAPI.CoCEnum.LeagueTypeReq.Name:
                {
                    field = "name";
                    break;
                }

                case stCoCAPI.CoCAPI.CoCEnum.LeagueTypeReq.UrlSmall:
                {
                    field = "small";
                    break;
                }

                case stCoCAPI.CoCAPI.CoCEnum.LeagueTypeReq.UrlMedium:
                {
                    field = "medium";
                    break;
                }

                case stCoCAPI.CoCAPI.CoCEnum.LeagueTypeReq.UrlTiny:
                {
                    field = "tiny";
                    break;
                }

                default:
                {
                    return(league);
                }
                }
                try
                {
                    league = dbMgr.QueryOneReturnString(
                        string.Format(
                            Properties.Settings.Default.DBSelectLeaque,
                            field,
                            leagueId
                            )
                        );
                    return(league);
                }
                catch (Exception e)
                {
                    throw new CoCDBException(
                              stCoCAPI.CoCAPI.CoCEnum.ClanFmtReq.fmtNone,
                              CoCDB.thisClass + e.Message
                              );
                }
            }
Пример #2
0
 public string GetLeague(stSqlite.Wrapper dbMgr, string leagueId, stCoCAPI.CoCAPI.CoCEnum.LeagueTypeReq type)
 {
     return(CoCAPI.CoCDB._GetLeague(this.dbMgr, leagueId, type));
 }
Пример #3
0
        private void _Init(string dbname, string dbopt, string key, string clantag, string curlexe, string rootpath, stCore.IMessage ilog, bool isnotify)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(dbname))
                {
                    dbname = CoCAPI._dbName;
                }
                this._ilog     = ilog;
                this._key      = key;
                this._clantag  = clantag;
                this._curlexe  = curlexe;
                this._rootpath = ((string.IsNullOrWhiteSpace(rootpath)) ?
                                  stCore.IOBaseAssembly.BaseDataDir() : rootpath
                                  );
                this._dbm = new stSqlite.Wrapper(dbname, dbopt);
                if (this._dbm == null)
                {
                    throw new ArgumentNullException(
                              string.Format(
                                  Properties.Resources.CoCInitError, typeof(stSqlite.Wrapper).Name, 0
                                  )
                              );
                }
                this._dbm.RegisterFunction(typeof(SelectLeagueIcoFunction));
                this._dbm.RegisterFunction(typeof(SelectBadgeIcoFunction));
                this._dbm.RegisterFunction(typeof(SelectFlagIcoFunction));
                this._dbm.RegisterFunction(typeof(ComputePasswordHashFunction));

                this._cocProcess = new stCoCAPI.CoCAPI.CoCProcess(this);
                if (this._cocProcess == null)
                {
                    throw new ArgumentNullException(
                              string.Format(
                                  Properties.Resources.CoCInitError, typeof(CoCProcess).Name, 1
                                  )
                              );
                }
                this._cocProcess.CheckTable();

                this._cocInformer = new stCoCAPI.CoCAPI.CoCInformer(this);
                if (this._cocInformer == null)
                {
                    throw new ArgumentNullException(
                              string.Format(
                                  Properties.Resources.CoCInitError, typeof(CoCInformer).Name, 2
                                  )
                              );
                }

                if (isnotify)
                {
                    this._cocRrd = new CoCRrd(this);
                    if (this._cocRrd == null)
                    {
                        throw new ArgumentNullException(
                                  string.Format(
                                      Properties.Resources.CoCInitError, typeof(CoCRrd).Name, 3
                                      )
                                  );
                    }
                    this._cocNotifier = new CoCNotify(this);
                    if (this._cocNotifier == null)
                    {
                        throw new ArgumentNullException(
                                  string.Format(
                                      Properties.Resources.CoCInitError, typeof(CoCNotify).Name, 4
                                      )
                                  );
                    }
                }

#if DEBUG_PRNTABLE
                DataTable dt1 = this._dbm.Query("SELECT * FROM clanwar");
                dt1.DataTableToPrint();
#endif
            }
            catch (Exception e)
            {
                stCore.LogException.Error(e, this._ilog);
                return;
            }
        }