示例#1
0
        public static void Register(Library l, DriverCollection d)
        {
            l.Add(mans);

            d.Add(OutputDriver.Instance);
            d.SetDefault(OutputDriver.Instance);
        }
示例#2
0
        /// <summary>
        /// Restocks a driver.
        /// </summary>
        /// <param name="driver">The driver.</param>
        /// <param name="returnReason"></param>
        /// <returns>A Task to be awaited.</returns>
        public void Restock(IWebDriver driver, DriverReturnReason returnReason)
        {
            // todo: better track if driver failures are due to common network issues or due to IP block.
            if (DriverReturnReason.Faulted == returnReason)
            {
                _driverCollection.Retire(driver);
                return;
            }

            var timeSinceCheckout = _driverCollection.TimeSinceCheckout(driver);

            if (_driverCooldownMinimum.TotalSeconds > 0 && timeSinceCheckout < _driverCooldownMinimum)
            {
                _driverCollection.AddAfterDelay(driver, _driverCooldownMinimum.Subtract(timeSinceCheckout));
            }
            else
            {
                _driverCollection.Add(driver);
            }
        }
示例#3
0
		/// <summary>
		///		Enumerates driver information and their supported display modes.
		/// </summary>
		public static DriverCollection GetDriverInfo()
		{
			DriverCollection driverList = new DriverCollection();

			foreach ( XFG.GraphicsAdapter adapterInfo in XFG.GraphicsAdapter.Adapters )
			{
				Driver driver = new Driver( adapterInfo );

				int lastWidth = 0, lastHeight = 0;
				XFG.SurfaceFormat lastFormat = 0;

				foreach ( XFG.DisplayMode mode in adapterInfo.SupportedDisplayModes )
				{
					// filter out lower resolutions, and make sure this isnt a dupe (ignore variations on refresh rate)
					if ( ( mode.Width >= 640 && mode.Height >= 480 ) &&
						( ( mode.Width != lastWidth ) || mode.Height != lastHeight || mode.Format != lastFormat ) )
					{
						// add the video mode to the list
						driver.VideoModes.Add( new VideoMode( mode ) );

						// save current mode settings for comparison on the next iteraion
						lastWidth = mode.Width;
						lastHeight = mode.Height;
						lastFormat = mode.Format;
					}
				}
				driverList.Add( driver );
			}

			return driverList;
		}
示例#4
0
		/// <summary>
		///		Enumerates driver information and their supported display modes.
		/// </summary>
		public static DriverCollection GetDriverInfo( D3D.Direct3D manager )
		{
			DriverCollection driverList = new DriverCollection();

			foreach ( D3D.AdapterInformation adapterInfo in manager.Adapters )
			{
				List<D3D.DisplayMode> displaymodeList = new List<D3D.DisplayMode>();
				Driver driver = new Driver( adapterInfo.Adapter,
                    adapterInfo.GetCaps(DeviceType.Hardware), adapterInfo.Details, adapterInfo.CurrentDisplayMode);

				int lastWidth = 0, lastHeight = 0;
				D3D.Format lastFormat = 0;

				// 32bit Modes
				foreach ( D3D.DisplayMode mode in adapterInfo.GetDisplayModes( D3D.Format.X8R8G8B8 ) )
				{
					displaymodeList.Add( mode );
				}

				// 16Bit modes
				foreach ( D3D.DisplayMode mode in adapterInfo.GetDisplayModes( D3D.Format.R5G6B5 ) )
				{
					displaymodeList.Add( mode );
				}

				foreach ( D3D.DisplayMode mode in displaymodeList )
				{
					// filter out lower resolutions, and make sure this isnt a dupe (ignore variations on refresh rate)
					if ( ( mode.Width >= 640 && mode.Height >= 480 ) &&
						( ( mode.Width != lastWidth ) || mode.Height != lastHeight || mode.Format != lastFormat ) )
					{
						// add the video mode to the list
						driver.VideoModeList.Add( new VideoMode( mode ) );

						// save current mode settings for comparison on the next iteraion
						lastWidth = mode.Width;
						lastHeight = mode.Height;
						lastFormat = mode.Format;
					}
				}
				driverList.Add( driver );
			}
			return driverList;
		}
示例#5
0
		/// <summary>
		///		Enumerates driver information and their supported display modes.
		/// </summary>
		public static DriverCollection GetDriverInfo()
		{
			var driverList = new DriverCollection();

#if SILVERLIGHT
			switch (GraphicsDeviceManager.Current.RenderModeReason)
			{
				case RenderModeReason.GPUAccelerationDisabled:
					MessageBox.Show("GPU hardware acceleration is disabled. Set 'EnableGPUAcceleration' to true in the hosting HTML page and 'Use GPU Acceleration' in Out-of-Browser settings", "GPUAccelerationDisabled", MessageBoxButton.OK);
					break;
				case RenderModeReason.Not3DCapable:
					MessageBox.Show("The graphics card is not 3D capable.", "Not3DCapable", MessageBoxButton.OK);
					break;
				case RenderModeReason.SecurityBlocked:                                
					MessageBox.Show("Right-click menu, open Silverlight Configuration, go to the Permissions panel and allow 3D Graphics", "SecurityBlocked", MessageBoxButton.OK);
					break;
				case RenderModeReason.TemporarilyUnavailable:
					MessageBox.Show("Device is temporarily unavailable.", "TemporarilyUnavailable", MessageBoxButton.OK);
					break;
				case RenderModeReason.Normal:
					driverList.Add(new Driver(GraphicsDeviceManager.Current.GraphicsDevice.Adapter));
					break;
			}
#else
			foreach (var adapterInfo in GraphicsAdapter.Adapters)
			{
				var driver = new Driver( adapterInfo );

				int lastWidth = 0, lastHeight = 0;
				SurfaceFormat lastFormat = 0;

				foreach ( var mode in adapterInfo.SupportedDisplayModes )
				{
					// filter out lower resolutions, and make sure this isnt a dupe (ignore variations on refresh rate)
					if ( ( mode.Width >= 640 && mode.Height >= 480 ) &&
						 ( ( mode.Width != lastWidth ) || mode.Height != lastHeight || mode.Format != lastFormat ) )
					{
						// add the video mode to the list
						driver.VideoModes.Add( new VideoMode( mode ) );

						// save current mode settings for comparison on the next iteraion
						lastWidth = mode.Width;
						lastHeight = mode.Height;
						lastFormat = mode.Format;
					}
				}
				driverList.Add( driver );
			}
#endif

			return driverList;
		}