Exemplo n.º 1
0
        private void addVideoToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (!String.IsNullOrEmpty(playlistsList.Text))
                {
                    openFileDialog.Title = Langs.open + " - " + playlistsList.Text;
                    if (openFileDialog.ShowDialog() == DialogResult.OK)
                    {
                        String SelectedPlaylistPath = Reference.PlaylistsPath + playlistsList.Text + "\\";
                        String SelectedPlaylistInfo = SelectedPlaylistPath + Path.GetFileNameWithoutExtension(openFileDialog.FileName) + ".info";

                        Rasu VideoInfo = new Rasu(SelectedPlaylistInfo);
                        if (!File.Exists(SelectedPlaylistPath + Path.GetFileName(openFileDialog.FileName)))
                        {
                            // Copy video
                            File.Copy(openFileDialog.FileName, SelectedPlaylistPath + Path.GetFileName(openFileDialog.FileName));
                            File.Create(SelectedPlaylistInfo).Dispose();

                            // Create info file
                            File.WriteAllText(SelectedPlaylistInfo, Resources.video);

                            // Set up video info file
                            VideoInfo.Set("video_extension", Path.GetExtension(openFileDialog.FileName));
                            VideoInfo.Set("video_file_version", Application.ProductVersion);
                            VideoInfo.SaveFile();

                            refreshList();
                        }
                        else
                        {
                            MetroMessageBox.Show(this, Langs.videoExist, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                        }
                    }
                }
                else
                {
                    MetroMessageBox.Show(this, Langs.selectPlaylist, "", MessageBoxButtons.OK, MessageBoxIcon.Error);
                }
            }
            catch (Exception ex)
            {
                MetroMessageBox.Show(this, ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 2
0
 // Apply edit
 private void editvideo_editvideobutton_Click(object sender, EventArgs e)
 {
     try
     {
         Rasu VideoInfo = new Rasu(wFile.Path + ".info");
         if (editvideo_videodescription.Text != wFile.Description && !String.IsNullOrEmpty(editvideo_videodescription.Text))
         {
             VideoInfo.Set("video_description", editvideo_videodescription.Text);
         }
         if (editvideo_videoname.Text != wFile.ToString() && !String.IsNullOrEmpty(editvideo_videoname.Text))
         {
             String VideoPath = wFile.Path + wFile.Extension;
             File.Move(VideoPath, Reference.PlaylistsPath + playlistsList.Text + "\\" + editvideo_videoname.Text + wFile.Extension);
             File.Move(VideoInfo.GetFilePath(), Reference.PlaylistsPath + playlistsList.Text + "\\" + editvideo_videoname.Text + ".info");
         }
         VideoInfo.SaveFile();
         Settings.refreshTabs();
         refreshList();
     }
     catch (Exception ex)
     {
         MetroMessageBox.Show(this, ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
     }
 }