Наследование: AbstractExternalBlobConnection
Пример #1
0
            public FileSystemCasBlobWriter(FileSystemCasConnection connection)
            {
                if (connection == null)
                {
                    throw new ArgumentNullException("connection");
                }
                _connection = connection;

                _hash = connection._hashName == null ? new SHA1CryptoServiceProvider() : HashAlgorithm.Create(connection._hashName);
                if (_hash == null)
                {
                    throw new Exception("Missing hash algorithm: " + connection._hashName);
                }

                string temp;

                do
                {
                    Guid unique = Guid.NewGuid();
                    temp = Path.Combine(connection._path, TemporaryFileBase + unique);
                } while (File.Exists(temp));

                _tempStream = new FileStream(temp, FileMode.Create, FileAccess.Write, FileShare.None);

                _tempFile = temp;
            }
Пример #2
0
 protected override void Dispose(bool disposing)
 {
     if (_tempStream != null)
     {
         lock (this)
         {
             _tempStream.Dispose();
             _tempStream = null;
             AttemptDelete(new FileInfo(_tempFile));
             _tempFile = null;
         }
     }
     if (disposing)
     {
         if (_hash != null)
         {
             ((IDisposable)_hash).Dispose();
         }
         _hash       = null;
         _connection = null;
     }
     base.Dispose(disposing);
 }
Пример #3
0
 protected override void Dispose(bool disposing)
 {
     if (_tempStream != null)
         lock (this)
         {
             _tempStream.Dispose();
             _tempStream = null;
             AttemptDelete(new FileInfo(_tempFile));
             _tempFile = null;
         }
     if (disposing)
     {
         if (_hash != null) ((IDisposable) _hash).Dispose();
         _hash = null;
         _connection = null;
     }
     base.Dispose(disposing);
 }
Пример #4
0
            public FileSystemCasBlobWriter(FileSystemCasConnection connection)
            {
                if (connection == null) throw new ArgumentNullException("connection");
                _connection = connection;

                _hash = connection._hashName == null ? new SHA1CryptoServiceProvider() : HashAlgorithm.Create(connection._hashName);
                if (_hash == null) throw new Exception("Missing hash algorithm: " + connection._hashName);

                string temp;

                do
                {
                    Guid unique = Guid.NewGuid();
                    temp = Path.Combine(connection._path, TemporaryFileBase + unique);
                } while (File.Exists(temp));

                _tempStream = new FileStream(temp, FileMode.Create, FileAccess.Write, FileShare.None);

                _tempFile = temp;
            }