示例#1
0
        public IList<Group> SearchChannels(string searchText, ChannelSort orderBy, bool orderDesc, out int totNum, 
            int start = 0, int count = int.MaxValue)
        {
            totNum = 0;

            //check for erroneous input:
            if ((count <= 0) || (start < 0))
            {
                SetLastError(log, ErrorCodes.WRONG_INPUT, string.Format("Input error: userID={0}, searchText={1}, maxNum={2}, start={3}",
                    CurrentUserID, searchText.PrintNull(), count, start));
                return new List<Group>();
            }

            //send the request and parse the response:
            if (searchText == null)
                searchText = string.Empty;
            string querystring = string.Format("query={0}&field={1}&direction={2}&start={3}&maxNum={4}",
                HttpUtility.UrlEncode(searchText), orderBy, (orderDesc ? SortDirection.Descent : SortDirection.Ascent), 
                start, count);
            S2CResListBaseEntity<GroupComm> resp = SendReqListBaseEntity<GroupComm>(SEARCH_CHANNELS_URL, querystring, false, false);

            //build the result:
            IList<Group> channels = resp.GetListFromResp<GroupComm, Group>(out totNum);
            return channels;
        }
示例#2
0
 public static string ChannelSortToString(ChannelSort channelSort)
 {
     if (channelSort == ChannelSort.Time)
     {
         return("time");
     }
     else if (channelSort == ChannelSort.Views)
     {
         return("views");
     }
     else
     {
         return(string.Empty);
     }
 }
示例#3
0
 public IList<Group> GetAllChannels(ChannelSort orderBy, bool orderDesc, out int totNum, 
     int start = 0, int count = int.MaxValue)
 {
     throw new NotImplementedException();
 }
示例#4
0
        /// <summary>
        /// 設定をファイルに保存
        /// </summary>
        public static void SaveSetting()
        {
            FileStream    fs     = null;
            XmlTextWriter writer = null;

            try
            {
                fs     = new FileStream(SettingPath, FileMode.Create, FileAccess.Write);
                writer = new XmlTextWriter(fs, Encoding.GetEncoding("utf-8"));

                writer.Formatting = Formatting.Indented;
                writer.WriteStartDocument(true);

                writer.WriteStartElement("Setting");

                writer.WriteStartElement("Header");

                writer.WriteStartElement("Name");
                writer.WriteAttributeString("name", PodcasCoInfo.ApplicationName);
                writer.WriteEndElement(); // End of Name.
                writer.WriteStartElement("Version");
                writer.WriteAttributeString("version", PodcasCoInfo.VersionNumber);
                writer.WriteEndElement(); // End of Version.

                writer.WriteStartElement("Date");
                writer.WriteAttributeString("date", DateTime.Now.ToString());
                writer.WriteEndElement(); // End of Date.

                writer.WriteEndElement(); // End of Header.

                writer.WriteStartElement("Content");

                writer.WriteStartElement("StationList");
                foreach (Station station in StationList.GetStationList())
                {
                    writer.WriteStartElement("Station");
                    writer.WriteAttributeString("id", station.Id);
                    writer.WriteAttributeString("name", station.Name);
                    writer.WriteAttributeString("kind", station.Kind.ToString());
                    writer.WriteAttributeString("startupDownload", station.StartupDownload.ToString());
                    writer.WriteAttributeString("startupDownloadNum", station.StartupDownloadNum.ToString());
                    writer.WriteAttributeString("startupDelete", station.StartupDelete.ToString());
                    writer.WriteAttributeString("startupDeleteRemainDay", station.StartupDeleteRemainDay.ToString());
                    writer.WriteEndElement(); // End of Station
                }
                writer.WriteEndElement();     // End of StationList

                writer.WriteStartElement("PodcastClipDirectoryPath");
                writer.WriteAttributeString("path", PodcastClipDirectoryPath);
                writer.WriteEndElement(); // End of PodcastClipDirectoryPath

                writer.WriteStartElement("MediaPlayerPath");
                writer.WriteAttributeString("path", MediaPlayerPath);
                writer.WriteEndElement(); // End of MediaPlayerPath

                writer.WriteStartElement("BrowserPath");
                writer.WriteAttributeString("path", BrowserPath);
                writer.WriteEndElement(); // End of BrowserPath

                writer.WriteStartElement("Proxy");
                writer.WriteAttributeString("use", ProxyUse.ToString());
                writer.WriteAttributeString("server", ProxyServer);
                writer.WriteAttributeString("port", ProxyPort.ToString());
                writer.WriteEndElement(); // End of Porxy

                writer.WriteStartElement("ChannelSort");
                writer.WriteAttributeString("sort", ChannelSort.ToString());
                writer.WriteEndElement(); // End of ChannelSort

                writer.WriteEndElement(); // End of Content.

                writer.WriteEndElement(); // End of Setting.

                writer.WriteEndDocument();
            }
            finally
            {
                writer.Close();
                fs.Close();
            }
        }