Exemplo n.º 1
0
        //public struct channel
        //{
        //    public string orbTitle;
        //    public string orbMediumID;
        //    public bool isFavorite;


        //    public ListItem listItem
        //    {
        //        get
        //        {
        //            string strFav;
        //            if (isFavorite)
        //            {
        //                strFav = " (FAV)";
        //            }
        //            else
        //            {
        //                strFav = "";
        //            }

        //            return new ListItem(orbMediumID, orbTitle + strFav);
        //        }
        //        set { value = listItem; }
        //    }
        //}


        //public ListItem GetChannelByName(string name)
        //{

        //    string title;
        //    // title = string.
        //    title = name.Replace(" (FAV)", "");
        //    title = title.Trim();

        //    for (int i = 0; i == 1024; i++)
        //    {
        //        Debug.Print(arrChannels[i].orbTitle);
        //        if (arrChannels[i].orbTitle == title)
        //        {
        //            return arrChannels[i]
        //                .listItem;
        //        }

        //    }
        //    return null;
        //}


        //public void RetrieveChannels()
        //{
        //    emptyArray();
        //    int intCounter = 1;

        //    var oComm = new Api();
        //    var oReader = oComm.ConvertStringToXmlReader(oComm.getResponseFromOrb(Api.tvgetListings, "sid=" + SessionSettings.sessionID));
        //    while (oReader.Read())
        //    {
        //        if (oReader.NodeType == XmlNodeType.Element)
        //        {
        //            if (oReader.Name == "channel")
        //            {
        //                arrChannels[intCounter] = new channel();
        //                arrChannels[intCounter].orbMediumID = oReader.GetAttribute("orbMediumId");
        //                arrChannels[intCounter].orbTitle = oReader.GetAttribute("title");
        //                if (Convert.ToInt16(oReader.GetAttribute("rating")) > 0)
        //                {
        //                    arrChannels[intCounter].isFavorite = true;
        //                }
        //                intCounter = intCounter + 1;

        //            }
        //        }
        //    }
        //    lastChannel = intCounter;
        //}

        //public ListItem GetChannel(int num)
        //{
        //    return arrChannels[num].listItem;
        //}

        //public ListItem GetChannel(string mediumid)
        //{
        //    dynamic intTeller = null;
        //    for (intTeller = 1; intTeller <= 1024; intTeller++)
        //    {
        //        if (arrChannels[intTeller].orbMediumID == mediumid)
        //        {
        //            return arrChannels[intTeller].listItem;
        //        }
        //    }
        //    return null;
        //}

        //public ListItem GetChannelByTitle(string title)
        //{
        //    dynamic intTeller = null;
        //    for (intTeller = 1; intTeller <= 1024; intTeller++)
        //    {
        //        if (arrChannels[intTeller].orbTitle == title)
        //        {
        //            return arrChannels[intTeller].listItem;
        //        }
        //    }
        //    return null;
        //}

        //public void emptyArray()
        //{
        //    lastChannel = 0;
        //}


        public string GetStreamingUri(string format, string orbMediumID, string type = TYPE_PC, int width = 0, int height = 0)
        {
            if (string.IsNullOrEmpty(orbMediumID))
                throw new OrbInternalError();

            var oParamBuilder = new ParamBuilder();
          
            oParamBuilder.addParam("sid",StaticSessionSettings.sessionID);
            oParamBuilder.addParam("streamFormat", format);
            oParamBuilder.addParam("mediumId", orbMediumID);
            oParamBuilder.addParam("type",type);
            if (height > 0)
                oParamBuilder.addParam("height", height.ToString());
            if (width > 0)
                oParamBuilder.addParam("width", width.ToString());

            Api oComm = new Api();

            var url = oComm.getManualAttributeFromOrbXmlNode(Api.Stream, oParamBuilder.GetParamList(), "item", "url");
            
            

            return url;
        }