@@ -8,10 +8,17 @@ namespace IBMiCmd.IBMiTools
8
8
{
9
9
class IBMi
10
10
{
11
+ readonly static Dictionary < string , string > FTPCodeMessages = new Dictionary < string , string > ( )
12
+ {
13
+ { "426" , "Connection closed; transfer aborted." } ,
14
+ { "530" , "Configuration username and password incorrect." } ,
15
+ { "550" , "File being access may not exist." }
16
+ } ;
17
+
11
18
public static string _ConfigFile { get ; set ; }
12
19
13
20
private static Boolean _NotConnected = false ;
14
- private static Boolean _Failed = false ;
21
+ private static string _Failed = "" ;
15
22
private static Dictionary < string , string > _config = new Dictionary < string , string > ( ) ;
16
23
private static List < string > _output = new List < string > ( ) ;
17
24
@@ -202,7 +209,7 @@ private static Boolean RunFTP(string FileLoc)
202
209
203
210
_list . Clear ( ) ;
204
211
_NotConnected = false ;
205
- _Failed = false ;
212
+ _Failed = "" ;
206
213
207
214
Process process = new Process ( ) ;
208
215
process . StartInfo . FileName = "cmd.exe" ;
@@ -221,7 +228,17 @@ private static Boolean RunFTP(string FileLoc)
221
228
process . WaitForExit ( ) ;
222
229
223
230
IBMiUtilities . DebugLog ( "FTP of command file " + FileLoc + " completed" ) ;
224
- return _Failed || _NotConnected ;
231
+
232
+ if ( _NotConnected )
233
+ {
234
+ MessageBox . Show ( "Not able to connect to " + GetConfig ( "system" ) , "Error" , MessageBoxButtons . OK , MessageBoxIcon . Exclamation ) ;
235
+ }
236
+ else if ( _Failed != "" )
237
+ {
238
+ MessageBox . Show ( FTPCodeMessages [ _Failed ] , "Error" , MessageBoxButtons . OK , MessageBoxIcon . Exclamation ) ;
239
+ }
240
+
241
+ return _Failed != "" || _NotConnected ;
225
242
}
226
243
227
244
private static void OutputHandler ( object sendingProcess , DataReceivedEventArgs outLine )
@@ -250,7 +267,7 @@ private static void OutputHandler(object sendingProcess, DataReceivedEventArgs o
250
267
case "426" :
251
268
case "530" :
252
269
case "550" :
253
- _Failed = true ;
270
+ _Failed = outLine . Data . Substring ( 0 , 3 ) ;
254
271
_output . Add ( "> " + outLine . Data . Substring ( 4 ) ) ;
255
272
break ;
256
273
default :
0 commit comments