Browse Source

Reusing CheckNotOpened

(cherry picked from commit f614f7915c1bb2c2fe08297b0885515884adb5e8)

Source commit: 42cff43bac8bb3221e4c23809abd71c2c97726cb
Martin Prikryl 4 years ago
parent
commit
3cfae3d1fd
1 changed files with 2 additions and 12 deletions
  1. 2 12
      dotnet/Session.cs

+ 2 - 12
dotnet/Session.cs

@@ -238,12 +238,7 @@ namespace WinSCP
         {
             using (CreateCallstackAndLock())
             {
-                CheckNotDisposed();
-
-                if (Opened)
-                {
-                    throw Logger.WriteException(new InvalidOperationException("Session is already opened"));
-                }
+                CheckNotOpened();
 
                 if (sessionOptions == null)
                 {
@@ -423,12 +418,7 @@ namespace WinSCP
 
                 string result;
 
-                CheckNotDisposed();
-
-                if (Opened)
-                {
-                    throw Logger.WriteException(new InvalidOperationException("Session is already opened"));
-                }
+                CheckNotOpened();
 
                 try
                 {