46 lines
1.2 KiB
C#
46 lines
1.2 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace WeldingCommon.Utils
|
|
{
|
|
public class ChangeChecker
|
|
{
|
|
private static Dictionary<string, bool> mapping = new Dictionary<string, bool>();
|
|
public static bool IsChangedBool(string Resource, bool value, bool defaultVal = false)
|
|
{
|
|
if (mapping.ContainsKey(Resource) == false) {
|
|
mapping[Resource] = defaultVal;
|
|
return false;
|
|
}
|
|
|
|
if (mapping[Resource] == value) {
|
|
return false;
|
|
}
|
|
|
|
mapping[Resource] = value;
|
|
return true;
|
|
}
|
|
public static bool IsChangedBoolMonitoring(string Resource, bool value, bool MonitoringValue, bool defaultVal = false)
|
|
{
|
|
if (mapping.ContainsKey(Resource) == false) {
|
|
mapping[Resource] = defaultVal;
|
|
return false;
|
|
}
|
|
|
|
if (mapping[Resource] == value) {
|
|
return false;
|
|
}
|
|
|
|
mapping[Resource] = value;
|
|
|
|
if(mapping[Resource] == MonitoringValue)
|
|
return true;
|
|
|
|
return false;
|
|
}
|
|
}
|
|
}
|