Created
April 24, 2018 18:44
-
-
Save BrunoCaimar/c0241fe3d4d364a3fe30ae71f432ba52 to your computer and use it in GitHub Desktop.
ProcessInfo.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
namespace ConsoleAppTest | |
{ | |
internal class Program | |
{ | |
private static void Main(string[] args) | |
{ | |
ImprimirInformacoesRuntimeAmbiente(); | |
} | |
private static void ImprimirInformacoesRuntimeAmbiente() | |
{ | |
var currentApp = System.Reflection.Assembly.GetExecutingAssembly(); | |
var info = "CodeBase:" + currentApp.CodeBase + | |
"\r\n - FullName: " + currentApp.FullName + | |
"\r\n - ImageRuntimeVersion: " + currentApp.ImageRuntimeVersion + | |
"\r\n - Location: " + currentApp.Location + | |
"\r\n - ToString(): " + currentApp.ToString() + | |
"\r\n - ProcessorArchitecture: " + currentApp.GetName().ProcessorArchitecture + | |
"\r\n - GetReferencedAssemblies(): " + currentApp.GetReferencedAssemblies(); | |
var env = "Environment.CommandLine: " + Environment.CommandLine + | |
"\r\n - CurrentDirectory:" + Environment.CurrentDirectory + | |
"\r\n - GetCommandLineArgs: " + string.Join(" - ", Environment.GetCommandLineArgs()) + | |
// "\r\n - GetEnvironmentVariables(): " + Expandir(Environment.GetEnvironmentVariables()) + | |
"\r\n - Environment.MachineName: " + Environment.MachineName + | |
"\r\n - Environment.OSVersion: " + Environment.OSVersion + | |
"\r\n - Environment.ProcessorCount: " + Environment.ProcessorCount + | |
// "\r\n - Environment.StackTrace:" + Environment.StackTrace + | |
"\r\n - Environment.SystemDirectory: " + Environment.SystemDirectory + | |
"\r\n - Environment.UserDomainName:" + Environment.UserDomainName + | |
"\r\n - Environment.UserInteractive:" + Environment.UserInteractive + | |
"\r\n - Environment.UserName:" + Environment.UserName + | |
"\r\n - Environment.Version:" + Environment.Version.ToString(); | |
var currentThread = System.Threading.Thread.CurrentThread; | |
var culture = "CurrentThread.CurrentCulture:" + currentThread.CurrentCulture.ToString() + | |
"\r\n - CurrentThread.CurrentUICulture:" + currentThread.CurrentUICulture.ToString() + | |
"\r\n - DateTime.Now:" + DateTime.Now.ToString() + | |
"\r\n - DateTime.UtcNow:" + DateTime.UtcNow.ToString(); | |
Console.WriteLine(info); | |
Console.WriteLine("-------------------------"); | |
Console.WriteLine(env); | |
Console.WriteLine("-------------------------"); | |
Console.WriteLine(culture); | |
Console.ReadKey(); | |
// Current Path | |
// Current DateTime | |
// Current ServerName | |
// Windows Version | |
// ArcGIS Version | |
// Runtime info - Program Name | |
// Runtime info - Program Version / Program Date / Program Size? | |
// Dependencies: Path / Name / Version | |
} | |
private static string Expandir(IDictionary dictionary) | |
{ | |
var sb = new List<string>(); | |
foreach (var item in dictionary) | |
{ | |
var entry = (DictionaryEntry)item; | |
sb.Add(entry.Key.ToString() + ": " + entry.Value); | |
} | |
return string.Join("\r\n", sb); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment