Beispiel #1
0
        protected override void OnConnected()
        {
            base.OnConnected();

            _sftpSession = new SftpSession(Session, _operationTimeout, Encoding.UTF8);
            //_sftpSession = new SftpSession(Session, _operationTimeout);


            _sftpSession.Connect();


            _userId = GetUserId();
            if (_userId != -1)
            {
                _userGroups = new HashSet <int>(GetUserGroupsIds());
            }


            if (String.IsNullOrWhiteSpace(_rootpath))
            {
                _rootpath = _sftpSession.RequestRealPath(".").First().Key;
            }

            _supportsPosixRename =
                _sftpSession._supportedExtensions.Contains(new KeyValuePair <string, string>("*****@*****.**", "1"));
            _supportsStatVfs =
                _sftpSession._supportedExtensions.Contains(new KeyValuePair <string, string>("*****@*****.**", "2"));
            // KeepAliveInterval=TimeSpan.FromSeconds(5);

            //  Session.Disconnected+= (sender, args) => Debugger.Break();
        }