Beispiel #1
0
        /// <summary>
        /// Checks if the specified symbolic file exists.
        /// </summary>
        /// <param name="SymbolicName">Path of the symbolic file.</param>
        public static bool CanConnectTo(string SymbolicName, IoMethod IoMethod = IoMethod.IoControl)
        {
            switch (IoMethod)
            {
            case IoMethod.IoControl:
            {
                var Handle = Native.CreateFile(SymbolicName, FileAccess.ReadWrite, FileShare.ReadWrite, IntPtr.Zero, FileMode.Open, 0, IntPtr.Zero);
                var Exists = (Handle != null && !Handle.IsInvalid);

                if (Handle != null)
                {
                    Handle.Close();
                }

                return(Exists);
            }

            case IoMethod.SharedMemory:
            {
                break;
            }

            default:
            {
                throw new ArgumentException();
            }
            }

            return(false);
        }
Beispiel #2
0
        public override int GetHashCode()
        {
            int hash = 1;

            if (CameraDev.Length != 0)
            {
                hash ^= CameraDev.GetHashCode();
            }
            if (FrameId.Length != 0)
            {
                hash ^= FrameId.GetHashCode();
            }
            if (PixelFormat.Length != 0)
            {
                hash ^= PixelFormat.GetHashCode();
            }
            if (IoMethod != 0)
            {
                hash ^= IoMethod.GetHashCode();
            }
            if (Width != 0)
            {
                hash ^= Width.GetHashCode();
            }
            if (Height != 0)
            {
                hash ^= Height.GetHashCode();
            }
            if (FrameRate != 0)
            {
                hash ^= FrameRate.GetHashCode();
            }
            if (Monochrome != false)
            {
                hash ^= Monochrome.GetHashCode();
            }
            if (Brightness != 0)
            {
                hash ^= Brightness.GetHashCode();
            }
            if (Contrast != 0)
            {
                hash ^= Contrast.GetHashCode();
            }
            if (Saturation != 0)
            {
                hash ^= Saturation.GetHashCode();
            }
            if (Sharpness != 0)
            {
                hash ^= Sharpness.GetHashCode();
            }
            if (Gain != 0)
            {
                hash ^= Gain.GetHashCode();
            }
            if (AutoFocus != false)
            {
                hash ^= AutoFocus.GetHashCode();
            }
            if (Focus != 0)
            {
                hash ^= Focus.GetHashCode();
            }
            if (AutoExposure != false)
            {
                hash ^= AutoExposure.GetHashCode();
            }
            if (Exposure != 0)
            {
                hash ^= Exposure.GetHashCode();
            }
            if (AutoWhiteBalance != false)
            {
                hash ^= AutoWhiteBalance.GetHashCode();
            }
            if (WhiteBalance != 0)
            {
                hash ^= WhiteBalance.GetHashCode();
            }
            if (BytesPerPixel != 0)
            {
                hash ^= BytesPerPixel.GetHashCode();
            }
            if (TriggerInternal != 0)
            {
                hash ^= TriggerInternal.GetHashCode();
            }
            if (TriggerFps != 0)
            {
                hash ^= TriggerFps.GetHashCode();
            }
            if (ChannelName.Length != 0)
            {
                hash ^= ChannelName.GetHashCode();
            }
            if (DeviceWaitMs != 0)
            {
                hash ^= DeviceWaitMs.GetHashCode();
            }
            if (SpinRate != 0)
            {
                hash ^= SpinRate.GetHashCode();
            }
            if (OutputType != 0)
            {
                hash ^= OutputType.GetHashCode();
            }
            if (compressConf_ != null)
            {
                hash ^= CompressConf.GetHashCode();
            }
            return(hash);
        }