public void Export(Stream stream, Node node, INodeThumbnailProvider thumbnailProvider) { CreateFolderBeginEndNodes(node); try { ReorderBonesRecursive(node.AsWidget); using (var tw = new StreamWriter(stream)) { writer = new Writer(tw); Write(node); var thumbnail = thumbnailProvider.GetThumbnail(node); if (thumbnail != null) { tw.NewLine = "\r\n"; tw.WriteLine(HotSceneImporter.ThumbnailMarker); tw.Write(thumbnail); } } } finally { RemoveFolderBeginEndNodes(node); } }