示例#1
0
 public void Close()
 {
     content.Close();
     content     = null;
     length      = 0;
     pagedAccess = null;
 }
示例#2
0
 public bool Open()
 {
     content = new MemoryStream(1024);
     content.SetLength(Header);
     content.Seek(0, SeekOrigin.Begin);
     length      = Header;
     pagedAccess = new StrongPagedAccess(content, 2048);
     return(true);
 }
示例#3
0
        public bool Open()
        {
            // If the store file doesn't exist, throw an error. We can't create
            // compressed files, they are made by calling the 'compress'.
            if (!File.Exists(fileName))
            {
                throw new ApplicationException("Compressed file '" + fileName + "' was not found.");
            }

            content     = new FileStream(fileName, FileMode.Open, FileAccess.Read, FileShare.None, 2048, FileOptions.WriteThrough);
            pagedAccess = new StrongPagedAccess(content, 2048);
            return(false);
        }
示例#4
0
 public bool Open()
 {
     // If the store file doesn't exist, create it
     if (!File.Exists(fileName))
     {
         content = new FileStream(fileName, FileMode.CreateNew, FileAccess.ReadWrite, FileShare.Read, 2048, FileOptions.WriteThrough);
         // Set the header table in the newly created file,
         content.SetLength(Header);
         content.Seek(0, SeekOrigin.Begin);
         length      = Header;
         pagedAccess = new StrongPagedAccess(content, 2048);
         return(true);
     }
     else
     {
         content     = new FileStream(fileName, FileMode.Open, FileAccess.ReadWrite, FileShare.Read, 2048, FileOptions.WriteThrough);
         length      = (int)content.Length;
         pagedAccess = new StrongPagedAccess(content, 2048);
         return(false);
     }
 }