Exemplo n.º 1
0
        private void DoShowProperties()
        {
            lbfi = new List<object>();
            foreach (string item in strItems)
            {
                BookmarkFileInfo bfi = new BookmarkFileInfo(item, false);
                if (bfi.IsValid)
                {
                    lbfi.Add(bfi);
                }
            }

            FileAttributesBrowser.ProcessObjectAttributes(lbfi);

            pgProperties.SelectedObjects = lbfi.ToArray();
            base.Modified = false;
        }
Exemplo n.º 2
0
        private void TestFile(string file)
        {
            if (_cancelSearch)
                return;

            FileInfo fi = new FileInfo(file);
            if (fi == null || !fi.Exists)
                return;

            if (SearchBookmarksActive())
            {
                BookmarkFileInfo bfi = new BookmarkFileInfo(file, false);
                if (bfi == null ||
                    !bfi.IsValid ||
                    (theTask.Option1 && bfi.IsOrphan) || /* for BMK files: option 1 = non-orphan bookmarks */
                    (theTask.Option2 && !bfi.IsOrphan))  /* for BMK files: option 2 = orphan bookmarks */
                {
                    return; // skip this file
                }
            }
            else if (SearchMediaFilesActive())
            {
                if (!MediaRenderer.IsSupportedMedia(file))
                    return; // not a media file

                MediaFileInfo mfi = MediaFileInfo.FromPath(file);
                if (mfi == null ||
                    !mfi.IsValid ||
                    (theTask.Option1 && mfi.Bookmarks.Count < 1) || /* for media files: option 1 = files with bookmarks */
                    (theTask.Option2 && mfi.Bookmarks.Count > 0))  /* for media files: option 2 = files w/o bookmarks */
                {
                    return; // skip this file
                }
            }

            if (!theTask.UseAttributes || AttributesMatch(fi.Attributes, true))
            {
                bool match = 
                    (theTask.SearchText.Length == 0) ||
                    (theTask.SearchProperties && ContainsProperty(file)) ||
                    (!theTask.SearchProperties && ContainsText(file));

                if (match && !_matchingItems.Contains(file))
                {
                    _matchingItems.Add(file);
                    CreateItem(file);
                }
            }
        }
Exemplo n.º 3
0
        private void BuildFields()
        {
            if (IsURI)
            {
                mediaType = "URL";
            }
            else if (!string.IsNullOrEmpty(base.Path))
            {
                try
                {
                    string mediaName = base.Name;
                    mediaType = base.Extension.Trim(new char[] { '.' }).ToLowerInvariant();
                    MediaRenderer renderer = MediaRenderer.DefaultInstance;
                    
                    if (!MediaRenderer.AllMediaTypes.Contains(mediaType))
                    {
                        throw new FileLoadException("Unexpected file type: " + mediaType,
                            base.Path);
                    }

                    // Check for bookmark file
                    string bookmarkPath = string.Format("{0}.bmk", base.Path);
                    _bookmarkInfo = new BookmarkFileInfo(bookmarkPath, false);

                    _bookmarkInfo.BookmarkCollectionChanged += 
                        new EventHandler(_bookmarkInfo_BookmarkCollectionChanged);
                }
                catch (FileLoadException)
                {
                    throw;
                }
                catch (FileNotFoundException)
                {
                    throw;
                }
                catch
                {
                }
            }
        }