private void SetAllNavigationButtonNotClick() { doorButton.image.sprite = MediaPool.GetInstance().GetDoorButtonImage(false); libraryButton.image.sprite = MediaPool.GetInstance().GetLibraryButtonImage(false); cossButton.image.sprite = MediaPool.GetInstance().GetCossButtonImage(false); lakeButton.image.sprite = MediaPool.GetInstance().GetLakeButtonImage(false); }
// Use this for initialization void Start() { // Pre-loading PrefabPool.GetInstance(); MediaPool.GetInstance(); stateController = new StateController("192.168.137.1", 50000); stateController.SetListener(this); // wormholeReceiver = new WormholeImageReceiver (); // wormholeReceiver.SetListener (this); directorTask = null; directorTaskLock = new System.Object(); emailSender = new EmailSender(); pageStack = new Stack <Page> (); pageStack.Push(new MainPage(this)); // pageStack.Push (new DoorNavigationPage (this)); // pageStack.Push (new WebPage (this)); // pageStack.Push (new WormholePage(this)); // pageStack.Push (new EmailInputPage (this)); // pageStack.Push (new EndPage (this)); }
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); } }
public static MediaPool GetInstance() { if (instance == null) { instance = new MediaPool(); } return(instance); }
void ExportMediaPool(XmlElement parent, MediaPool pool) { XmlElement elt = AddChild(parent, "MediaPool"); elt.SetAttribute("Count", pool.Count.ToString(myNumberFormat)); IEnumerator enumMedia = pool.GetEnumerator(); while (enumMedia.MoveNext()) { ExportMedia(elt, (Media)enumMedia.Current); } ExportMediaBin(elt, pool.RootMediaBin); }
Media FindMedia(MediaPool pool, String mediaKey) { Media media = (Media)pool[mediaKey]; if (null == media) { String newKey = (String)myGeneratedMediaKeys[mediaKey]; if (null != newKey) { media = (Media)pool[newKey]; } } return(media); }
public XmlState() { MixEffectBlocks = new List <MixEffectBlock>(); DownstreamKeys = new List <DownstreamKey>(); ColorGenerators = new List <ColorGenerator>(); Auxiliaries = new List <Auxiliary>(); Settings = new AtemSettings(); AudioMixer = new AudioMixer(); MediaPlayers = new List <MediaPlayer>(); MediaPool = new MediaPool(); CameraControl = new CameraControl(); MacroPool = new List <Macro>(); MacroControl = new MacroControl(); }
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(); }
private void SetupComponents() { GameObject pageAsset = PrefabPool.GetInstance().GetConfirmPage(); page = Instantiator.GetInstance().InstantiatePrefab(pageAsset); // Setup background Image confirmPage = page.transform.FindChild("BackgroundImage").gameObject.GetComponent <Image> (); confirmPage.sprite = MediaPool.GetInstance().GetFBConfirmPageImage(); // Link to remainingTimeText startTime = Timer.GetInstance().GetCurrentTime(); remainingTimeText = page.transform.FindChild("RemainingTimeText").gameObject.GetComponent <Text> (); remainingTimeText.text = "0"; }
private void SetupComponents() { GameObject pageAsset = PrefabPool.GetInstance().GetNavigationPage(); page = Instantiator.GetInstance().InstantiatePrefab(pageAsset); // Setup background Image doorNavigationPage = page.transform.FindChild("BackgroundImage").gameObject.GetComponent <Image> (); doorNavigationPage.sprite = MediaPool.GetInstance().GetCossNavigationImage(); // Link to remainingTimeText startTime = Timer.GetInstance().GetCurrentTime(); remainingTimeText = page.transform.FindChild("RemainingTimeText").gameObject.GetComponent <Text> (); remainingTimeText.text = "0"; endSession = false; }
void ImportMedia(XmlElement elt, MediaPool pool) { String key = ChildString(elt, "KeyString"); Media media = null; if (IsGeneratedMediaKey(key)) { XmlElement effectElt = elt["Effect"]; if (null == effectElt) { return; } String plugInName = ChildString(effectElt, "PlugIn"); PlugInNode plugIn = myVegas.Generators.GetChildByName(plugInName); if (null == plugIn) { return; } media = new Media(plugIn); myGeneratedMediaKeys[key] = media.KeyString; } else { media = new Media(key); } try { media.UseCustomTimecode = ChildBoolean(elt, "UseCustomTimecode"); } catch { } if (media.IsOffline() || media.UseCustomTimecode) { media.TimecodeIn = ChildTimecode(elt, "TimecodeIn"); } if (media.IsOffline()) { Timecode tcOut = ChildTimecode(elt, "TimecodeOut"); if (0 >= tcOut.Nanos) { tcOut = ChildTimecode(elt, "Length"); if (0 >= tcOut.Nanos) { throw new ApplicationException("offline media duration not specified."); } tcOut = media.TimecodeIn + tcOut; } media.TimecodeOut = tcOut; } ImportMediaInternal(elt, media); }
void ImportMediaPool(XmlElement parent, MediaPool pool) { XmlElement elt = parent["MediaPool"]; if (null == elt) { return; } foreach (XmlElement mediaElt in elt.SelectNodes("Media")) { ImportMedia(mediaElt, pool); } foreach (XmlElement subclipElt in elt.SelectNodes("Subclip")) { ImportSubclip(subclipElt, pool); } ImportMediaBin(elt["MediaBin"], pool.RootMediaBin, pool); }
private void SetupArrowAnimation() { arrow = page.transform.FindChild("Arrow").gameObject.GetComponent <Image> (); arrowAnimationIndex = 0; arrowAnimationTime = Timer.GetInstance().GetCurrentTime(); arrowAnimation = MediaPool.GetInstance().GetArrowAnimation(); arrow.sprite = arrowAnimation[arrowAnimationIndex]; arrowPositions = new Dictionary <Place, Vector2> (); arrowPositions.Add(Place.DOOR, new Vector2(-48, -40)); arrowPositions.Add(Place.LIBRARY, new Vector2(330, 75)); arrowPositions.Add(Place.COSS, new Vector2(180, 250)); arrowPositions.Add(Place.LAKE, new Vector2(-130, 40)); arrowRotations = new Dictionary <Place, Quaternion> (); arrowRotations.Add(Place.DOOR, Quaternion.Euler(0, 0, 150)); arrowRotations.Add(Place.LIBRARY, Quaternion.Euler(0, 0, 180)); arrowRotations.Add(Place.COSS, Quaternion.Euler(0, 0, 330)); arrowRotations.Add(Place.LAKE, Quaternion.Euler(0, 0, 0)); }
void ImportSubclip(XmlElement elt, MediaPool pool) { String parentMediaKey = ChildString(elt, "ParentMedia"); Media parentMedia = FindMedia(pool, parentMediaKey); if (null == parentMedia) { throw new ApplicationException("could not find subclip's parent media: " + parentMediaKey); } Timecode start = ChildTimecode(elt, "Start"); Timecode length = ChildTimecode(elt, "Length"); Boolean reverse = false; try { reverse = ChildBoolean(elt, "IsReversed"); } catch {} String displayName = null; try { displayName = ChildString(elt, "FilePath"); } catch {} Subclip subclip = new Subclip(parentMediaKey, start, length, reverse, displayName); ImportMediaInternal(elt, subclip); }
public void SetNavigationButtonClick(Place navigationButton) { SetAllNavigationButtonNotClick(); switch (navigationButton) { case Place.DOOR: doorButton.image.sprite = MediaPool.GetInstance().GetDoorButtonImage(true); break; case Place.LIBRARY: libraryButton.image.sprite = MediaPool.GetInstance().GetLibraryButtonImage(true); break; case Place.COSS: cossButton.image.sprite = MediaPool.GetInstance().GetCossButtonImage(true); break; case Place.LAKE: lakeButton.image.sprite = MediaPool.GetInstance().GetLakeButtonImage(true); break; } }
void ImportMediaBin(XmlElement elt, MediaBin bin, MediaPool pool) { if (null == elt) { return; } foreach (XmlElement mediaElt in elt.SelectNodes("./MediaRef")) { String mediaKey = mediaElt.InnerText; Media media = FindMedia(pool, mediaKey); if (null != media) { bin.Add(media); } } foreach (XmlElement subBinElt in elt.SelectNodes("./MediaBin")) { String subBinName = ChildString(subBinElt, "Name"); MediaBin subBin = new MediaBin(subBinName); bin.Add(subBin); ImportMediaBin(subBinElt, subBin, pool); } }
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); } }
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); }
private void CopyToolStripMenuItem_Click(object sender, EventArgs e) { MediaPool pool = MyVegas.Project.MediaPool; List <Media> selectedMedia = GetSelectedMedia(); using (var undo = new UndoBlock("Copy media to folder")) { var MovePrompt = new FormSimplePrompt("Enter destination", "Enter the destination folder here", "Non-existing folder will be created."); DialogResult rslt = MovePrompt.ShowDialog(); if (rslt != DialogResult.OK) { return; } string targetPath = ResolveFolderPath(MovePrompt.tbUserData.Text); if (targetPath == string.Empty) { MessageBox.Show("Weird path supplied. Please enter a path in this format: C:\\Path\\"); return; } // show zee bar! bool YesToAll = false; bool NoToAll = false; var progress = new FormProgressDialog("Copying files..."); progress.SetBounds(0, selectedMedia.Count); progress.Show(); foreach (Media media in selectedMedia) { progress.PerformStep(); string finalFileName = targetPath + Path.DirectorySeparatorChar + Path.GetFileName(media.FilePath); if (File.Exists(finalFileName) && !YesToAll) { if (NoToAll) { continue; } string Prompt = String.Format( "{0}\nRe-target this media to the specified file? If the file content differs, this may destabilize your project. \n{1}", media.FilePath, finalFileName); var dlgRetarget = new YesNoAll(Prompt, "Re-target", "Leave"); DialogResult rsltRetarget = dlgRetarget.ShowDialog(); if (rsltRetarget == DialogResult.Yes) { if (dlgRetarget.ToAll) { YesToAll = true; } } else { if (dlgRetarget.ToAll) { NoToAll = true; } continue; } } progress.AddLog(String.Format("Copying {0} -> {1}...", media.FilePath, finalFileName)); progress.Refresh(); CopyOrRedirect(pool, media, finalFileName); progress.AddLog("...Done."); } progress.Close(); } PopulateMediaListItems(); }