PoshSSH/PoshSSH/SessionObject.cs

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
using Renci.SshNet;
using System;


namespace SSH
{
    // Object for SSH Sessions
    public class SshSession
    {
        public Int32 SessionId;
        public string Host;
        public SshClient Session;
        public bool Connected
        {
            get { return Session.IsConnected; }
        }

        // Method for Connecing
        public void Connect()
        {
            Session.Connect();
        }

        // Method for disconecting session
        public void Disconnect()
        {
            Session.Disconnect();
        }
    }

    // Object for SFTP Sessions
    public class SftpSession
    {
        public Int32 SessionId;
        public string Host;
        public SftpClient Session;
        public bool Connected
        {
            get { return Session.IsConnected; }
        }
        public void Disconnect()
        {
            Session.Disconnect();
        }

        // Method for Connecing
        public void Connect()
        {
            Session.Connect();
        }
    }
}