예제 #1
0
 // Return the value, looking up any indirect ref.
 public void GetValue(MHOctetString str, MHEngine engine)
 {
     if (m_fIsDirect)
     {
         str.Copy(m_Direct);
     }
     else
     {
         MHUnion result = new MHUnion();
         MHRoot  pBase  = engine.FindObject(m_Indirect);
         pBase.GetVariableValue(result, engine);
         // From my reading of the MHEG documents implicit conversion is only
         // performed when assigning variables.  Nevertheless the Channel 4
         // Teletext assumes that implicit conversion takes place here as well.
         if (result.Type == MHUnion.U_Int)
         {
             // Implicit conversion of string to integer.
             MHOctetString s = new MHOctetString("" + result.Int);
             str.Copy(s);
         }
         else
         {
             result.CheckType(MHUnion.U_String);
             str.Copy(result.String);
         }
     }
 }
예제 #2
0
 public MHUnion()
 {
     m_Type          = U_None;
     m_StrVal        = new MHOctetString();
     m_ObjRefVal     = new MHObjectRef();
     m_ContentRefVal = new MHContentRef();
 }
예제 #3
0
 public MHOctetString(MHOctetString str, int nOffset, int nLen)
 {
     if (nLen < 0)
     {
         nLen = 0;
     }
     if (nLen > str.Size)
     {
         nLen = str.Size;
     }
     m_String = str.m_String.Substring(nOffset, nLen);
 }
예제 #4
0
        //  void GetDefaultFont(MHFontBody &font); // Not currently implemented
        public void GetDefaultFontAttrs(MHOctetString str)
        {
            MHApplication pApp = CurrentApp();

            if (pApp != null && pApp.FontAttrs.Size > 0)
            {
                str.Copy(pApp.FontAttrs);
            }
            else
            {
                str.Copy("plain.24.24.0");  // TODO: Check this.
            }
        }
예제 #5
0
        // Return a path relative to the home directory
        public string GetPathName(MHOctetString str)
        {
            string csPath = "";

            if (str.Size != 0)
            {
                csPath = str.ToString();
            }
            if (csPath.StartsWith("DSM:"))
            {
                csPath = csPath.Substring(4);                            // Remove DSM:
            }
            // If it has any other prefix this isn't a request for a carousel object.
            int firstColon = csPath.IndexOf(':'), firstSlash = csPath.IndexOf('/');

            if (firstColon > 0 && firstSlash > 0 && firstColon < firstSlash)
            {
                return("");
            }

            if (csPath.StartsWith("~"))
            {
                csPath = csPath.Substring(1);                         // Remove ~
            }
            // Ignore "CI://"
            if (!csPath.StartsWith("//"))
            { //
                // Add the current application's path name
                if (CurrentApp() != null)
                {
                    csPath = CurrentApp().Path + csPath;
                }
            }
            // Remove any occurrences of x/../
            int nPos;

            while ((nPos = csPath.IndexOf("/../")) >= 0)
            {
                Logging.Log(Logging.MHLogWarning, "/../ found in path " + csPath); // To check.
                int nEnd = nPos + 4;
                while (nPos >= 1 && csPath[nPos - 1] != '/')
                {
                    nPos--;
                }
                csPath = csPath.Substring(0, nPos) + csPath.Substring(nEnd);
            }
            return(csPath);
        }
예제 #6
0
        public MHEngine(IMHContext context)
        {
            m_Context       = context;
            m_fInTransition = false;
            m_fBooting      = true;

            m_redrawRegion.MakeEmpty();

            m_ApplicationStack   = new Stack <MHApplication>();
            m_ActionStack        = new Stack <MHElemAction>();
            m_EventQueue         = new List <MHAsynchEvent>();
            m_LinkTable          = new List <MHLink>();
            m_ExternContentTable = new List <MHExternContent>();
            m_PersistentStore    = new MHSequence <MHPSEntry>();
            m_CurrentGroupId     = new MHOctetString();
        }
예제 #7
0
 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");
     }
 }
예제 #8
0
        public bool GetEngineSupport(MHOctetString feature)
        {
            string csFeat = feature.ToString();

            string[] strings = csFeat.Split(new char[] { '(', ')', ',' });

            if (strings[0] == "ApplicationStacking" || strings[0] == "ASt")
            {
                return(true);
            }
            // We're required to support cloning for Text, Bitmap and Rectangle.
            if (strings[0] == "Cloning" || strings[0] == "Clo")
            {
                return(true);
            }
            if (strings[0] == "SceneCoordinateSystem" || strings[0] == "SCS")
            {
                if (strings.Length >= 3 && strings[1] == "720" && strings[2] == "576")
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
                // I've also seen SceneCoordinateSystem(1,1)
            }
            if (strings[0] == "MultipleAudioStreams" || strings[0] == "MAS")
            {
                if (strings.Length >= 2 && (strings[1] == "0" || strings[1] == "1"))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            if (strings[0] == "MultipleVideoStreams" || strings[0] == "MVS")
            {
                if (strings.Length >= 2 && (strings[1] == "0" || strings[1] == "1"))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            // We're supposed to return true for all values of N
            if (strings[0] == "OverlappingVisibles" || strings[0] == "OvV")
            {
                return(true);
            }

            if (strings[0] == "SceneAspectRatio" || strings[0] == "SAR")
            {
                if (strings.Length < 3)
                {
                    return(false);
                }
                else if ((strings[1] == "4" && strings[2] == "3") || (strings[1] == "16" && strings[2] == "9"))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }

            // We're supposed to support these at least.  May also support(10,1440,1152)
            if (strings[0] == "VideoScaling" || strings[0] == "VSc")
            {
                if (strings.Length < 4 || strings[1] != "10")
                {
                    return(false);
                }
                else if ((strings[2] == "720" && strings[3] == "576") || (strings[2] == "360" && strings[3] == "288"))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            if (strings[0] == "BitmapScaling" || strings[0] == "BSc")
            {
                if (strings.Length < 4 || strings[1] != "2")
                {
                    return(false);
                }
                else if ((strings[2] == "720" && strings[3] == "576") || (strings[2] == "360" && strings[3] == "288"))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }

            // I think we only support the video fully on screen
            if (strings[0] == "VideoDecodeOffset" || strings[0] == "VDO")
            {
                if (strings.Length >= 3 && strings[1] == "10" && strings[1] == "0")
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            // We support bitmaps that are partially off screen (don't we?)
            if (strings[0] == "BitmapDecodeOffset" || strings[0] == "BDO")
            {
                if (strings.Length >= 3 && strings[1] == "10" && (strings[2] == "0" || strings[2] == "1"))
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }

            if (strings[0] == "UKEngineProfile" || strings[0] == "UEP")
            {
                if (strings.Length < 2)
                {
                    return(false);
                }
                if (strings[1] == MHEGEngineProviderIdString)
                {
                    return(true);
                }
                if (strings[1] == m_Context.GetReceiverId())
                {
                    return(true);
                }
                if (strings[1] == m_Context.GetDSMCCId())
                {
                    return(true);
                }
                // The UK profile 1.06 seems a bit confused on this point.  It is not clear whether
                // we are supposed to return true for UKEngineProfile(2) or not.
                if (strings[1] == "2")
                {
                    return(true);
                }
                else
                {
                    return(false);
                }
            }
            // Otherwise return false.
            return(false);
        }
예제 #9
0
 public void Append(MHOctetString str)
 {
     m_String = m_String + str.m_String;
 }
예제 #10
0
 public MHObjectRef()
 {
     m_nObjectNo = 0;
     m_GroupId   = new MHOctetString();
 }
예제 #11
0
 public MHUnion(MHOctetString strVal)
 {
     m_Type   = U_String;
     m_StrVal = new MHOctetString();
     m_StrVal.Copy(strVal);
 }
예제 #12
0
 public MHGenericOctetString() : base()
 {
     m_Direct = new MHOctetString();
 }
예제 #13
0
 // Actions on Ingredients.
 public virtual void SetData(MHOctetString included, MHEngine engine)
 {
     InvalidAction("SetData");
 }
예제 #14
0
 public bool Equal(MHOctetString str)
 {
     return(m_String.Equals(str.m_String));
 }
예제 #15
0
 public void Copy(MHOctetString str)
 {
     m_String = (string)str.m_String.Clone();
 }
예제 #16
0
 // Load from or store to the persistent store.
 public bool LoadStorePersistent(bool fIsLoad, MHOctetString fileName, MHSequence <MHObjectRef> variables)
 {
     return(false);
 }
예제 #17
0
 public MHPSEntry()
 {
     m_FileName = new MHOctetString();
 }
예제 #18
0
 public int Compare(MHOctetString str)
 {
     return(m_String.CompareTo(str.m_String));
 }
예제 #19
0
 public MHColour()
 {
     m_nColIndex = -1;
     m_ColStr    = new MHOctetString();
 }
예제 #20
0
 public MHContentRef()
 {
     m_ContentRef = new MHOctetString();
 }
예제 #21
0
 public void SetFromIndex(int index)
 {
     m_nColIndex = index;
     m_ColStr    = new MHOctetString();
 }
예제 #22
0
 public virtual void SetFontAttributes(MHOctetString fontAttrs, MHEngine engine)
 {
     InvalidAction("SetFontAttributes");
 }
예제 #23
0
 public MHFontBody()
 {
     m_DirFont   = new MHOctetString();
     m_IndirFont = new MHObjectRef();
 }