Exemplo n.º 1
0
        public void Init()
        {
            dbsqlite = new SQLiteClass();
            DBPath   = INIClass.readIniInfo(GlobalVar.INI_systemSect, GlobalVar.INI_sysDBFileName);
            if (DBPath.Trim() == "")
            {
                DBPath = "sysdb.db";
                INIClass.wirteIniInfo(GlobalVar.INI_systemSect, GlobalVar.INI_sysLogFileName, DBPath);
            }
            FileInfo finfo = new FileInfo(DBPath);

            if (finfo.Exists)
            {
                dbsqlite.openDB(DBPath);
            }
            else
            {
                dbsqlite.createDB(DBPath);
                SQLiteTable tb = new SQLiteTable(GlobalVar.TBN_Global);
                tb.Columns.Add(new SQLiteColumn(GlobalVar.GCOL_ID, true));
                tb.Columns.Add(new SQLiteColumn(GlobalVar.GCOL_Category, ColType.Text));
                tb.Columns.Add(new SQLiteColumn(GlobalVar.GCOL_Key, ColType.Text));
                tb.Columns.Add(new SQLiteColumn(GlobalVar.GCOL_Value, ColType.Text));
                dbsqlite.createTable(tb);

                tb = new SQLiteTable(GlobalVar.TBN_Folder);
                tb.Columns.Add(new SQLiteColumn(GlobalVar.FCOL_FID, true));
                tb.Columns.Add(new SQLiteColumn(GlobalVar.FCOL_Path, ColType.Text));
                tb.Columns.Add(new SQLiteColumn(GlobalVar.FCOL_Recursive, ColType.Integer));
                dbsqlite.createTable(tb);
            }
        }
Exemplo n.º 2
0
        public bool SetIndexDir(string path)
        {
            if (path.Trim() == "")
            {
                MessageBox.Show("请输入索引存储路径", "提示");
                return(false);
            }
            DirectoryInfo dir = new DirectoryInfo(path.Trim());

            if (dir.Exists)
            {
                m_Index.INDEX_DIR = dir.FullName;
                INIClass.wirteIniInfo(GlobalVar.INI_indexSect, GlobalVar.INI_indexFolder, m_Index.INDEX_DIR);
                MessageBox.Show("设置索引存储路径成功", "提示");
                return(true);
            }
            else
            {
                MessageBox.Show("设置索引存储路径失败:路径不存在", "错误");
                return(false);
            }
        }