Пример #1
0
        public bool ChangeProtectionMode(DataProtectionMode protectionMode)
        {
            checkConnected();

            string answer;

            if (!TrySendCommandReadAnswer("PBSZ 0", out answer))
            {
                return(false);
            }

            if (answer == null)
            {
                return(false);
            }

            if (ConnectionType != 200)
            {
                return(false);
            }

            string command = "PROT ";

            if (protectionMode == DataProtectionMode.Clear)
            {
                command += "C";
            }
            else if (protectionMode == DataProtectionMode.Private)
            {
                command += "P";
            }
            else
            {
                command += "S";
            }

            if (!TrySendCommandReadAnswer(command, out answer))
            {
                return(false);
            }

            if (answer == null)
            {
                return(false);
            }

            return(ConnectionType == 200);
        }
Пример #2
0
        public bool ChangeProtectionMode(DataProtectionMode protectionMode)
        {
            _checkConnected();

            string answer = SendCommandReadAnswer("PBSZ 0");

            if (ConnectionType != 200)
            {
                return(false);
            }

            string command = "PROT ";

            if (protectionMode == DataProtectionMode.Clear)
            {
                command += "C";
            }
            else if (protectionMode == DataProtectionMode.Private)
            {
                command += "P";
            }
            else
            {
                command += "S";
            }

            answer = SendCommandReadAnswer(command);

            bool res = ConnectionType == 200;

            if (res)
            {
                _protectionMode = protectionMode;
            }

            return(res);
        }