Exemplo n.º 1
0
        /////////////////////////////////////////////

        int IndexArchive(FileInfo file, Scheduler.Priority priority)
        {
            if (this.FileAttributesStore.IsUpToDate(file.FullName))
            {
                return(-1);
            }

            log.Debug("Scanning Monodoc source file " + file);

            Scheduler.TaskGroup group = NewMarkingTaskGroup(file.FullName, file.LastWriteTime);

            int     countTypes = 0;
            ZipFile archive    = new ZipFile(file.ToString());

            foreach (ZipEntry entry in archive)
            {
                if (entry.Name.IndexOf(".") != -1)
                {
                    continue;
                }

                XmlDocument document = new XmlDocument();
                document.Load(archive.GetInputStream(entry));

                XmlNode type = document.SelectSingleNode("/Type");

                if (type == null)
                {
                    continue;
                }

                Indexable typeIndexable = TypeNodeToIndexable(type, file);

                Scheduler.Task typeTask = NewAddTask(typeIndexable);
                typeTask.Priority    = priority;
                typeTask.SubPriority = 0;
                typeTask.AddTaskGroup(group);
                ThisScheduler.Add(typeTask);

                foreach (XmlNode member in type.SelectNodes("Members/Member"))
                {
                    Indexable memberIndexable = MemberNodeToIndexable(
                        member,
                        file,
                        type.Attributes["FullName"].Value);

                    Scheduler.Task memberTask = NewAddTask(memberIndexable);
                    memberTask.Priority    = priority;
                    memberTask.SubPriority = 0;
                    memberTask.AddTaskGroup(group);
                    ThisScheduler.Add(memberTask);
                }
                countTypes++;
            }

            return(countTypes);
        }
Exemplo n.º 2
0
        public void Index(FileInfo file)
        {
            Scheduler.TaskGroup group = NewMarkingTaskGroup(file.FullName, file.LastWriteTime);

            MessageReader reader = new MessageReader(file.FullName);

            while (reader.HasMoreMessages)
            {
                Message   message   = reader.NextMessage;
                Indexable indexable = MessageToIndexable(message);

                Scheduler.Task task = NewAddTask(indexable);
                task.Priority    = Scheduler.Priority.Delayed;
                task.SubPriority = 0;
                task.AddTaskGroup(group);
                ThisScheduler.Add(task);
            }
        }