public void Initialise(MHParseNode p, MHEngine engine) { for (int i = 0; i < p.GetSeqCount(); i++) { m_Movement.Append(p.GetSeqN(i).GetIntValue()); } }
public override void Initialise(MHParseNode p, MHEngine engine) { base.Initialise(p, engine); // Target MHParseNode pOp = p.GetArgN(1); m_Operand.Initialise(pOp, engine); // Operand to add, subtract etc. }
public override void Initialise(MHParseNode p, MHEngine engine) { base.Initialise(p, engine); m_Argument1.Initialise(p.GetArgN(1), engine); m_Argument2.Initialise(p.GetArgN(2), engine); m_Argument3.Initialise(p.GetArgN(3), engine); m_Argument4.Initialise(p.GetArgN(4), engine); }
public virtual void Initialise(MHParseNode p, MHEngine engine) { // The first argument should be present. MHParseNode arg = p.GetArgN(0); // Extract the field. m_ObjectIdentifier.Initialise(arg, engine); }
public override void Initialise(MHParseNode p, MHEngine engine) { base.Initialise(p, engine); // Original value should be an int. MHParseNode pInitial = p.GetNamedArg(ASN1Codes.C_ORIGINAL_VALUE); m_nOriginalValue = pInitial.GetArgN(0).GetIntValue(); }
public override void Initialise(MHParseNode p, MHEngine engine) { base.Initialise(p, engine); // Original value should be an Content reference. MHParseNode pInitial = p.GetNamedArg(ASN1Codes.C_ORIGINAL_VALUE); // and this should be a ObjRef node. MHParseNode pArg = pInitial.GetNamedArg(ASN1Codes.C_CONTENT_REFERENCE); m_OriginalValue.Initialise(pArg.GetArgN(0), engine); }
public void Initialise(MHParseNode p, MHEngine engine) { if (p.NodeType == MHParseNode.PNInt) { m_nColIndex = p.GetIntValue(); } else { p.GetStringValue(m_ColStr); } }
public override void Initialise(MHParseNode p, MHEngine engine) { base.Initialise(p, engine); // Target m_EventSource.Initialise(p.GetArgN(1), engine); m_EventType = p.GetArgN(2).GetEnumValue(); if (p.GetArgCount() >= 4) { // TODO: We could check here that we only have bool, int or string and not object ref or content ref. m_EventData.Initialise(p.GetArgN(3), engine); } }
// 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(); } }
public override void Initialise(MHParseNode p, MHEngine engine) { base.Initialise(p, engine); m_nComponentTag = p.GetNamedArg(ASN1Codes.C_COMPONENT_TAG).GetArgN(0).GetIntValue(); MHParseNode pTerm = p.GetNamedArg(ASN1Codes.C_TERMINATION); if (pTerm != null) { m_Termination = pTerm.GetEnumValue(); } }
public void Initialise(MHParseNode p, MHEngine engine) { if (p.NodeType == MHParseNode.PNString) { p.GetStringValue(m_DirFont); } else { m_IndirFont.Initialise(p, engine); } }
public override void Initialise(MHParseNode p, MHEngine engine) { base.Initialise(p, engine); m_nComponentTag = p.GetNamedArg(ASN1Codes.C_COMPONENT_TAG).GetArgN(0).GetIntValue(); MHParseNode pOrigVol = p.GetNamedArg(ASN1Codes.C_ORIGINAL_VOLUME); if (pOrigVol != null) { m_nOriginalVol = pOrigVol.GetIntValue(); } }
public override void Initialise(MHParseNode p, MHEngine engine) { base.Initialise(p, engine); MHParseNode args = p.GetArgN(1); for (int i = 0; i < args.GetSeqCount(); i++) { MHPointArg pPoint = new MHPointArg(); m_Points.Append(pPoint); pPoint.Initialise(args.GetSeqN(i), engine); } }
public override void Initialise(MHParseNode p, MHEngine engine) { base.Initialise(p, engine); // Target m_Succeeded.Initialise(p.GetArgN(1), engine); // Call/fork succeeded flag // Arguments. MHParseNode args = p.GetArgN(2); for (int i = 0; i < args.GetSeqCount(); i++) { MHParameter pParm = new MHParameter(); m_Parameters.Append(pParm); pParm.Initialise(args.GetSeqN(i), engine); } }
public override void Initialise(MHParseNode p, MHEngine engine) { base.Initialise(p, engine); // Target m_Succeeded.Initialise(p.GetArgN(1), engine); MHParseNode pVarSeq = p.GetArgN(2); for (int i = 0; i < pVarSeq.GetSeqCount(); i++) { MHObjectRef pVar = new MHObjectRef(); m_Variables.Append(pVar); pVar.Initialise(pVarSeq.GetSeqN(i), engine); } m_FileName.Initialise(p.GetArgN(3), engine); }
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; m_ObjRef.Initialise(arg, engine); } }
public override void Initialise(MHParseNode p, MHEngine engine) { base.Initialise(p, engine); p.GetNamedArg(ASN1Codes.C_NAME).GetArgN(0).GetStringValue(m_Name); // Program name MHParseNode pAvail = p.GetNamedArg(ASN1Codes.C_INITIALLY_AVAILABLE); if (pAvail != null) { m_fInitiallyAvailable = pAvail.GetArgN(0).GetBoolValue(); } // The MHEG Standard says that InitiallyAvailable is mandatory and should be false. // That doesn't seem to be the case in some MHEG programs so we force it here. m_fInitiallyActive = false; }
public override void Initialise(MHParseNode p, MHEngine engine) { base.Initialise(p, engine); // Target MHParseNode pContent = p.GetArgN(1); if (pContent.NodeType == MHParseNode.PNSeq) { // Referenced content. m_fIsIncluded = false; m_fSizePresent = m_fCCPriorityPresent = false; m_Referenced.Initialise(pContent.GetSeqN(0), engine); if (pContent.GetSeqCount() > 1) { MHParseNode pArg = pContent.GetSeqN(1); if (pArg.NodeType == MHParseNode.PNTagged && pArg.GetTagNo() == ASN1Codes.C_NEW_CONTENT_SIZE) { MHParseNode pVal = pArg.GetArgN(0); // It may be NULL as a place-holder if (pVal.NodeType == MHParseNode.PNInt) { m_fSizePresent = true; m_ContentSize.Initialise(pVal, engine); } } } if (pContent.GetSeqCount() > 2) { MHParseNode pArg = pContent.GetSeqN(2); if (pArg.NodeType == MHParseNode.PNTagged && pArg.GetTagNo() == ASN1Codes.C_NEW_CONTENT_CACHE_PRIO) { MHParseNode pVal = pArg.GetArgN(0); if (pVal.NodeType == MHParseNode.PNInt) { m_fCCPriorityPresent = true; m_CCPriority.Initialise(pVal, engine); } } } } else { m_Included.Initialise(pContent, engine); m_fIsIncluded = true; } }
public void Initialise(MHParseNode p, MHEngine engine) { switch (p.GetTagNo()) { case ASN1Codes.C_NEW_GENERIC_BOOLEAN: m_Type = P_Bool; m_BoolVal.Initialise(p.GetArgN(0), engine); break; case ASN1Codes.C_NEW_GENERIC_INTEGER: m_Type = P_Int; m_IntVal.Initialise(p.GetArgN(0), engine); break; case ASN1Codes.C_NEW_GENERIC_OCTETSTRING: m_Type = P_String; m_StrVal.Initialise(p.GetArgN(0), engine); break; case ASN1Codes.C_NEW_GENERIC_OBJECT_REF: m_Type = P_ObjRef; m_ObjRefVal.Initialise(p.GetArgN(0), engine); break; case ASN1Codes.C_NEW_GENERIC_CONTENT_REF: m_Type = P_ContentRef; m_ContentRefVal.Initialise(p.GetArgN(0), engine); break; default: p.Failure("Expected generic"); break; } }
public void Initialise(MHParseNode arg, MHEngine engine) { if (arg.GetTagNo() == ASN1Codes.C_INDIRECTREFERENCE) { // Indirect reference. m_fIsDirect = false; m_Indirect.Initialise(arg.GetArgN(0), engine); } else if (arg.GetTagNo() == ASN1Codes.C_CONTENT_REFERENCE) { // Simple integer value. m_fIsDirect = true; m_Direct.Initialise(arg.GetArgN(0), engine); } else { throw new MHEGException("Expected direct or indirect content reference"); } }
public override void Initialise(MHParseNode p, MHEngine engine) { base.Initialise(p, engine); if (p.GetArgCount() > 1) { MHParseNode pIndexed = p.GetNamedArg(ASN1Codes.C_NEW_COLOUR_INDEX); MHParseNode pAbsolute = p.GetNamedArg(ASN1Codes.C_NEW_ABSOLUTE_COLOUR); if (pIndexed != null) { m_ColourType = CT_Indexed; m_Indexed.Initialise(pIndexed.GetArgN(0), engine); } else if (pAbsolute != null) { m_ColourType = CT_Absolute; m_Absolute.Initialise(pAbsolute.GetArgN(0), engine); } } }
public override void Initialise(MHParseNode p, MHEngine engine) { base.Initialise(p, engine); m_TimerId.Initialise(p.GetArgN(1), engine); // The timer id if (p.GetArgCount() > 2) { MHParseNode pNewTimer = p.GetArgN(2); m_TimerValue.Initialise(pNewTimer.GetSeqN(0), engine); if (pNewTimer.GetSeqCount() > 1) { m_TimerType = ST_TimerAbsolute; // May be absolute - depends on the value. m_AbsFlag.Initialise(pNewTimer.GetSeqN(1), engine); } else { m_TimerType = ST_TimerRelative; } } }
public override void Initialise(MHParseNode p, MHEngine engine) { base.Initialise(p, engine); // Tiling - optional MHParseNode pTiling = p.GetNamedArg(ASN1Codes.C_TILING); if (pTiling != null) { m_fTiling = pTiling.GetArgN(0).GetBoolValue(); } // Transparency - optional MHParseNode pTransparency = p.GetNamedArg(ASN1Codes.C_ORIGINAL_TRANSPARENCY); if (pTransparency != null) { m_nOrigTransparency = pTransparency.GetArgN(0).GetIntValue(); } m_pContent = engine.GetContext().CreateBitmap(m_fTiling); }
public override void Initialise(MHParseNode p, MHEngine engine) { base.Initialise(p, engine); MHParseNode pMovements = p.GetNamedArg(ASN1Codes.C_MOVEMENT_TABLE); if (pMovements != null) { for (int i = 0; i < pMovements.GetArgCount(); i++) { MHMovement pMove = new MHMovement(); m_MovementTable.Append(pMove); pMove.Initialise(pMovements.GetArgN(i), engine); } } MHParseNode pTokenGrp = p.GetNamedArg(ASN1Codes.C_TOKEN_GROUP_ITEMS); if (pTokenGrp != null) { for (int i = 0; i < pTokenGrp.GetArgCount(); i++) { MHTokenGroupItem pToken = new MHTokenGroupItem(); m_TokenGrpItems.Append(pToken); pToken.Initialise(pTokenGrp.GetArgN(i), engine); } } MHParseNode pNoToken = p.GetNamedArg(ASN1Codes.C_NO_TOKEN_ACTION_SLOTS); if (pNoToken != null) { for (int i = 0; i < pNoToken.GetArgCount(); i++) { MHParseNode pAct = pNoToken.GetArgN(i); MHActionSequence pActions = new MHActionSequence(); m_NoTokenActionSlots.Append(pActions); // The action slot entry may be NULL. if (pAct.NodeType != MHParseNode.PNNull) { pActions.Initialise(pAct, engine); } } } }
public void Initialise(MHParseNode p, MHEngine engine) { // A pair consisting of an object reference and an optional action slot sequence. m_Object.Initialise(p.GetSeqN(0), engine); if (p.GetSeqCount() > 1) { MHParseNode pSlots = p.GetSeqN(1); for (int i = 0; i < pSlots.GetSeqCount(); i++) { MHParseNode pAct = pSlots.GetSeqN(i); MHActionSequence pActions = new MHActionSequence(); m_ActionSlots.Append(pActions); // The action slot entry may be NULL. if (pAct.NodeType != MHParseNode.PNNull) { pActions.Initialise(pAct, engine); } } } }
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"); } }
public override void Initialise(MHParseNode p, MHEngine engine) { base.Initialise(p, engine); MHParseNode pMultiplex = p.GetNamedArg(ASN1Codes.C_MULTIPLEX); for (int i = 0; i < pMultiplex.GetArgCount(); i++) { MHParseNode pItem = pMultiplex.GetArgN(i); if (pItem.GetTagNo() == ASN1Codes.C_AUDIO) { MHAudio pAudio = new MHAudio(); m_Multiplex.Append(pAudio); pAudio.Initialise(pItem, engine); } else if (pItem.GetTagNo() == ASN1Codes.C_VIDEO) { MHVideo pVideo = new MHVideo(); m_Multiplex.Append(pVideo); pVideo.Initialise(pItem, engine); } else if (pItem.GetTagNo() == ASN1Codes.C_RTGRAPHICS) { MHRTGraphics pRtGraph = new MHRTGraphics(); m_Multiplex.Append(pRtGraph); pRtGraph.Initialise(pItem, engine); } // Ignore unknown items } MHParseNode pStorage = p.GetNamedArg(ASN1Codes.C_STORAGE); if (pStorage != null) { m_nStorage = pStorage.GetArgN(0).GetEnumValue(); } MHParseNode pLooping = p.GetNamedArg(ASN1Codes.C_LOOPING); if (pLooping != null) { m_nLooping = pLooping.GetArgN(0).GetIntValue(); } }
protected MHGroup ParseProgram(byte[] text) { if (text.Length == 0) { return(null); } IMHParser parser = null; MHParseNode pTree = null; MHGroup pRes = null; // Look at the first byte to decide whether this is text or binary. Binary // files will begin with 0xA0 or 0xA1, text files with white space, comment ('/') // or curly bracket. // This is only there for testing: all downloaded objects will be in ASN1 byte ch = text[0]; if (ch >= 128) { parser = new MHParseBinary(text); } else { parser = new MHParseText(text); } // Parse the binary or text. pTree = parser.Parse(); switch (pTree.GetTagNo()) { // The parse node should be a tagged item. case ASN1Codes.C_APPLICATION: pRes = new MHApplication(); break; case ASN1Codes.C_SCENE: pRes = new MHScene(); break; default: pTree.Failure("Expected Application or Scene"); break; // throws exception. } pRes.Initialise(pTree, this); // Convert the parse tree. return(pRes); }
public override void Initialise(MHParseNode p, MHEngine engine) { base.Initialise(p, engine); // Original box size - two integer arguments. MHParseNode pOriginalBox = p.GetNamedArg(ASN1Codes.C_ORIGINAL_BOX_SIZE); if (pOriginalBox == null) p.Failure("OriginalBoxSize missing"); m_nOriginalBoxWidth = pOriginalBox.GetArgN(0).GetIntValue(); m_nOriginalBoxHeight = pOriginalBox.GetArgN(1).GetIntValue(); // Original position - two integer arguments. Optional MHParseNode pOriginalPos = p.GetNamedArg(ASN1Codes.C_ORIGINAL_POSITION); if (pOriginalPos != null) { m_nOriginalPosX = pOriginalPos.GetArgN(0).GetIntValue(); m_nOriginalPosY = pOriginalPos.GetArgN(1).GetIntValue(); } // OriginalPalette ref - optional. MHParseNode pOriginalPaletteRef = p.GetNamedArg(ASN1Codes.C_ORIGINAL_PALETTE_REF); if (pOriginalPaletteRef != null) m_OriginalPaletteRef.Initialise(pOriginalPaletteRef.GetArgN(0), engine); }
public override void Initialise(MHParseNode p, MHEngine engine) { base.Initialise(p, engine); // Bordered bounding box - optional MHParseNode pBBBox = p.GetNamedArg(ASN1Codes.C_BORDERED_BOUNDING_BOX); if (pBBBox != null) { m_fBorderedBBox = pBBBox.GetArgN(0).GetBoolValue(); } // Original line width MHParseNode pOlw = p.GetNamedArg(ASN1Codes.C_ORIGINAL_LINE_WIDTH); if (pOlw != null) { m_nOriginalLineWidth = pOlw.GetArgN(0).GetIntValue(); } // Original line style. This is an integer not an enum. MHParseNode pOls = p.GetNamedArg(ASN1Codes.C_ORIGINAL_LINE_STYLE); if (pOls != null) { m_OriginalLineStyle = pOls.GetArgN(0).GetIntValue(); } // Line colour. MHParseNode pOrlc = p.GetNamedArg(ASN1Codes.C_ORIGINAL_REF_LINE_COLOUR); if (pOrlc != null) { m_OrigLineColour.Initialise(pOrlc.GetArgN(0), engine); } // Fill colour MHParseNode pOrfc = p.GetNamedArg(ASN1Codes.C_ORIGINAL_REF_FILL_COLOUR); if (pOrfc != null) { m_OrigFillColour.Initialise(pOrfc.GetArgN(0), engine); } }