/// <summary> /// Attempts to resolve (e.g., load from a file) the resource associated with the given URI</summary> /// <param name="uri">Resource URI</param> /// <returns>The resolved resource or null if there was a failure of some kind</returns> public IResource Resolve(Uri uri) { string fileName = PathUtil.GetCanonicalPath(uri); if (!fileName.EndsWith(".dae")) return null; DomNode domNode = null; try { using (Stream stream = File.OpenRead(fileName)) { var persister = new ColladaXmlPersister(m_loader); domNode = persister.Read(stream, uri); } } catch (IOException e) { Outputs.WriteLine(OutputMessageType.Warning, "Could not load resource: " + e.Message); } IResource resource = Adapters.As<IResource>(domNode); if (resource != null) resource.Uri = uri; return resource; }
/// <summary> /// Attempts to resolve (e.g., load from a file) the resource associated with the given URI</summary> /// <param name="uri">Resource URI</param> /// <returns>The resolved resource or null if there was a failure of some kind</returns> public IResource Resolve(Uri uri) { string fileName = PathUtil.GetCanonicalPath(uri); if (!fileName.EndsWith(".dae")) { return(null); } DomNode domNode = null; try { using (Stream stream = File.OpenRead(fileName)) { var persister = new ColladaXmlPersister(m_loader); domNode = persister.Read(stream, uri); } } catch (IOException e) { Outputs.WriteLine(OutputMessageType.Warning, "Could not load resource: " + e.Message); } IResource resource = domNode.As <IResource>(); if (resource != null) { resource.Uri = uri; } return(resource); }