Esempio n. 1
0
        /// <summary>
        /// Directly open a device
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public IOpenedDevice OpenDevice(string name)
        {
            IntPtr handle;
            var status = NativeMethods.SaneOpen(name, out handle);
            if (status != (int)SaneStatus.Success)
                throw NSaneException.CreateFromStatus((int)status);

            var device = new LocalDevice(name, handle);
            return device;
        }
Esempio n. 2
0
        /// <summary>
        /// Directly open a device
        /// </summary>
        /// <param name="name"></param>
        /// <returns></returns>
        public IOpenedDevice OpenDevice(string name)
        {
            IntPtr handle;
            var    status = NativeMethods.SaneOpen(name, out handle);

            if (status != (int)SaneStatus.Success)
            {
                throw NSaneException.CreateFromStatus((int)status);
            }

            var device = new LocalDevice(name, handle);

            return(device);
        }