Пример #1
0
 public Stream StreamFromStore(long id)
 {
     byte [] buffer = null;
     try {
         if (SheetStore.TryGetValue(id, out buffer))
         {
             return(new MemoryStream(buffer));
         }
     } catch (Exception ex) {
         // TODO: stream-closed-error should never happen.Try to get reread the source
         Registry.Pooled <IExceptionHandler> ().Catch(ex, MessageType.OK);
     }
     return(null);
 }
Пример #2
0
        public IGraphScene <IVisual, IVisualEdge> LoadFromStore(IGraph <IVisual, IVisualEdge> source, IGraphSceneLayout <IVisual, IVisualEdge> layout, Int64 id)
        {
            byte [] buffer = null;
            try {
                if (SheetStore.TryGetValue(id, out buffer))
                {
                    // save state of store:
                    var info  = SheetStore.GetSheetInfo(id);
                    var state = info.State.Clone();

                    var result = LoadFromStream(new MemoryStream(buffer), source, layout);

                    state.CopyTo(info.State);
                    state.CopyTo(result.State);

                    return(result);
                }
            } catch (Exception ex) {
                // TODO: stream-closed-error should never happen.Try to get reread the source
                Registry.Pooled <IExceptionHandler> ().Catch(ex, MessageType.OK);
            }
            return(null);
        }