1 Commits

Author SHA1 Message Date
Claire Kuang f2cb5c30be Update AutomateFunction.cs
build and deploy Speckle functions / publish-automate-function-version (push) Has been cancelled
2024-01-31 13:54:40 +00:00
@@ -118,22 +118,20 @@ static class AutomateFunction
{ {
if (releaseObjectPropDict.ContainsKey(entry.Key)) if (releaseObjectPropDict.ContainsKey(entry.Key))
{ {
bool changed = false;
try try
{ {
changed = entry.Value != releaseObjectPropDict[entry.Key]; bool changed = !Equals(entry.Value, releaseObjectPropDict[entry.Key]);
} if (changed)
catch { }
if (changed)
{
string diff =
$"Property ({entry.Key}) changed from ({releaseObjectPropDict[entry.Key]}) to ({entry.Value})";
if (!diffDictionary.ContainsKey(entry.Key))
{ {
diffDictionary.Add(entry.Key, diff); string diff =
$"Property ({entry.Key}) changed from ({releaseObjectPropDict[entry.Key]}) to ({entry.Value})";
if (!diffDictionary.ContainsKey(entry.Key))
{
diffDictionary.Add(entry.Key, diff);
}
} }
} }
catch { }
releaseObjectPropDict.Remove(entry.Key); releaseObjectPropDict.Remove(entry.Key);
} }
else else
@@ -206,4 +204,9 @@ static class AutomateFunction
); );
} }
} }
public static bool Equals<T>(T a, T b)
{
return EqualityComparer<T>.Default.Equals(a, b);
}
} }