public Model(IDisposableResource parent, SoftwareModel softwareModel, bool loadColors, bool loadUVs, bool loadNormals, string contentDirectory, Dictionary<string,Type> materialTypes, List<MaterialFieldBinder> value1BinderTypes, List<MaterialFieldBinder> value2BinderTypes, List<MaterialFieldBinder> value3BinderTypes, List<MaterialFieldBinder> value4BinderTypes, List<MaterialFieldBinder> textureBinderTypes, Dictionary<string,string> fileExtOverrides, int classicInstanceCount, Loader.LoadedCallbackMethod loadedCallback)
: base(parent)
{
Loader.AddLoadable(this);
new LoadWaiter(new ILoadable[]{softwareModel},
delegate(object sender, bool succeeeded)
{
if (succeeeded)
{
using (var stream = new MemoryStream())
{
try
{
Model.Save(stream, false, softwareModel, loadColors, loadUVs, loadNormals);
stream.Position = 0;
}
catch (Exception e)
{
FailedToLoad = true;
Dispose();
if (loadedCallback != null) loadedCallback(this, false);
}
if (!FailedToLoad) init(null, stream, contentDirectory, materialTypes, value1BinderTypes, value2BinderTypes, value3BinderTypes, value4BinderTypes, textureBinderTypes, fileExtOverrides, classicInstanceCount, loadedCallback);
}
}
else
{
FailedToLoad = true;
Dispose();
if (loadedCallback != null) loadedCallback(this, false);
}
});
}