Ejemplo n.º 1
0
        private void worker_QueryInfo(object sender, DoWorkEventArgs e)
        {
            try {
                Ping      ping      = new Ping();
                PingReply pingReply = null;

                try {
                    pingReply = ping.Send((string)e.Argument, 1000);
                }
                catch (PingException pingException) {
                    Console.WriteLine("Error! Bad hostname: " + (string)e.Argument + ". Skipping...");
                    ping.Dispose();
                    return;
                }

                if (pingReply.Status != IPStatus.Success)
                {
                    ping.Dispose();
                    return;
                }
                ping.Dispose();

                InfoGetter infoGetter = new InfoGetter();
                infoGetter.USBIDSPath = globalArgs.usbIDSPath;
                if (!infoGetter.connectionTest((string)e.Argument))
                {
                    Console.WriteLine("WMI/CIM query failed on " + (string)e.Argument + ". Skipping...");
                    return;
                }

                if (!infoGetter.registryTest((string)e.Argument))
                {
                    Console.WriteLine("Registry query failed on " + (string)e.Argument + ". Skipping...");
                    return;
                }

                string computer = (string)e.Argument;

                ComputerInfo       computerInfo = infoGetter.GetComputerInfo(computer);
                List <MonitorInfo> monitorInfos = infoGetter.GetMonitorInfo(computer);
                monitorInfos = infoGetter.FilterMonitorInfo(monitorInfos, globalArgs);
                List <DeviceInfo> deviceInfos = infoGetter.GetDeviceInfoRegistry(computer);
                deviceInfos = infoGetter.FilterDeviceInfo(deviceInfos, globalArgs);

                List <CSVInfo> returnInfo = writer.IngestData(computerInfo, monitorInfos, deviceInfos);
                e.Result = returnInfo;
            }
            catch {
                Console.WriteLine("Unknown unhandled error querying " + e.Argument + ". Aborting...");
                e.Result = null;
            }
        }
Ejemplo n.º 2
0
        private List <DeviceInfo> DisplayDeviceInfo(List <DeviceInfo> info)
        {
            DeviceInfoStackPanel.Children.Clear();
            int deviceCount = 1;
            List <DeviceInfo> deviceInfoListModified = infoGetter.FilterDeviceInfo(info, globalArgs);

            foreach (DeviceInfo device in deviceInfoListModified)
            {
                DeviceInfoUserControl deviceInfo = new DeviceInfoUserControl(device);
                deviceInfo.Title = "Device " + deviceCount;

                deviceCount += 1;

                DeviceInfoStackPanel.Children.Add(deviceInfo);
            }
            return(deviceInfoListModified);
        }