Beispiel #1
0
        static void Task1()
        {
            var processesInfo = new List <CustomProcessInfo>();
            var processes     = Process.GetProcesses();
            int counter       = 0;
            var counterStr    = $"{counter} / {processes.Length}";

            Console.Write($"Кол-во запущенных процессов: {processes.Length}\nИндексация: {counterStr}");
            Console.SetCursorPosition(Console.CursorLeft - counterStr.Length, Console.CursorTop);
            foreach (var item in processes.OrderBy(item => item.Id))
            {
                processesInfo.Add(new CustomProcessInfo(item));
                counterStr = $"{++counter} / {processes.Length}";
                Console.Write(counterStr);
                Console.SetCursorPosition(Console.CursorLeft - counterStr.Length, Console.CursorTop);
            }
            Console.SetCursorPosition(0, Console.CursorTop + 1);
            Console.BufferWidth = 256;
            CustomProcessInfo.SmartPrinter(processesInfo,
                                           "Id", "ProcessName", "BasePriority", "StartTime", "Responding", "TotalProcessorTime");
        }
 static bool CheckAccessibility(CustomProcessInfo process, string property) =>
 !process.InaccessibleProperties.Any(inaProp => inaProp.Name == property);