示例#1
0
文件: Column.cs 项目: mo5h/omeo
        public void Delete()
        {
            int handle = Handle;

            if (handle > 0)
            {
                _bfs.Lock();
                try
                {
                    _bfs.DeleteFile(handle);
                }
                finally
                {
                    _bfs.UnLock();
                }
            }
            else
            {
                IOTools.DeleteFile(GetFileName());
            }
        }
示例#2
0
文件: Column.cs 项目: mo5h/omeo
        internal BLOB(Table table, Stream source)
        {
            _table = table;
            _bfs   = table.Database.BlobFS;
            int handle;

            _bfs.Lock();
            try
            {
                Stream stream = _bfs.AllocFile(out handle).BaseStream;
                _id = handle.ToString();
                SetStream(source, stream);
            }
            finally
            {
                _bfs.UnLock();
            }
        }
示例#3
0
文件: Column.cs 项目: mo5h/omeo
 public override void Close()
 {
     if (_dirty)
     {
         _bfs.Lock();
         int handle = _handle;
         try
         {
             using (Stream stream = _bfs.RewriteFile(handle).BaseStream)
             {
                 WriteTo(stream);
             }
             _bfs.Flush();
         }
         finally
         {
             _bfs.UnLock();
         }
     }
     base.Close();
 }
示例#4
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;
 }