示例#1
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);
     }
 }
示例#2
0
        public WatchFile(String name, String extension)
        {
            try
            {
                this.Name      = name;
                this.Extension = extension;
                this.Path      = Reference.PlaylistsPath + Program.mainForm.playlistsList.Text + "\\" + name;

                if (Extension != ".web")
                {
                    var player = new WindowsMediaPlayer();
                    var clip   = player.newMedia(this.Path + this.Extension);
                    this.Duration = TimeSpan.FromSeconds(clip.duration).ToString();
                }

                Rasu VideoInfo = new Rasu(this.Path + ".info");

                // Check updates
                if (VideoInfo.Get("video_file_version") != Application.ProductVersion)
                {
                    Rasu VideoInfoTemplate = new Rasu(Resources.video);
                    VideoInfo.MergeFile(VideoInfoTemplate);

                    VideoInfoTemplate.Set("video_file_version", Application.ProductVersion);

                    File.WriteAllText(VideoInfo.GetFilePath(), VideoInfoTemplate.GetFileContent());
                    VideoInfo.ReloadFile();
                }

                this.Description = VideoInfo.Get("video_description");
            }
            catch (Exception ex)
            {
                MetroMessageBox.Show(Program.mainForm, ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }