Pārlūkot izejas kodu

Reimplementing Session.FileExists using Session.TryGetFileInfo

Source commit: 47791132d088135b70af0cab1a951cd25244341b
Martin Prikryl 3 gadi atpakaļ
vecāks
revīzija
b24bf52e47
1 mainītis faili ar 1 papildinājumiem un 22 dzēšanām
  1. 1 22
      dotnet/Session.cs

+ 1 - 22
dotnet/Session.cs

@@ -1570,28 +1570,7 @@ namespace WinSCP
 
         public bool FileExists(string path)
         {
-            using (CreateCallstackAndLock())
-            {
-                CheckOpened();
-
-                try
-                {
-                    _ignoreFailed = true;
-                    try
-                    {
-                        DoGetFileInfo(path);
-                    }
-                    finally
-                    {
-                        _ignoreFailed = false;
-                    }
-                    return true;
-                }
-                catch (SessionRemoteException)
-                {
-                    return false;
-                }
-            }
+            return TryGetFileInfo(path, out _);
         }
 
         public byte[] CalculateFileChecksum(string algorithm, string path)