Tamir.SharpSsh.jsch.JSch.setKnownHosts C# (CSharp) Method

setKnownHosts() public method

public setKnownHosts ( StreamReader foo ) : void
foo System.IO.StreamReader
return void
		public void setKnownHosts(StreamReader foo) 
		{ 
			if(known_hosts==null) known_hosts=new KnownHosts(this);
			if(known_hosts is KnownHosts)
			{
				lock(known_hosts)
				{
					((KnownHosts)known_hosts).setKnownHosts(foo); 
				}
			}
		}
		/*

Same methods

JSch::setKnownHosts ( String foo ) : void

Usage Example

コード例 #1
0
 private static void knownHosts(JSch sch)
 {
     DirectoryInfo home = FS.userHome();
     if (home == null)
         return;
     var known_hosts = new FileInfo(Path.Combine(home.ToString(), ".ssh/known_hosts"));
     try
     {
         using (var s = new StreamReader(known_hosts.FullName))
         {
             sch.setKnownHosts(s);
         }
     }
     catch (FileNotFoundException)
     {
         // Oh well. They don't have a known hosts in home.
     }
     catch (IOException)
     {
         // Oh well. They don't have a known hosts in home.
     }
 }
All Usage Examples Of Tamir.SharpSsh.jsch.JSch::setKnownHosts