示例#1
0
文件: Column.cs 项目: mo5h/omeo
 public BlobFSMemoryStream(int handle, BlobFileSystem bfs)
     : base(1024)
 {
     _handle = handle;
     _bfs    = bfs;
     bfs.Lock();
     try
     {
         CopyStream(this, bfs.GetRawStream(handle), bfs.GetRawBytes());
     }
     catch
     {
         SetLength(0);
         bfs.RewriteFile(handle);
         bfs.Flush();
     }
     finally
     {
         bfs.UnLock();
     }
     base.Position = 0;
     _dirty        = false;
 }
示例#2
0
文件: Column.cs 项目: mo5h/omeo
        public override string ToString()
        {
            int handle = Handle;

            if (handle == 0)
            {
                return(Utils.StreamToString(File.Open(GetFileName(), FileMode.Open, FileAccess.ReadWrite, FileShare.ReadWrite)));
            }
            _bfs.Lock();
            try
            {
                return(Utils.StreamToString(_bfs.GetRawStream(handle)));
            }
            catch
            {
                _bfs.RewriteFile(handle);
                _bfs.Flush();
                return(string.Empty);
            }
            finally
            {
                _bfs.UnLock();
            }
        }