Enforce coding styles (#2377)

This commit is contained in:
Next Turn 2019-03-06 00:14:06 +08:00 committed by Karel Zikmund
parent 85b7db561b
commit 4b17f38b2d
5 changed files with 51 additions and 52 deletions

View file

@ -2,22 +2,22 @@ using System;
public static class Program public static class Program
{ {
public static void Main(string[] args) public static void Main(string[] args)
{ {
string message = "dotnet-bot: Welcome to using .NET Core!"; string message = "dotnet-bot: Welcome to using .NET Core!";
if (args.Length > 0) if (args.Length > 0)
{ {
message = String.Join(" ",args); message = string.Join(" ", args);
} }
Console.WriteLine(GetBot(message)); Console.WriteLine(GetBot(message));
} }
public static string GetBot(string message) public static string GetBot(string message)
{ {
string bot = $"\n {message}"; string bot = $"\n {message}";
bot += @" bot += @"
__________________ __________________
\ \
\ \
@ -57,7 +57,6 @@ public static class Program
..... .....
"; ";
return bot; return bot;
} }
} }

View file

@ -12,7 +12,7 @@ public static class Program
} }
else if (args.Length > 0) else if (args.Length > 0)
{ {
message = String.Join(" ", args); message = string.Join(" ", args);
} }
Console.WriteLine(GetBot(message)); Console.WriteLine(GetBot(message));
@ -62,5 +62,4 @@ public static class Program
"; ";
return bot; return bot;
} }
} }

View file

@ -1,12 +1,12 @@
using System; using System;
namespace HelloWorldSample namespace HelloWorldSample
{ {
public static class Program public static class Program
{ {
public static void Main() public static void Main()
{ {
Console.WriteLine("Hello World!"); Console.WriteLine("Hello World!");
} }
} }
} }

View file

@ -1,13 +1,13 @@
using System; using System;
using System.Threading.Tasks; using System.Threading.Tasks;
namespace HelloWorldSample namespace HelloWorldSample
{ {
public static class Program public static class Program
{ {
public static async Task Main() public static async Task Main()
{ {
await Task.Run(() => Console.WriteLine("Hello World!")); await Task.Run(() => Console.WriteLine("Hello World!"));
} }
} }
} }

View file

@ -1,23 +1,24 @@
using System; using System;
using System.IO; using System.IO;
namespace Qotd namespace Qotd
{ {
public static class Program public static class Program
{ {
public static void Main(string[] args) public static void Main(string[] args)
{ {
if (args.Length <=0) if (args.Length == 0)
{ {
Console.ForegroundColor = ConsoleColor.Red; Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("You must specify a quotes file."); Console.WriteLine("You must specify a quotes file.");
Console.ResetColor(); Console.ResetColor();
return; return;
} }
var quotes = File.ReadAllLines(args[0]);
var randomQuote = quotes[new Random().Next(0, quotes.Length-1)]; var quotes = File.ReadAllLines(args[0]);
var randomQuote = quotes[new Random().Next(0, quotes.Length - 1)];
Console.WriteLine("[QOTD]: {0}", randomQuote);
} Console.WriteLine($"[QOTD]: {randomQuote}");
} }
} }
}