/// <summary>
        /// Allocates the specified pin.
        /// </summary>
        /// <param name="pin">The pin.</param>
        /// <param name="direction">The direction.</param>
        public void Allocate(ProcessorPin pin, PinDirection direction)
        {
            Release(pin);

            using (var streamWriter = new StreamWriter(Path.Combine(gpioPath, "export"), false))
                streamWriter.Write((int)pin);

            if (!gpioPathList.ContainsKey(pin))
            {
                var gpio = new FileGpioHandle {
                    GpioPath = GuessGpioPath(pin)
                };
                gpioPathList.Add(pin, gpio);
            }

            var filePath = Path.Combine(gpioPathList[pin].GpioPath, "direction");

            try {
                SetPinDirection(filePath, direction);
            }
            catch (UnauthorizedAccessException) {
                // program hasn't been started as root, give it a second to correct file permissions
                Thread.Sleep(TimeSpan.FromSeconds(1));
                SetPinDirection(filePath, direction);
            }

            gpioPathList[pin].GpioStream = new FileStream(Path.Combine(GuessGpioPath(pin), "value"), FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite);
        }
        /// <summary>
        /// Allocates the specified pin.
        /// </summary>
        /// <param name="pin">The pin.</param>
        /// <param name="direction">The direction.</param>
        public void Allocate(ProcessorPin pin, PinDirection direction)
        {
            Release(pin);

            using (var streamWriter = new StreamWriter(Path.Combine(gpioPath, "export"), false))
                streamWriter.Write((int)pin);

            if (!gpioPathList.ContainsKey(pin))
            {
                var gpio = new FileGpioHandle { GpioPath = GuessGpioPath(pin) };
                gpioPathList.Add(pin, gpio);
            }

            var filePath = Path.Combine(gpioPathList[pin].GpioPath, "direction");
            try {
                SetPinDirection(filePath, direction);
            }
            catch (UnauthorizedAccessException) {
                // program hasn't been started as root, give it a second to correct file permissions
                Thread.Sleep(TimeSpan.FromSeconds(1));
                SetPinDirection(filePath, direction);
            }

            gpioPathList[pin].GpioStream = new FileStream(Path.Combine(GuessGpioPath(pin), "value"), FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite);
        }