Skip to content

Commit

Permalink
Fixed debug info 🐛
Browse files Browse the repository at this point in the history
  • Loading branch information
Inestic committed Mar 18, 2022
1 parent 8549f5c commit f14bca1
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 21 deletions.
15 changes: 2 additions & 13 deletions SophiApp/SophiApp/Helpers/DebugHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,30 +16,20 @@ internal class DebugHelper
private const string APP_THEME = "App theme";
private const string APP_VER = "App version";
private const string PC_NAME = "Computer name";
private const string REG_ORG = "Registered organization";

private const string REG_OWNER = "Registered owner";

private const string USER_CULTURE = "User culture";

private const string USER_DOMAIN = "User domain";

private const string USER_NAME = "Current user";

private const string USER_REGION = "User region";

private static readonly object infoLogLocker = new object();

private static readonly Version OS_VERSION = OsHelper.GetVersion();
private static readonly object statusLogLocker = new object();

private static List<string> ErrorsLog = new List<string>();

private static List<string> InfoLog = new List<string>
{
$"{OsHelper.GetProductName()} {OsHelper.GetDisplayVersion()} build: {OsHelper.GetVersion()}",
$"{OsHelper.GetProductName()} {OsHelper.GetDisplayVersion()} build {OS_VERSION.Build}.{OS_VERSION.Revision}",
$"{PC_NAME}: {Environment.MachineName}",
$"{REG_ORG}: {OsHelper.GetRegisteredOrganization()}",
$"{REG_OWNER}: {OsHelper.GetRegisteredOwner()}",
$"{USER_NAME}: {Environment.UserName}",
$"{USER_DOMAIN}: {Environment.GetEnvironmentVariable("userdnsdomain") ?? Environment.UserDomainName}",
$"{USER_CULTURE}: {OsHelper.GetCurrentCultureName()}",
Expand All @@ -50,7 +40,6 @@ internal class DebugHelper
};

private static List<string> InitLog = new List<string>();

private static List<string> StatusLog = new List<string>();

private static string DateTime { get => System.DateTime.Now.ToString("dd.MM.yyyy HH:mm:ss"); }
Expand Down
2 changes: 2 additions & 0 deletions SophiApp/SophiApp/Helpers/ExtensionsHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,8 @@ public static List<string> Split(this List<string> source, string splitter)
return source;
}

public static int ToInt32(this object value) => Convert.ToInt32(value);

public static ushort ToUshort(this object value) => Convert.ToUInt16(value);
}
}
12 changes: 6 additions & 6 deletions SophiApp/SophiApp/Helpers/OsHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -86,13 +86,13 @@ internal static string GetProductName()

internal static ushort GetUpdateBuildRevision() => Convert.ToUInt16(RegHelper.GetValue(hive: RegistryHive.LocalMachine, REGISTRY_CURRENT_VERSION, UBR));

internal static string GetVersion()
internal static Version GetVersion()
{
var majorVersion = RegHelper.GetValue(hive: RegistryHive.LocalMachine, REGISTRY_CURRENT_VERSION, MAJOR_VERSION_NUMBER);
var minorVersion = RegHelper.GetValue(hive: RegistryHive.LocalMachine, REGISTRY_CURRENT_VERSION, MINOR_VERSION_NUMBER);
var buildVersion = GetBuild();
var ubrVersion = GetUpdateBuildRevision();
return $"{majorVersion}.{minorVersion}.{buildVersion}.{ubrVersion}";
var major = RegHelper.GetValue(hive: RegistryHive.LocalMachine, REGISTRY_CURRENT_VERSION, MAJOR_VERSION_NUMBER).ToInt32();
var minor = RegHelper.GetValue(hive: RegistryHive.LocalMachine, REGISTRY_CURRENT_VERSION, MINOR_VERSION_NUMBER).ToInt32();
var build = GetBuild();
var revision = GetUpdateBuildRevision();
return new Version(major, minor, build, revision);
}

internal static bool IsEdition(string name) => GetEdition().Contains(name);
Expand Down
4 changes: 2 additions & 2 deletions SophiApp/SophiApp/ViewModels/Methods.cs
Original file line number Diff line number Diff line change
Expand Up @@ -239,8 +239,8 @@ private void InitializeProperties()
}

private async Task InitializeTextedElements(string tag) => await Task.Run(() => TextedElements.Where(element => element.Tag == tag)
.ToList()
.ForEach(element => element.Initialize()));
.ToList()
.ForEach(element => element.Initialize()));

private async Task InitializeTextedElementsAsync()
{
Expand Down

0 comments on commit f14bca1

Please sign in to comment.