Well for instance Animations.cs you would do this
Code:
private static FileIndex m_FileIndex = new FileIndex( "Anim.idx", "Anim.mul", 0x40000, 6 );
public static FileIndex FileIndex{ get{ return m_FileIndex; } }
private static FileIndex m_FileIndex2 = new FileIndex( "Anim2.idx", "Anim2.mul", 0x10000, -1 );
public static FileIndex FileIndex2{ get{ return m_FileIndex; } }
private static FileIndex m_FileIndex3 = new FileIndex( "Anim3.idx", "Anim3.mul", 0x20000, -1 );
public static FileIndex FileIndex3{ get{ return m_FileIndex; } }
static Animations()
{
Initialize();
}
public static void Initialize()
{
Utility.EnsureClose(m_FileIndex);
Utility.EnsureClose(m_FileIndex2);
Utility.EnsureClose(m_FileIndex3);
m_FileIndex = new FileIndex("Anim.idx", "Anim.mul", 0x40000, 6);
m_FileIndex2 = new FileIndex("Anim2.idx", "Anim2.mul", 0x10000, -1);
m_FileIndex3 = new FileIndex("Anim3.idx", "Anim3.mul", 0x20000, -1);
}
Then make a Utility function EnsureClose
Code:
public static void EnsureClose(FileIndex fileIndex)
{
if (fileIndex != null && fileIndex.Stream != null)
{
fileIndex.Stream.Close();
}
}
Be sure you inlude your custom paths, and whenenver the custom path changes call Animations.Initilize();, just do this for each class that has a FileIndex in it.