Ejemplo n.º 1
0
        private void UpdateData()
        {
            #region CPU
            string s = sd.GetProcessorData();
            double d = double.Parse(s.Substring(0, s.IndexOf("%")));
            monitor.setCpu(d);

            labelCpu.Text    = string.Format("{0}%", monitor.cpu);
            dataBarCPU.Value = (int)monitor.cpu;
            dataChartCPU.UpdateChart(monitor.cpu);
            #endregion

            #region MEMORIA VIRTUAL
            s = sd.GetMemoryVData();
            MatchCollection values = Regex.Matches(s, @"([0-9,.]+)");

            monitor.memoriaVirtualPorcentaje = double.Parse(values[0].Value);
            monitor.memoriaVirtualEnUso      = double.Parse(values[1].Value);
            monitor.memoriaVirtualTotal      = double.Parse(values[2].Value);

            labelMemV.Text    = s;
            dataBarMemV.Value = (int)monitor.memoriaVirtualPorcentaje;
            dataChartMem.UpdateChart(monitor.memoriaVirtualPorcentaje);
            #endregion

            #region MEMORIA FISICA
            s      = sd.GetMemoryPData();
            values = Regex.Matches(s, @"([0-9,.]+)");

            monitor.setMemoriaPorcentaje(double.Parse(values[0].Value));
            monitor.memoriaFisicaEnUso = double.Parse(values[1].Value);
            monitor.memoriaFisicaTotal = double.Parse(values[2].Value);

            labelMemP.Text    = s;
            dataBarMemP.Value = (int)monitor.memoriaFisicaPorcentaje;
            #endregion

            d = sd.GetDiskData(SystemData.DiskData.Read);
            monitor.discoLectura = sd.FormatBytes(d);
            labelDiskR.Text      = string.Format("Lectura ({0} /s)", monitor.discoLectura);
            dataChartDiskR.UpdateChart(d);

            d = sd.GetDiskData(SystemData.DiskData.Write);
            monitor.discoEscritura = sd.FormatBytes(d);
            labelDiskW.Text        = string.Format("Escritura ({0} /s)", monitor.discoEscritura);
            dataChartDiskW.UpdateChart(d);

            d = sd.GetNetData(SystemData.NetData.Received);
            monitor.redEntrada = sd.FormatBytes(d);
            labelNetI.Text     = string.Format("Entrada ({0} /s)", monitor.redEntrada);
            dataChartNetI.UpdateChart(d);

            d = sd.GetNetData(SystemData.NetData.Sent);
            monitor.redSalida = sd.FormatBytes(d);
            labelNetO.Text    = string.Format("Entrada ({0} /s)", monitor.redSalida);
            dataChartNetO.UpdateChart(d);

            monitor.SendStatus();
        }
Ejemplo n.º 2
0
        private void UpdateData()
        {
            string s = sd.GetProcessorData();

            labelCpu.Text = s;
            double d = double.Parse(s.Substring(0, s.IndexOf("%")));

            dataBarCPU.Value = (int)d;
            dataChartCPU.UpdateChart(d);

            s = sd.GetMemoryVData();
            labelMemV.Text = s;
            d = double.Parse(s.Substring(0, s.IndexOf("%")));
            dataBarMemV.Value = (int)d;
            dataChartMem.UpdateChart(d);

            s = sd.GetMemoryPData();
            labelMemP.Text    = s;
            dataBarMemP.Value = (int)double.Parse(s.Substring(0, s.IndexOf("%")));

            d = sd.GetDiskData(SystemData.DiskData.Read);
            labelDiskR.Text = "Disk Okuma (" + sd.FormatBytes(d) + "/s)";
            dataChartDiskR.UpdateChart(d);

            d = sd.GetDiskData(SystemData.DiskData.Write);
            labelDiskW.Text = "Disk Yazma (" + sd.FormatBytes(d) + "/s)";
            dataChartDiskW.UpdateChart(d);

            d = sd.GetNetData(SystemData.NetData.Received);
            labelNetI.Text = "Eth I (" + sd.FormatBytes(d) + "/s)";
            dataChartNetI.UpdateChart(d);

            d = sd.GetNetData(SystemData.NetData.Sent);
            labelNetO.Text = "Eth O (" + sd.FormatBytes(d) + "/s)";
            dataChartNetO.UpdateChart(d);
        }
Ejemplo n.º 3
0
        private void UpdateData()
        {
            string s = sd.GetProcessorData();

            labelCpu.Text = s;
            double d = double.Parse(s.Substring(0, s.IndexOf("%")));

            dataBarCPU.Value = (int)d;

            dataChartCPU.UpdateChart(d);
            cpu = (int)d;

            s = sd.GetMemoryVData();
            labelMemV.Text = s;
            d = double.Parse(s.Substring(0, s.IndexOf("%")));
            dataBarMemV.Value = (int)d;
            dataChartMem.UpdateChart(d);
            mem_v = (int)d;

            s = sd.GetMemoryPData();
            labelMemP.Text = s;
            d = double.Parse(s.Substring(0, s.IndexOf("%")));
            dataBarMemP.Value = (int)d;
            mem_p             = (int)d;

            d = sd.GetDiskData(SystemData.DiskData.Read);
            labelDiskR.Text = "Disk R (" + sd.FormatBytes(d) + "/s)";
            dataChartDiskR.UpdateChart(d);
            disk_r = (int)(d / 1024);

            d = sd.GetDiskData(SystemData.DiskData.Write);
            labelDiskW.Text = "Disk W (" + sd.FormatBytes(d) + "/s)";
            dataChartDiskW.UpdateChart(d);
            disk_w = (int)(d / 1024);

            d = sd.GetNetData(SystemData.NetData.Received);
            labelNetI.Text = "Net I (" + sd.FormatBytes(d) + "/s)";
            dataChartNetI.UpdateChart(d);
            net_i = (int)(d / 1024);

            d = sd.GetNetData(SystemData.NetData.Sent);
            labelNetO.Text = "Net O (" + sd.FormatBytes(d) + "/s)";
            dataChartNetO.UpdateChart(d);
            net_o = (int)(d / 1024);

            label12.Text = HardwareInfo.GetCPUCurrentClockSpeed().ToString();

            count = 0;
            ManagementObjectSearcher   usersSearcher = new ManagementObjectSearcher(@"SELECT * FROM Win32_UserAccount");
            ManagementObjectCollection users         = usersSearcher.Get();

            var localUsers = users.Cast <ManagementObject>().Where(
                u => (bool)u["LocalAccount"] == true &&
                (bool)u["Disabled"] == false &&
                (bool)u["Lockout"] == false &&
                int.Parse(u["SIDType"].ToString()) == 1 &&
                u["Name"].ToString() != "HomeGroupUser$");

            foreach (ManagementObject user in users)
            {
                Console.WriteLine("Name: " + user["Name"].ToString());
                count++;
            }
        }