🖥️ VB CURSE DIFFICULTY: Adept Behavioral

The Memento of the PropertyBag

Saving an object's cursed state into a PropertyBag for later resurrection.

✧ GANG OF FOUR LINEAGE & ARCANUM ✧
GOF DESIGN PATTERN: Memento
ARCANUM SCHOOL: Chronomancy // State Preservation
SCRIBE / ARCHON: Joshua Edward McLaughlin Cox
CANONICAL REGISTRATION:
// VB PATTERN //
' StateSaver.cls
Public Sub SaveState(obj As Object, pb As PropertyBag)
    On Error Resume Next
    pb.WriteProperty "CurseLevel", obj.CurseLevel
    pb.WriteProperty "DemonName", obj.DemonName
End Sub

Public Sub RestoreState(obj As Object, pb As PropertyBag)
    On Error Resume Next
    obj.CurseLevel = pb.ReadProperty("CurseLevel", 0)
    obj.DemonName = pb.ReadProperty("DemonName", "Unknown")
End Sub

The PropertyBag is VB6’s built-in vessel for the Memento pattern. It allows you to siphon the state of an ActiveX control, persist it to disk, and load it later to restore the control to its former horrific glory.

Runic Tags: #memento #propertybag #state