Пример #1
0
        private void RenameMedia(Media Media, string TargetPath)
        {
            Media     sourceMedia = Media;
            MediaPool pool        = myVegas.Project.MediaPool;
            string    sourceFile  = sourceMedia.FilePath;

            try
            {
                var placeholder = new Media(TargetPath + ".temp");
                foreach (MediaStream stream in sourceMedia.Streams)
                {
                    if (stream is VideoStream)
                    {
                        placeholder.CreateOfflineStream(MediaType.Video);
                    }
                    else if (stream is AudioStream)
                    {
                        placeholder.CreateOfflineStream(MediaType.Audio);
                    }
                }
                sourceMedia.ReplaceWith(placeholder);
                pool.Remove(sourceFile);
                File.Move(sourceFile, TargetPath);
                placeholder.ReplaceWith(new Media(TargetPath));
                pool.Remove(placeholder.FilePath);
            }
            catch (Exception Ex)
            {
                myVegas.DebugOut(Ex.Message);
            }
        }
Пример #2
0
        private void deleteToolStripMenuItem_Click(object sender, EventArgs e)
        {
            MediaPool    pool          = MyVegas.Project.MediaPool;
            List <Media> selectedMedia = GetSelectedMedia();

            using (var undo = new UndoBlock("Delete media"))
            {
                foreach (Media media in selectedMedia)
                {
                    var killsheet = new List <TrackEvent>();
                    if (media.UseCount != 0)
                    {
                        DialogResult rslt = MessageBox.Show("Really remove this media? All associated events or takes will be removed.",
                                                            "Media still in use", MessageBoxButtons.YesNo);
                        {
                            if (rslt != DialogResult.Yes)
                            {
                                continue;
                            }
                            foreach (TrackEvent ev in MyVegas.Project.GetAllEvents())
                            {
                                if (ev.Takes.Count == 1 && ev.ActiveTake.Media == media)
                                {
                                    killsheet.Add(ev);
                                    continue;
                                }
                                foreach (Take take in ev.Takes)
                                {
                                    if (take.Media == media)
                                    {
                                        ev.Takes.Remove(take);
                                    }
                                }
                            }
                        }
                        foreach (TrackEvent ev in killsheet)
                        {
                            var parentTrack = ev.Track;
                            parentTrack.Events.Remove(ev);
                        }
                    }

                    string mediaKey = media.KeyString;
                    pool.Remove(mediaKey);
                }
            }
            PopulateMediaListItems();
        }
Пример #3
0
        private static void CopyOrRedirect(MediaPool pool, Media media, string path)
        {
            string target = Path.GetFullPath(path);

            if (Path.GetFullPath(media.FilePath) == target)
            {
                return;
            }

            // copy the file
            if (!File.Exists(target))
            {
                File.Copy(media.FilePath, target);
            }
            Media newMedia = pool.AddMedia(target);

            media.ReplaceWith(newMedia);
            string mediaKey = media.KeyString;

            if (media.UseCount == 0)
            {
                pool.Remove(mediaKey);
            }
        }
Пример #4
0
		private static void CopyOrRedirect(MediaPool pool, Media media, string path)
		{
			string target = Path.GetFullPath(path);
			if (Path.GetFullPath(media.FilePath) == target)
				return;

			// copy the file
			if (!File.Exists(target))
				File.Copy(media.FilePath, target);
			Media newMedia = pool.AddMedia(target);
			media.ReplaceWith(newMedia);
			string mediaKey = media.KeyString;
			if (media.UseCount == 0)
				pool.Remove(mediaKey);
		}