@@ -57,8 +57,45 @@ static void Main(string[] args)
57
57
return ;
58
58
}
59
59
60
- // Option UI
61
- OptionsUI ( ) ;
60
+
61
+ if ( options != null )
62
+ {
63
+ // Command
64
+ CommandOption ( ) ;
65
+ CommandValidate ( ) ;
66
+ // Path
67
+ PathOption ( ) ;
68
+ PathValidate ( ) ;
69
+ // Parameters
70
+ ParameterOption ( ) ;
71
+ ParameterValidate ( ) ;
72
+ // Files Check
73
+ FilesCheck ( ) ;
74
+ // Environment
75
+ EnvironmentOption ( ) ;
76
+ // Tenant
77
+ TenantOption ( ) ;
78
+ // Username
79
+ UsernameOption ( ) ;
80
+ // Password
81
+ PasswordOption ( ) ;
82
+ }
83
+
84
+ if ( options . PrintCommandline )
85
+ {
86
+ Console . WriteLine ( "\n \n " ) ;
87
+ Console . WriteLine ( "clarinet {0} {1} {2} {3} {4} {5} {6}" ,
88
+ options . Command ,
89
+ options . Path ,
90
+ options . Parameters ,
91
+ options . EnvNum ,
92
+ options . Tenant ,
93
+ options . Username ,
94
+ Crypto . Protect ( options . Password ) ) ;
95
+ Console . WriteLine ( "\n \n " ) ;
96
+ return ;
97
+ }
98
+
62
99
63
100
// Post Init and UI Option Handling
64
101
switch ( options . Command )
@@ -71,6 +108,7 @@ static void Main(string[] args)
71
108
case Command . PHOTO_DOWNLOAD :
72
109
case Command . PHOTO_UPLOAD :
73
110
case Command . DOCUMENT_UPLOAD :
111
+ case Command . CANDIDATE_ATTACHMENT_UPLOAD :
74
112
soapUrl = SoapUrlBuild ( options . Command ) ;
75
113
break ;
76
114
}
@@ -111,6 +149,9 @@ static void Main(string[] args)
111
149
case Command . DOCUMENT_UPLOAD :
112
150
Console . WriteLine ( "\n \n Uploading documents...\n \n " ) ;
113
151
break ;
152
+ case Command . CANDIDATE_ATTACHMENT_UPLOAD :
153
+ Console . WriteLine ( "\n \n Uploading attachments...\n \n " ) ;
154
+ break ;
114
155
default :
115
156
break ;
116
157
}
@@ -153,6 +194,10 @@ static void Main(string[] args)
153
194
bytes = File . ReadAllBytes ( file ) ;
154
195
result = Documents . Upload ( file , bytes , soapUrl , processedDir , options ) ;
155
196
break ;
197
+ case Command . CANDIDATE_ATTACHMENT_UPLOAD :
198
+ bytes = File . ReadAllBytes ( file ) ;
199
+ result = CandidateAttachments . Upload ( file , bytes , soapUrl , processedDir , options ) ;
200
+ break ;
156
201
}
157
202
158
203
if ( result . ToLower ( ) . IndexOf ( "<html" ) >= 0 )
@@ -267,51 +312,6 @@ static bool InitOptions(string[] args)
267
312
return false ;
268
313
}
269
314
270
- // Ensure Command is uppercase.
271
- if ( options != null && options . Command != null )
272
- {
273
- options . Command = options . Command . Trim ( ) . ToUpper ( ) ;
274
- }
275
-
276
- // Path parameter is a file
277
- if ( options != null && options . Path != null && options . Command == Command . CLAR_UPLOAD )
278
- {
279
- if ( File . Exists ( options . Path ) )
280
- {
281
- searchPattern = Path . GetFileName ( options . Path ) ;
282
- options . Path = options . Path . Substring ( 0 , options . Path . Length - searchPattern . Length ) ;
283
- }
284
- }
285
-
286
- // Set search pattern and cloud collection if parameters are included.
287
- if ( options != null && options . Parameters != null )
288
- {
289
- switch ( options . Command )
290
- {
291
- case Command . CLAR_UPLOAD :
292
- cloudCollection = options . Parameters ;
293
- break ;
294
- case Command . CLAR_DOWNLOAD :
295
- searchPattern = "" ;
296
- options . Parameters = Path . GetFileName ( Path . TrimEndingDirectorySeparator ( options . Parameters ) ) ;
297
- cloudCollection = options . Parameters ;
298
- break ;
299
- case Command . DRIVE_UPLOAD :
300
- case Command . DRIVE_TRASH :
301
- searchPattern = options . Parameters ;
302
- break ;
303
- case Command . PHOTO_DOWNLOAD :
304
- searchPattern = options . Parameters ;
305
- break ;
306
- case Command . PHOTO_UPLOAD :
307
- case Command . DOCUMENT_UPLOAD :
308
- searchPattern = "*.*" ;
309
- break ;
310
- default :
311
- break ;
312
- }
313
- }
314
-
315
315
return true ;
316
316
}
317
317
@@ -333,53 +333,52 @@ static void OptionsEncrypt()
333
333
Console . WriteLine ( "\n " ) ;
334
334
}
335
335
336
- static void OptionsUI ( )
337
- {
338
- // Command
339
- CommandOption ( ) ;
340
- // Path
341
- PathOption ( ) ;
342
- // Parameters
343
- ParameterOption ( ) ;
344
- // Files Check
345
- FilesCheck ( ) ;
346
- // Environment
347
- EnvironmentOption ( ) ;
348
- // Tenant
349
- TenantOption ( ) ;
350
- // Username
351
- UsernameOption ( ) ;
352
- // Password
353
- PasswordOption ( ) ;
354
- }
355
-
356
336
static void CommandOption ( )
357
337
{
358
338
if ( String . IsNullOrEmpty ( options . Command ) )
359
339
{
360
340
Console . WriteLine ( "Enter the command:\n " ) ;
361
341
options . Command = Console . ReadLine ( ) . Trim ( ) . ToUpper ( ) ;
362
- Console . WriteLine ( "" ) ;
363
- // Check for valid commands
364
- switch ( options . Command )
365
- {
366
- case Command . CLAR_UPLOAD :
367
- case Command . CLAR_DOWNLOAD :
368
- case Command . DRIVE_UPLOAD :
369
- case Command . DRIVE_TRASH :
370
- case Command . PHOTO_DOWNLOAD :
371
- case Command . PHOTO_UPLOAD :
372
- case Command . DOCUMENT_UPLOAD :
373
- break ;
374
- default :
375
- throw new Exception ( "Invalid command. Please use --help for a list of valid commands." ) ;
376
- }
342
+ Console . WriteLine ( "" ) ;
343
+ }
344
+ }
345
+
346
+ static void CommandValidate ( )
347
+ {
348
+ // Ensure Command is uppercase.
349
+ if ( options . Command != null )
350
+ {
351
+ options . Command = options . Command . Trim ( ) . ToUpper ( ) ;
352
+ }
353
+ // Check for valid commands
354
+ switch ( options . Command )
355
+ {
356
+ case Command . CLAR_UPLOAD :
357
+ case Command . CLAR_DOWNLOAD :
358
+ case Command . DRIVE_UPLOAD :
359
+ case Command . DRIVE_TRASH :
360
+ case Command . PHOTO_DOWNLOAD :
361
+ case Command . PHOTO_UPLOAD :
362
+ case Command . DOCUMENT_UPLOAD :
363
+ case Command . CANDIDATE_ATTACHMENT_UPLOAD :
364
+ break ;
365
+ default :
366
+ throw new Exception ( "Invalid command. Please use --help for a list of valid commands." ) ;
377
367
}
378
368
Console . WriteLine ( "\n \n Command: " + options . Command + "\n " ) ;
379
369
}
380
370
381
371
static void PathOption ( )
382
372
{
373
+ // Path parameter is a file
374
+ if ( options . Path != null && options . Command == Command . CLAR_UPLOAD )
375
+ {
376
+ if ( File . Exists ( options . Path ) )
377
+ {
378
+ searchPattern = Path . GetFileName ( options . Path ) ;
379
+ options . Path = options . Path . Substring ( 0 , options . Path . Length - searchPattern . Length ) ;
380
+ }
381
+ }
383
382
// Path or File
384
383
if ( String . IsNullOrEmpty ( options . Path ) )
385
384
{
@@ -400,12 +399,17 @@ static void PathOption()
400
399
break ;
401
400
case Command . PHOTO_UPLOAD :
402
401
case Command . DOCUMENT_UPLOAD :
402
+ case Command . CANDIDATE_ATTACHMENT_UPLOAD :
403
403
options . Path = inboundDir ;
404
404
break ;
405
405
default :
406
406
break ;
407
- }
408
- }
407
+ }
408
+ }
409
+ }
410
+
411
+ static void PathValidate ( )
412
+ {
409
413
Console . WriteLine ( "Processing: " + options . Path + "\n " ) ;
410
414
}
411
415
@@ -446,12 +450,45 @@ static void ParameterOption()
446
450
break ;
447
451
case Command . PHOTO_UPLOAD :
448
452
case Command . DOCUMENT_UPLOAD :
453
+ case Command . CANDIDATE_ATTACHMENT_UPLOAD :
449
454
searchPattern = "*.*" ;
450
455
break ;
451
456
}
452
457
}
453
-
454
- Console . WriteLine ( "Using parameters: " + options . Parameters + "\n " ) ;
458
+ }
459
+
460
+ static void ParameterValidate ( )
461
+ {
462
+ // Set search pattern and cloud collection if parameters are included.
463
+ if ( options . Parameters != null )
464
+ {
465
+ switch ( options . Command )
466
+ {
467
+ case Command . CLAR_UPLOAD :
468
+ cloudCollection = options . Parameters ;
469
+ break ;
470
+ case Command . CLAR_DOWNLOAD :
471
+ searchPattern = "" ;
472
+ options . Parameters = Path . GetFileName ( Path . TrimEndingDirectorySeparator ( options . Parameters ) ) ;
473
+ cloudCollection = options . Parameters ;
474
+ break ;
475
+ case Command . DRIVE_UPLOAD :
476
+ case Command . DRIVE_TRASH :
477
+ searchPattern = options . Parameters ;
478
+ break ;
479
+ case Command . PHOTO_DOWNLOAD :
480
+ searchPattern = options . Parameters ;
481
+ break ;
482
+ case Command . PHOTO_UPLOAD :
483
+ case Command . DOCUMENT_UPLOAD :
484
+ case Command . CANDIDATE_ATTACHMENT_UPLOAD :
485
+ searchPattern = "*.*" ;
486
+ break ;
487
+ default :
488
+ break ;
489
+ }
490
+ }
491
+ Console . WriteLine ( "Using parameters: " + options . Parameters + "\n " ) ;
455
492
}
456
493
457
494
static void FilesCheck ( )
@@ -571,6 +608,9 @@ static string SoapUrlBuild(string command)
571
608
case Command . DOCUMENT_UPLOAD :
572
609
soapUrl += "/{tenant}/Staffing/{version}" ;
573
610
break ;
611
+ case Command . CANDIDATE_ATTACHMENT_UPLOAD :
612
+ soapUrl += "/{tenant}/Recruiting/{version}" ;
613
+ break ;
574
614
}
575
615
576
616
return soapUrl ;
0 commit comments