Example #1
0
        //UI主线程中的方法调用
        private void AddFileToDB_UIThread(string uri)
        {
            Logger.I("AddFileInDoc={0}", uri);
            string tag = CfgPath.GetTagByPath(uri);

            if (tag != null)
            {
                UriDB.AddUris(new List <string>()
                {
                    uri
                }, new List <string>()
                {
                    tag
                });
            }
            else
            {
                Logger.E("观察到文件变化,但该文件不在文件仓库中=={0}", uri);
            }
        }
Example #2
0
        public GUTag QueryTagByPath(string path)
        {
            if (qPathCmd == null)
            {
                qPathCmd = new SQLiteCommand(@"SELECT * FROM Tags where (Path=@Path)", Conn);
                qPathCmd.Parameters.AddRange(new[] {
                    new SQLiteParameter("@Path", DbType.String),
                });
            }

            List <GUTag> ret = new List <GUTag>();

            qPathCmd.Parameters[0].Value = path;
            using (SQLiteDataReader r = qPathCmd.ExecuteReader())
            {
                while (r.Read())
                {
                    GUTag tag = ReadGUTagFromR(r);
                    ret.Add(tag);
                }
            }
            if (ret.Count > 0)
            {
                return(ret[0]);
            }
            else
            {
                string       tagTitle = CfgPath.GetTagByPath(path);
                List <GUTag> tags     = QueryTags(tagTitle);
                foreach (var tag in tags)
                {
                    if (tag.GetDir() == path)
                    {
                        return(tag);
                    }
                }
            }
            return(null);
        }
Example #3
0
 private static void AssertTag(string file, string tag)
 {
     //createdir(file);
     Assert.AreEqual(tag, CfgPath.GetTagByPath(file));
 }