Пример #1
0
 private void OnViewDone(object o, Evolution.ViewDoneArgs args)
 {
     // Now that we're done synching with the original
     // state of the calendar, switch all new changes to
     // Immediate mode
     priority = Scheduler.Priority.Immediate;
 }
Пример #2
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);
        }
Пример #3
0
        private void OnSequenceComplete(object o, Evolution.SequenceCompleteArgs args)
        {
            ignore_first_batch = false;

            // Now that we're done synching with the original
            // state of the addressbook, switch all new changes to
            // Immediate mode
            priority = Scheduler.Priority.Immediate;

            Logger.Log.Debug("Sequence complete!");
        }
Пример #4
0
        public void ScheduleRemoval(Uri[] uris, string tag, Scheduler.Priority priority)
        {
            if (queryable.ThisScheduler.ContainsByTag(tag))
            {
                Logger.Log.Debug("Not adding a Task for already running: {0}", tag);
                return;
            }

            Scheduler.Task task = queryable.NewAddTask(new UriRemovalIndexableGenerator(uris));
            task.Priority    = priority;
            task.SubPriority = 0;
            queryable.ThisScheduler.Add(task);
        }
Пример #5
0
        private void ScheduleRemoval(Property prop, Scheduler.Priority priority)
        {
            if (queryable.ThisScheduler.ContainsByTag(prop.ToString()))
            {
                Logger.Log.Debug("Not adding a Task for already running: {0}", prop.ToString());
                return;
            }

            Scheduler.Task task = queryable.NewRemoveByPropertyTask(prop);
            task.Priority    = priority;
            task.SubPriority = 0;
            queryable.ThisScheduler.Add(task);
        }
		public void Add (Indexable indexable, Scheduler.Priority priority)
		{
			lock (indexables) {
				indexables.Enqueue (indexable);

				if (priority > highest_prio)
					highest_prio = priority;

				if (self_task == null) {
					self_task = queryable.NewAddTask (this);
					self_task.Priority = highest_prio;
					queryable.ThisScheduler.Add (self_task);
				} else {
					self_task.Priority = highest_prio;
				}
			}
		}
Пример #7
0
        public static void RegisterProcess(Process process, Scheduler.Priority priority)
        {
#if PROCESSMANAGER_TRACE
            BasicConsole.WriteLine("Registering process...");
#endif
            if (process == null)
            {
                ExceptionMethods.Throw(new FOS_System.Exception("Attempted to register null process!"));
            }

            if (process.Registered)
            {
                ExceptionMethods.Throw(new FOS_System.Exception("Attempted to re-register process! Process name: " + process.Name));
            }

#if PROCESSMANAGER_TRACE
            //BasicConsole.WriteLine("Disabling scheduler...");
#endif
            //bool reenable = Scheduler.Enabled;
            //if (reenable)
            //{
            //    Scheduler.Disable();
            //}

#if PROCESSMANAGER_TRACE
            BasicConsole.WriteLine("Adding process...");
#endif

            Processes.Add(process);

#if PROCESSMANAGER_TRACE
            BasicConsole.WriteLine("Initialising process...");
#endif
            Scheduler.InitProcess(process, priority);


#if PROCESSMANAGER_TRACE
            //BasicConsole.WriteLine("Enabling scheduler...");
#endif
            //if (reenable)
            //{
            //    Scheduler.Enable();
            //}
        }
Пример #8
0
        private void IndexLog(string filename, Scheduler.Priority priority)
        {
            if (!File.Exists(filename))
            {
                return;
            }

            if (IsUpToDate(filename))
            {
                return;
            }

            Indexable indexable = ImLogToIndexable(filename);

            Scheduler.Task task = NewAddTask(indexable);
            task.Priority    = priority;
            task.SubPriority = 0;
            ThisScheduler.Add(task);
        }
Пример #9
0
        private void IndexNote(FileInfo file, Scheduler.Priority priority)
        {
            if (!File.Exists(file.FullName))
            {
                return;
            }

            if (IsUpToDate(file.FullName))
            {
                return;
            }

            Indexable indexable = NoteToIndexable(file);

            Scheduler.Task task = NewAddTask(indexable);
            task.Priority    = priority;
            task.SubPriority = 0;
            ThisScheduler.Add(task);
        }
        public void Add(Indexable indexable, Scheduler.Priority priority)
        {
            lock (indexables) {
                indexables.Enqueue(indexable);

                if (priority > highest_prio)
                {
                    highest_prio = priority;
                }

                if (self_task == null)
                {
                    self_task          = queryable.NewAddTask(this);
                    self_task.Priority = highest_prio;
                    queryable.ThisScheduler.Add(self_task);
                }
                else
                {
                    self_task.Priority = highest_prio;
                }
            }
        }
Пример #11
0
        private void IndexNote(FileInfo file, Scheduler.Priority priority)
        {
            if (this.IsUpToDate(file.FullName))
            {
                return;
            }

            // Try and parse a Note from the given path
            Note note = TomboyNote.ParseNote(file);

            if (note == null)
            {
                return;
            }

            // A Note was returned; add it to the index
            Indexable indexable = NoteToIndexable(file, note);

            Scheduler.Task task = NewAddTask(indexable);
            task.Priority    = priority;
            task.SubPriority = 0;
            ThisScheduler.Add(task);
        }
Пример #12
0
		private void OnViewDone (object o, Evolution.ViewDoneArgs args)
		{
			// Now that we're done synching with the original
			// state of the calendar, switch all new changes to
			// Immediate mode
			priority = Scheduler.Priority.Immediate;
		}
Пример #13
0
        private void IndexLauncher(FileInfo file, Scheduler.Priority priority)
        {
            if ((!file.Exists) ||
                (this.FileAttributesStore.IsUpToDate(file.FullName)))
            {
                return;
            }

            /* Check to see if file is a launcher */
            if (Beagle.Util.VFS.Mime.GetMimeType(file.FullName) != "application/x-desktop")
            {
                return;
            }

            StreamReader reader;

            try {
                reader = new StreamReader(file.Open(FileMode.Open, FileAccess.Read, FileShare.Read));
            } catch (Exception e) {
                log.Warn("Could not open '{0}': {1}", file.FullName, e.Message);
                return;
            }

            if (reader.ReadLine() != "[Desktop Entry]")
            {
                reader.Close();
                return;
            }

            /* I'm convinced it is a launcher */
            Indexable indexable = new Indexable(UriFu.PathToFileUri(file.FullName));

            indexable.Timestamp = file.LastWriteTime;
            indexable.Type      = "Launcher";
            indexable.MimeType  = "application/x-desktop";

            // desktop files must have a name
            bool have_name = false;

            String line;

            while ((line = reader.ReadLine()) != null)
            {
                string [] sline = line.Split('=');
                if (sline.Length != 2)
                {
                    continue;
                }

                // FIXME: We shouldnt really search fields that are in other locales than the current should we?

                if (sline [0].Equals("Icon") || sline [0].Equals("Exec"))
                {
                    indexable.AddProperty(Beagle.Property.NewUnsearched("fixme:" + sline[0], sline[1]));
                }
                else if (sline [0].StartsWith("Name"))
                {
                    if (sline [0] == "Name")
                    {
                        have_name = true;
                    }
                    indexable.AddProperty(Beagle.Property.NewUnsearched("fixme:" + sline[0], sline[1]));
                }
                else if (sline[0].StartsWith("Comment"))
                {
                    indexable.AddProperty(Beagle.Property.New("fixme:" + sline[0], sline[1]));
                }
            }
            reader.Close();

            if (have_name)
            {
                Scheduler.Task task = NewAddTask(indexable);
                task.Priority = priority;
                ThisScheduler.Add(task);
            }
        }
Пример #14
0
		private void OnSequenceComplete (object o, Evolution.SequenceCompleteArgs args)
		{
			ignore_first_batch = false;

			// Now that we're done synching with the original
			// state of the addressbook, switch all new changes to
			// Immediate mode
			priority = Scheduler.Priority.Immediate;

			Logger.Log.Debug ("Sequence complete!");
		}
Пример #15
0
 public void ScheduleIndexable(Indexable indexable, Scheduler.Priority priority)
 {
     generator.Add(indexable, priority);
 }