private void lvwVideos_AfterLabelEdit(object sender, LabelEditEventArgs e) { //grabs the changed name of file after user does edit ex. Barney string strLabel = e.Label; //grabs name of selected file with extension ex. Barney.vob string strFilePathOld = this.lvwVideos.SelectedItems[0].Tag.ToString(); if (strLabel != null) { // FileManipulation objFileNameChange = new FileManipulation(strFilePathOld); string strFilePathChange = FileManipulation.FileNameChange(strFilePathOld, strLabel); if (strFilePathOld != strFilePathChange) { if (Convert.ToString(File.Exists(strFilePathChange)) == "False") { File.Move(strFilePathOld, strFilePathChange); this.lvwVideos.SelectedItems[0].Tag = strFilePathChange; } else { if (MessageBox.Show("File Name Not Changed It Already Exists - " + strLabel, "File Name Change Error", MessageBoxButtons.OK) == DialogResult.OK) { this.FillVideos(Settings.Default.DirectoryPrevious); } } } } }
private void timPlaylist_Tick(object sender, EventArgs e) { int intPlaylist = axVLCPlugin1.PlaylistIndex; strFilePath = arrPlaylist[intPlaylist]; this.Text = "Playing - " + FileManipulation.GetFileNameFromPath(strFilePath); this.lblTimeElasped.Text = axVLCPlugin1.Time.ToString(); this.lblTimeTotal.Text = axVLCPlugin1.Length.ToString(); }
public static List <VideoObj> GetVideos(string strDirPath) { List <VideoObj> videos = new List <VideoObj>(); DirectoryInfo dir = new DirectoryInfo(strDirPath); FileInfo[] files = dir.GetFiles(); foreach (FileInfo fi in files) { if (FileManipulation.CheckFileAllowed(fi.Name)) { VideoObj videoobj = new VideoObj(); videoobj.FileName = FileManipulation.GetFileName(fi.Name); videoobj.FilePath = fi.FullName; videoobj.ImageIndex = 1; videos.Add(videoobj); } } return(videos); }
public static List <VideoObj> GetDirectories(string strDirPath) { List <VideoObj> directories = new List <VideoObj>(); DirectoryInfo dir = new DirectoryInfo(strDirPath); DirectoryInfo[] dirs = dir.GetDirectories(); //load the directories foreach (DirectoryInfo di in dirs) { if (FileManipulation.CheckDirectoryNotAllowed(di.Name)) { VideoObj videoobj = new VideoObj(); videoobj.FileName = "Folder - " + di.Name; videoobj.FilePath = di.FullName; videoobj.ImageIndex = 0; directories.Add(videoobj); } } return(directories); }
private void btnOpenVideo_Click(object sender, EventArgs e) { //code for making the video files active...so you can play them try { string strFilenamePath = lvwVideos.SelectedItems[0].Tag.ToString(); string strFileExt; //get playlist int intVideoIndex = lvwVideos.SelectedItems[0].Index; List <string> playlist = new List <string>(); for (int i = intVideoIndex; i < (intVideoIndex + 30); i++) { try { playlist.Add(this.lvwVideos.Items[i].Tag.ToString()); } catch { break; } } if (lvwVideos.SelectedItems[0].ImageIndex == 1) { try { strFileExt = FileManipulation.GetFileExtension(strFilenamePath, 1); if (strFileExt == "pdf") { System.Diagnostics.Process.Start(strFilenamePath); } frmVLC vlc = new frmVLC(strFilenamePath, playlist); vlc.Show(); } catch { return; } } else if (lvwVideos.SelectedItems[0].ImageIndex == 0) { this.FillVideos(strFilenamePath); folderCol.Add(strFilenamePath); } else if (lvwVideos.SelectedItems[0].ImageIndex == 2) { Settings.Default.DirectoryPrevious = "root"; Settings.Default.Save(); if (folderCol.Count > 1) { this.FillVideos(folderCol[folderCol.Count - 2].ToString()); folderCol.RemoveAt(folderCol.Count - 1); } else { this.FillVideos(strFilenamePath); } this.FillVideos(strFilenamePath); } } catch { return; } }