Comments

JohnnyRoy wrote on 2/28/2005, 11:09 AM
Because the MediaPool.Clear() method is not exposed, you have to iterate over the contents of the Media Pool removing each one. You cannot modify the contents of a collection while iterating over it so you have to make a copy first and iterate over the copy, while modifying the original collection.

Here is the code to do what you want assuming the media is not in use:
import System.Windows.Forms;
import System.Collections;
import Sony.Vegas;
try
{
var mediaKeys : ArrayList = new ArrayList();

// Copy the keys of all the media into an array
var enumMedia : IEnumerator = Vegas.Project.MediaPool.GetEnumerator();
while (enumMedia.MoveNext())
{
var media : Media = enumMedia.Current;
mediaKeys.Add(media.KeyString);
}

// Iterate through the array removing media files from the pool
for (var keyName in mediaKeys)
{
Vegas.Project.MediaPool.Remove(keyName);
}

}
catch (errorMsg)
{
MessageBox.Show(errorMsg, "Error", MessageBoxButtons.OK, MessageBoxIcon.Exclamation);
}

~jr