/// <summary>
        /// Constructor.
        /// </summary>
        /// <param name="args"> Arguments for the constructor. Contains the fingerprint file name, the debug file name and the checkFingerprint status</param>
        public ApiClient(ApiClientArgs args)
        {
            if (args == null)
            {
                throw new ApiClientException("ERROR: input is invalid");
            }

            CheckFingerprint = args.CheckFingerprint;
            _proxySettings   = new ApiProxySettingsProcessor(args.ProxySetting);
            if (args.Port != null)
            {
                _portResolver = new ApiPortResolver(args.Port.Value, args.IsUserEnteredPort);
            }
            FingerprintManager = new FingerprintManager(args.FingerprintFile, _proxySettings);
            LimitQuery         = Limit;

            if (args.DebugFile != null)
            {
                SetDebugFile(args.DebugFile);
            }
        }
        /// <summary>
        /// Checks if the server's fingerprint, which is stored in the local fingerprint storage file, equals to the
        /// fingerprint received in the current API call.
        /// If server's fingerprint is not found in the file, a {@link CertificateException} is thrown.
        /// If the fingerprint is found in the file, the function extracts the server's fingerprint from the
        /// certificate and compares them.
        /// If they are not equal, a <see cref="WebException"/> is thrown
        /// </summary>
        /// <param name="server">IP address or name of the Check Point Management Server.</param>
        /// <param name="cert"> Server certificate.</param>
        private bool CompareFingerPrint(string server, string cert)
        {
            if (cert == null)
            {
                throw new ApiClientException("Failed to get certificate info: " + cert);
            }

            //Reading fingerprint from file
            string fingerprintFile = FingerprintManager.GetFingerprintFromFile(server);

            if (fingerprintFile == null)
            {
                throw new WebException();
            }

            //Check if fingerprint from server's certificate
            if (!fingerprintFile.Equals(cert))
            {
                throw new WebException();
            }

            return(true);
        }