Пример #1
0
        static void Main()
        {
            int j = 0;

            //using (StreamReader sr = new StreamReader(@"c:\radio_stations.csv"))
            //{
            //    int j = 0;
            //    while (!sr.EndOfStream)
            //    {

            //        string line = sr.ReadLine();
            //        string[] fields = line.Split(",".ToCharArray());

            //        int i = 0;
            //        string url = fields[i++];
            //        string title = fields[i++];
            //        string genre = fields[i++];

            //        RadioStation rs = new RadioStation();
            //        rs.Url = url;
            //        rs.Title = title;
            //        rs.Genre = genre;

            //        Console.WriteLine(">> {0} / {1}", j++, 857);
            //        ValidateUrl(url, title, genre);
            //    }

            //    data.SavePersistentList();
            //}

            data = RadioStationsData.Load();

            foreach(RadioStation rs in data.RadioStations)
            {
                Console.WriteLine(">> {0} / {1}", j++, data.RadioStations.Count);
                Console.WriteLine("Trying url: {0}", rs.Url);

                try
                {
                    ShoutcastStream ss = new ShoutcastStream(rs.Url, 500);
                    if (ss.Connected)
                    {
                        if (ss.Bitrate >= 128)
                        {
                            data2.RadioStations.Add(rs);
                        }
                    }
                }
                catch { }

                data2.SavePersistentList();
            }

            string xml = PersistenceProxy.ReadObject("RadioStationsData", string.Empty);
            using (StreamWriter sw = new StreamWriter(@"c:\radio_stations.xml"))
            {
                sw.Write(xml);
            }
        }
        void StreamingServerChooserDlg_Load(object sender, EventArgs e)
        {
            lvServers.Items.Clear();

            // Get the list from persistency support
            _allData = RadioStationsData.Load();
            if (_allData != null && _allData.RadioStations != null)
            {
                var genres = (from rs in _allData.RadioStations
                              orderby rs.Genre ascending
                              select rs.Genre).Distinct();

                cmbSearchgenre.Items.Add(string.Empty);
                foreach (var genre in genres)
                {
                    cmbSearchgenre.Items.Add(genre);
                }

                this.txtSearch.TextChanged += new System.EventHandler(this.txtSearch_TextChanged);
                this.cmbSearchgenre.SelectedIndexChanged += new System.EventHandler(this.cmbSearchgenre_SelectedIndexChanged);

                DisplayData();
            }
        }