當前位置: 首頁>>代碼示例>>C#>>正文


C# java.String類代碼示例

本文整理匯總了C#中Tamir.SharpSsh.java.String的典型用法代碼示例。如果您正苦於以下問題:C# String類的具體用法?C# String怎麽用?C# String使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


String類屬於Tamir.SharpSsh.java命名空間,在下文中一共展示了String類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ProxyHTTP

		public ProxyHTTP(String proxy_host)
		{
			int port=DEFAULTPORT;
			String host=proxy_host;
			if(proxy_host.indexOf(':')!=-1)
			{
				try
				{
					host=proxy_host.substring(0, proxy_host.indexOf(':'));
					port=Integer.parseInt(proxy_host.substring(proxy_host.indexOf(':')+1));
				}
				catch(Exception e)
				{
				}
			}
			this.proxy_host=host;
			this.proxy_port=port;
		}
開發者ID:stux2000,項目名稱:dokan,代碼行數:18,代碼來源:ProxyHTTP.cs

示例2: get

		public void get(String src, String dst,
			SftpProgressMonitor monitor) 
		{ //throws SftpException{
			get(src, dst, monitor, OVERWRITE);
		}
開發者ID:joconno4,項目名稱:MediaPortal-2,代碼行數:5,代碼來源:ChannelSftp.cs

示例3: openChannel

		//public void start(){ (new Thread(this)).start();  }

		public Channel openChannel(String type) 
		{
			if(!_isConnected)
			{
				throw new JSchException("session is down");
			}
			try
			{
				Channel channel=Channel.getChannel(type);
				addChannel(channel);
				channel.init();
				return channel;
			}
			catch(Exception e)
			{
				System.Console.WriteLine(e);
			}
			return null;
		}
開發者ID:MatanDavidCohen,項目名稱:StockAnalyzerWin,代碼行數:21,代碼來源:Session.cs

示例4: setClientVersion

		public void setClientVersion(String cv)
		{
			V_C=cv.getBytes();
		}
開發者ID:MatanDavidCohen,項目名稱:StockAnalyzerWin,代碼行數:4,代碼來源:Session.cs

示例5: setX11Host

		public void setX11Host(String host){ ChannelX11.setHost(host); }
開發者ID:MatanDavidCohen,項目名稱:StockAnalyzerWin,代碼行數:1,代碼來源:Session.cs

示例6: setUserName

		internal void setUserName(String foo){ this.username=foo; }
開發者ID:MatanDavidCohen,項目名稱:StockAnalyzerWin,代碼行數:1,代碼來源:Session.cs

示例7: setPortForwardingR

		public void setPortForwardingR(int rport, String daemon, System.Object[] arg) 
		{
			ChannelForwardedTCPIP.addPort(this, rport, daemon, arg);
			setPortForwarding(rport);
		}
開發者ID:MatanDavidCohen,項目名稱:StockAnalyzerWin,代碼行數:5,代碼來源:Session.cs

示例8: setUserPasswd

		public void setUserPasswd(String user, String passwd)
		{
			this.user=user;
			this.passwd=passwd;
		}
開發者ID:stux2000,項目名稱:dokan,代碼行數:5,代碼來源:ProxyHTTP.cs

示例9: delPortForwardingL

		public void delPortForwardingL(String boundaddress, int lport) 
		{
			PortWatcher.delPort(this, boundaddress, lport);
		}
開發者ID:MatanDavidCohen,項目名稱:StockAnalyzerWin,代碼行數:4,代碼來源:Session.cs

示例10: connect

		public void connect(SocketFactory socket_factory, String host, int port, int timeout)
		{
			try
			{
				if(socket_factory==null)
				{
					socket=Util.createSocket(proxy_host, proxy_port, timeout);    
					ins= new JStream(socket.getInputStream());
					outs=new JStream(socket.getOutputStream());
				}
				else
				{
					socket=socket_factory.createSocket(proxy_host, proxy_port);
					ins=new JStream(socket_factory.getInputStream(socket));
					outs=new JStream(socket_factory.getOutputStream(socket));
				}
				if(timeout>0)
				{
					socket.setSoTimeout(timeout);
				}
				socket.setTcpNoDelay(true);

				outs.write(new String("CONNECT "+host+":"+port+" HTTP/1.0\r\n").getBytes());

				if(user!=null && passwd!=null)
				{
					byte[] _code=(user+":"+passwd).getBytes();
					_code=Util.toBase64(_code, 0, _code.Length);
					outs.write(new String("Proxy-Authorization: Basic ").getBytes());
					outs.write(_code);
					outs.write(new String("\r\n").getBytes());
				}

				outs.write(new String("\r\n").getBytes());
				outs.flush();

				int foo=0;

				StringBuffer sb=new StringBuffer();
				while(foo>=0)
				{
					foo=ins.read(); if(foo!=13){sb.append((char)foo);  continue;}
					foo=ins.read(); if(foo!=10){continue;}
					break;
				}
				if(foo<0)
				{
					throw new System.IO.IOException(); 
				}

				String response=sb.toString(); 
				String reason="Unknow reason";
				int code=-1;
				try
				{
					foo=response.indexOf(' ');
					int bar=response.indexOf(' ', foo+1);
					code=Integer.parseInt(response.substring(foo+1, bar));
					reason=response.substring(bar+1);
				}
				catch(Exception e)
				{
				}
				if(code!=200)
				{
					throw new System.IO.IOException("proxy error: "+reason);
				}

				/*
				while(foo>=0){
				  foo=in.read(); if(foo!=13) continue;
				  foo=in.read(); if(foo!=10) continue;
				  foo=in.read(); if(foo!=13) continue;      
				  foo=in.read(); if(foo!=10) continue;
				  break;
				}
				*/

				int count=0;
				while(true)
				{
					count=0;
					while(foo>=0)
					{
						foo=ins.read(); if(foo!=13){count++;  continue;}
						foo=ins.read(); if(foo!=10){continue;}
						break;
					}
					if(foo<0)
					{
						throw new System.IO.IOException();
					}
					if(count==0)break;
				}
			}
			catch(RuntimeException e)
			{
				throw e;
			}
			catch(Exception e)
//.........這裏部分代碼省略.........
開發者ID:stux2000,項目名稱:dokan,代碼行數:101,代碼來源:ProxyHTTP.cs

示例11: cd

        /*
        cd /tmp
        c->s REALPATH
        s->c NAME
        c->s STAT
        s->c ATTR
        */
        public void cd(String path)
        {
            //throws SftpException{
            try
            {
                path=remoteAbsolutePath(path);

                Vector v=glob_remote(path);
                if(v.size()!=1)
                {
                    throw new SftpException(SSH_FX_FAILURE, v.toString());
                }
                path=(String)(v.elementAt(0));
                sendREALPATH(path.getBytes());

                Header _header=new Header();
                _header=header(buf, _header);
                int length=_header.length;
                int type=_header.type;
                buf.rewind();
                fill(buf.buffer, 0, length);

                if(type!=101 && type!=104)
                {
                    throw new SftpException(SSH_FX_FAILURE, "");
                }
                int i;
                if(type==101)
                {
                    i=buf.getInt();
                    throwStatusError(buf, i);
                }
                i=buf.getInt();
                byte[] str=buf.getString();
                if(str!=null && str[0]!='/')
                {
                    str=(cwd+"/"+new String(str)).getBytes();
                }
                str=buf.getString();         // logname
                i=buf.getInt();              // attrs

                String newpwd=new String(str);
                SftpATTRS attr=_stat(newpwd);
                if((attr.getFlags()&SftpATTRS.SSH_FILEXFER_ATTR_PERMISSIONS)==0)
                {
                    throw new SftpException(SSH_FX_FAILURE,
                                            "Can't change directory: "+path);
                }
                if(!attr.isDir())
                {
                    throw new SftpException(SSH_FX_FAILURE,
                                            "Can't change directory: "+path);
                }
                cwd=newpwd;
            }
            catch(Exception e)
            {
                if(e is SftpException) throw (SftpException)e;
                throw new SftpException(SSH_FX_FAILURE, "");
            }
        }
開發者ID:JamesHagerman,項目名稱:sftprelay,代碼行數:68,代碼來源:ChannelSftp.cs

示例12: chown

        public void chown(int uid, String path)
        {
            //throws SftpException{
            try
            {
                path=remoteAbsolutePath(path);

                Vector v=glob_remote(path);
                int vsize=v.size();
                for(int j=0; j<vsize; j++)
                {
                    path=(String)(v.elementAt(j));

                    SftpATTRS attr=_stat(path);

                    attr.setFLAGS(0);
                    attr.setUIDGID(uid, attr.gid);
                    _setStat(path, attr);
                }
            }
            catch(Exception e)
            {
                if(e is SftpException) throw (SftpException)e;
                throw new SftpException(SSH_FX_FAILURE, "");
            }
        }
開發者ID:JamesHagerman,項目名稱:sftprelay,代碼行數:26,代碼來源:ChannelSftp.cs

示例13: setHost

		public void setHost(String host){ this.host=host; }
開發者ID:MatanDavidCohen,項目名稱:StockAnalyzerWin,代碼行數:1,代碼來源:Session.cs

示例14: run

		public void run()
		{
			thread=this;

			byte[] foo;
			Buffer buf=new Buffer();
			Packet packet=new Packet(buf);
			int i=0;
			Channel channel;
			int[] start=new int[1];
			int[] length=new int[1];
			KeyExchange kex=null;

			try
			{
				while(_isConnected &&
					thread!=null)
				{
					buf=read(buf);
					int msgType=buf.buffer[5]&0xff;
					//      if(msgType!=94)
					//System.Console.WriteLine("read: 94 ? "+msgType);

					if(kex!=null && kex.getState()==msgType)
					{
						bool result=kex.next(buf);
						if(!result)
						{
							throw new JSchException("verify: "+result);
						}
						continue;
					}

					switch(msgType)
					{
						case SSH_MSG_KEXINIT:
							//System.Console.WriteLine("KEXINIT");
							kex=receive_kexinit(buf);
							break;

						case SSH_MSG_NEWKEYS:
							//System.Console.WriteLine("NEWKEYS");
							send_newkeys();
							receive_newkeys(buf, kex);
							kex=null;
							break;

						case SSH_MSG_CHANNEL_DATA:
							buf.getInt();
							buf.getByte();
							buf.getByte();
							i=buf.getInt();
							channel=Channel.getChannel(i, this);
							foo=buf.getString(start, length);
							if(channel==null)
							{
								break;
							}
							try
							{
								channel.write(foo, start[0], length[0]);
							}
							catch(Exception e)
							{
								//System.Console.WriteLine(e);
								try{channel.disconnect();}
								catch(Exception ee){}
								break;
							}
							int len=length[0];
							channel.setLocalWindowSize(channel.lwsize-len);
							if(channel.lwsize<channel.lwsize_max/2)
							{
								packet.reset();
								buf.putByte((byte)SSH_MSG_CHANNEL_WINDOW_ADJUST);
								buf.putInt(channel.getRecipient());
								buf.putInt(channel.lwsize_max-channel.lwsize);
								write(packet);
								channel.setLocalWindowSize(channel.lwsize_max);
							}
							break;

						case SSH_MSG_CHANNEL_EXTENDED_DATA:
							buf.getInt();
							buf.getShort();
							i=buf.getInt();
							channel=Channel.getChannel(i, this);
							buf.getInt();                   // data_type_code == 1
							foo=buf.getString(start, length);
							//System.Console.WriteLine("stderr: "+new String(foo,start[0],length[0]));
							if(channel==null)
							{
								break;
							}
							//channel.write(foo, start[0], length[0]);
							channel.write_ext(foo, start[0], length[0]);

							len=length[0];
							channel.setLocalWindowSize(channel.lwsize-len);
							if(channel.lwsize<channel.lwsize_max/2)
//.........這裏部分代碼省略.........
開發者ID:MatanDavidCohen,項目名稱:StockAnalyzerWin,代碼行數:101,代碼來源:Session.cs

示例15: setPassword

		public void setPassword(String foo){ this.password=foo; }
開發者ID:MatanDavidCohen,項目名稱:StockAnalyzerWin,代碼行數:1,代碼來源:Session.cs


注:本文中的Tamir.SharpSsh.java.String類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。