-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
94 lines (79 loc) · 4.35 KB
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
using System;
using Microsoft.AspNetCore;
using Microsoft.AspNetCore.Hosting;
using Microsoft.Extensions.Logging;
using C = System.Console;
using E = System.Environment;
#pragma warning disable CS0414, CS0219, IDE0051, IDE0059, CS1591, IDE0044
namespace BaseballScraper
{
public class Program
{
public static void Main (string[] args)
{
PrintEnvironmentInfo();
CheckEnvironmentVersion();
C.WriteLine($"\n***** ---> READY TO ROLL <--- *****");
CreateWebHostBuilder(args).Build().Run();
}
public static IWebHostBuilder CreateWebHostBuilder(string[] args) =>
WebHost.CreateDefaultBuilder(args)
.UseSetting(WebHostDefaults.SuppressStatusMessagesKey, "False")
.UseStartup<Startup>()
.ConfigureLogging(logging =>
logging.SetMinimumLevel(LogLevel.Warning)
.AddConsole()
.AddDebug()
);
private static void PrintEnvironmentInfo()
{
C.ForegroundColor = ConsoleColor.Blue;
C.WriteLine($"\n[ CURRENT ENVIRONMENT INFO ]");
C.WriteLine ($"Version : {E.Version}");
C.WriteLine ($"System Directory : {E.SystemDirectory}");
C.WriteLine ($"Current Directory : {E.CurrentDirectory}");
C.WriteLine ($"Command Line : {E.CommandLine}");
C.WriteLine ($"Current Managed Thread Id : {E.CurrentManagedThreadId}");
C.WriteLine ($"Exit Code : {E.ExitCode}");
C.WriteLine ($"Machine Name : {E.MachineName}");
C.WriteLine ($"OS Version : {E.OSVersion}");
C.WriteLine ($"Processor Count : {E.ProcessorCount}");
C.WriteLine ($"Stack Trace : {E.StackTrace}");
C.WriteLine ($"System Page Size : {E.SystemPageSize}");
C.WriteLine ($"Working Set : {E.WorkingSet}");
C.WriteLine ($"User Domain Name : {E.UserDomainName}\n");
C.ResetColor();
}
private static void CheckEnvironmentVersion()
{
if(string.Equals(Environment.Version.ToString(), "Production", StringComparison.Ordinal))
{
C.ForegroundColor = ConsoleColor.Red;
C.WriteLine($"\n***************************************************");
C.WriteLine("SWITCH TO DEV ENVIRONMENT");
C.WriteLine($"***************************************************\n");
C.ResetColor();
}
}
}
}
// C.ForegroundColor = ConsoleColor.Blue;
// C.WriteLine($"\n***** ---> READY TO ROLL <--- *****");
// C.WriteLine ($"Version : {Environment.Version}");
// C.WriteLine ($"System Directory : {Environment.SystemDirectory}");
// C.WriteLine ($"Current Directory : {Environment.CurrentDirectory}");
// C.WriteLine ($"Command Line : {Environment.CommandLine}");
// C.WriteLine ($"Current Managed Thread Id : {Environment.CurrentManagedThreadId}");
// C.WriteLine ($"Machine Name : {Environment.MachineName}");
// C.WriteLine ($"OS Version : {Environment.OSVersion}");
// C.WriteLine ($"Processor Count : {Environment.ProcessorCount}");
// C.WriteLine ($"User Domain Name : {Environment.UserDomainName}\n");
// C.ResetColor();
// if(string.Equals(Environment.Version.ToString(), "Production", StringComparison.Ordinal))
// {
// C.ForegroundColor = ConsoleColor.Red;
// C.WriteLine($"\n***************************************************");
// C.WriteLine("SWITCH TO DEV ENVIRONMENT");
// C.WriteLine($"***************************************************\n");
// C.ResetColor();
// }