Example #1
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);
        }
Example #2
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);
        }