add spanish translations to restart detector

This commit is contained in:
Vincent Maas committed 2022-02-27 15:23:46 +01:00
1 parent b8910a3b64
commit 0c1859f848
2 files changed
+10 -5

No files matched your search

+2 -2
View File
@@ -18,8 +18,8 @@
<PublisherName>Maassoft</PublisherName>
<Company>Maassoft</Company>
<ApplicationRevision>0</ApplicationRevision>
<ApplicationVersion>5.5.0.0</ApplicationVersion>
<Version>5.5.0.0</Version>
<ApplicationVersion>5.5.1.0</ApplicationVersion>
<Version>5.5.1.0</Version>
<UseApplicationTrust>false</UseApplicationTrust>
<PublishWizardCompleted>true</PublishWizardCompleted>
<BootstrapperEnabled>false</BootstrapperEnabled>
+8 -3
View File
@@ -1,6 +1,7 @@
using Microsoft.Win32;
using NLog;
using System;
using System.Collections.Generic;
using System.Diagnostics.Eventing.Reader;
using System.Linq;
@@ -14,6 +15,9 @@ namespace ColorControl
private EventLogWatcher watcher = null;
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
private static readonly IEnumerable<string> RestartNames = new[] { "restart", "herstart", "reinicio" };
private static readonly IEnumerable<string> PowerOffNames = new[] { "power off", "uitschakelen", "apagar" };
public RestartDetector()
{
try
@@ -56,13 +60,14 @@ namespace ColorControl
{
foreach (EventProperty x in ((EventLogRecord)arg.EventRecord).Properties)
{
Logger.Debug("Event value: " + x.Value);
if (x.Value.Equals("restart"))
var strValue = x.Value.ToString();
Logger.Debug("Event value: " + strValue);
if (RestartNames.Any(n => n.Equals(strValue, StringComparison.OrdinalIgnoreCase)))
{
RestartDetected = true;
break;
}
if (x.Value.Equals("power off"))
if (PowerOffNames.Any(n => n.Equals(strValue, StringComparison.OrdinalIgnoreCase)))
{
PowerOffDetected = true;
break;