public IEnumerable <VisualHref> VisualHrefsOf(IStreamThing source) { source.DeCompress(); IEnumerable <VisualHref> result = new VisualHref[0]; var stream = source.Data; if (stream == null) { return(null); } try { stream.Position = 0; var graph = new VisualThingGraph() { Source = ThingGraph }; var serializer = new VisualThingXmlSerializer { VisualThingGraph = graph, Layout = this.Layout }; serializer.Read(stream); stream.Position = 0; result = serializer.VisualsCollection .Where(v => !(v is IVisualEdge)) .Select(v => HrefOfVisual(graph, v)) .ToArray(); } catch (Exception ex) { // TODO: stream-closed-error should never happen.Try to get reread the source Registry.Pooled <IExceptionHandler> ().Catch(ex, MessageType.OK); } finally { source.ClearRealSubject(); } return(result); }
public virtual ICollection <IVisual> Read(Stream stream, IGraph <IVisual, IVisualEdge> source, IGraphSceneLayout <IVisual, IVisualEdge> layout) { var graph = source.Source <IVisual, IVisualEdge, IThing, ILink> (); if (graph == null) { return(null); } var serializer = new VisualThingXmlSerializer { VisualThingGraph = graph, Layout = layout }; serializer.Read(stream); return(serializer.VisualsCollection); }