Пример #1
0
        /// <summary>
        /// Return the devices connected to the software
        /// </summary>
        /// <returns>Array of ConnectedDevices structs which contain device information</returns>
        public ConnectedDevices[] GetConnectedDevices()
        {
            String export_command = get_connected_devices_cmd;

            WriteString(export_command);

            String response = "";

            GetResponse(ref response);
            String[]           response_strings = response.Split('\n');
            ConnectedDevices[] devices          = new ConnectedDevices[response_strings.Length - 1];
            for (int i = 0; i < devices.Length; ++i)
            {
                String[] current_device = response_strings[i].Split(',');
                devices[i].type      = current_device[2];
                devices[i].name      = current_device[1];
                devices[i].index     = int.Parse(current_device[0]);
                devices[i].device_id = Convert.ToInt32(current_device[3].Substring(1), 16);
                if (current_device.Length > 4)
                {
                    devices[i].is_active = true;
                }
                else
                {
                    devices[i].is_active = false;
                }
            }
            return(devices);
        }
        /// <summary>
        /// Return the devices connected to the software
        /// </summary>
        /// <returns>Array of ConnectedDevices structs which contain device information</returns>
        public ConnectedDevices[] GetConnectedDevices()
        {
            String export_command = get_connected_devices_cmd;
            WriteString(export_command);

            String response = "";
            GetResponse(ref response);
            String[] response_strings = response.Split('\n');
            ConnectedDevices[] devices = new ConnectedDevices[response_strings.Length - 1];
            for (int i = 0; i < devices.Length; ++i)
            {
                String[] current_device = response_strings[i].Split(',');
                devices[i].type = current_device[2];
                devices[i].name = current_device[1];
                devices[i].index = int.Parse(current_device[0]);
                devices[i].device_id = Convert.ToInt32(current_device[3].Substring(1), 16);
                if (current_device.Length > 4)
                    devices[i].is_active = true;
                else
                    devices[i].is_active = false;
            }
            return devices;
        }