Skip to content

Commit d5cbac1

Browse files
committed
Add missing attributes and fix broken SafeParseBool
1 parent ea88539 commit d5cbac1

File tree

1 file changed

+7
-3
lines changed
  • b2sbackglassdesigner/b2sbackglassdesigner/Modules

1 file changed

+7
-3
lines changed

b2sbackglassdesigner/b2sbackglassdesigner/Modules/moduleB2S.vb

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -395,9 +395,9 @@ Module moduleB2S
395395
Return _defaultValue
396396
End Function
397397
Public Function SafeParseBool(_value As String, _defaultValue As Boolean) As Boolean
398-
Dim result As Boolean
399-
If Boolean.TryParse(_value, result) Then
400-
Return result
398+
Dim result As Integer
399+
If Integer.TryParse(_value, result) Then
400+
Return result = 1
401401
End If
402402
Return _defaultValue
403403
End Function
@@ -613,6 +613,8 @@ Module moduleB2S
613613
animation.LockInvolvedLamps = SafeParseBool(animationNode.Attributes("LockInvolvedLamps")?.Value, False)
614614
animation.HideScoreDisplays = SafeParseBool(animationNode.Attributes("HideScoreDisplays")?.Value, False)
615615
animation.BringToFront = SafeParseBool(animationNode.Attributes("BringToFront")?.Value, False)
616+
animation.RandomStart = SafeParseBool(animationNode.Attributes("RandomStart")?.Value, False)
617+
animation.RandomQuality = SafeParseInt(animationNode.Attributes("RandomQuality")?.Value, 1)
616618

617619
' Read animation steps
618620
For Each stepNode As Xml.XmlNode In animationNode.SelectNodes("AnimationStep")
@@ -655,6 +657,8 @@ Module moduleB2S
655657
animationNode.SetAttribute("LockInvolvedLamps", If(_animationHeader.LockInvolvedLamps, "1", "0"))
656658
animationNode.SetAttribute("HideScoreDisplays", If(_animationHeader.HideScoreDisplays, "1", "0"))
657659
animationNode.SetAttribute("BringToFront", If(_animationHeader.BringToFront, "1", "0"))
660+
animationNode.SetAttribute("RandomStart", If(_animationHeader.RandomStart, "1", "0"))
661+
animationNode.SetAttribute("RandomQuality", CType(_animationHeader.RandomQuality, Integer).ToString())
658662

659663
' Add Animation Steps as child nodes
660664
For Each stepItem As Animation.AnimationStep In _animationHeader.AnimationSteps

0 commit comments

Comments
 (0)