public override void Perform(MHEngine engine) { MHObjectRef target = new MHObjectRef(); m_Target.GetValue(target, engine); // Get the target if (m_fIsIncluded) { // Included content MHOctetString included = new MHOctetString(); m_Included.GetValue(included, engine); engine.FindObject(target).SetData(included, engine); } else { MHContentRef referenced = new MHContentRef(); int size, cc; m_Referenced.GetValue(referenced, engine); if (m_fSizePresent) { size = m_ContentSize.GetValue(engine); } else { size = 0; } if (m_fCCPriorityPresent) { cc = m_CCPriority.GetValue(engine); } else { cc = 0; } engine.FindObject(target).SetData(referenced, m_fSizePresent, size, m_fCCPriorityPresent, cc, engine); } }
public override void Activation(MHEngine engine) { if (m_fRunning) { return; } base.Activation(engine); // We're supposed to apply Activation to each of the "items" but it isn't clear // exactly what that means. Assume it means each of the visibles. for (int i = 0; i < m_TokenGrpItems.Size; i++) { MHObjectRef pObject = m_TokenGrpItems.GetAt(i).Object; // The object reference may be the null reference. // Worse: it seems that sometimes in BBC's MHEG the reference simply doesn't exist. if (pObject.IsSet()) { try { engine.FindObject(m_TokenGrpItems.GetAt(i).Object).Activation(engine); } catch (MHEGException) {} } } engine.EventTriggered(this, EventTokenMovedTo, new MHUnion(m_nTokenPosition)); m_fRunning = true; engine.EventTriggered(this, EventIsRunning); }
public override void Perform(MHEngine engine) { MHObjectRef target = new MHObjectRef(); m_Target.GetValue(target, engine); // Get the item to set. MHColour newColour = new MHColour(); switch (m_ColourType) { case CT_None: { // If the colour is not specified use "transparent". newColour.SetFromString("\u0000\u0000\u0000\u00FF"); break; } case CT_Absolute: { MHOctetString colour = new MHOctetString(); m_Absolute.GetValue(colour, engine); newColour.ColStr.Copy(colour); break; } case CT_Indexed: newColour.SetFromIndex(m_Indexed.GetValue(engine)); break; } SetColour(newColour, engine); // Set the colour of the appropriate portion of the visible }
// Look up the target protected MHRoot Target(MHEngine engine) { MHObjectRef target = new MHObjectRef(); m_Target.GetValue(target, engine); return(engine.FindObject(target)); }
private MHSequence <MHParameter> m_Parameters; // Arguments. public MHCall(string name, bool bIsFork) : base(name) { m_Succeeded = new MHObjectRef(); m_Parameters = new MHSequence <MHParameter>(); m_bIsFork = bIsFork; }
// Check this link to see if the event matches the requirements. If the link does not specify // any event data the link fires whatever the value of the data. public void MatchEvent(MHObjectRef sourceRefRef, int ev, MHUnion evData, MHEngine engine) { Logging.Assert(RunningStatus); // Should now be true if we call this. if (RunningStatus && m_nEventType == ev && sourceRefRef.Equal(m_EventSource, engine)) { // Source and event type match. bool fMatch = false; switch (m_EventData.Type) { case MHUnion.U_None: fMatch = true; break; // No data specified - always matches. case MHUnion.U_Bool: evData.CheckType(MHUnion.U_Bool); fMatch = evData.Bool == m_EventData.Bool; break; case MHUnion.U_Int: evData.CheckType(MHUnion.U_Int); fMatch = evData.Int == m_EventData.Int; break; case MHUnion.U_String: evData.CheckType(MHUnion.U_String); fMatch = evData.String.Equal(m_EventData.String); break; default: Logging.Log(Logging.MHLogWarning, "Unmatched Event: " + m_EventData.Type); Logging.Assert(false); break; // Should only be the above types. } // Fire the link if (fMatch) { Logging.Log(Logging.MHLogLinks, "Link fired - " + m_ObjectIdentifier.Printable()); engine.AddActions(m_LinkEffect); } } }
public override void Perform(MHEngine engine) { MHObjectRef target = new MHObjectRef(); m_Target.GetValue(target, engine); engine.Spawn(target); }
public override void Perform(MHEngine engine) { MHObjectRef reference = new MHObjectRef(); m_RefObject.GetValue(reference, engine); CallAction(engine, Target(engine), engine.FindObject(reference)); }
public MHVisible() { m_OriginalPaletteRef = new MHObjectRef(); m_PaletteRef = new MHObjectRef(); m_nOriginalBoxWidth = m_nOriginalBoxHeight = -1; // Should always be specified. m_nOriginalPosX = m_nOriginalPosY = 0; // Default values. }
public virtual void SI_GetBasicSI(MHObjectRef success, MHSequence <MHParameter> args, MHEngine engine) { // Returns basic SI information about the service indicated by an index // returned by GSI. // Returns networkID, origNetworkID, transportStreamID, serviceID Logging.Assert(false); }
public override void Perform(MHEngine engine) { MHObjectRef item = new MHObjectRef(); m_Item.GetValue(item, engine); Target(engine).AddItem(m_Index.GetValue(engine), engine.FindObject(item), engine); }
public override void Perform(MHEngine engine) { MHObjectRef target = new MHObjectRef(); m_Target.GetValue(target, engine); // Get the target engine.TransitionToScene(target); }
public MHPersistent(string name, bool bIsLoad) : base(name) { m_bIsLoad = bIsLoad; m_Succeeded = new MHObjectRef(); m_Variables = new MHSequence <MHObjectRef>(); m_FileName = new MHGenericOctetString(); }
public virtual void SearchAndExtractSubString(MHObjectRef success, MHSequence <MHParameter> args, MHEngine engine) { if (args.Size == 5) { // Find a substring within a string and return an index to the position // and the prefix to the substring. MHOctetString str = new MHOctetString(); MHOctetString searchString = new MHOctetString(); GetString(args.GetAt(0), str, engine); int nStart = GetInt(args.GetAt(1), engine); if (nStart < 1) { nStart = 1; } GetString(args.GetAt(2), searchString, engine); // Strings are indexed from one. int nPos; for (nPos = nStart - 1; nPos <= str.Size - searchString.Size; nPos++) { int i; for (i = 0; i < searchString.Size; i++) { if (searchString.GetAt(i) != str.GetAt(i + nPos)) { break; // Doesn't match } } if (i == searchString.Size) { break; // Found a match. } } // Set the results. MHParameter pResString = args.GetAt(3); MHParameter pResInt = args.GetAt(4); SetSuccessFlag(success, true, engine); // Set this first. if (nPos <= str.Size - searchString.Size) { // Found // Set the index to the position AFTER the string, counting from 1. engine.FindObject(pResInt.GetReference()).SetVariableValue(new MHUnion(nPos + 1 + searchString.Size)); // Return the sequence from nStart - 1 of length nPos - nStart + 1 MHOctetString resultString = new MHOctetString(str, nStart - 1, nPos - nStart + 1); engine.FindObject(pResString.GetReference()).SetVariableValue(new MHUnion(resultString)); } else { // Not found. Set the result string to empty and the result index to -1 engine.FindObject(pResInt.GetReference()).SetVariableValue(new MHUnion(-1)); engine.FindObject(pResString.GetReference()).SetVariableValue(new MHUnion(new MHOctetString(""))); } } else { SetSuccessFlag(success, false, engine); } }
public override void Perform(MHEngine engine) { MHObjectRef target = new MHObjectRef(); m_Target.GetValue(target, engine); // Get the target MHUnion testValue = new MHUnion(); testValue.GetValueFrom(m_Comparison, engine); // Get the actual value to compare. engine.FindObject(target).TestVariable(m_nOperator, testValue, engine); // Do the test. }
public MHVisible(MHVisible reference) : base(reference) { m_OriginalPaletteRef = new MHObjectRef(); m_PaletteRef = new MHObjectRef(); m_nOriginalBoxWidth = reference.m_nOriginalBoxWidth; m_nOriginalBoxHeight = reference.m_nOriginalBoxHeight; m_nOriginalPosX = reference.m_nOriginalPosX; m_nOriginalPosY = reference.m_nOriginalPosY; m_OriginalPaletteRef.Copy(reference.m_OriginalPaletteRef); }
public override void Perform(MHEngine engine) { MHObjectRef target = new MHObjectRef(); m_Target.GetValue(target, engine); // Get the target MHUnion newValue = new MHUnion(); newValue.GetValueFrom(m_NewValue, engine); // Get the actual value to set. engine.FindObject(target).SetVariableValue(newValue); // Set the value. }
public override void CallAction(MHEngine engine, MHRoot pTarget, MHRoot pObj) { // We need to get the group (scene or application) that contains the target. MHObjectRef groupRef = new MHObjectRef(); groupRef.GroupId.Copy(pTarget.ObjectIdentifier.GroupId); groupRef.ObjectNo = 0; // The group always has object ref zero. MHRoot pGroup = engine.FindObject(groupRef); // Get the group to make the clone and add it to its ingredients. pGroup.MakeClone(pTarget, pObj, engine); }
public override void GetListItem(int nCell, MHObjectRef itemDest, MHEngine engine) { if (m_fWrapAround) { nCell = AdjustIndex(nCell); } if (nCell < 1 || nCell > m_ItemList.Count) { return; // Ignore it if it's out of range and not wrapping } engine.FindObject(itemDest).SetVariableValue(new MHUnion(m_ItemList[nCell - 1].Visible.ObjectIdentifier)); }
public override void GetItemStatus(int nCell, MHObjectRef itemDest, MHEngine engine) { if (m_fWrapAround) { nCell = AdjustIndex(nCell); } if (nCell < 1 || nCell > (int)m_ItemList.Count) { return; } engine.FindObject(itemDest).SetVariableValue(new MHUnion(m_ItemList[nCell - 1].Selected)); }
public override void Perform(MHEngine engine) { MHObjectRef target = new MHObjectRef(); m_Target.GetValue(target, engine); // Get the target - this should always be the application MHOctetString fileName = new MHOctetString(); m_FileName.GetValue(fileName, engine); bool fResult = engine.LoadStorePersistent(m_bIsLoad, fileName, m_Variables); engine.FindObject(m_Succeeded).SetVariableValue(new MHUnion(fResult)); }
public virtual void SI_TuneIndex(MHObjectRef success, MHSequence <MHParameter> args, MHEngine engine) { // Tunes to an index returned by GSI if (args.Size == 1) { int nChannel = GetInt(args.GetAt(0), engine); bool res = engine.GetContext().TuneTo(nChannel); SetSuccessFlag(success, res, engine); } else { SetSuccessFlag(success, false, 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 virtual void SearchSubString(MHObjectRef success, MHSequence <MHParameter> args, MHEngine engine) { if (args.Size == 4) { // Find a substring within a string and return an index to the position. MHOctetString str = new MHOctetString(); MHOctetString searchString = new MHOctetString(); GetString(args.GetAt(0), str, engine); int nStart = GetInt(args.GetAt(1), engine); if (nStart < 1) { nStart = 1; } GetString(args.GetAt(2), searchString, engine); // Strings are indexed from one. int nPos; for (nPos = nStart - 1; nPos <= str.Size - searchString.Size; nPos++) { int i; for (i = 0; i < searchString.Size; i++) { if (searchString.GetAt(i) != str.GetAt(i + nPos)) { break; } } if (i == searchString.Size) { break; // Found a match. } } // Set the result. MHParameter pResInt = args.GetAt(3); SetSuccessFlag(success, true, engine); // Set this first. if (nPos <= str.Size - searchString.Size) { // Found // Set the index to the position of the string, counting from 1. engine.FindObject(pResInt.GetReference()).SetVariableValue(new MHUnion(nPos + 1)); } else { // Not found. Set the result index to -1 engine.FindObject(pResInt.GetReference()).SetVariableValue(new MHUnion(-1)); } } else { SetSuccessFlag(success, false, engine); } }
public virtual void Random(MHObjectRef success, MHSequence <MHParameter> args, MHEngine engine) { if (args.Size == 2) { int nLimit = GetInt(args.GetAt(0), engine); MHParameter pResInt = args.GetAt(1); Random randomGenerator = new Random(); engine.FindObject((pResInt.GetReference())).SetVariableValue(new MHUnion(randomGenerator.Next(nLimit) + 1)); SetSuccessFlag(success, true, engine); } else { SetSuccessFlag(success, false, engine); } }
public override void Perform(MHEngine engine) { // This is a special case. If the object does not exist we set the result to false. MHObjectRef target = new MHObjectRef(); m_Target.GetValue(target, engine); // Get the target MHRoot pObject = engine.FindObject(target, false); bool fResult = false; // Default result. if (pObject == null) { fResult = pObject.AvailabilityStatus; } engine.FindObject(m_ResultVar).SetVariableValue(new MHUnion(fResult)); }
public virtual void CastToObjectRef(MHObjectRef success, MHSequence <MHParameter> args, MHEngine engine) { // Converts a string and an integer to an ObjectRef. if (args.Size == 3) { MHObjectRef result = new MHObjectRef(); GetString(args.GetAt(0), result.GroupId, engine); result.ObjectNo = GetInt(args.GetAt(1), engine); engine.FindObject(args.GetAt(2).GetReference()).SetVariableValue(new MHUnion(result)); SetSuccessFlag(success, true, engine); } else { SetSuccessFlag(success, false, engine); } }
public virtual void GetStringLength(MHObjectRef success, MHSequence <MHParameter> args, MHEngine engine) { if (args.Size == 2) { // Find a substring within a string and return an index to the position. MHOctetString str = new MHOctetString(); GetString(args.GetAt(0), str, engine); MHParameter pResInt = args.GetAt(1); SetSuccessFlag(success, true, engine); engine.FindObject(pResInt.GetReference()).SetVariableValue(new MHUnion(str.Size)); } else { SetSuccessFlag(success, false, engine); } }
public virtual void GetDayOfWeek(MHObjectRef success, MHSequence <MHParameter> args, MHEngine engine) { if (args.Size == 2) { int date = GetInt(args.GetAt(0), engine); // Date as produced in GCD DateTime dt = new DateTime(1858, 11, 17); int nDayOfWeek = (int)dt.AddDays(date).DayOfWeek; engine.FindObject(args.GetAt(1).GetReference()).SetVariableValue(new MHUnion(nDayOfWeek)); SetSuccessFlag(success, true, engine); } else { SetSuccessFlag(success, false, engine); } }
public virtual void CastToContentRef(MHObjectRef success, MHSequence <MHParameter> args, MHEngine engine) { // Converts a string to a ContentRef. if (args.Size == 2) { MHOctetString str = new MHOctetString(); GetString(args.GetAt(0), str, engine); MHContentRef result = new MHContentRef(); result.ContentRef.Copy(str); engine.FindObject(args.GetAt(1).GetReference()).SetVariableValue(new MHUnion(result)); SetSuccessFlag(success, true, engine); } else { SetSuccessFlag(success, false, engine); } }