Exemplo n.º 1
0
        public override ComputerSummary GetComputerSummary()
        {
            ComputerSummary summary = new ComputerSummary();

            summary.Name = GetComputerName();
            Console.WriteLine("Computer name: {0}", summary.Name);
            summary.User = GetUserName();
            Console.WriteLine("User name: {0}", summary.User);
            summary.Cpu = GetCpuName();
            Console.WriteLine("CPU name: {0}", summary.Cpu);
            summary.Ram = GetTotalRam();
            Console.WriteLine("Total RAM: {0} GB", summary.Ram);
            summary.VideoCard = GetVideoCardName();
            Console.WriteLine("Video card: {0}", summary.VideoCard);
            summary.Ip = GetIpAddress();
            Console.WriteLine("IP adress: {0}", summary.Ip);
            summary.CpuUsage = GetCpuUsage();
            Console.WriteLine("CPU usage: {0} %", summary.CpuUsage);
            summary.RamUsage = GetRamUsage();
            Console.WriteLine("Used RAM: {0} GB", summary.RamUsage);
            summary.AvailableDiskSpaceGb = GetAvailableDiskSpaceGb();
            Console.WriteLine("Free disk space: {0} GB", summary.AvailableDiskSpaceGb);
            summary.AverageDiskQueueLength = GetAverageDiskQueueLength();
            Console.WriteLine("Average disk queue length: {0}", summary.AverageDiskQueueLength);
            return(summary);
        }
Exemplo n.º 2
0
 public override ComputerSummary GetComputerSummary()
 {
     var computerSummary = new ComputerSummary
     {
         Name = GetMetric(ComputerName),
         User = GetMetric(UserName),
         AvailableDiskSpaceGb = int.Parse(GetMetric(AvailableDiskSpaceGb)),
         Cpu = GetMetric(Cpu),
         Ram = int.Parse(GetMetric(AvailableRam)),
         VideoCard = GetMetric(VideoCard),
         Ip = IPAddress.Parse(GetMetric(Ip)),
         CpuUsage = int.Parse(GetMetric(CpuUsage)),
         RamUsage = int.Parse(GetMetric(RamUsage)),
         AverageDiskQueueLength = int.Parse(GetMetric(AverageDiskQueueLength))
     };
     return computerSummary;
 }
        public override ComputerSummary GetComputerSummary()
        {
            var computerSummary = new ComputerSummary
            {
                Name = GetMetric(ComputerName),
                User = GetMetric(UserName),
                AvailableDiskSpaceGb = int.Parse(GetMetric(AvailableDiskSpaceGb)),
                Cpu       = GetMetric(Cpu),
                Ram       = int.Parse(GetMetric(AvailableRam)),
                VideoCard = GetMetric(VideoCard),
                Ip        = IPAddress.Parse(GetMetric(Ip)),
                CpuUsage  = int.Parse(GetMetric(CpuUsage)),
                RamUsage  = int.Parse(GetMetric(RamUsage)),
                AverageDiskQueueLength = int.Parse(GetMetric(AverageDiskQueueLength))
            };

            return(computerSummary);
        }
Exemplo n.º 4
0
        public override ComputerSummary GetComputerSummary()
        {
            ComputerSummary computerSummary = new ComputerSummary
            {
                Name                   = GetMetric("computername"),
                User                   = GetMetric("username"),
                Cpu                    = GetMetric("cpuname"),
                Ram                    = int.Parse(GetMetric("ramcapacity")),
                VideoCard              = GetMetric("vganame"),
                Ip                     = IPAddress.Parse(GetMetric("ip")),
                CpuUsage               = int.Parse(GetMetric("cpuusage")),
                RamUsage               = Convert.ToInt32(double.Parse(GetMetric("ramusage"))),
                AvailableDiskSpaceGb   = int.Parse(GetMetric("availablediskspace")),
                AverageDiskQueueLength = int.Parse(GetMetric("averagediskqueuelength"))
            };

            return(computerSummary);
        }
Exemplo n.º 5
0
        public override ComputerSummary GetComputerSummary()
        {
            var computerSummary = new ComputerSummary();

            try
            {
                computerSummary.Name                   = GetMetric(Hardware.Name);
                computerSummary.CpuUsage               = int.Parse(GetMetric(Hardware.CpuUsage));
                computerSummary.User                   = GetMetric(Hardware.User);
                computerSummary.Cpu                    = GetMetric(Hardware.Cpu);
                computerSummary.Ram                    = int.Parse(GetMetric(Hardware.Ram));
                computerSummary.RamUsage               = int.Parse(GetMetric(Hardware.RamUsage));
                computerSummary.VideoCard              = GetMetric(Hardware.VideoCard);
                computerSummary.Ip                     = IPAddress.Parse(GetMetric(Hardware.Ip));
                computerSummary.AvailableDiskSpaceGb   = int.Parse(GetMetric(Hardware.AvailableDiskSpaceGb));
                computerSummary.AverageDiskQueueLength = int.Parse(GetMetric(Hardware.AverageDiskQueueLength));
            }
            catch (Exception e)
            {
                Console.Write(e.StackTrace);
            }
            return(computerSummary);
        }
Exemplo n.º 6
0
 private void FillTextBoxes(ComputerSummary computerMetrics)
 {
     UserNameBox.AppendText(computerMetrics.User);
     ComputerNameBox.AppendText(computerMetrics.Name);
     RamBox.AppendText(computerMetrics.Ram + " MB");
     RamUsageBox.AppendText(computerMetrics.RamUsage + " %");
     CpuUsageBox.AppendText(computerMetrics.CpuUsage + " %");
     CpuBox.AppendText(computerMetrics.Cpu);
     IpBox.AppendText(computerMetrics.Ip.ToString());
     AverageDiskQueueLengthBox.AppendText(computerMetrics.AverageDiskQueueLength.ToString());
     AvailableDiskSpaceGBBox.AppendText(computerMetrics.AvailableDiskSpaceGb + " GB");
     VideoCardBox.AppendText(computerMetrics.VideoCard);
 }