示例#1
0
文件: Media.cs 项目: j4m355/orb.net
        private static void FullSearch()
        {
            ParamBuilder oParamBuilder = new ParamBuilder();
            SearchResults = new List<Item>();

            oParamBuilder.addParam("sid", StaticSessionSettings.sessionID);
            oParamBuilder.addParam("q", "");

            var oComm = new Api();
            var result = oComm.getResponseFromOrb<List<Item>>(Api.mediasearch, oParamBuilder.GetParamList());

            List<Item> Temp = new List<Item>();

            Temp = result;

            SearchResults.Clear();

            foreach (var item in Temp)
            {
                if (!string.IsNullOrWhiteSpace(item.field))
                    SearchResults.Add(item);
            }

            iveFullySearched = true;
        }
示例#2
0
文件: Session.cs 项目: j4m355/orb.net
        public bool sessionkeepAlive()
        {
            var oParamBuilder = new ParamBuilder();
            
            var oComm = new Api();
            oParamBuilder.addParam("sid", StaticSessionSettings.sessionID);
            var result = oComm.getResponseFromOrb<Status>(Api.sessionkeepAlive, oParamBuilder.GetParamList());

            if (result.code == "0")
                return true;

            return false;
        }
示例#3
0
文件: Session.cs 项目: j4m355/orb.net
        public bool sessionlogin(string username, string password)
        {
            StaticSessionSettings.username = username;
            StaticSessionSettings.password = password;

            var oComm = new Api();
            var oParamBuilder = new ParamBuilder();
            var blnLoggedIn = false;

            oParamBuilder.addParam("apiKey", StaticSessionSettings.applicationKey);
            oParamBuilder.addParam("l", StaticSessionSettings.username);
            oParamBuilder.addParam("password", StaticSessionSettings.password);

            var result = oComm.getResponseFromOrb<Status>(Api.sessionlogin, oParamBuilder.GetParamList());

            StaticSessionSettings.sessionID = result.orbSessionId;
           // if(result.code == "0") 
                blnLoggedIn = true;
            StaticSessionSettings.sessionExpireTime = result.maxInactiveInterval;
           
            return blnLoggedIn;
        }
示例#4
0
文件: Stream.cs 项目: j4m355/orb.net
        //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;
        }