Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Interproject exchange] Default exchange signals filter #1514

Merged
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 12 additions & 3 deletions src/InterprojectExchange/FilterConfiguration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,11 @@ public void Save()
}
}

/// <summary>
/// Настройка фильтра сигналов по умолчанию
/// </summary>
private readonly List<string> DefaultDevicesFilter = new List<string>() { "DI", "DO", "AI", "AO" };

/// <summary>
/// Прочитать конфигурацию фильтрации из .ini
/// </summary>
Expand All @@ -65,8 +70,6 @@ public void Read()
var newFilterParameters =
new Dictionary<string, Dictionary<string, bool>>();
var iniFile = new IniFile(pathToConfig);
// Стандартное значение ключа параметра в .ini
string defaultValue = "false";

foreach (var section in FilterParameters.Keys)
{
Expand All @@ -76,7 +79,13 @@ public void Read()
foreach (var keyValuePair in parameters)
{
string readValue = iniFile.ReadString(section,
keyValuePair.Key, defaultValue);
keyValuePair.Key, "-");

if (readValue == "-")
{
readValue = DefaultDevicesFilter.Contains(keyValuePair.Key).ToString();
}

bool.TryParse(readValue, out bool isEnabled);
itemParameters.Add(keyValuePair.Key, isEnabled);
}
Expand Down