Пример #1
0
        /// <summary>
        /// will return a file element with tag string, 
        /// path, and name populated from supplied
        /// TagMatrix
        /// </summary>
        /// <param name="path"></param>
        /// <param name="matrix"></param>
        /// <returns></returns>
        public static FileElement FromPath(string path, TagMatrix matrix)
        {
            //return new FileElement
            //{
            //    Path = path,
            //    Name = System.IO.Path.GetFileName(path),
            //    TagString = matrix.GetTagString(path)
            //};

            FileElement fe = new FileElement(path);
            fe.TagString = matrix.GetTagString(path);

            return fe;
        }
 public FileElementTagExtractionAction(TagMatrix tm, ITaggerGrid tg)
 {
     masterTagMatrix = tm;
     tgrGrid = tg;
 }
 public FileElementTimestampExtractionAction(TagMatrix tm, ITaggerGrid tg, MenuItem enabled)
 {
     masterTagMatrix = tm;
     tgrGrid = tg;
     this.enabled = enabled;
 }
Пример #4
0
 public void PopulateTagString(TagMatrix tm)
 {
     TagString = tm.GetTagString(Path);
 }
        //private TagMatrix tagMatrix = new TagMatrix();
        //private string lastLoadedPath;
        //private List<FileElementActionSubscriber> selectionChangedListeners =
        //    new List<FileElementActionSubscriber>();
        public string GetFolderWithLeastNonZeroUntaggedCount(string folderPath,
                                                             FilePathFilter fpf,
                                                             bool fileInsteadOfDb)
        {
            //we are going to be going through multiple folders,
            //we don't want to load all of them to our main matrix
            TagMatrix temp = new TagMatrix();
            temp.AddFolder(folderPath);

            if (fileInsteadOfDb)
            {
                temp.LoadFromXml(Configuration.GetTagFilePath(folderPath));
            }
            else
            {
                temp.LoadFromDb(folderPath);
            }

            string leastPath = folderPath;
            int leastCount =
                temp.GetFilesForTag(TagMatrix.TAG_UNTAGGED, fpf).Count();

            foreach (string path in Directory.GetDirectories(folderPath))
            {
                temp.Clear();
                temp.AddFolder(path);
                if (fileInsteadOfDb)
                {
                    temp.LoadFromXml(Configuration.GetTagFilePath(path));
                }
                else
                {
                    temp.LoadFromDb(path);
                }
                int count =
                    temp.GetFilesForTag(TagMatrix.TAG_UNTAGGED, fpf).Count();

                if (count > 0)
                {
                    if (leastCount < 1 || count < leastCount)
                    {
                        leastCount = count;
                        leastPath = path;
                    }
                }
            }

            return leastPath;
        }