Stand von WE . Prüfung laufen gut

This commit is contained in:
Roland Drabesch
2023-01-06 17:23:32 +01:00
parent ae52e6e258
commit 04b893d79d
5 changed files with 242 additions and 125 deletions
@@ -957,8 +957,16 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
if (string.IsNullOrEmpty(PcbId))
{
//GetPcbId fills the PsbId property
if (string.IsNullOrEmpty(GetPcbId()))
return "";
if (string.IsNullOrEmpty(GetPcbId()) || string.IsNullOrEmpty(PcbId) || PcbId.Length < 8)
{
if (string.IsNullOrEmpty(GetPcbId()))
{
return "";
}
}
}
url += PcbId;
@@ -983,12 +991,18 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
{
_logger.Info($"Slot:{Slot} - Cannot get password from GenesisPasswordService, " +
$"URL({url}), Error({ex.Message})");
var listOfOfflinePasswords = JsonConvert.DeserializeObject<List<OfflinePasswordItem>>(File.ReadAllText(ProgramConfig.OfflineInfoFile));
password = listOfOfflinePasswords.First(x => x.PcbId == PcbId).Password;
if (!string.IsNullOrEmpty(password))
if (File.Exists(ProgramConfig.OfflineInfoFile))
{
_logger.Info($"Slot:{Slot} - Got password from password file!");
var listOfOfflinePasswords = JsonConvert.DeserializeObject<List<OfflinePasswordItem>>(File.ReadAllText(ProgramConfig.OfflineInfoFile));
password = listOfOfflinePasswords.First(x => x.PcbId == PcbId).Password;
if (!string.IsNullOrEmpty(password))
{
_logger.Info($"Slot:{Slot} - Got password from password file!");
}
}
password = "";
}
return password;
@@ -1003,7 +1017,11 @@ namespace Xylem.Common.Hardware.WaterMeter.Genesis.GenesisCore
if (string.IsNullOrEmpty(_password) || string.IsNullOrEmpty(PcbId))
{
var password = GetPassword();
return !string.IsNullOrEmpty(password) && Login(password);
if (string.IsNullOrEmpty(password))
{
return false;
}
return Login(password);
}
return Login(_password);