Example #1
0
        static void listAll()
        {
            var processlist = allProcesses();

            Diplay.PrintLine();
            foreach (Process theprocess in processlist)
            {
                if (theprocess.Id != 0)
                {
                    Diplay.PrintRow(new string[] { theprocess.ProcessName, Convert.ToString(theprocess.Id), (Convert.ToDouble(theprocess.WorkingSet64) / (1024 * 1024)).ToString("N4") + " MB" });
                    Diplay.PrintLine();
                }
            }
            Console.WriteLine("Number of processes running: {0}", processlist.Length);
        }
Example #2
0
        public void doIt(int idx)
        {
            ConsoleSpinner load = new ConsoleSpinner();

            load.Delay = 350;

            try
            {
                string file2open = path + names[idx - 1];
                for (int i = 0; i < 8; i++)
                {
                    load.Turn("Loadin ", 6);
                }
                Console.WriteLine();

                ProcessCollection processes = null;
                string            xmlPath   = file2open;

                XmlSerializer serializer = new XmlSerializer(typeof(ProcessCollection));

                StreamReader reader = new StreamReader(xmlPath);
                processes = (ProcessCollection)serializer.Deserialize(reader);
                reader.Close();
                Diplay.PrintLine();
                for (int i = 0; i < processes.Process.Length; i++)
                {
                    Diplay.PrintRow(new string[] { processes.Process[i].Name, processes.Process[i].ID, processes.Process[i].Memory });
                    Diplay.PrintLine();
                }
            }
            catch (ArgumentOutOfRangeException)
            {
                for (int i = 0; i < 8; i++)
                {
                    load.Turn("Loadin ", 7);
                }
                Console.WriteLine("Reason: No Id like that");
            }
        }