Skip to content

Commit b2eb6c5

Browse files
committed
* Specify unix line endings so that christian-bromann/docusaurus-theme-github-codeblock formats code blocks correctly
1 parent 30fded6 commit b2eb6c5

File tree

10 files changed

+576
-562
lines changed

10 files changed

+576
-562
lines changed

dotnet/.gitattributes

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# Set the default behavior, in case people don't have core.autocrlf set.
2+
* text=auto
3+
4+
# Auto detect text files and perform LF normalization
5+
*.cs text=auto eol=lf
6+
*.txt text=auto
7+
8+
# Declare files that will always have CRLF line endings on checkout.
9+
*.sln text eol=crlf
10+
*.csproj text eol=crlf
11+
12+
# Custom for Visual Studio
13+
*.cs diff=csharp
14+

dotnet/EmitLogDirect/EmitLogDirect.cs

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
1-
using RabbitMQ.Client;
2-
using System.Text;
3-
4-
var factory = new ConnectionFactory { HostName = "localhost" };
5-
using var connection = await factory.CreateConnectionAsync();
6-
using var channel = await connection.CreateChannelAsync();
7-
8-
await channel.ExchangeDeclareAsync(exchange: "direct_logs", type: ExchangeType.Direct);
9-
10-
var severity = (args.Length > 0) ? args[0] : "info";
11-
var message = (args.Length > 1) ? string.Join(" ", args.Skip(1).ToArray()) : "Hello World!";
12-
var body = Encoding.UTF8.GetBytes(message);
13-
await channel.BasicPublishAsync(exchange: "direct_logs", routingKey: severity, body: body);
14-
Console.WriteLine($" [x] Sent '{severity}':'{message}'");
15-
16-
Console.WriteLine(" Press [enter] to exit.");
17-
Console.ReadLine();
1+
using RabbitMQ.Client;
2+
using System.Text;
3+
4+
var factory = new ConnectionFactory { HostName = "localhost" };
5+
using var connection = await factory.CreateConnectionAsync();
6+
using var channel = await connection.CreateChannelAsync();
7+
8+
await channel.ExchangeDeclareAsync(exchange: "direct_logs", type: ExchangeType.Direct);
9+
10+
var severity = (args.Length > 0) ? args[0] : "info";
11+
var message = (args.Length > 1) ? string.Join(" ", args.Skip(1).ToArray()) : "Hello World!";
12+
var body = Encoding.UTF8.GetBytes(message);
13+
await channel.BasicPublishAsync(exchange: "direct_logs", routingKey: severity, body: body);
14+
Console.WriteLine($" [x] Sent '{severity}':'{message}'");
15+
16+
Console.WriteLine(" Press [enter] to exit.");
17+
Console.ReadLine();

dotnet/EmitLogTopic/EmitLogTopic.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
using RabbitMQ.Client;
2-
using System.Text;
3-
4-
var factory = new ConnectionFactory { HostName = "localhost" };
5-
using var connection = await factory.CreateConnectionAsync();
6-
using var channel = await connection.CreateChannelAsync();
7-
8-
await channel.ExchangeDeclareAsync(exchange: "topic_logs", type: ExchangeType.Topic);
9-
10-
var routingKey = (args.Length > 0) ? args[0] : "anonymous.info";
11-
var message = (args.Length > 1) ? string.Join(" ", args.Skip(1).ToArray()) : "Hello World!";
12-
var body = Encoding.UTF8.GetBytes(message);
13-
await channel.BasicPublishAsync(exchange: "topic_logs", routingKey: routingKey, body: body);
14-
Console.WriteLine($" [x] Sent '{routingKey}':'{message}'");
1+
using RabbitMQ.Client;
2+
using System.Text;
3+
4+
var factory = new ConnectionFactory { HostName = "localhost" };
5+
using var connection = await factory.CreateConnectionAsync();
6+
using var channel = await connection.CreateChannelAsync();
7+
8+
await channel.ExchangeDeclareAsync(exchange: "topic_logs", type: ExchangeType.Topic);
9+
10+
var routingKey = (args.Length > 0) ? args[0] : "anonymous.info";
11+
var message = (args.Length > 1) ? string.Join(" ", args.Skip(1).ToArray()) : "Hello World!";
12+
var body = Encoding.UTF8.GetBytes(message);
13+
await channel.BasicPublishAsync(exchange: "topic_logs", routingKey: routingKey, body: body);
14+
Console.WriteLine($" [x] Sent '{routingKey}':'{message}'");

dotnet/NewTask/NewTask.cs

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,26 +1,26 @@
1-
using RabbitMQ.Client;
2-
using System.Text;
3-
4-
var factory = new ConnectionFactory { HostName = "localhost" };
5-
using var connection = await factory.CreateConnectionAsync();
6-
using var channel = await connection.CreateChannelAsync();
7-
8-
await channel.QueueDeclareAsync(queue: "task_queue", durable: true, exclusive: false,
9-
autoDelete: false, arguments: null);
10-
11-
var message = GetMessage(args);
12-
var body = Encoding.UTF8.GetBytes(message);
13-
14-
var properties = new BasicProperties
15-
{
16-
Persistent = true
17-
};
18-
19-
await channel.BasicPublishAsync(exchange: string.Empty, routingKey: "task_queue", mandatory: true,
20-
basicProperties: properties, body: body);
21-
Console.WriteLine($" [x] Sent {message}");
22-
23-
static string GetMessage(string[] args)
24-
{
25-
return ((args.Length > 0) ? string.Join(" ", args) : "Hello World!");
26-
}
1+
using RabbitMQ.Client;
2+
using System.Text;
3+
4+
var factory = new ConnectionFactory { HostName = "localhost" };
5+
using var connection = await factory.CreateConnectionAsync();
6+
using var channel = await connection.CreateChannelAsync();
7+
8+
await channel.QueueDeclareAsync(queue: "task_queue", durable: true, exclusive: false,
9+
autoDelete: false, arguments: null);
10+
11+
var message = GetMessage(args);
12+
var body = Encoding.UTF8.GetBytes(message);
13+
14+
var properties = new BasicProperties
15+
{
16+
Persistent = true
17+
};
18+
19+
await channel.BasicPublishAsync(exchange: string.Empty, routingKey: "task_queue", mandatory: true,
20+
basicProperties: properties, body: body);
21+
Console.WriteLine($" [x] Sent {message}");
22+
23+
static string GetMessage(string[] args)
24+
{
25+
return ((args.Length > 0) ? string.Join(" ", args) : "Hello World!");
26+
}

0 commit comments

Comments
 (0)