コード例 #1
0
        public override void remove(String host, String type, byte[] key)
        {
            bool _sync = false;

            for (int i = 0; i < pool.Count; i++)
            {
                HostKey hk = (HostKey)(pool[i]);
                if (host == null ||
                    (hk.getHost().Equals(host) &&
                     (type == null || (hk.getType().Equals(type) &&
                                       (key == null || Util.array_equals(key, hk.key))))))
                {
                    pool.Remove(hk);
                    _sync = true;
                }
            }
            if (_sync)
            {
                try
                {
                    sync();
                }
                catch
                {
                }
                ;
            }
        }
コード例 #2
0
ファイル: KnownHosts.cs プロジェクト: amon-ra/Dokan-SSHFS
 public override HostKey[] getHostKey(String host, String type)
 {
     lock (pool)
     {
         int count = 0;
         for (int i = 0; i < pool.Count; i++)
         {
             HostKey hk = (HostKey)pool[i];
             if (hk.type == HostKey.UNKNOWN)
             {
                 continue;
             }
             if (host == null ||
                 (isIncluded(hk.host, host) &&
                  (type == null || hk.getType().Equals(type))))
             {
                 count++;
             }
         }
         if (count == 0)
         {
             return(null);
         }
         HostKey[] foo = new HostKey[count];
         int       j   = 0;
         for (int i = 0; i < pool.Count; i++)
         {
             HostKey hk = (HostKey)pool[i];
             if (hk.type == HostKey.UNKNOWN)
             {
                 continue;
             }
             if (host == null ||
                 (isIncluded(hk.host, host) &&
                  (type == null || hk.getType().Equals(type))))
             {
                 foo[j++] = hk;
             }
         }
         return(foo);
     }
 }