File tree Expand file tree Collapse file tree 2 files changed +20
-16
lines changed Expand file tree Collapse file tree 2 files changed +20
-16
lines changed Original file line number Diff line number Diff line change @@ -52,6 +52,15 @@ public void PrintHelp()
52
52
Console . WriteLine ( "<type_of_client> [opts]" ) ;
53
53
this . WriteOptionDescriptions ( Console . Out ) ;
54
54
}
55
+
56
+ protected static bool ParseBoolOption ( string durable )
57
+ {
58
+ if ( durable == "yes" || durable == "true" || durable == "True" )
59
+ return true ;
60
+ if ( durable == "no" || durable == "false" || durable == "False" )
61
+ return false ;
62
+ throw new ArgumentException ( ) ;
63
+ }
55
64
}
56
65
57
66
/// <summary>
@@ -319,14 +328,7 @@ public SenderOptions() : base()
319
328
this . Add ( "property-type=" , "specify message property type (overrides auto-cast feature)" ,
320
329
( string propertyType ) => { this . PropertyType = propertyType ; } ) ;
321
330
this . Add ( "msg-durable=" , "send durable messages yes/no" ,
322
- ( string durable ) => {
323
- if ( ( ( durable == "yes" ) || ( durable == "true" ) ) || ( durable == "True" ) )
324
- this . Durable = true ;
325
- else if ( ( ( durable == "no" ) || ( durable == "false" ) ) || ( durable == "False" ) )
326
- this . Durable = false ;
327
- else
328
- throw new ArgumentException ( ) ;
329
- } ) ;
331
+ ( string durable ) => { this . Durable = ParseBoolOption ( durable ) ; } ) ;
330
332
this . Add ( "msg-ttl=" , "message time-to-live (ms)" ,
331
333
( uint ttl ) => { this . Ttl = ttl ; } ) ;
332
334
this . Add ( "msg-priority=" , "message priority" ,
Original file line number Diff line number Diff line change @@ -52,6 +52,15 @@ public void PrintHelp()
52
52
Console . WriteLine ( "<type_of_client> [opts]" ) ;
53
53
this . WriteOptionDescriptions ( Console . Out ) ;
54
54
}
55
+
56
+ protected static bool ParseBoolOption ( string durable )
57
+ {
58
+ if ( durable == "yes" || durable == "true" || durable == "True" )
59
+ return true ;
60
+ if ( durable == "no" || durable == "false" || durable == "False" )
61
+ return false ;
62
+ throw new ArgumentException ( ) ;
63
+ }
55
64
}
56
65
57
66
/// <summary>
@@ -319,14 +328,7 @@ public SenderOptions() : base()
319
328
this . Add ( "property-type=" , "specify message property type (overrides auto-cast feature)" ,
320
329
( string propertyType ) => { this . PropertyType = propertyType ; } ) ;
321
330
this . Add ( "msg-durable=" , "send durable messages yes/no" ,
322
- ( string durable ) => {
323
- if ( ( ( durable == "yes" ) || ( durable == "true" ) ) || ( durable == "True" ) )
324
- this . Durable = true ;
325
- else if ( ( ( durable == "no" ) || ( durable == "false" ) ) || ( durable == "False" ) )
326
- this . Durable = false ;
327
- else
328
- throw new ArgumentException ( ) ;
329
- } ) ;
331
+ ( string durable ) => { this . Durable = ParseBoolOption ( durable ) ; } ) ;
330
332
this . Add ( "msg-ttl=" , "message time-to-live (ms)" ,
331
333
( uint ttl ) => { this . Ttl = ttl ; } ) ;
332
334
this . Add ( "msg-priority=" , "message priority" ,
You can’t perform that action at this time.
0 commit comments