Пример #1
0
        public override Stream Open(FileMode mode)
        {
            if (_blobStream != null) {
                return _blobStream;
            }

            switch (mode) {
                case FileMode.Create:
                case FileMode.CreateNew:
                case FileMode.Truncate:
                    var b = CloudBlob;
                    if (b == null) {
                    }
                    return _blobStream = CloudBlob.OpenWrite();

                case FileMode.Open:
                    if (!Exists || !IsFile) {
                        throw new CoAppException("Path not found '{0}'".format(AbsolutePath));
                    }
                    return _blobStream = CloudBlob.OpenRead();
            }
            throw new CoAppException("Unsupported File Mode.");
        }
Пример #2
0
 public void Close()
 {
     if (_blobStream != null) {
         _blobStream.Close();
         _blobStream.Dispose();
         _blobStream = null;
     }
 }