shared_ptr <KeyfileList> TextUserInterface::AskKeyfiles (const wxString &message) const
	{
		wxString msg = _("Enter keyfile");
		if (!message.empty())
			msg = message;

		make_shared_auto (KeyfileList, keyfiles);

		wxString s;
		wxString m = msg + L" [" + _("none") + L"]: ";
		while (!(s = AskString (m)).empty())
		{
			keyfiles->push_back (make_shared <Keyfile> (wstring (s)));
			m = msg + L" [" + _("finish") + L"]: ";
		}

		return keyfiles;
	}
Exemplo n.º 2
0
	HostDeviceList CoreFreeBSD::GetHostDevices (bool pathListOnly) const
	{
		HostDeviceList devices;
#ifdef TC_MACOSX
		const string busType = "rdisk";
#else
		foreach (const string &busType, StringConverter::Split ("ad da"))
#endif
		{
			for (int devNumber = 0; devNumber < 64; devNumber++)
			{
				stringstream devPath;
				devPath << "/dev/" << busType << devNumber;

				if (FilesystemPath (devPath.str()).IsBlockDevice() || FilesystemPath (devPath.str()).IsCharacterDevice())
				{
					make_shared_auto (HostDevice, device);
					device->Path = devPath.str();
					if (!pathListOnly)
					{
						try
						{
							device->Size = GetDeviceSize (device->Path);
						}
						catch (...)
						{
							device->Size = 0;
						}
						device->MountPoint = GetDeviceMountPoint (device->Path);
						device->SystemNumber = 0;
					}
					devices.push_back (device);

					for (int partNumber = 1; partNumber < 32; partNumber++)
					{
#ifdef TC_MACOSX
						const string partLetter = "";
#else
						foreach (const string &partLetter, StringConverter::Split (",a,b,c,d,e,f,g,h", ",", true))
#endif
						{
							stringstream partPath;
							partPath << devPath.str() << "s" << partNumber << partLetter;

							if (FilesystemPath (partPath.str()).IsBlockDevice() || FilesystemPath (partPath.str()).IsCharacterDevice())
							{
								make_shared_auto (HostDevice, partition);
								partition->Path = partPath.str();
								if (!pathListOnly)
								{
									try 
									{	        
										partition->Size = GetDeviceSize (partition->Path);
									}
									catch (...)
									{
										partition->Size = 0;
									}
									partition->MountPoint = GetDeviceMountPoint (partition->Path);
									partition->SystemNumber = 0;
								}

								device->Partitions.push_back (partition);
							}
						}
					}
				}
			}
		}
Exemplo n.º 3
0
	HostDeviceList CoreSolaris::GetHostDevices (bool pathListOnly) const
	{
		HostDeviceList devices;

		foreach_ref (const FilePath &devPath, Directory::GetFilePaths ("/dev/rdsk", false))
		{
			string drivePath = devPath;
			if (drivePath.rfind ("p0") == drivePath.size() - 2)
			{
				make_shared_auto (HostDevice, device);
				device->Path = drivePath;

				try
				{
					device->Size = GetDeviceSize (device->Path);
				}
				catch (...)
				{
					device->Size = 0;
				}
				
				if (device->Size == 0)
					continue;

				device->MountPoint = GetDeviceMountPoint (device->Path);
				device->SystemNumber = 0;

				devices.push_back (device);

				for (int partNumber = 1; partNumber <= 32; partNumber++)
				{
					stringstream partPath;
					partPath << drivePath.substr (0, drivePath.size() - 1) << partNumber;

					if (FilesystemPath (partPath.str()).IsBlockDevice() || FilesystemPath (partPath.str()).IsCharacterDevice())
					{
						make_shared_auto (HostDevice, partition);
						partition->Path = partPath.str();

						try 
						{	        
							partition->Size = GetDeviceSize (partition->Path);
						}
						catch (...)
						{
							partition->Size = 0;
						}

						if (partition->Size == 0)
							continue;

						partition->MountPoint = GetDeviceMountPoint (partition->Path);
						partition->SystemNumber = 0;

						device->Partitions.push_back (partition);
					}
				}
			}
		}

		return devices;
	}