Exemple #1
0
        public void Getdataformsqlite(Action _action)
        {
            Sqlitehelper     helper = new Sqlitehelper("data source=skbrowser.db");
            SqliteDataReader sdr    = helper.ReadFullTable("histroy");

            while (sdr.Read())
            {
                Item item = new Item();
                item.id        = sdr.GetInt16(MappingSqlitedatareader("id", sdr));
                item.bunletype =
                    (Bundletype)Enum.Parse(typeof(Bundletype), sdr.GetString(MappingSqlitedatareader("bundletype", sdr)));
                item.bundleurlandroid = sdr.GetString(MappingSqlitedatareader("bundleurlandroid", sdr));
                item.bundleurlios     = sdr.GetString(MappingSqlitedatareader("bundleurlios", sdr));
                item.category         = sdr.GetString(MappingSqlitedatareader("category", sdr));
                item.description      = sdr.GetString(MappingSqlitedatareader("description", sdr));
                item.thumbnails       = sdr.GetString(MappingSqlitedatareader("thumbnails", sdr));
                item.itemname         = sdr.GetString(MappingSqlitedatareader("itemname", sdr));
                item.trackerid        = sdr.GetString(MappingSqlitedatareader("trackerid", sdr));
                item.trackerurl       = sdr.GetString(MappingSqlitedatareader("trackerurl", sdr));
                item.tutorthumbnail   = sdr.GetString(MappingSqlitedatareader("tutorthumbnail", sdr));
                item.tutourl          = sdr.GetString(MappingSqlitedatareader("tutourl", sdr));
                item.visiblc          = bool.Parse(sdr.GetString(MappingSqlitedatareader("visible", sdr)));
                histroy.Add(item);
            }
            helper.CloseSqlConnection();

            if (_action != null)
            {
                _action.Invoke();
            }
        }
Exemple #2
0
        public void Adddatatosqlite(List <string> _datas)
        {
            Sqlitehelper helper = new Sqlitehelper("data source=skbrowser.db");

            helper.InsertInto("histroy", _datas.ToArray());
            helper.CloseSqlConnection();
        }
Exemple #3
0
        public void Getdataformsqlite(Action _action)
        {
            Sqlitehelper     helper = new Sqlitehelper("data source=skbrowser.db");
            SqliteDataReader sdr    = helper.ReadFullTable("favorite_test");

            while (sdr.Read())
            {
                Item item = new Item();
                int  id   = sdr.GetInt16(MappingSqlitedatareader("id", sdr));

                //不重复为已存在收藏表(数据库)中的数据进行解析
                if (favorite.ContainsKey(id))
                {
                    continue;
                }
                Debug.Log(sdr.GetString(MappingSqlitedatareader("jsondata", sdr)));
                item = JsonUtility.FromJson <Item>(sdr.GetString(MappingSqlitedatareader("jsondata", sdr)));
                favorite.Add(item.id, item);
            }
            helper.CloseSqlConnection();

            if (_action != null)
            {
                _action.Invoke();
            }
        }
Exemple #4
0
        private void Adddatatofavoritedb()
        {
            Sqlitehelper helper = new Sqlitehelper("data source=skbrowser.db");


            SqliteDataReader sdr = helper.Readfromid("favorite_test", "id", item.id.ToString());

            if (sdr.HasRows)
            {
                Uimanager.Getinstance().Showtips("已取消收藏");
                helper.Delete("favorite_test", "id", item.id.ToString());
                helper.CloseSqlConnection();
                favorite.GetComponent <Image>().sprite = Resources.Load <Sprite>("Ui/btn_like_nor");
                Favoriteview favoriteview = FindObjectOfType <Favoriteview>();

                if (!favoriteview.favoritegameobjects.ContainsKey(item.id))
                {
                    return;
                }
                Destroy(favoriteview.favoritegameobjects[item.id]);
                favoriteview.favoritegameobjects.Remove(item.id);
                if (!favoriteview.favoriteoperation.favorite.ContainsKey(item.id))
                {
                    return;
                }
                favoriteview.favoriteoperation.favorite.Remove(item.id);
                return;
            }

            string itemjson = JsonUtility.ToJson(item);

            helper.InsertInto("favorite_test", new string[] { item.id.ToString(), item.itemname, itemjson });
            Uimanager.Getinstance().Showtips("已添加至收藏");
            favorite.GetComponent <Image>().sprite = Resources.Load <Sprite>("Ui/btn_like_sel");
        }
Exemple #5
0
        private void Start()
        {
            //创建数据库名称为xuanyusong.db
            Sqlitehelper db = new Sqlitehelper("data source=xuanyusong.db");

            //创建数据库表,与字段
            db.CreateTable("momo", new string[] { "name", "qq", "email", "blog" }, new string[] { "text", "text", "text", "text" });
            //关闭对象
            db.CloseSqlConnection();
        }
Exemple #6
0
        /// <summary>
        /// 对按钮添加相应事件
        /// </summary>
        public void OnEnable()
        {
            description.text = item.description;
            title.text       = item.itemname;

            if (mediaplayer != null)
            {
                mediaplayer.Load(item.tutourl);
                mediaplayer.Pause();
            }

            //设置下载按钮文字,若是已缓存至本地则为false,反之
            if (!SKassetbundlehelper.instance.Checkcache(item.Getitemurl(), item.version))
            {
                downloadtext.text           = "<color=#3266BAFF>点击下载</color>";
                downloadprogress.fillAmount = 0;
            }
            else
            {
                downloadtext.text           = "<color=white>进入体验</color>";
                downloadprogress.fillAmount = 1;
            }

            if (item != null)
            {
                Browser.Getinstance().GetMarkless(item.tutorthumbnail, Setuptutorthumbnail, null, videopayer);
            }
#if VERSION2_0
            Sqlitehelper     helper = new Sqlitehelper("data source=skbrowser.db");
            SqliteDataReader sdr    = helper.Readfromid("favorite_test", "id", item.id.ToString());
            if (sdr.HasRows)
            {
                favorite.GetComponent <Image>().sprite = Resources.Load <Sprite>("Ui/btn_like_sel");
            }
            else
            {
                favorite.GetComponent <Image>().sprite = Resources.Load <Sprite>("Ui/btn_like_nor");
            }
            helper.CloseSqlConnection();
#endif
        }
Exemple #7
0
 public void Updatedatatosqlite(string _id)
 {
     Sqlitehelper helper = new Sqlitehelper("data source=skbrowser.db");
     //helper.UpdateInto()
 }
Exemple #8
0
        public void Deletedatafromsqlite(string _id)
        {
            Sqlitehelper helper = new Sqlitehelper("data source=skbrowser.db");

            helper.Delete("histroy", "id", _id);
        }