protected SceneInfo SaveToThing(IGraphScene <IVisual, IVisualEdge> scene, IGraphSceneLayout <IVisual, IVisualEdge> layout, IThing thing, string name) { var result = default(SceneInfo); if (thing is IStreamThing || thing == null) { var content = new Content <Stream> ( new MemoryStream(), CompressionType.bZip2, ContentTypes.LimadaSheet); var serializer = new SheetSerializer(); serializer.Save(content.Data, scene.Graph, layout); content.Data.Position = 0; content.Description = name; thing = new VisualThingsContentViz().AssignContent(scene.Graph, thing, content); result = SheetStore.RegisterSceneInfo(thing.Id, name); result.State.Hollow = false; result.State.Clean = true; result.State.CopyTo(scene.State); } else { throw new ArgumentException("thing must be a StreamThing"); } return(result); }
Stream SaveSheet(IGraphScene <IVisual, IVisualEdge> scene, IGraphSceneLayout <IVisual, IVisualEdge> layout) { var sheet = new SheetSerializer(); var s = new MemoryStream(); sheet.Save(s, scene.Graph, scene.CloneLayout(layout)); s.Position = 0; return(s); }