Esempio n. 1
0
 public RemoteDiskCache(
     mwg.mwgvfs.gvfs.GvfsOperation operation,
     mwg.mwgvfs.gvfs.IFsBasic basic, SshfsMessage message)
     : base(new FsBasic_RemoteFsOperation_Adapter(operation, basic, message), message)
 {
     this.InitCacheFile();
 }
Esempio n. 2
0
 public FsBasic_RemoteFsOperation_Adapter(
     mwg.mwgvfs.gvfs.GvfsOperation operation,
     mwg.mwgvfs.gvfs.IFsBasic basic,
     SshfsMessage message
     )
 {
     this.operation = operation;
     this.basic     = basic;
     this.output    = message;
 }
Esempio n. 3
0
        public static void ssh_test1()
        {
            SshUserData data1 = new SshUserData();

            data1.user = "******";
            data1.host = "tkynt2.phys.s.u-tokyo.ac.jp";
            data1.port = 22;
            data1.pass = "";

            System.Collections.Hashtable config = new System.Collections.Hashtable();
            config["StrictHostKeyChecking"] = "no";

            SshfsMessage mess1 = new SshfsMessage("[]");

            jsch::JSch    jsch  = new Tamir.SharpSsh.jsch.JSch();
            jsch::Session sess1 = jsch.getSession(data1.user, data1.host, data1.port);

            sess1.setConfig(config);
            //sess1.setUserInfo(new DokanSSHFS.DokanUserInfo(data1.pass,null));
            sess1.setUserInfo(new SshLoginInfo(mess1, data1));
            sess1.setPassword(data1.pass);
            sess1.connect();

            jsch::ChannelExec ch_e = (jsch::ChannelExec)sess1.openChannel("exec");

            ch_e.setCommand("cat");
            ch_e.setOutputStream(System.Console.OpenStandardOutput(), true);
            Tamir.SharpSsh.java.io.InputStream ins = ch_e.getInputStream();
            ch_e.connect();

            System.Console.WriteLine("ls -al ~/");
            System.IO.StreamWriter sw = new System.IO.StreamWriter(ins);
            sw.WriteLine("hello");

            //System.Threading.Thread.Sleep(2000);
            //System.Console.WriteLine("comp.");

            sw.Close();
            ins.close();

            ch_e.disconnect();
            sess1.disconnect();
        }
Esempio n. 4
0
 public RemoteEasyCache(IRemoteFsOperation operation, SshfsMessage message) : base(operation, message)
 {
 }
Esempio n. 5
0
 public RemoteNoCache(IRemoteFsOperation operation, SshfsMessage message)
 {
     this.operation = operation;
     this.message   = message;
 }
Esempio n. 6
0
 public RemoteDiskCache(IRemoteFsOperation operation, SshfsMessage message)
     : base(operation, message)
 {
     this.InitCacheFile();
 }
Esempio n. 7
0
 public ResourceList(SshfsMessage msg)
 {
     this.msg = msg;
 }
Esempio n. 8
0
 //==========================================================================
 //	操作
 //==========================================================================
 protected SshSessionBase(ISftpAccount account, string prompt)
 {
     this.msg       = new SshfsMessage(prompt);
     this.resources = new ResourceList(this.msg);
     this.account   = account;
 }
Esempio n. 9
0
 public SshLoginInfo(SshfsMessage message, SshUserData user)
 {
     this.msg  = message;
     this.pass = user.pass;
     this.psph = user.psph;
 }
Esempio n. 10
0
        public static void ssh_test2()
        {
            SshUserData data1 = new SshUserData();

            data1.user = "******";
            data1.host = "tkynt2.phys.s.u-tokyo.ac.jp";
            data1.port = 22;
            data1.pass = "";

            System.Collections.Hashtable config = new System.Collections.Hashtable();
            config["StrictHostKeyChecking"] = "no";

            SshfsMessage mess1 = new SshfsMessage("[]");

            jsch::JSch    jsch  = new Tamir.SharpSsh.jsch.JSch();
            jsch::Session sess1 = jsch.getSession(data1.user, data1.host, data1.port);

            sess1.setConfig(config);
            //sess1.setUserInfo(new DokanSSHFS.DokanUserInfo(data1.pass,null));
            sess1.setUserInfo(new SshLoginInfo(mess1, data1));
            sess1.setPassword(data1.pass);
            sess1.connect();

            //MyProx proxy=new MyProx(sess1);

            //SshUserData data2=new SshUserData();
            //data2.user="******";
            //data2.host="127.0.0.1";
            //data2.port=50022;
            //data2.pass="";
            //jsch::Session sess2=jsch.getSession(data2.user,data2.host,data2.port);
            //sess2.setConfig(config);
            //sess2.setUserInfo(new mwg.Sshfs.SshLoginInfo(mess1,data2));
            //sess2.setPassword(data2.pass);
            //sess2.setProxy(proxy);
            //sess2.connect();

            System.Console.WriteLine("cat");
            jsch::ChannelExec ch_e = (jsch::ChannelExec)sess1.openChannel("exec");

            ch_e.setCommand("cat");
            ch_e.setOutputStream(System.Console.OpenStandardOutput(), true);
            System.IO.Stream ins = ch_e.getOutputStream();
            ch_e.connect();


            System.Threading.Thread.Sleep(2000);
            System.Console.WriteLine("hello");
            ins.WriteByte((byte)'h');
            ins.WriteByte((byte)'e');
            ins.WriteByte((byte)'l');
            ins.WriteByte((byte)'l');
            ins.WriteByte((byte)'o');
            ins.WriteByte((byte)'\n');
            ins.Flush();
            //System.Threading.Thread.Sleep(2000);

            System.Threading.Thread.Sleep(2000);
            System.IO.StreamWriter sw = new System.IO.StreamWriter(ins);
            System.Console.WriteLine("test"); sw.WriteLine("test"); sw.Flush();
            System.Threading.Thread.Sleep(2000);
            System.Console.WriteLine("world"); sw.WriteLine("world"); sw.Flush();
            System.Threading.Thread.Sleep(2000);
            for (int i = 0; i < 5; i++)
            {
                System.Console.WriteLine("count={0}", i);
                sw.WriteLine("count={0}", i);
                sw.Flush();
                System.Threading.Thread.Sleep(2000);
            }
            for (int i = 5; i < 20; i++)
            {
                System.Console.WriteLine("count={0}", i);
                sw.WriteLine("count={0}", i);
                sw.Flush();
            }
            System.Threading.Thread.Sleep(2000);
            sw.Close();

            ins.Close();
            System.Console.WriteLine("comp.");

            ch_e.disconnect();
            //sess2.disconnect();
            sess1.disconnect();
        }