Beagrep.Daemon.BuildIndex.DirectoryToIndexable C# (CSharp) Метод

DirectoryToIndexable() статический приватный Метод

static private DirectoryToIndexable ( DirectoryInfo dir, Queue modified_directories ) : Beagrep.Indexable
dir System.IO.DirectoryInfo
modified_directories System.Collections.Queue
Результат Beagrep.Indexable
        static Indexable DirectoryToIndexable(DirectoryInfo dir, Queue modified_directories)
        {
            if (!dir.Exists)
                                return null;

                        // Check if the directory information is stored in attributes store
                        // And if the mtime of the directory is same as that in the attributes store
                        FileAttributes attr = fa_store.Read (PathInIndex (dir.FullName));

                        // If the directory exists in the fa store, then it is already indexed.
                        if (attr != null) {
                                // If we don't care about deleted content then we are fine.
                                // If the attributes are up-to-date, then we are fine too.
                                if (! arg_delete || FileAttributesStore.IsUpToDate (attr, FileSystem.GetLastWriteTimeUtc (dir.FullName)))
                                        return null;

                                // But the last write time needs to be uptodate to support enable-deletion,
                                // so we actually index the directories, even if --disable-directories
                                // is set.
                                modified_directories.Enqueue (dir);
                        }

                        // Create the indexable and add the standard properties we
                        // use in the FileSystemQueryable.
                        Uri uri = PathToUri (dir.FullName);
                        Indexable indexable = new Indexable (uri);
                        indexable.MimeType = "inode/directory";
                        indexable.NoContent = true;
                        indexable.Timestamp = dir.LastWriteTimeUtc;

                        // Store the directory information in the index anyway, but if --disable-directories
                        // was passed, then do not store the names and other standard properties
                        // used during searching
                        if (! arg_disable_directories)
                                FSQ.AddStandardPropertiesToIndexable (indexable, dir.Name, Guid.Empty, false);

                        // Add directory name property
                        string dirname = dir.Parent.FullName;
                        indexable.AddProperty (Property.NewUnsearched (Property.ParentDirUriPropKey, PathToUri (dirname)));

                        indexable.AddProperty (Property.NewBool (Property.IsDirectoryPropKey, true));

                        return indexable;
        }