Skip to content

Commit

Permalink
Fixed config bug 🐛
Browse files Browse the repository at this point in the history
  • Loading branch information
Inestic committed Oct 18, 2021
1 parent 19b1332 commit 5582c15
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
18 changes: 12 additions & 6 deletions ip2email/ip2email/Classes/AppConfig.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class AppConfig
{
internal AppConfig()
{
SetIsConfiguredState();
isConfigured(EmailBody, EmailServer, EmailServerPort, RecipientEmail, SenderEmail, SenderPassword);
}

internal string EmailBody { get => DecodeFromRegistry("EBO"); set => EncodeToRegistry("EBO", value); }
Expand Down Expand Up @@ -78,12 +78,18 @@ private void EncodeToRegistry(string regKeyName, string regKeyValue)
}
}

private void SetIsConfiguredState()
private void isConfigured(params string[] properties)
{
IsConfigured = (SenderEmail == null || SenderPassword == null
|| RecipientEmail == null
|| EmailServer == null
|| EmailServerPort == null) ? false : true;
foreach (var property in properties)
{
if (property is null)
{
IsConfigured = false;
break;
}

IsConfigured = true;
}
}
}
}
4 changes: 2 additions & 2 deletions ip2email/ip2email/Helpers/TextHelper.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ internal static class TextHelper
internal static readonly string FailedGetInternetIP = "Failed to obtain public IP address";
internal static readonly string FailedGetLocalIP = "Failed to obtain local IP address";
internal static readonly string InternetIpSite = "https://ifconfig.me/ip";
internal static readonly string RegistryAppName = "IP2Email";
internal static readonly string RegistryAppPath = $@"{RegistryKeySoftware}\{RegistryKeyAuthor}\{RegistryAppName}";
internal static readonly string RegistryAppName = "IP2Email";
internal static readonly string RegistryKeyAuthor = "Inestic";
internal static readonly string RegistryKeySoftware = "Software";
internal static readonly string RegistryAppPath = $@"{RegistryKeySoftware}\{RegistryKeyAuthor}\{RegistryAppName}";
internal static readonly string SecurityKey = "";
internal static readonly string SenderDisplayName = "IP2Email";
}
Expand Down

0 comments on commit 5582c15

Please sign in to comment.