Ejemplo n.º 1
0
        public static bool GetConfig(string fieldName, object fieldValue, out ConfChapterAssetManifest config)
        {
            DataTable sqReader = SQLiteHelper.Instance().GetSelectWhereCondition("conf_ChapterAssetManifest", fieldName, fieldValue);

            if (sqReader != null)
            {
                try
                {
                    sqReader.Read();
                    if (sqReader.HasRows)
                    {
                        config = GetConfByDic(sqReader);
                    }
                    else
                    {
                        config = null;
                        return(false);
                    }
                    return(true);
                }
                catch (Exception ex)
                {
                    SqliteDriver.SQLiteHelper.OnError(string.Format("ChapterAssetManifest 表找不到列={0} 值={1}的数据\n{2}", fieldName, fieldValue, ex));
                }
                config = null;
                return(false);
            }
            config = null;
            return(false);
        }
Ejemplo n.º 2
0
        private static ConfChapterAssetManifest GetConfByDic(DataTable reader)
        {
            int    id         = reader.GetInt32(0);
            int    chapterID  = reader.GetInt32(1);
            string AssetsName = reader.GetString(2);

            ConfChapterAssetManifest new_obj_ConfChapterAssetManifest = new ConfChapterAssetManifest(id,
                                                                                                     chapterID,
                                                                                                     AssetsName
                                                                                                     );

            return(new_obj_ConfChapterAssetManifest);
        }
Ejemplo n.º 3
0
 private static void GetArrrayList()
 {
     if (cacheArray.Count <= 0)
     {
         DataTable sqReader = SQLiteHelper.Instance().GetReadFullTable("conf_ChapterAssetManifest");
         if (sqReader != null)
         {
             while (sqReader.Read())
             {
                 ConfChapterAssetManifest _conf = GetConfByDic(sqReader);
                 cacheArray.Add(_conf);
                 dic[_conf.id] = _conf;
             }
             resLoaded = true;
         }
     }
 }
Ejemplo n.º 4
0
        public static bool GetConfig(int id, out ConfChapterAssetManifest config)
        {
            if (dic.TryGetValue(id, out config))
            {
                return(config != null);
            }
            if (cacheLoaded)
            {
                config = null;
                return(false);
            }
            DataTable sqReader = SQLiteHelper.Instance().GetSelectWhere("conf_ChapterAssetManifest", id);

            if (sqReader != null)
            {
                try
                {
                    sqReader.Read();
                    if (sqReader.HasRows)
                    {
                        config = GetConfByDic(sqReader);
                    }
                    else
                    {
                        dic[id] = null;
                        config  = null;
                        return(false);
                    }
                    dic[id] = config;
                    return(true);
                }
                catch (Exception ex)
                {
                    SqliteDriver.SQLiteHelper.OnError(string.Format("ChapterAssetManifest 表找不到SN={0} 的数据\n{1}", id, ex));
                }
                config = null;
                return(false);
            }
            else
            {
                config = null;
                return(false);
            }
        }