Beispiel #1
0
 public void UpdateList()
 {
     Process[] newSession = Process.GetProcesses();
     foreach (Process process in newSession)
     {
         int i = ProcessExists(process.Id);
         if (i != -1)
         {
             ProcessList[i].Update();
         }
         else
         {
             ProcessList.Add(new SingleProcess(process, AbleToAccess(process)));
         }
     }
     //int length = ProcessList.Count;
     //for (int i = 0; i < length; i++)
     //{
     //    if (ProcessList[i].Updated) ProcessList[i].Updated = false;
     //    else
     //    {
     //        ProcessList.RemoveAt(i);
     //        --i; --length;
     //    }
     //}
     ProcessList.RemoveAll(i => i.Updated == false);
     ProcessList.ForEach(i => i.Updated = false);
 }
Beispiel #2
0
        protected override int RunProcess(Process process)
        {
            var before = process.CpuState.TimeUse;

            Cpu.RunToEnd();
            var after = Cpu.State.TimeUse;

            ProcessList.ForEach(increasePriority);
            SuspendedList.ForEach(increasePriority);

            if (process.Priority != Priority.RealTime && process.Priority > Priority.Low)
            {
                process.Priority--;
            }

            return(after - before);
        }