public bool HasNextIndexable() { if (metadata != null) { if (metadata.MoveNext()) { return(true); } else { metadata = null; FileAttributesStore.AttachLastWriteTime((string)metafiles.Current, DateTime.UtcNow); } } while (metadata == null) { if (metafiles == null) { metafiles = DirectoryWalker.GetItems(nautilus_dir, is_xml_file).GetEnumerator(); } if (!metafiles.MoveNext()) { return(false); } string file = (string)metafiles.Current; if (FileAttributesStore.IsUpToDate(file)) { continue; } metadata = NautilusTools.GetMetadata((string)metafiles.Current).GetEnumerator(); if (metadata.MoveNext()) { return(true); } else { metadata = null; FileAttributesStore.AttachLastWriteTime(file, DateTime.UtcNow); } } return(false); // Makes the compiler happy }
///////////////////////////////////////////////// private void OnInotifyEvent(Inotify.Watch watch, string path, string subitem, string srcpath, Inotify.EventType type) { if (subitem == "") { return; } if (Path.GetExtension(subitem) != ".xml") { return; } // We're only handling MovedTo events here. string file = Path.Combine(path, subitem); DateTime last_checked = DateTime.MinValue; FileAttributes attr; attr = FileAttributesStore.Read(file); if (attr != null) { last_checked = attr.LastWriteTime; } foreach (NautilusTools.NautilusMetadata nm in NautilusTools.GetMetadata(file, last_checked)) { Indexable indexable = GetIndexable(nm); Scheduler.Task task; task = this.target_queryable.NewAddTask(indexable); task.Priority = Scheduler.Priority.Immediate; ThisScheduler.Add(task); } }