Пример #1
0
 public static void RefreshList()
 {
     DocumentList = new List<DocumentInfo>();
     TagList = new List<string>();
     foreach (DirectoryInfo dir in DocumentDirectoryList)
     {
         foreach (FileInfo file in dir.GetFiles())
         {
             DocumentType type = GetDocumentType(file.Extension.Substring(1));
             if (type != null)
             {
                 DocumentInfo newDoc = new DocumentInfo();
                 newDoc.File = file;
                 newDoc.Type = type;
                 newDoc.FullName = file.Name;
                 MatchCollection tagMatches = NameSpliter.Matches(newDoc.FullName);
                 foreach (Match tagMatch in tagMatches)
                 {
                     string tag = tagMatch.Groups["Tag"].ToString();
                     AddTag(newDoc, tag);
                 }
                 AddTag(newDoc, file.Extension.ToLower());
                 newDoc.Name = NameSpliter.Replace(newDoc.FullName, "");
                 DocumentList.Add(newDoc);
             }
         }
     }
     TagList.Sort();
 }
Пример #2
0
        public static List<string> TagList; //This will load by method RefreshList().

        #endregion Fields

        #region Methods

        public static void AddTag(DocumentInfo doc, string tag)
        {
            if (!doc.Tags.Contains(tag))
            {
                doc.Tags.Add(tag);
            }
            if (!TagList.Contains(tag))
            {
                TagList.Add(tag);
            }
        }