2017-08-21 21:04:44 +01:00
|
|
|
|
// /***************************************************************************
|
|
|
|
|
|
// The Disc Image Chef
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// Filename : ListDevices.cs
|
|
|
|
|
|
// Author(s) : Natalia Portillo <claunia@claunia.com>
|
|
|
|
|
|
//
|
|
|
|
|
|
// Component : Verbs.
|
|
|
|
|
|
//
|
|
|
|
|
|
// --[ Description ] ----------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// Implements the 'media-info' verb.
|
|
|
|
|
|
//
|
|
|
|
|
|
// --[ License ] --------------------------------------------------------------
|
|
|
|
|
|
//
|
|
|
|
|
|
// This program is free software: you can redistribute it and/or modify
|
|
|
|
|
|
// it under the terms of the GNU General Public License as
|
|
|
|
|
|
// published by the Free Software Foundation, either version 3 of the
|
|
|
|
|
|
// License, or (at your option) any later version.
|
|
|
|
|
|
//
|
|
|
|
|
|
// This program is distributed in the hope that it will be useful,
|
|
|
|
|
|
// but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
|
|
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
|
|
// GNU General Public License for more details.
|
|
|
|
|
|
//
|
|
|
|
|
|
// You should have received a copy of the GNU General Public License
|
|
|
|
|
|
// along with this program. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
|
|
//
|
|
|
|
|
|
// ----------------------------------------------------------------------------
|
2017-12-19 03:50:57 +00:00
|
|
|
|
// Copyright © 2011-2018 Natalia Portillo
|
2017-08-21 21:04:44 +01:00
|
|
|
|
// ****************************************************************************/
|
|
|
|
|
|
|
|
|
|
|
|
using System.Linq;
|
|
|
|
|
|
using DiscImageChef.Console;
|
|
|
|
|
|
using DiscImageChef.Devices;
|
|
|
|
|
|
|
|
|
|
|
|
namespace DiscImageChef.Commands
|
|
|
|
|
|
{
|
2017-12-20 02:08:37 +00:00
|
|
|
|
static class ListDevices
|
2017-08-21 21:04:44 +01:00
|
|
|
|
{
|
2017-12-20 02:08:37 +00:00
|
|
|
|
internal static void doListDevices(ListDevicesOptions options)
|
2017-08-21 21:04:44 +01:00
|
|
|
|
{
|
|
|
|
|
|
DicConsole.DebugWriteLine("Media-Info command", "--debug={0}", options.Debug);
|
|
|
|
|
|
DicConsole.DebugWriteLine("Media-Info command", "--verbose={0}", options.Verbose);
|
|
|
|
|
|
|
|
|
|
|
|
Devices.DeviceInfo[] devices = Device.ListDevices();
|
|
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
if(devices == null || devices.Length == 0) DicConsole.WriteLine("No known devices attached.");
|
2017-08-21 21:04:44 +01:00
|
|
|
|
else
|
|
|
|
|
|
{
|
|
|
|
|
|
devices = devices.OrderBy(d => d.path).ToArray();
|
|
|
|
|
|
|
2017-12-19 20:33:03 +00:00
|
|
|
|
DicConsole.WriteLine("{0,-22}|{1,-16}|{2,-24}|{3,-24}|{4,-10}|{5,-10}", "Path", "Vendor", "Model",
|
|
|
|
|
|
"Serial", "Bus", "Supported?");
|
|
|
|
|
|
DicConsole.WriteLine("{0,-22}+{1,-16}+{2,-24}+{3,-24}+{4,-10}+{5,-10}", "----------------------",
|
|
|
|
|
|
"----------------", "------------------------", "------------------------",
|
|
|
|
|
|
"----------", "----------");
|
2017-08-21 21:04:44 +01:00
|
|
|
|
foreach(Devices.DeviceInfo dev in devices)
|
2017-12-19 20:33:03 +00:00
|
|
|
|
DicConsole.WriteLine("{0,-22}|{1,-16}|{2,-24}|{3,-24}|{4,-10}|{5,-10}", dev.path, dev.vendor,
|
|
|
|
|
|
dev.model, dev.serial, dev.bus, dev.supported);
|
2017-08-21 21:04:44 +01:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
Core.Statistics.AddCommand("list-devices");
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2017-12-19 20:33:03 +00:00
|
|
|
|
}
|