コード例 #1
0
        // Set this up from the parse tree.
        public override void Initialise(MHParseNode p, MHEngine engine)
        {
            base.Initialise(p, engine);
            Logging.Assert(m_ObjectIdentifier.ObjectNo > 0);
            MHParseNode pIA = p.GetNamedArg(ASN1Codes.C_INITIALLY_ACTIVE);

            if (pIA != null)
            {
                m_fInitiallyActive = pIA.GetArgN(0).GetBoolValue();
            }

            MHParseNode pCHook = p.GetNamedArg(ASN1Codes.C_CONTENT_HOOK);

            if (pCHook != null)
            {
                m_nContentHook = pCHook.GetArgN(0).GetIntValue();
            }

            MHParseNode pOrigContent = p.GetNamedArg(ASN1Codes.C_ORIGINAL_CONTENT);

            if (pOrigContent != null)
            {
                MHParseNode pArg = pOrigContent.GetArgN(0);
                // Either a string - included content.
                if (pArg.NodeType == MHParseNode.PNString)
                {
                    m_ContentType = IN_IncludedContent;
                    pArg.GetStringValue(m_OrigIncludedContent);
                }
                else
                { // or a sequence - referenced content.
                    // In the text version this is tagged with :ContentRef
                    m_ContentType = IN_ReferencedContent;
                    m_OrigContentRef.Initialise(pArg.GetArgN(0), engine);
                    MHParseNode pContentSize = pArg.GetNamedArg(ASN1Codes.C_CONTENT_SIZE);
                    if (pContentSize != null)
                    {
                        m_nOrigContentSize = pContentSize.GetArgN(0).GetIntValue();
                    }
                    MHParseNode pCCPrio = pArg.GetNamedArg(ASN1Codes.C_CONTENT_CACHE_PRIORITY);
                    if (pCCPrio != null)
                    {
                        m_nOrigCCPrio = pCCPrio.GetArgN(0).GetIntValue();
                    }
                }
            }

            MHParseNode pShared = p.GetNamedArg(ASN1Codes.C_SHARED);

            if (pShared != null)
            {
                m_fShared = pShared.GetArgN(0).GetBoolValue();
            }
        }
コード例 #2
0
ファイル: MHColour.cs プロジェクト: mcgoober/mheg-dotnet
 public void Initialise(MHParseNode p, MHEngine engine)
 {
     if (p.NodeType == MHParseNode.PNInt)
     {
         m_nColIndex = p.GetIntValue();
     }
     else
     {
         p.GetStringValue(m_ColStr);
     }
 }
コード例 #3
0
 public void Initialise(MHParseNode p, MHEngine engine)
 {
     if (p.NodeType == MHParseNode.PNString)
     {
         p.GetStringValue(m_DirFont);
     }
     else
     {
         m_IndirFont.Initialise(p, engine);
     }
 }
コード例 #4
0
ファイル: MHParameter.cs プロジェクト: mcgoober/mheg-dotnet
 public void Initialise(MHParseNode arg, MHEngine engine)
 {
     if (arg.NodeType == MHParseNode.PNTagged && arg.GetTagNo() == ASN1Codes.C_INDIRECTREFERENCE)
     {
         // Indirect reference.
         m_fIsDirect = false;
         m_Indirect.Initialise(arg.GetArgN(0), engine);
     }
     else
     { // Simple integer value.
         m_fIsDirect = true;
         arg.GetStringValue(m_Direct);
     }
 }
コード例 #5
0
ファイル: MHObjectRef.cs プロジェクト: mcgoober/mheg-dotnet
 public void Initialise(MHParseNode p, MHEngine engine)
 {
     if (p.NodeType == MHParseNode.PNInt)
     {
         m_nObjectNo = p.GetIntValue();
         // Set the group id to the id of this group.
         m_GroupId.Copy(engine.GetGroupId());
     }
     else if (p.NodeType == MHParseNode.PNSeq)
     {
         MHParseNode   pFirst  = p.GetSeqN(0);
         MHOctetString groupId = new MHOctetString();
         pFirst.GetStringValue(m_GroupId);
         m_nObjectNo = p.GetSeqN(1).GetIntValue();
     }
     else
     {
         p.Failure("ObjectRef: Argument is not int or sequence");
     }
 }
コード例 #6
0
 public void Initialise(MHParseNode p, MHEngine engine)
 {
     p.GetStringValue(m_ContentRef);
 }
コード例 #7
0
ファイル: MHLink.cs プロジェクト: mcgoober/mheg-dotnet
        // Set this up from the parse tree.
        public override void Initialise(MHParseNode p, MHEngine engine)
        {
            base.Initialise(p, engine);
            // The link condition is encoded differently in the binary and text representations.
            MHParseNode pLinkCond = p.GetNamedArg(ASN1Codes.C_LINK_CONDITION);

            if (pLinkCond != null)
            {                                                           // Only in binary.
                m_EventSource.Initialise(pLinkCond.GetArgN(0), engine); // Event source
                m_nEventType = pLinkCond.GetArgN(1).GetEnumValue();     // Event type
                // The event data is optional and type-dependent.
                if (pLinkCond.GetArgCount() >= 3)
                {
                    MHParseNode pEventData = pLinkCond.GetArgN(2);
                    switch (pEventData.NodeType)
                    {
                    case MHParseNode.PNBool: m_EventData.Bool = pEventData.GetBoolValue(); m_EventData.Type = MHUnion.U_Bool; break;

                    case MHParseNode.PNInt: m_EventData.Int = pEventData.GetIntValue(); m_EventData.Type = MHUnion.U_Int; break;

                    case MHParseNode.PNString: pEventData.GetStringValue(m_EventData.String); m_EventData.Type = MHUnion.U_String; break;

                    default: pEventData.Failure("Unknown type of event data"); break;
                    }
                }
            }
            else
            {                                                                       // Only in text.
                MHParseNode pEventSource = p.GetNamedArg(ASN1Codes.P_EVENT_SOURCE); // Event source
                if (pEventSource == null)
                {
                    p.Failure("Missing :EventSource");
                }
                m_EventSource.Initialise(pEventSource.GetArgN(0), engine);
                MHParseNode pEventType = p.GetNamedArg(ASN1Codes.P_EVENT_TYPE); // Event type
                if (pEventType == null)
                {
                    p.Failure("Missing :EventType");
                }
                m_nEventType = pEventType.GetArgN(0).GetEnumValue();
                MHParseNode pEventData = p.GetNamedArg(ASN1Codes.P_EVENT_DATA); // Event data - optional
                if (pEventData != null)
                {
                    MHParseNode pEventDataArg = pEventData.GetArgN(0);
                    switch (pEventDataArg.NodeType)
                    {
                    case MHParseNode.PNBool: m_EventData.Bool = pEventDataArg.GetBoolValue(); m_EventData.Type = MHUnion.U_Bool; break;

                    case MHParseNode.PNInt: m_EventData.Int = pEventDataArg.GetIntValue(); m_EventData.Type = MHUnion.U_Int; break;

                    case MHParseNode.PNString: pEventDataArg.GetStringValue(m_EventData.String); m_EventData.Type = MHUnion.U_String; break;

                    default: pEventDataArg.Failure("Unknown type of event data"); break;
                    }
                }
            }

            MHParseNode pLinkEffect = p.GetNamedArg(ASN1Codes.C_LINK_EFFECT);

            m_LinkEffect.Initialise(pLinkEffect, engine);
        }