Exemple #1
0
        public static void Import(string RootDir)
        {
            DirectoryInfo DI = new DirectoryInfo(RootDir);

            FileInfo[] D = DI.GetFiles("*.mp3");
            foreach(FileInfo X in D){
                try{
                    id3.MP3 Dw = new id3.MP3(X.DirectoryName,X.Name);
                    id3.FileCommands.readMP3Tag(ref Dw);
                    SQLiteConnection CP = MainForm.MakeConnection();
                    CP.Open();
                    String P = "INSERT INTO song(name,artist,album,path) VALUES (\""+Dw.id3Title.Replace("\0","")+"\" ,'"+Dw.id3Artist.Replace("\0","")+"','"+Dw.id3Album.Replace("\0","")+"','mp3:"+X.FullName+"')";
                    SQLiteCommand C = new SQLiteCommand(P,CP);
                    C.ExecuteNonQuery();

                    CP.Close();
                }catch(Exception e){

                }

            }
            DirectoryInfo[] Directories = DI.GetDirectories();
            foreach(DirectoryInfo R in Directories){
                Import(R.FullName);
            }
        }
Exemple #2
0
        public void ImportData(SQLiteConnection Conn,string RootDir)
        {
            DirectoryInfo DI = new DirectoryInfo(RootDir);

            FileInfo[] D = DI.GetFiles("*.mp3");
            foreach(FileInfo X in D){
                try{
                    id3.MP3 Dw = new id3.MP3(X.DirectoryName,X.Name);
                    id3.FileCommands.readMP3Tag(ref Dw);
                    SQLiteConnection CP = Conn;
                    CP.Open();

                    String P = "INSERT INTO song(name,artist,album,path,no,composer,store,engine) VALUES (\""+Dw.id3Title.Replace("\0","").Replace("\"","'")+"\" ,\""+Dw.id3Artist.Replace("\0","").Replace("\"","'")+"\",\""+Dw.id3Album.Replace("\0","").Replace("\"","'")+"\",\"mp3:"+X.FullName+"\","+Dw.id3TrackNumber+",\"Other\",\"Local Files\",\"mp3\")";
                    SQLiteCommand C = new SQLiteCommand(P,CP);
                    C.ExecuteNonQuery();
                    FilesCompleted++;
                    CP.Close();
                }catch(Exception e){
                    System.Windows.Forms.MessageBox.Show(e.Message);
                }

            }
            DirectoryInfo[] Directories = DI.GetDirectories();
            foreach(DirectoryInfo R in Directories){
                ImportData(Conn,R.FullName);
            }
        }
Exemple #3
0
        void FX_DownloadFileCompleted(object sender, AsyncCompletedEventArgs e)
        {
            try
            {
                id3.MP3 D;
                try
                {

                            D = new id3.MP3(Folder,FileName);

                            id3.FileCommands.readMP3Tag(ref D);

                            File.Move(Folder+"\\"+FileName,Folder+"\\"+FileName+".mp3");
                            FileName=FileName+"mp3";

                            SQLiteConnection CP = MainForm.MakeConnection();
                            CP.Open();
                            String P = "INSERT INTO song(name,artist,album,path) VALUES (\""+D.id3Title.Replace("\0","")+"\" ,'"+D.id3Artist.Replace("\0","")+"','"+D.id3Album.Replace("\0","")+"','"+PartFile+"')";
                            SQLiteCommand C = new SQLiteCommand(P,CP);
                            C.ExecuteNonQuery();
                            String Ps = "INSERT INTO purchase(song_id,store) VALUES(last_insert_rowid(),'"+Store+"')";
                             C = new SQLiteCommand(Ps,CP);
                            C.ExecuteNonQuery();
                            CP.Close();

                }
                catch
                {

                            id3.FileCommands.oFileStream.Close();

                            String FileFolder=FileName.Replace(".zip","");

                            if(!Directory.Exists(Folder+"\\"+FileFolder.Replace("%20"," ")))
                            {
                                Directory.CreateDirectory(Folder+"\\"+FileFolder.Replace("%20"," "));
                            }
                            String DS = MainForm.GetAppPath()+"unzip";

                            Process sD = new Process();

                            sD.Exited+= new EventHandler(D_Exited);
                            ProcessStartInfo XP = new ProcessStartInfo();
                            sD.StartInfo= XP;
                            XP.CreateNoWindow=false;
                            XP.UseShellExecute=false;
                            sD.EnableRaisingEvents=true;

                            XP.FileName=(DS);
                            XP.Arguments =(" \""+Folder+"\\"+FileName+"\" -d \""+Folder+"\\"+FileName.Replace(".zip","")+"\"");

                            sD.Start();

                }
            }
            catch(Exception ex)
            {
                MessageBox.Show(ex.Message);
            }
        }