public static EnvironmentInfo GetEnvironmentInfo() { var info = new EnvironmentInfo { ProductName = Application.ProductName, AppVersion = Application.ProductVersion, Thread_CurrentPrincipal_Identity_Name = Thread.CurrentPrincipal.Identity.Name, Thread_CurrentPrincipal_Identity_AuthenticationType = Thread.CurrentPrincipal.Identity.AuthenticationType, Environment_UserDomainName = Environment.UserDomainName, Environment_UserName = Environment.UserName, Environment_OSVersion_VersionString = Environment.OSVersion.VersionString, Environment_CurrentDirectory = Environment.CurrentDirectory, ExecutingAssembly_FullName = Assembly.GetExecutingAssembly().FullName, AppDataPath = GetAppDataPath(), Thread_CurrentThread_CurrentCulture_Name = Thread.CurrentThread.CurrentCulture.Name, Thread_CurrentThread_CurrentUICulture_Name = Thread.CurrentThread.CurrentUICulture.Name, }; if (Thread.CurrentPrincipal != null && Thread.CurrentPrincipal.Identity != null) { info.Thread_CurrentPrincipal_Identity_Name = Thread.CurrentPrincipal.Identity.Name; info.Thread_CurrentPrincipal_Identity_AuthenticationType = Thread.CurrentPrincipal.Identity.AuthenticationType; } return info; }
private static void SerializeShortEnvironmentInfoToStringBuilder(EnvironmentInfo info, StringBuilder sb) { if (info == null) { return; } sb.Append(FIELD_LP); sb.Append(SerializeValue(info.Thread_CurrentPrincipal_Identity_Name)); sb.Append(FIELD_RP); sb.Append(FIELD_LP); sb.Append(SerializeValue(info.AppVersion)); sb.Append(FIELD_RP); sb.Append(FIELD_LP); sb.Append(SerializeValue(info.AppDataPath)); sb.Append(FIELD_RP); sb.Append(FIELD_LP); sb.Append(SerializeValue(info.Environment_CurrentDirectory)); sb.Append(FIELD_RP); sb.Append(FIELD_LP); sb.Append(SerializeValue(info.Thread_CurrentThread_CurrentCulture_Name)); sb.Append(FIELD_RP); sb.Append(FIELD_LP); sb.Append(SerializeValue(info.Thread_CurrentThread_CurrentUICulture_Name)); sb.Append(FIELD_RP); }