From 71e79d472953e72d3d8b6b4e3a066f1e58e27ef0 Mon Sep 17 00:00:00 2001 From: Giuseppe Privitera Date: Mon, 17 Aug 2015 14:30:08 +0100 Subject: [PATCH] remove useless whitespaces in argument list --- dotnet-visual-studio/1_Send/Program.cs | 14 +++---- dotnet-visual-studio/2_NewTask/Program.cs | 24 +++++------ dotnet-visual-studio/3_EmitLog/Program.cs | 22 +++++----- .../4_EmitLogDirect/Program.cs | 20 +++++----- .../5_EmitLogTopic/Program.cs | 18 ++++----- dotnet-visual-studio/6_RPCClient/RPCClient.cs | 16 ++++---- dotnet-visual-studio/6_RPCServer/Program.cs | 40 +++++++++---------- dotnet/EmitLog.cs | 22 +++++----- dotnet/EmitLogDirect.cs | 20 +++++----- dotnet/EmitLogTopic.cs | 18 ++++----- dotnet/NewTask.cs | 24 +++++------ dotnet/ReceiveLogsDirect.cs | 2 +- dotnet/Send.cs | 14 +++---- 13 files changed, 127 insertions(+), 127 deletions(-) diff --git a/dotnet-visual-studio/1_Send/Program.cs b/dotnet-visual-studio/1_Send/Program.cs index 63c4e0b3..11edd2cd 100644 --- a/dotnet-visual-studio/1_Send/Program.cs +++ b/dotnet-visual-studio/1_Send/Program.cs @@ -7,19 +7,19 @@ class Program public static void Main() { var factory = new ConnectionFactory() { HostName = "localhost" }; - using( var connection = factory.CreateConnection() ) - using( var channel = connection.CreateModel() ) + using(var connection = factory.CreateConnection()) + using(var channel = connection.CreateModel()) { - channel.QueueDeclare( queue: "hello", durable: false, exclusive: false, autoDelete: false, arguments: null ); + channel.QueueDeclare(queue: "hello", durable: false, exclusive: false, autoDelete: false, arguments: null); string message = "Hello World!"; - var body = Encoding.UTF8.GetBytes( message ); + var body = Encoding.UTF8.GetBytes(message); - channel.BasicPublish( exchange: "", routingKey: "hello", basicProperties: null, body: body ); - Console.WriteLine( " [x] Sent {0}", message ); + channel.BasicPublish(exchange: "", routingKey: "hello", basicProperties: null, body: body); + Console.WriteLine(" [x] Sent {0}", message); } - Console.WriteLine( " Press [enter] to exit." ); + Console.WriteLine(" Press [enter] to exit."); Console.ReadLine(); } } diff --git a/dotnet-visual-studio/2_NewTask/Program.cs b/dotnet-visual-studio/2_NewTask/Program.cs index 78644fbb..f3928ec9 100644 --- a/dotnet-visual-studio/2_NewTask/Program.cs +++ b/dotnet-visual-studio/2_NewTask/Program.cs @@ -4,30 +4,30 @@ class Program { - public static void Main( string[] args ) + public static void Main(string[] args) { var factory = new ConnectionFactory() { HostName = "localhost" }; - using( var connection = factory.CreateConnection() ) - using( var channel = connection.CreateModel() ) + using(var connection = factory.CreateConnection()) + using(var channel = connection.CreateModel()) { - channel.QueueDeclare( queue: "task_queue", durable: true, exclusive: false, autoDelete: false, arguments: null ); + channel.QueueDeclare(queue: "task_queue", durable: true, exclusive: false, autoDelete: false, arguments: null); - var message = GetMessage( args ); - var body = Encoding.UTF8.GetBytes( message ); + var message = GetMessage(args); + var body = Encoding.UTF8.GetBytes(message); var properties = channel.CreateBasicProperties(); - properties.SetPersistent( true ); + properties.SetPersistent(true); - channel.BasicPublish( exchange: "", routingKey: "task_queue", basicProperties: properties, body: body ); - Console.WriteLine( " [x] Sent {0}", message ); + channel.BasicPublish(exchange: "", routingKey: "task_queue", basicProperties: properties, body: body); + Console.WriteLine(" [x] Sent {0}", message); } - Console.WriteLine( " Press [enter] to exit." ); + Console.WriteLine(" Press [enter] to exit."); Console.ReadLine(); } - private static string GetMessage( string[] args ) + private static string GetMessage(string[] args) { - return ( ( args.Length > 0 ) ? string.Join( " ", args ) : "Hello World!" ); + return ((args.Length > 0) ? string.Join(" ", args) : "Hello World!"); } } diff --git a/dotnet-visual-studio/3_EmitLog/Program.cs b/dotnet-visual-studio/3_EmitLog/Program.cs index c1914013..8e5a65e9 100644 --- a/dotnet-visual-studio/3_EmitLog/Program.cs +++ b/dotnet-visual-studio/3_EmitLog/Program.cs @@ -4,26 +4,26 @@ class Program { - public static void Main( string[] args ) + public static void Main(string[] args) { var factory = new ConnectionFactory() { HostName = "localhost" }; - using( var connection = factory.CreateConnection() ) - using( var channel = connection.CreateModel() ) + using(var connection = factory.CreateConnection()) + using(var channel = connection.CreateModel()) { - channel.ExchangeDeclare( exchange: "logs", type: "fanout" ); + channel.ExchangeDeclare(exchange: "logs", type: "fanout"); - var message = GetMessage( args ); - var body = Encoding.UTF8.GetBytes( message ); - channel.BasicPublish( exchange: "logs", routingKey: "", basicProperties: null, body: body ); - Console.WriteLine( " [x] Sent {0}", message ); + var message = GetMessage(args); + var body = Encoding.UTF8.GetBytes(message); + channel.BasicPublish(exchange: "logs", routingKey: "", basicProperties: null, body: body); + Console.WriteLine(" [x] Sent {0}", message); } - Console.WriteLine( " Press [enter] to exit." ); + Console.WriteLine(" Press [enter] to exit."); Console.ReadLine(); } - private static string GetMessage( string[] args ) + private static string GetMessage(string[] args) { - return ( ( args.Length > 0 ) ? string.Join( " ", args ) : "info: Hello World!" ); + return (( args.Length > 0) ? string.Join(" ", args) : "info: Hello World!"); } } diff --git a/dotnet-visual-studio/4_EmitLogDirect/Program.cs b/dotnet-visual-studio/4_EmitLogDirect/Program.cs index 06e96af3..8ef94594 100644 --- a/dotnet-visual-studio/4_EmitLogDirect/Program.cs +++ b/dotnet-visual-studio/4_EmitLogDirect/Program.cs @@ -5,22 +5,22 @@ class Program { - public static void Main( string[] args ) + public static void Main(string[] args) { var factory = new ConnectionFactory() { HostName = "localhost" }; - using( var connection = factory.CreateConnection() ) - using( var channel = connection.CreateModel() ) + using(var connection = factory.CreateConnection()) + using(var channel = connection.CreateModel()) { - channel.ExchangeDeclare( exchange: "direct_logs", type: "direct" ); + channel.ExchangeDeclare(exchange: "direct_logs", type: "direct"); - var severity = ( args.Length > 0 ) ? args[0] : "info"; - var message = ( args.Length > 1 ) ? string.Join( " ", args.Skip( 1 ).ToArray() ) : "Hello World!"; - var body = Encoding.UTF8.GetBytes( message ); - channel.BasicPublish( exchange: "direct_logs", routingKey: severity, basicProperties: null, body: body ); - Console.WriteLine( " [x] Sent '{0}':'{1}'", severity, message ); + var severity = (args.Length > 0) ? args[0] : "info"; + var message = (args.Length > 1) ? string.Join(" ", args.Skip(1).ToArray()) : "Hello World!"; + var body = Encoding.UTF8.GetBytes(message); + channel.BasicPublish(exchange: "direct_logs", routingKey: severity, basicProperties: null, body: body); + Console.WriteLine(" [x] Sent '{0}':'{1}'", severity, message); } - Console.WriteLine( " Press [enter] to exit." ); + Console.WriteLine(" Press [enter] to exit."); Console.ReadLine(); } } diff --git a/dotnet-visual-studio/5_EmitLogTopic/Program.cs b/dotnet-visual-studio/5_EmitLogTopic/Program.cs index ff9623e9..af376b0e 100644 --- a/dotnet-visual-studio/5_EmitLogTopic/Program.cs +++ b/dotnet-visual-studio/5_EmitLogTopic/Program.cs @@ -5,19 +5,19 @@ class Program { - public static void Main( string[] args ) + public static void Main(string[] args) { var factory = new ConnectionFactory() { HostName = "localhost" }; - using( var connection = factory.CreateConnection() ) - using( var channel = connection.CreateModel() ) + using(var connection = factory.CreateConnection()) + using(var channel = connection.CreateModel()) { - channel.ExchangeDeclare( exchange: "topic_logs", type: "topic" ); + channel.ExchangeDeclare(exchange: "topic_logs", type: "topic"); - var routingKey = ( args.Length > 0 ) ? args[0] : "anonymous.info"; - var message = ( args.Length > 1 ) ? string.Join( " ", args.Skip( 1 ).ToArray() ) : "Hello World!"; - var body = Encoding.UTF8.GetBytes( message ); - channel.BasicPublish( exchange: "topic_logs", routingKey: routingKey, basicProperties: null, body: body ); - Console.WriteLine( " [x] Sent '{0}':'{1}'", routingKey, message ); + var routingKey = (args.Length > 0) ? args[0] : "anonymous.info"; + var message = (args.Length > 1) ? string.Join(" ", args.Skip(1).ToArray()) : "Hello World!"; + var body = Encoding.UTF8.GetBytes(message); + channel.BasicPublish(exchange: "topic_logs", routingKey: routingKey, basicProperties: null, body: body); + Console.WriteLine(" [x] Sent '{0}':'{1}'", routingKey, message); } } } diff --git a/dotnet-visual-studio/6_RPCClient/RPCClient.cs b/dotnet-visual-studio/6_RPCClient/RPCClient.cs index 2501f9d1..62f7d29c 100644 --- a/dotnet-visual-studio/6_RPCClient/RPCClient.cs +++ b/dotnet-visual-studio/6_RPCClient/RPCClient.cs @@ -19,26 +19,26 @@ public RPCClient() connection = factory.CreateConnection(); channel = connection.CreateModel(); replyQueueName = channel.QueueDeclare().QueueName; - consumer = new QueueingBasicConsumer( channel ); - channel.BasicConsume( queue: replyQueueName, noAck: true, consumer: consumer ); + consumer = new QueueingBasicConsumer(channel); + channel.BasicConsume(queue: replyQueueName, noAck: true, consumer: consumer); } - public string Call( string message ) + public string Call(string message) { var corrId = Guid.NewGuid().ToString(); var props = channel.CreateBasicProperties(); props.ReplyTo = replyQueueName; props.CorrelationId = corrId; - var messageBytes = Encoding.UTF8.GetBytes( message ); - channel.BasicPublish( exchange: "", routingKey: "rpc_queue", basicProperties: props, body: messageBytes ); + var messageBytes = Encoding.UTF8.GetBytes(message); + channel.BasicPublish(exchange: "", routingKey: "rpc_queue", basicProperties: props, body: messageBytes); - while( true ) + while(true) { var ea = (BasicDeliverEventArgs)consumer.Queue.Dequeue(); - if( ea.BasicProperties.CorrelationId == corrId ) + if(ea.BasicProperties.CorrelationId == corrId) { - return Encoding.UTF8.GetString( ea.Body ); + return Encoding.UTF8.GetString(ea.Body); } } } diff --git a/dotnet-visual-studio/6_RPCServer/Program.cs b/dotnet-visual-studio/6_RPCServer/Program.cs index 00d1fc5d..fc7f0a6f 100644 --- a/dotnet-visual-studio/6_RPCServer/Program.cs +++ b/dotnet-visual-studio/6_RPCServer/Program.cs @@ -8,16 +8,16 @@ class Program public static void Main() { var factory = new ConnectionFactory() { HostName = "localhost" }; - using( var connection = factory.CreateConnection() ) - using( var channel = connection.CreateModel() ) + using(var connection = factory.CreateConnection()) + using(var channel = connection.CreateModel()) { - channel.QueueDeclare( queue: "rpc_queue", durable: false, exclusive: false, autoDelete: false, arguments: null ); - channel.BasicQos( 0, 1, false ); - var consumer = new QueueingBasicConsumer( channel ); - channel.BasicConsume( queue: "rpc_queue", noAck: false, consumer: consumer ); - Console.WriteLine( " [x] Awaiting RPC requests" ); + channel.QueueDeclare(queue: "rpc_queue", durable: false, exclusive: false, autoDelete: false, arguments: null); + channel.BasicQos(0, 1, false); + var consumer = new QueueingBasicConsumer(channel); + channel.BasicConsume(queue: "rpc_queue", noAck: false, consumer: consumer); + Console.WriteLine(" [x] Awaiting RPC requests"); - while( true ) + while(true) { string response = null; var ea = (BasicDeliverEventArgs)consumer.Queue.Dequeue(); @@ -29,21 +29,21 @@ public static void Main() try { - var message = Encoding.UTF8.GetString( body ); - int n = int.Parse( message ); - Console.WriteLine( " [.] fib({0})", message ); - response = fib( n ).ToString(); + var message = Encoding.UTF8.GetString(body); + int n = int.Parse(message); + Console.WriteLine(" [.] fib({0})", message); + response = fib(n).ToString(); } - catch( Exception e ) + catch(Exception e) { - Console.WriteLine( " [.] " + e.Message ); + Console.WriteLine(" [.] " + e.Message); response = ""; } finally { - var responseBytes = Encoding.UTF8.GetBytes( response ); - channel.BasicPublish( exchange: "", routingKey: props.ReplyTo, basicProperties: replyProps, body: responseBytes ); - channel.BasicAck( deliveryTag: ea.DeliveryTag, multiple: false ); + var responseBytes = Encoding.UTF8.GetBytes(response); + channel.BasicPublish(exchange: "", routingKey: props.ReplyTo, basicProperties: replyProps, body: responseBytes); + channel.BasicAck(deliveryTag: ea.DeliveryTag, multiple: false); } } } @@ -53,13 +53,13 @@ public static void Main() /// Assumes only valid positive integer input. /// Don't expect this one to work for big numbers, and it's probably the slowest recursive implementation possible. /// - private static int fib( int n ) + private static int fib(int n) { - if( n == 0 || n == 1 ) + if(n == 0 || n == 1) { return n; } - return fib( n - 1 ) + fib( n - 2 ); + return fib(n - 1) + fib(n - 2); } } diff --git a/dotnet/EmitLog.cs b/dotnet/EmitLog.cs index aa48ea75..ec4a781c 100644 --- a/dotnet/EmitLog.cs +++ b/dotnet/EmitLog.cs @@ -4,26 +4,26 @@ class EmitLog { - public static void Main( string[] args ) + public static void Main(string[] args) { var factory = new ConnectionFactory() { HostName = "localhost" }; - using( var connection = factory.CreateConnection() ) - using( var channel = connection.CreateModel() ) + using(var connection = factory.CreateConnection()) + using(var channel = connection.CreateModel()) { - channel.ExchangeDeclare( exchange: "logs", type: "fanout" ); + channel.ExchangeDeclare(exchange: "logs", type: "fanout"); - var message = GetMessage( args ); - var body = Encoding.UTF8.GetBytes( message ); - channel.BasicPublish( exchange: "logs", routingKey: "", basicProperties: null, body: body ); - Console.WriteLine( " [x] Sent {0}", message ); + var message = GetMessage(args); + var body = Encoding.UTF8.GetBytes(message); + channel.BasicPublish(exchange: "logs", routingKey: "", basicProperties: null, body: body); + Console.WriteLine(" [x] Sent {0}", message); } - Console.WriteLine( " Press [enter] to exit." ); + Console.WriteLine(" Press [enter] to exit."); Console.ReadLine(); } - private static string GetMessage( string[] args ) + private static string GetMessage(string[] args) { - return ( ( args.Length > 0 ) ? string.Join( " ", args ) : "info: Hello World!" ); + return ((args.Length > 0) ? string.Join(" ", args) : "info: Hello World!"); } } diff --git a/dotnet/EmitLogDirect.cs b/dotnet/EmitLogDirect.cs index 7ba375d0..707267f9 100644 --- a/dotnet/EmitLogDirect.cs +++ b/dotnet/EmitLogDirect.cs @@ -5,22 +5,22 @@ class EmitLogDirect { - public static void Main( string[] args ) + public static void Main(string[] args) { var factory = new ConnectionFactory() { HostName = "localhost" }; - using( var connection = factory.CreateConnection() ) - using( var channel = connection.CreateModel() ) + using(var connection = factory.CreateConnection()) + using(var channel = connection.CreateModel()) { - channel.ExchangeDeclare( exchange: "direct_logs", type: "direct" ); + channel.ExchangeDeclare(exchange: "direct_logs", type: "direct"); - var severity = ( args.Length > 0 ) ? args[0] : "info"; - var message = ( args.Length > 1 ) ? string.Join( " ", args.Skip( 1 ).ToArray() ) : "Hello World!"; - var body = Encoding.UTF8.GetBytes( message ); - channel.BasicPublish( exchange: "direct_logs", routingKey: severity, basicProperties: null, body: body ); - Console.WriteLine( " [x] Sent '{0}':'{1}'", severity, message ); + var severity = (args.Length > 0) ? args[0] : "info"; + var message = (args.Length > 1) ? string.Join(" ", args.Skip(1).ToArray()) : "Hello World!"; + var body = Encoding.UTF8.GetBytes(message); + channel.BasicPublish(exchange: "direct_logs", routingKey: severity, basicProperties: null, body: body); + Console.WriteLine(" [x] Sent '{0}':'{1}'", severity, message); } - Console.WriteLine( " Press [enter] to exit." ); + Console.WriteLine(" Press [enter] to exit."); Console.ReadLine(); } } diff --git a/dotnet/EmitLogTopic.cs b/dotnet/EmitLogTopic.cs index 39941084..f50fee0a 100644 --- a/dotnet/EmitLogTopic.cs +++ b/dotnet/EmitLogTopic.cs @@ -5,19 +5,19 @@ class EmitLogTopic { - public static void Main( string[] args ) + public static void Main(string[] args) { var factory = new ConnectionFactory() { HostName = "localhost" }; - using( var connection = factory.CreateConnection() ) - using( var channel = connection.CreateModel() ) + using(var connection = factory.CreateConnection()) + using(var channel = connection.CreateModel()) { - channel.ExchangeDeclare( exchange: "topic_logs", type: "topic" ); + channel.ExchangeDeclare(exchange: "topic_logs", type: "topic"); - var routingKey = ( args.Length > 0 ) ? args[0] : "anonymous.info"; - var message = ( args.Length > 1 ) ? string.Join( " ", args.Skip( 1 ).ToArray() ) : "Hello World!"; - var body = Encoding.UTF8.GetBytes( message ); - channel.BasicPublish( exchange: "topic_logs", routingKey: routingKey, basicProperties: null, body: body ); - Console.WriteLine( " [x] Sent '{0}':'{1}'", routingKey, message ); + var routingKey = (args.Length > 0) ? args[0] : "anonymous.info"; + var message = (args.Length > 1) ? string.Join(" ", args.Skip(1).ToArray()) : "Hello World!"; + var body = Encoding.UTF8.GetBytes(message); + channel.BasicPublish(exchange: "topic_logs", routingKey: routingKey, basicProperties: null, body: body); + Console.WriteLine(" [x] Sent '{0}':'{1}'", routingKey, message); } } } diff --git a/dotnet/NewTask.cs b/dotnet/NewTask.cs index f9b56871..49bbb1ea 100644 --- a/dotnet/NewTask.cs +++ b/dotnet/NewTask.cs @@ -4,30 +4,30 @@ class NewTask { - public static void Main( string[] args ) + public static void Main(string[] args) { var factory = new ConnectionFactory() { HostName = "localhost" }; - using( var connection = factory.CreateConnection() ) - using( var channel = connection.CreateModel() ) + using(var connection = factory.CreateConnection()) + using(var channel = connection.CreateModel()) { - channel.QueueDeclare( queue: "task_queue", durable: true, exclusive: false, autoDelete: false, arguments: null ); + channel.QueueDeclare(queue: "task_queue", durable: true, exclusive: false, autoDelete: false, arguments: null); - var message = GetMessage( args ); - var body = Encoding.UTF8.GetBytes( message ); + var message = GetMessage(args); + var body = Encoding.UTF8.GetBytes(message); var properties = channel.CreateBasicProperties(); - properties.SetPersistent( true ); + properties.SetPersistent(true); - channel.BasicPublish( exchange: "", routingKey: "task_queue", basicProperties: properties, body: body ); - Console.WriteLine( " [x] Sent {0}", message ); + channel.BasicPublish(exchange: "", routingKey: "task_queue", basicProperties: properties, body: body); + Console.WriteLine(" [x] Sent {0}", message); } - Console.WriteLine( " Press [enter] to exit." ); + Console.WriteLine(" Press [enter] to exit."); Console.ReadLine(); } - private static string GetMessage( string[] args ) + private static string GetMessage(string[] args) { - return ( ( args.Length > 0 ) ? string.Join( " ", args ) : "Hello World!" ); + return ((args.Length > 0) ? string.Join(" ", args) : "Hello World!"); } } diff --git a/dotnet/ReceiveLogsDirect.cs b/dotnet/ReceiveLogsDirect.cs index c8c232ac..fbafda0c 100644 --- a/dotnet/ReceiveLogsDirect.cs +++ b/dotnet/ReceiveLogsDirect.cs @@ -5,7 +5,7 @@ class ReceiveLogsDirect { - public static void Main( string[] args ) + public static void Main(string[] args) { var factory = new ConnectionFactory() { HostName = "localhost" }; using(var connection = factory.CreateConnection()) diff --git a/dotnet/Send.cs b/dotnet/Send.cs index a2419f19..cf2144f1 100644 --- a/dotnet/Send.cs +++ b/dotnet/Send.cs @@ -7,19 +7,19 @@ class Send public static void Main() { var factory = new ConnectionFactory() { HostName = "localhost" }; - using( var connection = factory.CreateConnection() ) - using( var channel = connection.CreateModel() ) + using(var connection = factory.CreateConnection()) + using(var channel = connection.CreateModel()) { - channel.QueueDeclare( queue: "hello", durable: false, exclusive: false, autoDelete: false, arguments: null ); + channel.QueueDeclare(queue: "hello", durable: false, exclusive: false, autoDelete: false, arguments: null); string message = "Hello World!"; - var body = Encoding.UTF8.GetBytes( message ); + var body = Encoding.UTF8.GetBytes(message); - channel.BasicPublish( exchange: "", routingKey: "hello", basicProperties: null, body: body ); - Console.WriteLine( " [x] Sent {0}", message ); + channel.BasicPublish(exchange: "", routingKey: "hello", basicProperties: null, body: body); + Console.WriteLine(" [x] Sent {0}", message); } - Console.WriteLine( " Press [enter] to exit." ); + Console.WriteLine(" Press [enter] to exit."); Console.ReadLine(); } }