コード例 #1
0
ファイル: PlayList.cs プロジェクト: needspeed/VotemUp
 public static Dictionary<int, Song> getParsedSongs(String path, String albumcover_path)
 {
     Dictionary<int, Song> songs = new Dictionary<int, Song>();
     String[] readFile = Util.readFileToArray(path);
     foreach (String line in readFile)
     {
         String act_line = line.Split('\r')[0];
         if (act_line.EndsWith(".mp3"))
         {
             try
             {
                 Song song = new Song(act_line, albumcover_path);
                 songs[song.getUniqueID()] = song;
             }
             catch (System.IO.FileNotFoundException fnfe)
             {
                 Console.WriteLine("File not found: " + act_line);
                 continue;
             }
             catch (TagLib.CorruptFileException cfe)
             {
                 Console.WriteLine("Corrupt File: " + act_line);
                 continue;
             }
         }
     }
     return songs;
 }
コード例 #2
0
ファイル: CsInterpreter.cs プロジェクト: needspeed/VotemUp
        private static String genListElement(int uid, Song.mp3Head info, String static_html_element)
        {
            String read_html = static_html_element;

            if(info.picture != null) read_html = read_html.Replace("$ALBUM_COVER_PATH", "/"+info.picture.Split(new string[]{HTTP.HttpUtil.getHTMLdirectory()},StringSplitOptions.None)[1]);
            read_html = read_html.Replace("$SONG_TITLE", info.title);
            read_html = read_html.Replace("$SONG_ARTIST", info.artist);
            read_html = read_html.Replace("$SONG_DURATION", (info.duration)/60 + ":" + ((info.duration%60 > 9) ? "" : "0") + info.duration%60 );
            read_html = read_html.Replace("$SONG_UID", uid.ToString());

            return read_html;
        }